/* Hiive Arts Property Management
   Hiive Arts brand: gold #BD802C (from the logo) on near-black, Instrument Serif titles, Inter text.
   Dark is the default; [data-theme="light"] on <html> switches to the light edition. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0a0a0a;
  --surface:    #111111;
  --surface2:   #171717;
  --border:     #242424;
  --border-strong: #333333;
  --text:       #f0f0f0;
  --muted:      #8c8c8c;
  --gold:       #BD802C;
  --gold-light: #D4A04F;
  --gold-deep:  #8A5A1C;
  --gold-text:  #D4A04F;          /* gold used for text: readable on the background */
  --gold-soft:  rgba(189,128,44,0.12);
  --on-gold:    #0a0a0a;
  --green:      #00e676;
  --green-soft: rgba(0,230,118,0.1);
  --red:        #ff5252;
  --red-soft:   rgba(255,82,82,0.1);
  --nav-bg:     rgba(10,10,10,0.88);
  --shadow:     0 10px 40px rgba(0,0,0,0.5);
  --font:       'Inter', system-ui, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
  --radius:     10px;
  --tr:         0.2s ease;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:         #f7f4ee;
  --surface:    #ffffff;
  --surface2:   #f1ece3;
  --border:     #e4dccd;
  --border-strong: #cfc3ad;
  --text:       #1a1712;
  --muted:      #6e665a;
  --gold-text:  #8A5A1C;
  --gold-soft:  rgba(189,128,44,0.14);
  --green:      #0f8a4b;
  --green-soft: rgba(15,138,75,0.1);
  --red:        #c62828;
  --red-soft:   rgba(198,40,40,0.08);
  --nav-bg:     rgba(247,244,238,0.9);
  --shadow:     0 10px 40px rgba(60,40,10,0.15);
  color-scheme: light;
}

html { font-size: 16px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; transition: background var(--tr), color var(--tr); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: var(--font); font-size: inherit; color: inherit; }
button { cursor: pointer; }

/* ── Nav ── */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 100; height: 60px;
  background: var(--nav-bg); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { max-width: 1200px; height: 100%; margin: 0 auto; padding: 0 20px; display: flex; align-items: center; gap: 8px; }
