/* Property workspace — operate-mode design system. Keeps the Home visual
   language from the demo (showcase.html) but tightened for real app use. */

:root {
  --ink: #0a0a0f;
  --ink-2: #1d1d22;
  --muted: #65656d;
  --muted-2: #8c8c94;
  --hair: #e2e2e8;
  --hair-2: #d2d2d8;
  --surface: #ffffff;
  --surface-2: #f6f6f8;
  --surface-3: #efeff2;
  --accent: #0a66d6;
  --accent-soft: #e4edfb;
  --accent-ink: #0f4ca8;
  --ok: #0a7a46;
  --ok-soft: #e2f3e9;
  --warn: #975300;
  --warn-soft: #fcebcf;
  --danger: #b1283f;
  --danger-soft: #fbe4e7;
  --info: #1f4fa8;
  --info-soft: #e6edf8;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-1: 0 1px 0 rgba(10, 10, 15, .04), 0 1px 2px rgba(10, 10, 15, .04);
  --shadow-2: 0 1px 0 rgba(10, 10, 15, .04), 0 6px 20px -8px rgba(10, 10, 15, .14);
  --focus: 0 0 0 3px rgba(10, 102, 214, .35);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Inter", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { overflow-x: hidden; }
body {
  font: 16px/1.55 var(--font);
  color: var(--ink);
  background: var(--surface-2);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { position: static; display: inline-block; padding: 8px 12px; background: var(--accent); color: #fff; }

/* --- shell --- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--hair);
  display: flex; flex-direction: column; padding: 18px 14px 14px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; border-bottom: 1px solid var(--hair); margin-bottom: 10px; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #0a66d6, #0f4ca8 70%, #0b3a86); color: white; display: grid; place-items: center; font-weight: 650; letter-spacing: -.01em; font-size: 15px; }
.brand .name { font-weight: 650; letter-spacing: -.015em; font-size: 16px; }
.brand .name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.brand .dot { color: var(--accent); }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); padding: 12px 10px 6px; }
.navi {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px;
  min-height: 36px; text-decoration: none;
}
.navi:hover { background: var(--surface-3); text-decoration: none; }
.navi.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 550; }
.count { font-size: 11px; background: var(--surface-3); color: var(--ink-2); padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.side-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--hair); display: grid; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 999px; background: linear-gradient(135deg, #e5b1a4, #c76f67); color: white; display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.who { font-size: 13px; font-weight: 550; }
.who small { color: var(--muted); display: block; font-size: 11px; font-weight: 400; }

.shell { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(246, 246, 248, .85);
  backdrop-filter: saturate(1.3) blur(14px);
  -webkit-backdrop-filter: saturate(1.3) blur(14px);
  border-bottom: 1px solid var(--hair);
  padding: 12px 24px;
}
.crumbs { color: var(--muted); font-size: 13px; }
.crumbs b { color: var(--ink-2); font-weight: 600; }
.crumbs .sep { color: var(--muted-2); margin: 0 6px; }

.view { padding: 24px 28px 60px; display: grid; gap: 20px; min-width: 0; max-width: 100vw; }
.flash { display: grid; gap: 8px; }
.flash-row { padding: 10px 14px; background: var(--info-soft); color: var(--info); border-radius: 10px; font-size: 14px; }
.flash-row.success { background: var(--ok-soft); color: var(--ok); }
.flash-row.error { background: var(--danger-soft); color: var(--danger); }

.page-head h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.025em; margin: 0 0 6px; font-weight: 650; }
.page-head p { color: var(--muted); margin: 0 0 10px; max-width: 68ch; }

/* --- cards --- */
.card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--hair); }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.card-body { padding: 16px 18px; }

/* --- grids --- */
.grid-2 { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 20px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.tiles.t3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.tile { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-lg); padding: 16px 18px; display: grid; gap: 6px; }
.tile .lbl { color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; }
.tile .val { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.tile .foot { color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; }

/* --- chips --- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); max-width: 100%; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.outline { background: transparent; border: 1px solid var(--hair-2); color: var(--ink-2); }
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; display: inline-block; }

/* --- buttons --- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; min-height: 40px;
  background: var(--surface); border: 1px solid var(--hair); color: var(--ink-2);
  border-radius: 9px; font-weight: 500; font-size: 14px;
  cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn.pri { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.pri:hover { background: #0a5bc3; border-color: #0a5bc3; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); }
.btn.danger:hover { background: var(--danger-soft); }

/* --- forms --- */
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--hair-2);
  border-radius: 9px; outline: none; font-size: 16px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: var(--focus);
}
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { color: var(--danger); font-size: 12.5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* --- lists --- */
.rows { display: grid; }
.rrow {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px;
  padding: 12px 18px; border-bottom: 1px solid var(--hair); align-items: center;
  background: transparent; text-align: left; width: 100%;
}
.rrow:last-child { border-bottom: 0; }
.rrow:hover { background: var(--surface-2); }
.rrow .ttl { font-weight: 550; font-size: 14px; }
.rrow .meta { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rrow .right { text-align: right; }
.rrow .amt { font-weight: 600; font-size: 14px; }

/* --- property identity tile (pid) --- */
.pid {
  width: 48px; height: 48px; border-radius: 11px; display: grid; place-items: center;
  color: #fff; font-weight: 650; font-size: 13px; position: relative;
  background: linear-gradient(135deg, #4b86d0, #1f3e6d);
}
.pid.sm { width: 36px; height: 36px; font-size: 11px; }
.pid.lg { width: 64px; height: 64px; font-size: 15px; border-radius: 13px; }
.pid small { position: absolute; bottom: 4px; right: 6px; font-size: 9px; opacity: .9; font-weight: 500; }

/* colour each property by first char of code — a quick deterministic palette */
.pid.c-c { background: linear-gradient(135deg, #4b86d0, #1f3e6d); }
.pid.c-m { background: linear-gradient(135deg, #8f6ad0, #4d3987); }
.pid.c-o { background: linear-gradient(135deg, #cc8c3a, #7a4e14); }
.pid.c-h { background: linear-gradient(135deg, #41a08c, #1a5a4f); }
.pid.c-d { background: linear-gradient(135deg, #d59c3a, #91611a); }
.pid.c-t { background: linear-gradient(135deg, #6abfc9, #26636b); }

/* --- auth shell --- */
.auth-shell { max-width: 420px; margin: 60px auto; padding: 0 20px; }
.auth-card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow-2); }
.auth-card h1 { font-size: 24px; letter-spacing: -.02em; margin: 0 0 8px; }
.auth-card p { color: var(--muted); margin: 0 0 18px; }
.auth-card label { display: block; margin-bottom: 14px; }

/* --- notices --- */
.notice { display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; border: 1px solid; }
.notice.info { background: var(--info-soft); border-color: #cfd9ec; color: #22326e; }
.notice.warn { background: var(--warn-soft); border-color: #efd7a9; color: #6b3b00; }
.notice.danger { background: var(--danger-soft); border-color: #efccd3; color: #7a1a2c; }
.notice.ok { background: var(--ok-soft); border-color: #c6e4d1; color: #0c5a35; }

/* --- empty states --- */
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink-2); margin: 0 0 6px; font-weight: 600; }

/* --- mobile --- */
.mnav { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .tiles, .tiles.t3 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .topbar { padding: 10px 14px; }
  .view { padding: 14px 14px 100px; gap: 14px; }
  .page-head h1 { font-size: 24px; }
  .mnav {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(255, 255, 255, .95); backdrop-filter: blur(14px);
    border-top: 1px solid var(--hair);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 40;
  }
  .mnav a { background: transparent; border: 0; padding: 8px 2px; display: grid; place-items: center; gap: 2px; color: var(--muted); font-size: 11px; font-weight: 550; border-radius: 10px; min-height: 48px; text-decoration: none; }
  .mnav a.active { color: var(--accent); background: var(--accent-soft); }
}
@media (max-width: 420px) {
  .tiles, .tiles.t3 { grid-template-columns: 1fr; }
}
/* Review 6: rows whose right-hand actions (chips + buttons) would squeeze
   the title column on phones stack the actions under the text instead. */
.rrow .actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 600px) {
  .rrow.rrow-stack { grid-template-columns: 36px minmax(0, 1fr); row-gap: 8px; padding: 12px 14px; }
  .rrow.rrow-stack > .actions { grid-column: 2; justify-content: flex-start; text-align: left; }
  .rrow.rrow-stack .ttl, .rrow.rrow-stack .meta { overflow-wrap: anywhere; }
}
/* Final closing batch: list filter bar. Labelled controls wrap inside the
   card instead of being clipped by .card { overflow: hidden } on phones. */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; width: 100%; min-width: 0; }
.filter-bar .fb-field { display: grid; gap: 4px; flex: 1 1 200px; min-width: 0; }
.filter-bar .fb-field.fb-narrow { flex: 0 1 180px; }
.filter-bar label { font-size: 12px; font-weight: 600; color: var(--muted); }
.filter-bar input, .filter-bar select { width: 100%; min-width: 0; box-sizing: border-box; min-height: 36px; }
.filter-bar .btn { flex: 0 0 auto; min-height: 36px; }
@media (max-width: 600px) {
  .filter-bar .fb-field, .filter-bar .fb-field.fb-narrow { flex: 1 1 100%; }
  .filter-bar .btn { flex: 1 1 100%; }
}
