:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #607080;
  --line: #d9e0e7;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --primary-soft: #d9f3ef;
  --danger: #b42318;
  --danger-soft: #fde8e7;
  --warning: #a15c07;
  --warning-soft: #fff2d8;
  --ok: #16784a;
  --ok-soft: #dff4e8;
  --shadow: 0 12px 30px rgb(31 41 51 / 8%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.auth-layout {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(100%, 420px);
}

.login-panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-heading {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.15;
}

h2 {
  margin-bottom: 4px;
  font-size: 1rem;
  line-height: 1.2;
}

.form-stack,
.admin-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 8px 10px;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 14%);
  outline: none;
}

.alert {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0 0 16px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 700;
}

.alert-danger {
  border-color: #f0b8b4;
  background: var(--danger-soft);
  color: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  padding: 16px;
}

.brand {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  overflow-wrap: anywhere;
}

.brand small {
  color: var(--muted);
  font-size: 0.76rem;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav a {
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
  padding: 9px 10px;
}

.side-nav a:hover,
.side-nav a.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 14px 24px;
}

.operator {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.operator span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  display: grid;
  gap: 16px;
  width: min(100%, 1280px);
  margin: 0 auto;
  padding: 18px 24px 32px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.metric strong {
  font-size: 1.8rem;
  line-height: 1;
}

.metric-ok {
  border-color: #b8dfc8;
}

.metric-danger {
  border-color: #efbeb9;
}

.metric-warning {
  border-color: #edcf9b;
}

.panel {
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.section-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.toolbar {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}

.toolbar input {
  max-width: 340px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f9fafb;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

td {
  font-size: 0.88rem;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 850;
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 7px 12px;
}

.button-primary {
  background: var(--primary);
  color: #fff;
}

.button-primary:hover {
  background: var(--primary-strong);
}

.button-secondary {
  border-color: var(--line);
  background: #edf2f2;
  color: var(--text);
}

.button-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.form-panel {
  max-width: 760px;
}

.admin-form {
  padding: 16px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .side-nav {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .auth-layout {
    padding: 14px;
  }

  .login-panel {
    padding: 20px;
  }

  .topbar,
  .section-head,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .operator {
    justify-content: space-between;
  }

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

  .toolbar input {
    max-width: none;
  }
}
