:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e9f2;
  --accent: #2563eb;
  --accent-2: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-ink: #ffffff;
  --ok-bg: #e7f7ee; --ok-ink: #15803d;
  --err-bg: #fdecec; --err-ink: #b42318;
  --void: #d92d20;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117; --card: #161b22; --text: #e6edf3; --muted: #8b949e; --line: #262d36;
    --accent: #6d9bff; --accent-2: #8b7cff; --accent-soft: #1b2440;
    --ok-bg: #12301f; --ok-ink: #7fd7a3; --err-bg: #3a1917; --err-ink: #f4a39b; --void: #f4776b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 40px; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; margin: 4px 0 18px; }
h2 { font-size: 17px; font-weight: 650; margin: 26px 0 12px; }
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- header / navigation ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 10px 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; color: var(--text); font-size: 16px; white-space: nowrap; }
.logo {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px rgba(37, 99, 235, .3);
}
.logo .ic { width: 18px; height: 18px; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 550; font-size: 14px; white-space: nowrap; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent); }
.me { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.me-name {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px;
  color: var(--text); font-weight: 600; border: 1px solid var(--line); background: var(--card);
}
.me-name:hover, .me-name.on { border-color: var(--accent); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.lang-form select { width: auto; padding: 6px 10px; font-size: 13px; border-radius: 999px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.icon-btn:hover { color: var(--void); border-color: var(--void); background: transparent; }

/* ---------- surfaces ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.flash { padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash.error { background: var(--err-bg); color: var(--err-ink); }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head-row h1 { margin: 0; }
.hint { color: var(--muted); font-size: 13px; }
.who { color: var(--muted); }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; font-weight: 550; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.field { margin-bottom: 14px; }
.stack { display: grid; gap: 6px; margin-top: 8px; }
.stack label { margin: 0; }
.mode { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; }
.mode label { display: flex; gap: 7px; align-items: center; color: var(--text); font-size: 14px; font-weight: 500; margin: 0; }
.mode input { width: auto; accent-color: var(--accent); }

/* ---------- buttons ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px;
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); transition: filter .15s, background .15s, transform .05s;
}
button:hover, .btn:hover { filter: brightness(1.07); }
button:active, .btn:active { transform: translateY(1px); }
button.secondary, .btn.secondary { background: var(--card); color: var(--accent); border-color: var(--line); }
button.secondary:hover, .btn.secondary:hover { border-color: var(--accent); filter: none; }
button.danger { background: var(--void); border-color: var(--void); color: #fff; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; }
button.link:hover { text-decoration: underline; filter: none; }
button:disabled { opacity: .6; cursor: default; }
.inline { display: inline; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.danger-link { color: var(--void) !important; }

/* ---------- issue receipt rows ---------- */
.items { width: 100%; border-collapse: collapse; }
.items th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 0 8px 8px 0; }
.items td { padding: 0 8px 10px 0; vertical-align: top; }
.items td.k { width: 170px; }
.items td.a { width: 130px; }
.items td.x { width: 40px; }
.rm { background: var(--card); border: 1px solid var(--line); color: var(--muted); padding: 9px 12px; }
.rm:hover { color: var(--void); border-color: var(--void); filter: none; }
.total { font-size: 20px; font-weight: 750; }

/* ---------- tables ---------- */
table.list {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
table.list th, table.list td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.list thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: color-mix(in srgb, var(--bg) 60%, var(--card)); }
table.list tbody tr { transition: background .12s; }
table.list tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
table.list tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.list tfoot th { border-top: 1px solid var(--line); border-bottom: 0; color: var(--text); font-weight: 650; }
table.stats { max-width: 560px; }
table.stats tbody th { width: 40%; color: var(--muted); font-weight: 550; font-size: 14px; text-transform: none; letter-spacing: 0; }
.void-tag { color: var(--void); font-weight: 600; }
tr.void td { color: var(--muted); text-decoration: line-through; }
tr.void td .void-tag { text-decoration: none; }
.ok-tag, .due-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ok-tag { color: var(--ok-ink); background: var(--ok-bg); }
.due-tag { color: var(--err-ink); background: var(--err-bg); }
.vacant-tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--bg); border: 1px dashed var(--line); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; flex: 1 1 170px; }

