/* Property Vault — Admin console. Brand: #125358 / #a5670f / #f7f5f0 */
:root {
  --teal: #125358;
  --teal-700: #0e4448;
  --teal-900: #0a3336;
  --teal-050: #e7f0f0;
  --amber: #a5670f;
  --amber-050: #f6ecdd;
  --cream: #f7f5f0;
  --ink: #17201f;
  --muted: #5f6d6c;
  --line: #e6e3db;
  --white: #ffffff;
  --ok: #1f7a4d;
  --ok-050: #e3f3ea;
  --danger: #b23b3b;
  --danger-050: #f6e4e4;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 40, 40, 0.06), 0 12px 30px rgba(16, 40, 40, 0.08);
  --shadow-sm: 0 1px 2px rgba(16, 40, 40, 0.06), 0 4px 12px rgba(16, 40, 40, 0.06);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--teal-050); padding: 1px 6px; border-radius: 6px; }

.logo { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 6px 16px rgba(10, 51, 54, 0.35); display: block; }
.wordmark { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; font-size: 1.14rem; }
.eyebrow { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--amber); font-weight: 700; }

/* ---------------------------------------------------------------- Login --- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(165, 103, 15, 0.22), transparent 60%),
    radial-gradient(900px 700px at 110% 120%, rgba(231, 240, 240, 0.14), transparent 55%),
    linear-gradient(160deg, var(--teal) 0%, var(--teal-900) 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 22px;
  padding: 34px 32px;
  box-shadow: 0 30px 80px rgba(6, 28, 30, 0.45);
}
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand .logo { width: 52px; height: 52px; }
.login-lead { color: var(--muted); margin: 18px 0 22px; }
.login-foot { margin: 16px 0 0; font-size: 0.78rem; color: var(--muted); }
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.field input, .field select {
  font: inherit;
  color: var(--ink);
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(18, 83, 88, 0.15);
}
.advanced summary { cursor: pointer; color: var(--teal); font-size: 0.8rem; font-weight: 600; }
.advanced[open] { display: grid; gap: 14px; padding-top: 6px; }
.form-error { color: var(--danger); font-size: 0.85rem; margin: 4px 0 0; }

/* --------------------------------------------------------------- Buttons --- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: 10px;
  padding: 10px 16px; display: inline-flex; align-items: center; gap: 8px;
  transition: transform 0.05s, background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-700); }
.btn-secondary { background: var(--amber); color: #fff; }
.btn-secondary:hover { filter: brightness(0.95); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }
.btn-ghost { background: transparent; color: rgba(255,255,255,0.85); }
.btn-ghost:hover { background: rgba(255,255,255,0.12); }
.btn-danger { background: var(--danger-050); color: var(--danger); }
.btn-danger:hover { background: #efcccc; }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; border-radius: 9px; }

/* ----------------------------------------------------------------- Shell --- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100%; }
.sidebar {
  background: linear-gradient(180deg, var(--teal) 0%, var(--teal-900) 100%);
  color: #eaf3f2; display: flex; flex-direction: column; padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.sidebar .wordmark { color: #fff; }
.nav { display: grid; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 11px;
  color: rgba(234, 243, 242, 0.82); font-weight: 600; font-size: 0.92rem; cursor: pointer;
  border-left: 3px solid transparent;
}
.nav-link .ico { width: 18px; text-align: center; opacity: 0.9; }
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-link.active { background: rgba(255,255,255,0.14); color: #fff; border-left-color: var(--amber); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,0.12); }
.who { font-size: 0.82rem; }
.who b { display: block; color: #fff; }
.who span { color: rgba(234,243,242,0.65); }

.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 32px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.6);
  position: sticky; top: 0; backdrop-filter: blur(8px); z-index: 5;
}
.topbar h1 { font-family: var(--serif); font-weight: 600; font-size: 1.55rem; margin: 0; letter-spacing: -0.01em; }
.page-actions { display: flex; gap: 10px; }
.view { padding: 28px 32px 60px; }

/* ------------------------------------------------------------- Dashboard --- */
.grid-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); display: grid; gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .chip {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  font-size: 1.1rem; margin-bottom: 4px;
}
.chip.teal { background: var(--teal-050); color: var(--teal); }
.chip.amber { background: var(--amber-050); color: var(--amber); }
.chip.ok { background: var(--ok-050); color: var(--ok); }
.stat .num { font-family: var(--serif); font-size: 2.1rem; font-weight: 600; letter-spacing: -0.01em; }
.stat .lbl { color: var(--muted); font-size: 0.85rem; font-weight: 600; }

.section-title { margin: 30px 0 12px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 700; }

/* ---------------------------------------------------------------- Tables --- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filters select {
  font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--white); color: var(--ink); cursor: pointer;
}
.filters select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(18, 83, 88, 0.12); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
thead th {
  text-align: left; padding: 13px 18px; background: #fbfaf7; color: var(--muted);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fbfaf7; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 0.82rem; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.badge.homeowner { background: var(--teal-050); color: var(--teal); }
.badge.agent { background: var(--amber-050); color: var(--amber); }
.badge.admin { background: #e6e1f2; color: #4b3b8f; }
.badge.type { background: #eef1f0; color: #45514f; text-transform: none; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 700; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.on { color: var(--ok); }
.pill.off { color: #98a2a1; }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- Modal --- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 30, 32, 0.42); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 24px; z-index: 40; animation: fade 0.12s ease;
}
.modal {
  width: 100%; max-width: 560px; background: #fff; border-radius: 18px; box-shadow: 0 30px 80px rgba(6,28,30,0.4);
  max-height: 90vh; display: flex; flex-direction: column; animation: pop 0.14s ease;
}
.modal header { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal header h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.3rem; }
.modal .body { padding: 22px 24px; overflow-y: auto; display: grid; gap: 16px; }
.modal footer { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.icon-btn { border: none; background: none; cursor: pointer; font-size: 1.3rem; color: var(--muted); line-height: 1; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); font-size: 0.9rem; }
.opt-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.detail-list { display: grid; gap: 10px; }
.detail-list .kv { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.detail-list .kv b { color: var(--muted); font-weight: 600; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.99); } }

/* ---------------------------------------------------------------- Toast --- */
.toast-root { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 60; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 11px; box-shadow: var(--shadow);
  font-size: 0.88rem; font-weight: 600; animation: pop 0.14s ease; max-width: 340px;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .nav { grid-auto-flow: column; grid-template-columns: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: none; padding: 0; flex-direction: row; align-items: center; }
  .row2 { grid-template-columns: 1fr; }
}
