/* AssetVision */
:root {
  --bg: #f4f6f9; --surface: #ffffff; --surface2: #f9fafc; --text: #111827; --muted: #4b5563; --line: #e3e7ee; --line2: #eef1f5;
  --brand: #1d5fd6; --brand-d: #1747a6; --brand-soft: #e6eefc;
  --ok: #0f7a3d; --ok-soft: #e7f5ec; --warn: #8a4b00; --warn-soft: #fff3e0; --bad: #b42318; --bad-soft: #fdecea; --teal: #0e6e6e; --teal-soft: #e0f3f3;
  --grey-soft: #eef1f5; --dark-soft: #e5e7eb; --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --surface: #171e27; --surface2: #1b2430; --text: #e8edf4; --muted: #a3afbf; --line: #2a3442; --line2: #232c38;
    --brand: #4f8cff; --brand-d: #7aa8ff; --brand-soft: #1b2b47;
    --ok: #4cc584; --ok-soft: #173326; --warn: #f0b45a; --warn-soft: #3a2a12; --bad: #ff7b6e; --bad-soft: #3d1c19; --teal: #5ad1d1; --teal-soft: #13302f;
    --grey-soft: #222b37; --dark-soft: #2a3340; --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
a { color: var(--brand); text-decoration: none; } a:hover { color: var(--brand-d); text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; } .mono { font-family: var(--mono); }
.loading-inline { padding: 40px; color: var(--muted); text-align: center; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty.bad { color: var(--bad); }

/* buttons & fields */
.btn { font: inherit; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { border-color: #c9d1dd; background: var(--surface2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; } .btn.primary:hover { background: var(--brand-d); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; } .btn.small { min-height: 30px; padding: 0 10px; font-size: 13px; } .btn.block { width: 100%; } .btn.big { min-height: 50px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { font: inherit; border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.icon-btn:hover { background: var(--grey-soft); }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.field > span { font-weight: 600; color: var(--text); }
.field small { color: var(--muted); }
input, select, textarea { font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid #c9d1dd; border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
.chk { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); cursor: pointer; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* layout */
.app { display: flex; min-height: 100vh; }
.side { width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-size: 17px; font-weight: 600; }
.brand b { color: var(--brand); } .brand.big { font-size: 22px; justify-content: center; margin-bottom: 18px; }
.tenant-pick { display: flex; flex-direction: column; gap: 4px; padding: 0 6px; font-size: 12px; color: var(--muted); }
.tenant-pick select { font-size: 14px; min-height: 36px; padding: 6px 8px; }
.tenant-name { padding: 8px 10px; border-radius: 8px; background: var(--grey-soft); font-weight: 600; font-size: 14px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a, .side .me { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 14.5px; font-weight: 500; text-decoration: none; }
.side nav a .ico, .side .me .ico { color: var(--muted); flex: none; }
.side nav a:hover, .side .me:hover { background: var(--grey-soft); text-decoration: none; }
.side nav a.on { background: var(--brand-soft); color: var(--brand-d); font-weight: 600; } .side nav a.on .ico { color: var(--brand); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.side .me span { display: flex; flex-direction: column; min-width: 0; } .side .me small { color: var(--muted); font-weight: 400; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.build { font-size: 11px; color: var(--muted); padding: 0 10px; }
.main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 10px; padding: 18px 28px 0; }
.top h1 { font-size: 22px; }
.menu-btn { display: none; }
#view { padding: 18px 28px 40px; display: flex; flex-direction: column; gap: 18px; }
.scrim { display: none; }
@media (max-width: 900px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-105%); transition: transform .2s; box-shadow: 0 0 30px rgba(0, 0, 0, .2); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
  .menu-btn { display: inline-block; }
  .top { padding: 12px 14px 0; } #view { padding: 14px 14px 32px; }
}

/* blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card > h3, .card-h { font-size: 15px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar .grow { flex: 1 1 220px; min-width: 0; }
.bar .search { max-width: 360px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); text-decoration: none !important; box-shadow: var(--shadow); }
a.kpi:hover { border-color: var(--brand); }
.kpi-label { font-size: 13px; color: var(--muted); } .kpi-value { font-size: 28px; font-weight: 700; margin-top: 2px; } .kpi-sub { font-size: 12px; color: var(--muted); }
.kpi.green .kpi-value { color: var(--ok); } .kpi.red .kpi-value { color: var(--bad); } .kpi.amber .kpi-value { color: var(--warn); } .kpi.blue .kpi-value { color: var(--brand); }
.cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.cols > * { flex: 1 1 380px; min-width: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--brand-d); border-color: var(--brand); font-weight: 600; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; } }
.head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.head h2 { font-size: 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr[data-href] { cursor: pointer; } .tbl tr[data-href]:hover td { background: var(--surface2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.wrap { white-space: normal; min-width: 180px; }
/* phones: rows become cards */
@media (max-width: 640px) {
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .tbl.cards td { padding: 3px 0 3px 112px; border: 0; text-align: left !important; position: relative; min-height: 24px; }
  .tbl.cards td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 104px; color: var(--muted); font-size: 12px; }
  .tbl.cards td[data-label=""] { padding-left: 0; }
  .tbl.cards td[data-label=""]::before { display: none; }
  .tbl.cards td:empty { display: none; }
}

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.grey { background: var(--grey-soft); color: var(--muted); } .pill.dark { background: var(--dark-soft); color: var(--text); }
.pill.blue { background: var(--brand-soft); color: var(--brand-d); } .pill.amber { background: var(--warn-soft); color: var(--warn); }
.pill.green { background: var(--ok-soft); color: var(--ok); } .pill.red { background: var(--bad-soft); color: var(--bad); } .pill.teal { background: var(--teal-soft); color: var(--teal); }
.code { font-family: var(--mono); font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.timeline li { display: grid; grid-template-columns: 115px 1fr; gap: 10px; }
.timeline time { color: var(--muted); font-size: 13px; }
.timeline .who { color: var(--muted); font-size: 12px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.steps > div { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.steps b { color: var(--text); font-size: 14px; }
.steps .meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; } .steps .meter i { display: block; height: 100%; background: var(--ok); }
.progress { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--grey-soft); min-width: 120px; }
.progress i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.pick-tenant { max-width: 560px; margin: 40px auto; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.preview-box { max-height: 340px; overflow: auto; }
.row-err td { background: var(--bad-soft); }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--brand-soft); color: var(--text); font-size: 14px; }
.notice.warn { background: var(--warn-soft); } .notice.bad { background: var(--bad-soft); }

/* login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 10px 30px rgba(16, 24, 40, .08); }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin-bottom: 8px; }
.tf-qr { display: flex; justify-content: center; margin: 10px 0; } .tf-qr svg { border-radius: 8px; }
.tf-steps { padding-left: 18px; font-size: 14px; } .tf-secret { font-family: var(--mono); display: block; padding: 8px; background: var(--grey-soft); border-radius: 8px; word-break: break-all; }
.tf-codes { columns: 2; font-family: var(--mono); padding-left: 22px; } .tf-saved { margin: 10px 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

/* modal & toasts */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 20, 27, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 14px 14px; overflow-y: auto; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.modal.wide { max-width: 860px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal header h3 { font-size: 17px; }
.modal-body { padding: 16px 18px 6px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { padding: 10px 14px; border-radius: 10px; background: #111827; color: #fff; font-size: 14px; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); max-width: 360px; }
.toast.bad { background: var(--bad); }

/* the carrier's page (phone) */
.courier { max-width: 460px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.c-head { display: flex; gap: 10px; align-items: center; padding: 16px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.c-head div { display: flex; flex-direction: column; } .c-head small { color: var(--muted); }
.c-body { padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.c-body .card { margin-bottom: 14px; }
.c-num { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.c-done { text-align: center; padding: 80px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