/* ---------- misc ---------- */
.preview { width: 100%; max-width: 780px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: block; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details summary { cursor: pointer; color: var(--accent); font-weight: 500; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] { min-width: 240px; }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: 13px; margin: 6px 0 12px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
textarea#invite, textarea#newkey { font-family: ui-monospace, monospace; font-size: 13px; }

/* ---------- login ---------- */
body.login-page {
  min-height: 100vh; min-height: 100dvh;
  background:
    radial-gradient(900px 480px at 12% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(700px 420px at 100% 110%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 70%),
    var(--bg);
}
body.login-page main { padding-top: 0; }
.login { max-width: 400px; margin: 0 auto; padding: max(4vh, 16px) 0 32px; }
.login-lang { display: flex; justify-content: flex-end; margin-bottom: 4vh; }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-logo {
  display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}
.login-logo .ic { width: 32px; height: 32px; }
.login-brand h1 { margin: 14px 0 4px; font-size: 28px; letter-spacing: -.02em; }
.login-brand p { margin: 0; color: var(--muted); }
.login-card { padding: 26px; border-radius: 20px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 18px 50px rgba(15, 23, 42, .10); }
.login-card input { padding: 12px 14px; font-size: 16px; border-radius: 12px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; background: none; border: 0; color: var(--muted); border-radius: 8px;
}
.pw-eye:hover, .pw-eye.on { color: var(--accent); filter: none; }
.pw-eye .ic { width: 20px; height: 20px; }
.login-submit {
  width: 100%; margin-top: 8px; padding: 13px; font-size: 16px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent);
}
.smart-tile {
  display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 16px 18px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--line); color: var(--text); box-shadow: var(--shadow);
  transition: border-color .15s, transform .05s;
}
.smart-tile:hover { border-color: var(--accent); }
.smart-tile:active { transform: scale(.99); }
.smart-ico {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706;
}
.smart-ico .ic { width: 24px; height: 24px; }
.smart-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.smart-txt span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.smart-go { font-size: 26px; color: var(--muted); line-height: 1; }
.smart-forget { text-align: center; margin-top: 10px; font-size: 13px; }
.login-note { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 8px 0; }
.smart-foot { margin-top: 24px; text-align: center; }
.btn.small { padding: 6px 12px; font-size: 14px; }

/* ---------- item types ---------- */
.type-line { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.type-line:last-of-type { border-bottom: 0; }
.type-name { display: flex; gap: 8px; flex: 1; align-items: center; }
.type-name input { max-width: 340px; }
.type-name.add { margin-top: 14px; }

/* ---------- phones: bottom tab bar ---------- */
@media (max-width: 760px) {
  main { padding: 18px 14px 30px; }
  body.with-nav main { padding-bottom: 96px; }
  /* a backdrop-filter would trap the fixed tab bar inside the header */
  .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--card); }
  .top-in { padding: 8px 14px; gap: 10px; }
  .brand span:last-child { display: none; }
  .me { margin-left: auto; }
  .me-text { display: none; }
  .me-name { padding: 3px; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; justify-content: space-around; gap: 0;
    background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(15, 23, 42, .06);
  }
  .nav a { flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 10.5px; min-width: 50px; flex: 1; border-radius: 12px; }
  .nav a .ic { width: 22px; height: 22px; }
  .nav a span { max-width: 60px; overflow: hidden; text-overflow: ellipsis; }
  .nav a.on { background: transparent; }
  .items thead { display: none; }
  .items tr { display: grid; grid-template-columns: 1fr 1fr 40px; gap: 8px; margin-bottom: 14px; }
  .items td { padding: 0; width: auto !important; }
  .items td.d { grid-column: 1 / -1; grid-row: 2; }
  table.list .hide-sm { display: none; }
  table.list th, table.list td { padding: 10px 8px; font-size: 14px; }
  .kv { grid-template-columns: 100px 1fr; }
}