.nav-logo { display: flex; align-items: center; gap: 10px; margin-right: 18px; font-family: var(--font-display); font-size: 1.25rem; white-space: nowrap; }
.nav-logo img { width: 30px; height: 30px; object-fit: contain; }
.nav-logo small { font-family: var(--font); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.nav-link { padding: 6px 12px; border-radius: 6px; font-size: 0.85rem; font-weight: 500; color: var(--muted); transition: all var(--tr); }
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--gold-soft); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.nav-user { font-size: 0.8rem; color: var(--muted); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); transition: all var(--tr);
}
.icon-btn:hover { color: var(--gold-text); border-color: var(--gold); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── Page ── */
.page { max-width: 1200px; margin: 0 auto; padding: 88px 20px 64px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 14px; margin-bottom: 26px; }
.page-title { font-family: var(--font-display); font-weight: 400; font-size: 2.2rem; line-height: 1.1; }
.page-sub { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.crumb { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; display: inline-block; }
.crumb:hover { color: var(--gold-text); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: 1.45rem; margin: 30px 0 12px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1;
  padding: 10px 18px; border-radius: 7px; font-size: 0.85rem; font-weight: 600; border: 1px solid transparent;
  transition: all var(--tr); white-space: nowrap;
}
.btn-primary { background: var(--gold); color: var(--on-gold); }
.btn-primary:hover { background: var(--gold-light); transform: translateY(-1px); box-shadow: 0 4px 20px rgba(189,128,44,0.25); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-text); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: transparent; }
.btn-danger:hover { border-color: var(--red); }
.btn-sm { padding: 6px 11px; font-size: 0.78rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.link-btn { background: none; border: none; color: var(--muted); padding: 4px 6px; border-radius: 5px; font-size: 0.8rem; }
.link-btn:hover { color: var(--gold-text); background: var(--gold-soft); }
.link-btn.danger:hover { color: var(--red); background: var(--red-soft); }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-sub { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.cur-code { font-size: 0.45em; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); vertical-align: 0.35em; margin-left: 4px; }

.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.prop-card { display: block; transition: border-color var(--tr), transform var(--tr); position: relative; overflow: hidden; }
.prop-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-light)); }
.prop-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.prop-name { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.15; }
.prop-meta { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
.prop-rows { margin-top: 16px; display: grid; gap: 8px; font-size: 0.85rem; }
.prop-row { display: flex; justify-content: space-between; gap: 10px; }
.prop-row span:first-child { color: var(--muted); }
.prop-card.archived { opacity: 0.55; }
.add-card { display: flex; align-items: center; justify-content: center; min-height: 190px; border-style: dashed; color: var(--muted); font-weight: 600; cursor: pointer; }
.add-card:hover { color: var(--gold-text); border-color: var(--gold); }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.badge-draft { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.badge-sent  { background: var(--gold-soft); color: var(--gold-text); }
.badge-paid  { background: var(--green-soft); color: var(--green); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tab { padding: 10px 16px; border: none; background: none; color: var(--muted); font-weight: 600; font-size: 0.88rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold-text); border-bottom-color: var(--gold); }

/* ── Tables ── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th { text-align: left; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface2); }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--gold-soft); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tfoot td { font-weight: 700; background: var(--surface2); border-top: 1px solid var(--border-strong); }
.muted { color: var(--muted); }
.empty { padding: 34px; text-align: center; color: var(--muted); }

/* Inline-editable cells */
.cell-input {
  width: 100%; min-width: 60px; background: transparent; border: 1px solid transparent; border-radius: 5px;
  padding: 6px 7px; transition: border-color var(--tr), background var(--tr);
}
.cell-input:hover { border-color: var(--border); }
.cell-input:focus { outline: none; border-color: var(--gold); background: var(--surface2); }
.cell-input.num { text-align: right; }
.cell-input:disabled { color: var(--text); cursor: default; border-color: transparent; }
select.cell-input { cursor: pointer; }
.w-qty { width: 80px; } .w-rate { width: 110px; } .w-amt { width: 120px; } .w-unit { width: 100px; }
.cell-input[data-f=service]  { min-width: 200px; }
.cell-input[data-f=provider] { min-width: 190px; }
input[type=checkbox] { accent-color: var(--gold); width: 16px; height: 16px; cursor: pointer; }

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 10px 12px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--surface2); transition: border-color var(--tr);
}
.form-input:focus { outline: none; border-color: var(--gold); }
textarea.form-input { min-height: 90px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-hint { font-size: 0.75rem; color: var(--muted); margin-top: 5px; }
.error-box { background: var(--red-soft); color: var(--red); border-radius: 7px; padding: 10px 12px; font-size: 0.85rem; margin-bottom: 14px; }

/* ── Dialogs ── */
dialog { margin: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); padding: 26px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0,0,0,0.55); backdrop-filter: blur(3px); }
dialog h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ── Statement editor ── */
.totals-card { display: grid; gap: 8px; font-size: 0.92rem; max-width: 380px; margin-left: auto; }
.totals-card .row { display: flex; justify-content: space-between; gap: 20px; }
.totals-card .grand { border-top: 1px solid var(--border-strong); padding-top: 10px; margin-top: 4px; font-size: 1.2rem; font-weight: 700; }
.totals-card .grand span:last-child { color: var(--gold-text); white-space: nowrap; }
.totals-card .grand { align-items: baseline; }
.fee-row td { color: var(--muted); }
.fee-input { width: 64px; display: inline-block; }
.notice { background: var(--gold-soft); border: 1px solid rgba(189,128,44,0.3); color: var(--text); border-radius: 8px; padding: 10px 14px; font-size: 0.85rem; margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.add-line { margin-top: 10px; }

/* ── Auth ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: min(400px, 100%); }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo img { width: 64px; height: 64px; object-fit: contain; }
.auth-logo .wordmark { font-family: var(--font-display); font-size: 2rem; display: block; margin-top: 6px; }
.auth-logo small { display: block; font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-text); margin-top: 2px; }
.auth-corner { position: fixed; top: 16px; right: 16px; }

/* ── Toast ── */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--surface); border: 1px solid var(--gold); color: var(--text); padding: 10px 18px; border-radius: 8px; font-size: 0.85rem; box-shadow: var(--shadow); transition: all 0.25s ease; z-index: 300; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--red); color: var(--red); }

/* ── Phones ── */
@media (max-width: 700px) {
  .nav-logo small, .nav-user { display: none; }
  .nav-logo { margin-right: 4px; }
  .page { padding: 80px 16px 56px; }
  .page-title { font-size: 1.8rem; }
  .form-row { grid-template-columns: 1fr; }
  .prop-grid { grid-template-columns: 1fr; }
  .totals-card { max-width: none; }
}
