:root {
  color-scheme: dark;
  --bg: #050b09;
  --ink: #07110e;
  --panel: rgba(9, 20, 16, .88);
  --panel-2: rgba(13, 30, 21, .82);
  --line: rgba(220, 244, 228, .16);
  --line-strong: rgba(220, 244, 228, .32);
  --text: #f6fff8;
  --muted: #a8b8b0;
  --green: #72f414;
  --green-2: #9bff35;
  --gold: #d6b757;
  --red: #ff4d5a;
  --field: #101923;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    linear-gradient(180deg, rgba(4, 11, 9, .35), rgba(4, 11, 9, .92)),
    radial-gradient(circle at 70% 8%, rgba(114, 244, 20, .16), transparent 28%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .02) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .8), transparent 72%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.login-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(980px, 100%);
  min-height: 590px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background:
    radial-gradient(circle at 80% 18%, rgba(114, 244, 20, .12), transparent 34%),
    linear-gradient(145deg, rgba(8, 18, 14, .96), rgba(3, 8, 7, .98));
  box-shadow: 0 34px 90px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .1);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark img {
  width: 58px;
  height: 58px;
}

.brand-mark strong {
  display: block;
  font-size: 30px;
  letter-spacing: -.04em;
}

.brand-mark span {
  color: var(--green);
}

.brand-mark small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .28em;
}

.brand-mark.compact img {
  width: 44px;
  height: 44px;
}

.brand-mark.compact strong {
  font-size: 22px;
}

.login-form {
  align-self: center;
  width: min(430px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 19, 14, .78);
}

.login-form h1 {
  font-size: 28px;
  letter-spacing: -.03em;
}

.login-form p,
footer {
  color: var(--muted);
}

label {
  display: grid;
  gap: 8px;
  color: #dbe8df;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(221, 236, 230, .18);
  border-radius: 6px;
  background: var(--field);
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(114, 244, 20, .68);
}

.primary-button,
.ghost-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 800;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.primary-button {
  background: linear-gradient(180deg, var(--green-2), var(--green));
  color: #07110e;
}

.ghost-button {
  background: rgba(255, 255, 255, .045);
  border-color: var(--line);
  color: var(--text);
}

.ghost-button.danger {
  color: #ffdfe2;
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  border-color: rgba(114, 244, 20, .55);
}

.form-error,
.status-line {
  padding: 10px 12px;
  border: 1px solid rgba(255, 77, 90, .35);
  border-radius: 6px;
  background: rgba(255, 77, 90, .1);
  color: #ffdfe2;
}

.status-line.ok {
  border-color: rgba(114, 244, 20, .35);
  background: rgba(114, 244, 20, .1);
  color: #dfffd1;
}

.admin-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5, 14, 11, .98), rgba(4, 10, 8, .92));
}

nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

nav button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #d7e4dc;
  text-align: left;
  font-weight: 700;
}

nav button.active,
nav button:hover {
  color: var(--text);
  border-color: rgba(114, 244, 20, .28);
  background: rgba(114, 244, 20, .12);
}

.system-card,
.panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--panel), rgba(4, 11, 9, .9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
}

.system-card {
  display: grid;
  gap: 5px;
  padding: 16px;
}

.system-card span,
.system-card small,
.panel-title span,
.metric-card span,
td small {
  color: var(--muted);
}

.workspace {
  position: relative;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  font-size: 26px;
  letter-spacing: -.03em;
}

.topbar p {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.page-section {
  display: none;
}

.page-section.active {
  display: grid;
  gap: 18px;
  animation: rise .22s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 118px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
}

.metric-card strong {
  font-size: 25px;
  letter-spacing: -.03em;
}

.metric-card b {
  color: var(--green);
}

.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-title h2 {
  font-size: 18px;
}

.tools {
  align-items: end;
}

.search-input {
  max-width: 300px;
}

.bar-chart {
  height: 245px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: end;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.bar {
  min-width: 16px;
  display: grid;
  align-items: end;
  gap: 4px;
  height: 100%;
}

.bar i {
  display: block;
  min-height: 4px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--green-2), rgba(114, 244, 20, .38));
}

.bar small {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.plan-breakdown,
.activity-list {
  display: grid;
  gap: 10px;
}

.plan-row,
.activity-item {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid rgba(220, 244, 228, .1);
  border-radius: 6px;
  background: rgba(255, 255, 255, .035);
}

.plan-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.plan-row strong {
  color: var(--green);
  font-size: 22px;
}

.activity-item small {
  color: var(--muted);
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(220, 244, 228, .1);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(220, 244, 228, .1);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #dce8df;
  background: rgba(255, 255, 255, .045);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

td {
  color: #eef8f1;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(114, 244, 20, .24);
  background: rgba(114, 244, 20, .1);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.pill.red {
  border-color: rgba(255, 77, 90, .3);
  background: rgba(255, 77, 90, .1);
  color: #ff9da5;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.row-actions button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .045);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, .72);
}

.modal-card {
  width: min(420px, calc(100vw - 24px));
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #07110e;
}

.modal-card menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 0;
  margin: 4px 0 0;
}

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    grid-template-rows: auto auto;
  }

  .system-card {
    display: none;
  }

  nav {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    overflow: auto;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-title.tools {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .login-panel,
  .login-form {
    padding: 20px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}