/* ================= app polish (2026-09-27) ================= */
.page-head { margin: 4px 0 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
h2.section { font-size: 15px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 26px 2px 10px; }
.card-title { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
table.list { border-radius: var(--radius); }

/* hero (tenant summary) */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 20px 22px 18px; margin-bottom: 14px; color: #fff;
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 60%, #7c3aed 100%);
  box-shadow: 0 14px 34px rgba(79, 70, 229, .28);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%);
}
.hero-due { background: linear-gradient(135deg, #f97316 0%, #e11d48 100%); box-shadow: 0 14px 34px rgba(225, 29, 72, .28); }
.hero-none { background: linear-gradient(135deg, #475569 0%, #334155 100%); box-shadow: 0 14px 34px rgba(15, 23, 42, .25); }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-unit { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 15px; }
.hero-unit .ic { width: 18px; height: 18px; opacity: .9; }
.hero-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(255, 255, 255, .2); backdrop-filter: blur(6px);
}
.hero-pill .ic { width: 16px; height: 16px; }
.hero-label { font-size: 13px; opacity: .85; font-weight: 600; letter-spacing: .02em; }
.hero-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; margin: 2px 0 16px; }
.hero-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; opacity: .92; position: relative; z-index: 1; }
.hero-foot strong { font-weight: 800; }

/* info card (next payment / unpaid) */
.info-card {
  display: flex; gap: 14px; align-items: flex-start; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.info-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.info-ico .ic { width: 22px; height: 22px; }
.info-due .info-ico { background: var(--err-bg); color: var(--err-ink); }
.info-title { font-size: 13px; font-weight: 700; color: var(--muted); }
.info-due .info-title { color: var(--err-ink); }
.info-main { font-size: 17px; font-weight: 750; margin-top: 2px; }
.info-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* list rows (history, receipts, documents) */
.rows { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; color: var(--text); border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
a.row, .row a.row-main { color: var(--text); }
a.row:hover { background: color-mix(in srgb, var(--accent-soft) 50%, transparent); }
.row.empty { color: var(--muted); justify-content: center; padding: 26px 16px; }
.row-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--bg); color: var(--muted); }
.row-ico .ic { width: 20px; height: 20px; }
.row-ico.rent { background: var(--accent-soft); color: var(--accent); }
.row-ico.doc { background: color-mix(in srgb, #f59e0b 15%, transparent); color: #d97706; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-amt { font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-go { color: var(--muted); display: grid; }
.row-go .ic { width: 18px; height: 18px; }
.row.void .row-amt, .row.void .row-sub { text-decoration: line-through; color: var(--muted); }
.icon-btn.plain { border-color: transparent; color: var(--accent); }
.icon-btn.plain:hover { color: var(--accent); border-color: var(--line); }
.total-strip { margin: 0 2px 10px; color: var(--muted); font-size: 13px; font-weight: 600; }

/* admin stat cards */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 4px; }
.stat-ico { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; margin-bottom: 6px; }
.stat-ico .ic { width: 20px; height: 20px; }
.stat-ico.blue { background: #e0ecff; color: #2563eb; }
.stat-ico.violet { background: #ede9fe; color: #7c3aed; }
.stat-ico.green { background: var(--ok-bg); color: var(--ok-ink); }
.stat-ico.red { background: var(--err-bg); color: var(--err-ink); }
.stat-ico.grey { background: var(--bg); color: var(--muted); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-note { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.stat-note.due { color: var(--err-ink); }

/* smart-home tiles */
.dev-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.dev {
  --tone: #64748b; width: 100%; min-height: 150px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 16px; border-radius: 22px; text-align: left; color: var(--text); font-weight: 500;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  transition: background .2s, border-color .2s, box-shadow .2s, transform .08s;
}
.dev:hover { filter: none; border-color: color-mix(in srgb, var(--tone) 45%, var(--line)); }
.dev:active { transform: scale(.97); }
.dev-plug { --tone: #2563eb; } .dev-smart { --tone: #f59e0b; } .dev-fan { --tone: #0ea5e9; }
.dev-snow { --tone: #06b6d4; } .dev-flame { --tone: #ef4444; }
.dev-top { display: flex; justify-content: space-between; width: 100%; margin-bottom: auto; }
.dev-ico { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px; background: var(--bg); color: var(--muted); transition: inherit; }
.dev-ico .ic { width: 24px; height: 24px; }
.dev-pwr { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); }
.dev-pwr .ic { width: 15px; height: 15px; }
.dev-name { font-weight: 700; font-size: 15px; margin-top: 16px; line-height: 1.3; }
.dev-state { font-size: 13px; color: var(--muted); font-weight: 600; }
.dev.on { background: color-mix(in srgb, var(--tone) 12%, var(--card)); border-color: color-mix(in srgb, var(--tone) 40%, transparent);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--tone) 22%, transparent); }
.dev.on .dev-ico { background: var(--tone); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--tone) 45%, transparent); }
.dev.on .dev-pwr { background: var(--tone); border-color: var(--tone); color: #fff; }
.dev.on .dev-state { color: var(--tone); }
.dev.dev-fan.on .dev-ico .ic { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dev.dev-fan.on .dev-ico .ic { animation: none; } }
.dev:disabled { opacity: .55; }

/* desktop header: keep every admin tab readable */
@media (min-width: 761px) and (max-width: 1400px) {
  .top-in { gap: 12px; }
  .nav a { padding: 8px 9px; gap: 6px; }
  .me-text { display: none; }
  .me-name { padding: 3px; }
  .lang-form select { max-width: 112px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  .nav a span { display: none; }
  .nav a { padding: 9px; }
}

@media (prefers-color-scheme: dark) {
  .stat-ico.blue { background: #1b2a4a; color: #8fb3ff; }
  .stat-ico.violet { background: #2a2147; color: #b9a4ff; }
}

@media (max-width: 760px) {
  h1 { font-size: 22px; }
  .brand span:last-child { display: inline; }
  .lang-form select { max-width: 104px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 19px; }
  .hero-value { font-size: 24px; }
  .dev-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .dev { min-height: 140px; }
  /* bottom tab bar: pill behind the active icon */
  .nav a .ic { width: 22px; height: 22px; box-sizing: content-box; padding: 4px 12px; border-radius: 999px; transition: background .15s; }
  .nav a.on .ic { background: var(--accent-soft); }
  .nav a.on span { font-weight: 700; }
}

/* ================= admin pages polish ================= */
/* unit cards (overview, tenants) */
.ucards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-bottom: 14px; }
.ucard {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 8px; overflow: hidden;
}
.ucard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.ucard.st-ok::before { background: #22c55e; }
.ucard.st-due::before { background: #f43f5e; }
.ucard.st-none::before { background: #94a3b8; }
.ucard.gone { opacity: .65; }
.ucard.vacant { border-style: dashed; box-shadow: none; background: color-mix(in srgb, var(--card) 60%, var(--bg)); justify-content: space-between; min-height: 150px; }
.ucard.vacant::before { display: none; }
.ucard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ucard-unit { display: inline-flex; align-items: center; gap: 7px; font-weight: 750; font-size: 15px; min-width: 0; }
.ucard-unit span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ucard-unit .ic { color: var(--muted); width: 17px; height: 17px; }
.ucard-name { font-size: 17px; font-weight: 700; color: var(--text); }
.ucard-name:hover { color: var(--accent); }
.ucard-kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 4px 0 0; font-size: 13.5px; }
.ucard-kv dt { color: var(--muted); }
.ucard-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.ucard-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
a.chip:hover { color: var(--accent); border-color: var(--accent); }
.chip .ic { width: 14px; height: 14px; }

/* toolbars / filters */
.toolbar { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.row-no { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--accent); min-width: 42px; }

/* accounts */
.avatar.lg { width: 40px; height: 40px; font-size: 16px; flex: none; }
.urow { flex-wrap: wrap; }
.urow details { margin-left: auto; }
.urow details[open] { flex-basis: 100%; margin-left: 0; background: var(--bg); border-radius: 14px; padding: 12px 14px; }
.urow details > summary { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px; }
.urow details[open] > summary { display: inline-block; margin-bottom: 8px; }
.urow details .stack { max-width: 420px; }
.role { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--bg); color: var(--muted); border: 1px solid var(--line); vertical-align: 2px; }
.role.admin { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.invite-card { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* section cards (settings, issue receipt) */
.sect { padding: 20px; }
.sect-title { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 16px; font-weight: 750; }
.sect-ico { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; }
.sect-ico .ic { width: 18px; height: 18px; }
.sect-ico.blue { background: #e0ecff; color: #2563eb; }
.sect-ico.violet { background: #ede9fe; color: #7c3aed; }
.sect-ico.amber { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706; }
.sect-ico.green { background: var(--ok-bg); color: var(--ok-ink); }
.sect-ico.grey { background: var(--bg); color: var(--muted); }
.sig-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sig { height: 44px; background: #fff; padding: 4px 8px; border-radius: 10px; border: 1px solid var(--line); }
.sig-row input { flex: 1; min-width: 200px; }
.link-tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-bottom: 16px; }
.link-tile {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius); color: var(--text);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.link-tile:hover { border-color: var(--accent); }
.link-tile > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.save-bar, .issue-bar {
  position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12); padding: 12px 14px 12px 18px; backdrop-filter: blur(8px);
}
.save-bar { justify-content: flex-end; }
.save-bar button, .issue-bar button { padding: 12px 28px; font-size: 16px; border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.issue-total-label { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.issue-total { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.no-chip { padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }

@media (prefers-color-scheme: dark) {
  .sect-ico.blue { background: #1b2a4a; color: #8fb3ff; }
  .sect-ico.violet { background: #2a2147; color: #b9a4ff; }
}
@media (max-width: 760px) {
  .ucards { grid-template-columns: 1fr; }
  body.with-nav .save-bar, body.with-nav .issue-bar { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .issue-total { font-size: 20px; }
  .row-no { display: none; }
}
