/* =====================================================================
   ME · SIM Management — Design system (2026 enterprise refresh)
   ---------------------------------------------------------------------
   Tokens are restrained: deep slate primary, surface white, restrained
   accents. Tabular numerals for figures. Mobile-first layout: the side
   nav becomes a slide-in drawer below 1024px.
   ===================================================================== */

:root {
  /* surface */
  --bg:            #f6f7f9;
  --bg-soft:       #eef0f3;
  --surface:       #ffffff;
  --surface-2:     #fafbfc;
  --surface-3:     #f3f4f7;
  --border:        #e3e6ec;
  --border-strong: #c9cdd6;

  /* text */
  --text:          #11131a;
  --text-soft:     #4b5160;
  --text-mute:     #7b8190;
  --text-inverse:  #ffffff;

  /* brand */
  --brand:         #1f3b66;
  --brand-strong:  #16294a;
  --brand-soft:    #eaf0fa;
  --brand-text:    #ffffff;

  /* status accents */
  --ok:            #1a7f44;
  --ok-soft:       #e5f3ec;
  --warn:          #b8721a;
  --warn-soft:     #fbf1e1;
  --danger:        #b3261e;
  --danger-soft:   #fbeae8;
  --info:          #1f5a86;
  --info-soft:     #e6f0f8;
  --neutral:       #5a6172;
  --neutral-soft:  #ecedf1;

  /* layout */
  --side-w:        272px;
  --side-w-collapsed: 76px;
  --topbar-h:      62px;
  --radius:        10px;
  --radius-sm:     6px;
  --radius-lg:     14px;
  --shadow-xs:     0 1px 0 rgba(15,20,30,.04), 0 1px 2px rgba(15,20,30,.06);
  --shadow-sm:     0 1px 0 rgba(15,20,30,.04), 0 4px 14px rgba(15,20,30,.07);
  --shadow-md:     0 8px 30px rgba(15,20,30,.10);
  --shadow-lg:     0 24px 60px rgba(15,20,30,.18);

  /* type */
  --font-sans: "Inter", "Helvetica Neue", -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", "Noto Sans",
               "Arial", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

/* ── reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
img, svg { display: block; max-width: 100%; }

/* ── utilities ─────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
.mono { font-family: var(--font-mono); letter-spacing: -.01em; }
.muted { color: var(--text-mute); }
.soft  { color: var(--text-soft); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── app shell ────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "side topbar"
    "side main";
  min-height: 100vh;
  background: var(--bg);
}
.app.is-collapsed { grid-template-columns: var(--side-w-collapsed) 1fr; }

@media (max-width: 1023px) {
  .app, .app.is-collapsed {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .sidenav { transform: translateX(-100%); transition: transform .2s ease; }
  .sidenav.is-open { transform: translateX(0); }
  .sidenav-backdrop {
    position: fixed; inset: 0; background: rgba(15,20,30,.55);
    backdrop-filter: blur(2px); opacity: 0; pointer-events: none;
    transition: opacity .2s ease; z-index: 39;
  }
  .sidenav-backdrop.is-open { opacity: 1; pointer-events: auto; }
}

/* ── side nav ─────────────────────────────────────────────────────── */
.sidenav {
  grid-area: side;
  background: #0e1726;
  color: #e5e8ef;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
@media (max-width: 1023px) {
  .sidenav {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--side-w); z-index: 40; height: 100vh;
  }
}

.sidenav-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; height: var(--topbar-h);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidenav-brand .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(140deg, #1f3b66, #3055a4);
  display: grid; place-items: center; color: #fff;
  font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.sidenav-brand .name {
  font-weight: 600; letter-spacing: .2px; font-size: 14px;
  color: #fff; white-space: nowrap;
}
.sidenav-brand .name small {
  display: block; color: #8a93a6; font-weight: 400; font-size: 11px; margin-top: 2px;
}
.is-collapsed .sidenav-brand .name { display: none; }

.sidenav-scroll { overflow: auto; flex: 1; padding: 12px 8px 8px; }
.sidenav-group { margin: 14px 6px 4px; }
.sidenav-group-label {
  font-size: 10.5px; letter-spacing: .9px; text-transform: uppercase;
  color: #6b7385; padding: 0 10px 8px;
}
.is-collapsed .sidenav-group-label { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 9px 12px; border-radius: 8px;
  color: #c2c8d3; font-size: 13.5px; font-weight: 500;
  cursor: pointer; position: relative; line-height: 1.1;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.is-active { background: #1c2a40; color: #fff; }
.nav-item.is-active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: #6593d9;
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .9; }
.nav-item .badge {
  margin-left: auto; background: rgba(255,255,255,.08);
  padding: 2px 8px; border-radius: 999px; font-size: 11px; color: #d8dce5;
  font-variant-numeric: tabular-nums;
}
.is-collapsed .nav-item { justify-content: center; padding: 10px 0; }
.is-collapsed .nav-item .label, .is-collapsed .nav-item .badge { display: none; }

.sidenav-sub { margin: 2px 0 6px 28px; padding-left: 6px; border-left: 1px solid rgba(255,255,255,.07); }
.is-collapsed .sidenav-sub { display: none; }
.sidenav-sub .nav-item { padding: 6px 10px; font-size: 13px; color: #aab1bf; }
.sidenav-sub .nav-item.is-active { background: transparent; color: #fff; }
.sidenav-sub .nav-item.is-active::before { display: none; }

.sidenav-foot {
  border-top: 1px solid rgba(255,255,255,.06); padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.sidenav-foot .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #2a3b58; color: #fff; display: grid; place-items: center;
  font-weight: 600; font-size: 12px;
}
.sidenav-foot .who { line-height: 1.2; min-width: 0; }
.sidenav-foot .who .n { color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidenav-foot .who .r { color: #8a93a6; font-size: 11px; }
.is-collapsed .sidenav-foot .who, .is-collapsed .sidenav-foot .logout-btn { display: none; }
.sidenav-foot .logout-btn {
  margin-left: auto; color: #8a93a6; padding: 6px; border-radius: 6px;
}
.sidenav-foot .logout-btn:hover { background: rgba(255,255,255,.06); color: #fff; }

/* ── topbar ──────────────────────────────────────────────────────── */
.topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
}
.topbar .menu-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-soft);
}
.topbar .menu-btn:hover { background: var(--surface-3); color: var(--text); }
.topbar .page-title { font-size: 15.5px; font-weight: 600; letter-spacing: -.005em; }
.topbar .page-sub { font-size: 12px; color: var(--text-mute); }
.topbar .topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center; color: var(--text-soft);
  border: 1px solid transparent;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ── main ────────────────────────────────────────────────────────── */
.main { grid-area: main; padding: 22px clamp(16px, 3vw, 30px) 60px; min-width: 0; }
@media (max-width: 640px) { .main { padding: 16px 12px 80px; } }

/* ── card ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .sub { color: var(--text-mute); font-size: 12px; }
.card-body { padding: 14px 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

/* ── buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; min-height: 36px;
  border-radius: 8px; font-weight: 500; font-size: 13.5px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); white-space: nowrap; user-select: none;
  transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}
.btn:hover { background: var(--surface-3); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(31,59,102,.18); border-color: var(--brand); }
.btn:active { transform: translateY(0.5px); }
.btn .icon { width: 16px; height: 16px; flex-shrink: 0; }
.btn .btn-label { display: inline; }
.btn-primary {
  background: var(--brand); color: var(--brand-text); border-color: var(--brand);
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset;
}
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-primary:focus-visible { box-shadow: 0 0 0 3px rgba(31,59,102,.28); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { min-height: 30px; padding: 5px 10px; font-size: 12.5px; gap: 6px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-xs { min-height: 24px; padding: 2px 8px; font-size: 12px; gap: 4px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; pointer-events: none; }
/* Icon-only mode: hides .btn-label, keeps square aspect */
.btn-icon { padding: 0; width: 36px; justify-content: center; }
.btn-icon.btn-sm { width: 30px; }
.btn-icon .btn-label { display: none; }

/* ── inputs ──────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text-soft); }
.field .hint { color: var(--text-mute); font-size: 11.5px; }
.input, .select, .textarea {
  display: block; width: 100%;
  padding: 9px 12px; min-height: 38px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-size: 13.5px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,59,102,.12);
}
.textarea { min-height: 80px; resize: vertical; line-height: 1.45; padding: 10px 12px; }
.input.is-error { border-color: var(--danger); }
.input-group { position: relative; display: flex; align-items: stretch; }
.input-group .input { padding-left: 36px; }
.input-group .icon-left {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-mute); pointer-events: none;
}

/* ── badge / chip ────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; line-height: 1.15;
  background: var(--neutral-soft); color: var(--neutral);
  border: 1px solid transparent; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok      { background: var(--ok-soft);      color: var(--ok); }
.badge-warn    { background: var(--warn-soft);    color: var(--warn); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-brand   { background: var(--brand-soft);   color: var(--brand); }
.badge-outline { background: transparent; border-color: var(--border-strong); color: var(--text-soft); }

/* ── tabs ────────────────────────────────────────────────────────── */
.tabs-shell {
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tabs {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; scrollbar-width: none;
  padding: 0 6px;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 12px 16px; font-size: 13.5px; font-weight: 500;
  color: var(--text-soft); border-bottom: 2px solid transparent;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; transition: color .12s, border-color .12s;
  margin-bottom: -1px;  /* overlap the parent border for crisp active indicator */
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.is-active { color: var(--brand); border-bottom-color: var(--brand); background: var(--surface); }
.tab .count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 7px;
  background: var(--surface-3); border-radius: 999px;
  font-size: 11px; color: var(--text-soft); font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tab.is-active .count { background: var(--brand-soft); color: var(--brand); }

/* fade indicators when tabs overflow horizontally on mobile */
.tabs-shell::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 28px;
  background: linear-gradient(to right, transparent, var(--surface));
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.tabs-shell.has-overflow::after { opacity: 1; }

/* ── table ───────────────────────────────────────────────────────── */
.table-wrap { overflow: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th, .table td {
  text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; line-height: 1.35;
}
.table thead th {
  position: sticky; top: 0;
  background: var(--surface-2); color: var(--text-mute);
  font-weight: 500; font-size: 11.5px; letter-spacing: .3px; text-transform: uppercase;
  border-bottom-color: var(--border);
  z-index: 1;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-action { text-align: right; width: 1%; white-space: nowrap; }
.table .right { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions {
  display: inline-flex; gap: 4px; align-items: center;
  flex-wrap: nowrap; justify-content: flex-end;
}
.row-actions .btn { border-color: var(--border); }
.row-actions .btn:hover { background: var(--surface-3); }
.row-actions .btn-danger.is-disabled {
  opacity: .45; cursor: not-allowed;
}
.row-actions .btn-danger.is-disabled:hover { background: var(--surface); border-color: var(--border); color: var(--danger); }
/* On narrow screens, collapse to icon-only action buttons */
@media (max-width: 900px) {
  .row-actions .btn { padding: 0; width: 32px; justify-content: center; gap: 0; }
  .row-actions .btn .btn-label { display: none; }
}

.copyable {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px 2px 8px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--surface-3); color: var(--text);
  cursor: pointer; transition: background .12s;
  border: 1px solid transparent;
}
.copyable:hover { background: var(--brand-soft); color: var(--brand); }
.copyable .icon { width: 13px; height: 13px; opacity: .6; }

/* ── empty state ─────────────────────────────────────────────────── */
.empty {
  padding: 48px 16px; text-align: center; color: var(--text-mute);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty .icon { width: 32px; height: 32px; color: var(--text-mute); margin-bottom: 6px; }
.empty .title { font-weight: 500; color: var(--text-soft); }

/* ── skeleton ────────────────────────────────────────────────────── */
.skel { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%);
  background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite;
  border-radius: 6px; height: 14px; }
@keyframes skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── toast ───────────────────────────────────────────────────────── */
.toast-root {
  position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column;
  gap: 10px; z-index: 9999;
}
.toast {
  background: #161e2e; color: #fff; padding: 12px 14px;
  border-radius: 10px; box-shadow: var(--shadow-md);
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 240px; max-width: 360px;
  border-left: 3px solid var(--neutral); font-size: 13.5px;
  animation: toast-in .22s ease-out;
}
.toast-ok      { border-left-color: #57bb7c; }
.toast-warn    { border-left-color: #e2a04d; }
.toast-danger  { border-left-color: #f06b62; }
.toast .icon { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.toast .msg { line-height: 1.4; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── modal & drawer ──────────────────────────────────────────────── */
.modal-back, .drawer-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15,20,30,.55); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px; max-height: 90vh; overflow: auto;
  border: 1px solid var(--border);
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px 16px; display: flex; gap: 8px; justify-content: flex-end; }

.drawer-back { justify-content: flex-end; padding: 0; }
.drawer {
  background: var(--surface); width: 100%; max-width: 640px; height: 100vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: drawer-in .22s ease-out;
}
.drawer-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.drawer-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.drawer-body { padding: 18px 20px; overflow: auto; flex: 1; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; }
@keyframes drawer-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── form layout ─────────────────────────────────────────────────── */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ── timeline (SIM detail) ───────────────────────────────────────── */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding: 6px 0 14px; }
.timeline-item::before {
  content: ""; position: absolute; left: -18px; top: 12px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand);
}
.timeline-item .when { font-size: 11.5px; color: var(--text-mute); }
.timeline-item .what { font-size: 13px; color: var(--text); margin-top: 2px; }

/* ── stats / KPI ─────────────────────────────────────────────────── */
.kpi-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 16px 14px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.kpi .label { font-size: 12px; color: var(--text-mute); font-weight: 500; letter-spacing: .1px; }
.kpi .value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 11.5px; color: var(--text-mute); }
.kpi .icon-bg {
  position: absolute; right: 12px; top: 12px;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand);
}
.kpi.ok    .icon-bg { background: var(--ok-soft);    color: var(--ok); }
.kpi.warn  .icon-bg { background: var(--warn-soft);  color: var(--warn); }
.kpi.danger .icon-bg { background: var(--danger-soft); color: var(--danger); }
.kpi.info  .icon-bg { background: var(--info-soft);  color: var(--info); }

/* ── login ───────────────────────────────────────────────────────── */
.login-bg {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 80% 10%, rgba(31,59,102,.06), transparent 60%),
              radial-gradient(800px 400px at 10% 90%, rgba(31,59,102,.05), transparent 60%),
              var(--bg);
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-md);
  padding: 28px 26px 24px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(140deg, #1f3b66, #3055a4);
  display: grid; place-items: center; color: #fff; font-weight: 700;
}
.login-brand .t { line-height: 1.2; }
.login-brand .t .n { font-weight: 700; }
.login-brand .t .s { color: var(--text-mute); font-size: 12px; }

.login-card .field label { font-size: 13px; }
.login-card .input { min-height: 44px; font-size: 14.5px; padding: 10px 14px; }
.login-submit {
  width: 100%;
  justify-content: center;
  min-height: 46px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .2px;
  margin-top: 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 6px 18px rgba(31,59,102,.22);
}
.login-submit:active { transform: translateY(1px); }
.login-submit[aria-busy="true"] { opacity: .8; cursor: progress; }

/* ── small helpers used across pages ─────────────────────────────── */
.section-head {
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
  margin: 0 0 14px;
}
.section-head h2 { margin: 0; font-size: 18.5px; font-weight: 600; letter-spacing: -.01em; }
.section-head .sub { color: var(--text-mute); font-size: 12.5px; margin-top: 2px; }

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(auto-fit, minmax(160px, max-content));
  gap: 10px;
  align-items: center;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px;
}
.filter-bar .input, .filter-bar .select { min-height: 38px; padding: 8px 12px; background: var(--surface); }
.filter-bar .input-group .input { padding-left: 38px; }
.filter-bar .grow { min-width: 0; }
@media (max-width: 720px) {
  .filter-bar { grid-template-columns: 1fr; padding: 10px; }
  .filter-bar .select { width: 100%; }
}

/* dedicated search input: larger touch target, clear icon */
.search-input {
  position: relative;
}
.search-input .input {
  padding-left: 40px; padding-right: 36px;
  min-height: 40px; font-size: 14px;
}
.search-input .icon-left {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-mute); pointer-events: none;
}
.search-input .clear-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center; color: var(--text-mute);
  background: transparent; border: 0; cursor: pointer; opacity: 0;
  transition: opacity .12s, background .12s;
}
.search-input.has-value .clear-btn { opacity: 1; }
.search-input .clear-btn:hover { background: var(--surface-3); color: var(--text); }
.search-input .clear-btn .icon { width: 14px; height: 14px; }

/* ── pagination ──────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 4px; flex-wrap: wrap;
}
.pagination-info {
  color: var(--text-mute); font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.pagination-info b { color: var(--text); font-weight: 600; }
.pagination-controls {
  display: inline-flex; align-items: center; gap: 4px;
}
.page-btn {
  min-width: 34px; height: 34px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-soft);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background .12s, border-color .12s, color .12s;
}
.page-btn:hover:not(:disabled):not(.is-current) { background: var(--surface-3); color: var(--text); }
.page-btn.is-current {
  background: var(--brand); border-color: var(--brand);
  color: var(--brand-text); cursor: default;
}
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-btn.is-ellipsis {
  border: 0; background: transparent; cursor: default; color: var(--text-mute);
  min-width: 26px; padding: 0;
}
.page-btn .icon { width: 14px; height: 14px; }
.per-page-select {
  height: 34px; padding: 0 28px 0 10px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 12.5px; color: var(--text-soft); cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-mute) 50%),
                    linear-gradient(135deg, var(--text-mute) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
@media (max-width: 540px) {
  .pagination { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .pagination-controls { justify-content: center; flex-wrap: wrap; }
  .page-num-hide-mobile { display: none; }
  /* Only show prev/next (have aria-label) and the current page button */
  .pagination-controls .page-btn[data-page]:not([aria-label]):not(.is-current) { display: none; }
  .pagination-controls .page-btn.is-ellipsis { display: none; }
  .pagination-info { text-align: center; }
}

/* tiny tweaks for mobile usability */
@media (max-width: 600px) {
  .card-head { padding: 12px 14px; }
  .card-body { padding: 12px 14px; }
  .table th, .table td { padding: 10px 10px; font-size: 12.5px; }
  .topbar .page-title { font-size: 14.5px; }
}
