/* ============================================================
   HAVEN HARBOR OPS — app stylesheet
   Brand tokens ported from the Haven Harbor website, adapted
   for a data-dense admin tool (tighter spacing, app chrome).
   ============================================================ */

:root {
  --navy: #1b2b4a;
  --navy-deep: #14213d;
  --navy-soft: #2c3e5e;
  --copper: #b58a52;
  --copper-light: #c9a875;
  --cream: #faf7f1;
  --cream-deep: #f1ebe0;
  --ink: #25292e;
  --muted: #6b7280;
  --white: #fff;
  --line: rgba(27, 43, 74, 0.10);
  --shadow-sm: 0 8px 24px rgba(20, 33, 61, 0.08);
  --shadow: 0 18px 50px rgba(20, 33, 61, 0.12);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ok: #2f6f4f;
  --err: #9b2c2c;
  --occ: #c0392b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); color: var(--navy); line-height: 1.15; font-weight: 600; }
a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; background: var(--cream-deep); padding: 1px 6px; border-radius: 4px; }

.eyebrow {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--copper); display: inline-block;
}
.lead { font-size: 1.05rem; color: #4a5160; max-width: 70ch; margin-bottom: 28px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; font-family: var(--sans); font-size: 0.74rem;
  font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 13px 28px; border-radius: 2px; cursor: pointer;
  transition: all 0.2s ease; border: 1.5px solid var(--copper); background: none;
}
.btn--primary { background: var(--copper); color: #fff; }
.btn--primary:hover { background: var(--navy); border-color: var(--navy); }
.btn--ghost { color: var(--navy); border-color: var(--navy); }
.btn--ghost:hover { background: var(--navy); color: #fff; }
.btn--sm { padding: 8px 16px; font-size: 0.66rem; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex: none; background: var(--navy-deep); color: var(--cream);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 24px 24px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}
.sidebar__logo { width: 150px; height: auto; display: block; }
.sidebar__ops { font-family: var(--sans); font-size: 0.6rem; letter-spacing: 0.36em; text-transform: uppercase; color: var(--copper-light); }

.sidebar__nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar__link {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 6px; font-size: 0.82rem; font-weight: 500;
  color: rgba(255, 255, 255, 0.78); transition: all 0.15s;
}
.sidebar__link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar__link.is-active { background: var(--copper); color: #fff; }
.sidebar__icon { width: 20px; text-align: center; opacity: 0.9; }

/* Collapsible nav groups */
.nav-group { border-radius: 6px; }
.nav-group > summary {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 6px; font-size: 0.82rem; font-weight: 500;
  color: rgba(255, 255, 255, 0.78); cursor: pointer; list-style: none;
  transition: all 0.15s;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
  content: "›"; margin-left: auto; transition: transform 0.18s; opacity: 0.6; font-size: 1.1rem;
}
.nav-group[open] > summary::after { transform: rotate(90deg); }
.nav-group > summary:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar__sublink {
  display: block; padding: 9px 14px 9px 46px; border-radius: 6px;
  font-size: 0.8rem; color: rgba(255, 255, 255, 0.66); transition: all 0.15s;
}
.sidebar__sublink:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar__sublink.is-active { background: var(--copper); color: #fff; }
.nav-subhead {
  padding: 12px 14px 4px 20px; font-size: 0.58rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase; color: rgba(255, 255, 255, 0.4);
}
.nav-proplist { max-height: 260px; overflow-y: auto; }
.sidebar__sublink--prop { padding-left: 24px; font-size: 0.78rem; }
.nav-empty { display: block; padding: 6px 20px; font-size: 0.76rem; color: rgba(255,255,255,0.4); }

/* ---------- Content / topbar ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 36px; background: rgba(250, 247, 241, 0.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: 1.7rem; }
.topbar__user { display: flex; align-items: center; gap: 16px; }
.topbar__email { font-size: 0.8rem; color: var(--muted); }
a.topbar__email:hover { color: var(--copper); }
.user-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-actions form { display: inline; }
.user-setpw { display: inline-block; }
.user-setpw > summary { padding: 8px 16px; font-size: 0.66rem; }
.user-setpw .inline-form { margin-top: 8px; }

.page { padding: 32px 36px; max-width: 1200px; width: 100%; }

/* ---------- Stat tiles ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px; margin-bottom: 32px;
}
.stat-tile {
  background: var(--white); border: 1px solid var(--line); border-radius: 8px;
  padding: 22px 22px 20px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-tile__label { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.stat-tile__value { font-family: var(--serif); font-size: 2.4rem; color: var(--navy); line-height: 1; }
.stat-tile__hint { font-size: 0.72rem; color: var(--copper); }

/* ---------- Panels ---------- */
.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 26px; box-shadow: var(--shadow-sm); }
.panel h3 { font-size: 1.4rem; margin-bottom: 8px; }
.panel p { color: #4a5160; font-size: 0.92rem; }
.tag { display: inline-block; background: var(--cream-deep); color: var(--navy-soft); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding: 3px 9px; border-radius: 20px; margin-left: 6px; }

/* ---------- Placeholder ---------- */
.placeholder { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 40px; box-shadow: var(--shadow-sm); }
.placeholder__meta { color: var(--muted); font-size: 0.85rem; margin-top: 10px; }

/* ---------- Flash ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.flash { padding: 12px 16px; border-radius: 6px; font-size: 0.88rem; border: 1px solid; }
.flash--success { background: #eaf3ee; color: var(--ok); border-color: #cfe5d8; }
.flash--error { background: #f7eaea; color: var(--err); border-color: #ecd2d2; }

/* ---------- Auth ---------- */
.auth-body { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--cream); border-radius: 12px; box-shadow: var(--shadow); padding: 40px 36px; }
.auth-card__brand { display: flex; justify-content: center; margin-bottom: 18px; }
.auth-card__logo { width: 96px; height: auto; display: block; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label span { font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.auth-form input { padding: 12px 14px; border: 1px solid #d8d2c6; border-radius: 6px; font-family: var(--sans); font-size: 0.95rem; background: var(--white); }
.auth-form input:focus { outline: none; border-color: var(--copper); }
.auth-form .btn { margin-top: 6px; width: 100%; text-align: center; }
.auth-card.center { text-align: center; }
.error-title { font-size: 2rem; margin: 6px 0 10px; }
.error-message { color: #4a5160; font-size: 0.95rem; margin-bottom: 22px; }
.error-btn { display: inline-block; }

/* ---------- Page actions / shared bits ---------- */
.page-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-actions .lead { margin-bottom: 0; }
.muted, .kv small.muted, small.muted { color: var(--muted); }
.back-link { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--copper); }
.back-link:hover { color: var(--navy); }
.notes { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: #4a5160; font-size: 0.9rem; white-space: pre-line; }
.empty { background: var(--white); border: 1px dashed var(--line); border-radius: 8px; padding: 40px; text-align: center; color: var(--muted); }

/* ---------- Badges ---------- */
.badge { display: inline-block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 10px; border-radius: 20px; }
.badge--ok, .badge--active { background: #e6f0ea; color: var(--ok); }
.badge--warn, .badge--onboarding { background: #fcf3e2; color: #8a6d1f; }
.badge--paused { background: #eceef2; color: var(--navy-soft); }
.badge--offboarded { background: #f1e4e4; color: var(--err); }

/* ---------- Data table ---------- */
.data-table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table th { text-align: left; font-size: 0.64rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 14px 18px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 14px 18px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; transition: background 0.12s; }
.data-table tbody tr:hover { background: var(--cream-deep); }

/* ---------- Property card grid ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.prop-card { display: block; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 22px; box-shadow: var(--shadow-sm); transition: transform 0.18s, box-shadow 0.18s; }
.prop-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.prop-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.prop-card__head h3 { font-size: 1.35rem; }
.prop-card__loc { color: var(--muted); font-size: 0.82rem; margin: 4px 0 16px; }
.prop-card__rules { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prop-card__rules dt { font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.prop-card__rules dd { font-size: 0.9rem; color: var(--ink); font-weight: 500; }

/* ---------- Detail layout ---------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel--rules { background: var(--cream-deep); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin-top: 6px; }
.kv dt { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); align-self: center; }
.kv dd { font-size: 0.92rem; }
.link-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.link-list li { display: flex; flex-direction: column; }
.link-list a { font-weight: 600; color: var(--navy); }
.link-list a:hover { color: var(--copper); }
.link-list .muted { font-size: 0.8rem; }

.sections-stub { margin-top: 22px; }
.stub-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.stub { background: var(--white); border: 1px dashed var(--line); border-radius: 6px; padding: 14px 18px; font-weight: 600; color: var(--navy-soft); font-size: 0.85rem; }
.stub small { display: block; font-weight: 400; color: var(--muted); font-size: 0.7rem; margin-top: 2px; }

/* ---------- Settings ---------- */
.settings-card { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 24px 26px; box-shadow: var(--shadow-sm); max-width: 720px; margin-bottom: 18px; }
.settings-card .lead { font-size: 0.95rem; margin: 10px 0 18px; }
.settings-card--muted { background: var(--cream-deep); box-shadow: none; }
.form-card--flush { padding: 0; border: none; box-shadow: none; max-width: none; margin-top: 0; }
.form-card--flush .form-actions { border-top: none; padding-top: 0; margin-top: 8px; }
.settings-test { display: flex; align-items: center; gap: 16px; margin: 6px 0 14px; flex-wrap: wrap; }
.settings-test__result { font-size: 0.88rem; }
.settings-test__result.ok { color: var(--ok); }
.settings-test__result.fail { color: var(--err); }

.map-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.map-row__src { min-width: 200px; display: flex; flex-direction: column; }
.map-row__arrow { color: var(--copper); font-weight: 700; }
.map-row__select { padding: 9px 12px; border: 1px solid #d8d2c6; border-radius: 6px; font-family: var(--sans); font-size: 0.9rem; background: var(--white); min-width: 200px; }

/* reservations / source badge */
.sync-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--cream-deep); border-radius: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.res-heading { font-size: 1.1rem; margin: 22px 0 10px; }
.src-badge { font-size: 0.7rem; font-weight: 600; padding: 3px 9px; border-radius: 20px; background: var(--cream-deep); color: var(--navy-soft); }

/* ---------- Forms ---------- */
.form-card { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 28px 30px; box-shadow: var(--shadow-sm); max-width: 820px; margin-top: 14px; }
.form-section { font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--copper); margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.form-section:first-child { margin-top: 0; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 180px; }
.field--wide { flex-basis: 100%; }
.field--xs { flex: 0 1 130px; }
.field span { font-size: 0.64rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea { padding: 10px 12px; border: 1px solid #d8d2c6; border-radius: 6px; font-family: var(--sans); font-size: 0.92rem; background: var(--white); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--copper); }
.field--check { flex-direction: row; align-items: center; gap: 8px; flex: 1 1 180px; }
.field--check span { text-transform: none; letter-spacing: 0; font-size: 0.9rem; color: var(--ink); }
.field--check input { width: 18px; height: 18px; }
.form-hint { font-size: 0.78rem; color: var(--muted); margin: -4px 0 14px; }
.form-actions { display: flex; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Property tabs ---------- */
.page-actions__right { display: flex; align-items: center; gap: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  padding: 11px 18px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--navy); }
.tab.is-active { color: var(--navy); border-bottom-color: var(--copper); }

/* ---------- P&L tab ---------- */
.pnl-monthbar { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.pnl-monthbar h3 { font-size: 1.5rem; min-width: 160px; text-align: center; }
.pnl-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.pnl-table td { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.pnl-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pnl-table tr.pnl-sub td { font-weight: 600; border-bottom: 2px solid var(--line); }
.pnl-table tr.pnl-total td { font-family: var(--serif); font-size: 1.15rem; color: var(--navy); border-bottom: none; padding-top: 12px; }
.pnl-occ { text-align: center; margin: 18px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pnl-occ .cal-stat__num { font-size: 2rem; }

/* year-to-date chart */
.yr-chartbox { height: 340px; margin: 6px 0 18px; }
.data-table tfoot tr.yr-total td { font-weight: 700; color: var(--navy); border-top: 2px solid var(--line); }
.data-table td.pos { color: var(--ok); }
.data-table td.neg { color: var(--err); }

/* ---------- Occupancy calendar ---------- */
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 18px; align-items: start; margin: 18px 0; }
.cal-main, .cal-side { background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); padding: 20px 22px; }
.cal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-header h3 { font-size: 1.4rem; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.cal-key { display: flex; align-items: center; gap: 6px; font-size: 0.72rem; color: var(--muted); }
.swatch { width: 13px; height: 13px; border-radius: 3px; display: inline-block; background: var(--cream-deep); border: 1px solid var(--line); }
.swatch--occ { background: var(--occ); border-color: var(--occ); }
.swatch--in { background: linear-gradient(135deg, var(--cream-deep) 50%, var(--occ) 50%); }
.swatch--out { background: linear-gradient(135deg, var(--occ) 50%, var(--cream-deep) 50%); }
.swatch--turn { background: linear-gradient(135deg, var(--occ) 46%, #fff 46% 54%, var(--occ) 54%); }

.cal-months { display: flex; flex-wrap: wrap; gap: 18px; }
.cal-month { flex: 1 1 200px; min-width: 188px; max-width: 240px; }
.cal-month h4 { text-align: center; font-size: 1.05rem; margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { margin-bottom: 3px; }
.cal-dowlabel { text-align: center; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.cal-day {
  aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; border-radius: 4px; background: var(--cream-deep);
  color: var(--ink); position: relative; overflow: hidden;
}
.cal-day--occupied { background: var(--occ); color: #fff; }
.cal-day--checkin { background: linear-gradient(135deg, var(--cream-deep) 50%, var(--occ) 50%); }
.cal-day--checkout { background: linear-gradient(135deg, var(--occ) 50%, var(--cream-deep) 50%); }
.cal-day--turnover { background: linear-gradient(135deg, var(--occ) 47%, #fff 47% 53%, var(--occ) 53%); color: #fff; }
.cal-day--out { background: transparent; color: rgba(37, 41, 46, 0.22); }
.cal-day--today { box-shadow: inset 0 0 0 2px var(--navy); font-weight: 700; }
.cal-note { margin-top: 14px; font-size: 0.74rem; color: var(--muted); font-style: italic; }

.cal-stat { text-align: center; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.cal-stat__num { font-family: var(--serif); font-size: 2.6rem; color: var(--navy); line-height: 1; display: block; }
.cal-stat__label { font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); display: block; margin-top: 6px; }
.cal-stat__sub { font-size: 0.78rem; color: var(--copper); }
.kv--tight { grid-template-columns: 1fr auto; gap: 7px 10px; margin: 14px 0; }
.kv--tight dt { font-size: 0.72rem; text-transform: none; letter-spacing: 0; color: var(--muted); }
.kv--tight dd { text-align: right; font-size: 0.85rem; }
.cal-actions { border-top: 1px solid var(--line); padding-top: 14px; }
.cal-actions h4 { font-family: var(--sans); font-size: 0.64rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--copper); margin-bottom: 8px; }
.action-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 6px; font-size: 0.85rem; color: var(--ink); }
.action-row:hover { background: var(--cream-deep); }
.action-count { background: var(--cream-deep); border-radius: 20px; padding: 2px 11px; font-weight: 700; font-size: 0.8rem; }
.action-row--alert .action-count { background: #f1e4e4; color: var(--err); }

@media (max-width: 900px) { .cal-wrap { grid-template-columns: 1fr; } }

/* ---------- Documents browser ---------- */
.breadcrumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--copper); }
.breadcrumb a:hover { color: var(--navy); }
.breadcrumb .bc-sep { margin: 0 8px; opacity: 0.5; }
.breadcrumb .bc-current { color: var(--navy); font-weight: 600; }
.doc-toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.doc-toolbar .add-form { display: inline-block; }
.doc-toolbar .add-form > summary { padding: 9px 16px; }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.folder-card { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); transition: transform 0.15s, box-shadow 0.15s; }
.folder-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.folder-card__link, a.folder-card { display: flex; flex-direction: column; gap: 4px; padding: 18px 18px 16px; color: var(--ink); }
a.folder-card { text-decoration: none; }
.folder-card__icon { font-size: 1.6rem; }
.folder-card__name { font-weight: 600; color: var(--navy); }
.folder-card__count { font-size: 0.78rem; color: var(--muted); }
.folder-card__del { position: absolute; top: 8px; right: 8px; }

/* Documents tree/list */
.doc-tree, .doc-children { list-style: none; margin: 0; padding: 0; }
.doc-tree { background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); overflow: hidden; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-top: 1px solid var(--line); }
.doc-tree > li:first-child > .doc-row { border-top: none; }
.doc-row--folder { background: var(--cream); }
.doc-row--folder .doc-row__name { color: var(--navy); font-weight: 600; }
.doc-exp { width: 18px; flex: none; background: none; border: none; cursor: pointer; color: var(--muted); font-size: 0.75rem; padding: 0; }
.doc-exp--spacer { cursor: default; }
.doc-row__icon { width: 20px; flex: none; text-align: center; }
.doc-row__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row__meta { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }
.doc-row__actions { display: flex; gap: 4px; flex: none; }
.doc-row--indent { padding-left: 46px; background: #fcfaf6; }
.doc-children .doc-row { border-top: 1px solid var(--line); }
.doc-empty { padding: 9px 14px 9px 46px; border-top: 1px solid var(--line); background: #fcfaf6; }

/* ---------- Progress bar ---------- */
.progress { height: 7px; background: var(--cream-deep); border-radius: 20px; overflow: hidden; margin: 8px 0 6px; }
.progress__bar { height: 100%; background: var(--navy); border-radius: 20px; }
.progress__bar--copper { background: var(--copper); }

/* ---------- REPS dashboard calendar ---------- */
.reps-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.reps-key { display: flex; align-items: center; gap: 6px; font-size: 0.74rem; color: var(--muted); }
.wk-sw { width: 13px; height: 13px; border-radius: 3px; display: inline-block; }
.wk-sw--submitted { background: #e6f0ea; border: 1px solid var(--ok); }
.wk-sw--draft { background: #fcf3e2; border: 1px solid #d9b75a; }
.wk-sw--empty { background: var(--cream-deep); border: 1px solid var(--line); }
.reps-cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-top: 12px; }
.reps-cal__month h4 { font-size: 1rem; margin-bottom: 8px; }
.reps-cal__weeks { display: flex; flex-wrap: wrap; gap: 6px; }
.wk { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 48px; height: 44px; border-radius: 6px; text-decoration: none; border: 1px solid var(--line); transition: transform 0.12s; }
.wk:hover { transform: translateY(-2px); }
.wk__day { font-size: 0.66rem; color: var(--muted); }
.wk__hrs { font-size: 0.74rem; font-weight: 700; color: var(--navy); }
.wk--submitted { background: #e6f0ea; border-color: #bcdcc8; }
.wk--draft { background: #fcf3e2; border-color: #ecd9a8; }
.wk--empty { background: var(--white); }
.wk--empty .wk__hrs { color: var(--muted); font-weight: 400; }

/* ---------- REPS timecard ---------- */
.reps-weekbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.reps-weeknav { display: flex; align-items: center; gap: 12px; }
.reps-weeklabel { font-family: var(--serif); font-size: 1.3rem; color: var(--navy); }
.reps-weekstatus { display: flex; align-items: center; gap: 10px; font-size: 0.9rem; }
.reps-days { display: flex; flex-direction: column; gap: 10px; }
.reps-day { background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-sm); padding: 12px 16px; scroll-margin-top: 90px; }
.reps-day__head { display: flex; justify-content: space-between; align-items: baseline; }
.reps-day__label { font-weight: 600; color: var(--navy); }
.reps-day__total { color: var(--muted); font-size: 0.85rem; }
.reps-entries { list-style: none; margin: 8px 0 4px; padding: 0; }
.reps-entries li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 0.9rem; }
.reps-entry__hours { font-weight: 700; color: var(--navy); min-width: 44px; }
.reps-entry__cat { background: var(--cream-deep); border-radius: 20px; padding: 2px 10px; font-size: 0.74rem; font-weight: 600; color: var(--navy-soft); white-space: nowrap; }
.reps-entry__desc { color: #4a5160; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reps-entry__del { margin-left: auto; }

/* ---------- Working-file sections (property detail) ---------- */
.work-section { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 22px 24px; box-shadow: var(--shadow-sm); margin-top: 18px; scroll-margin-top: 90px; }
.work-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.work-section__head h3 { font-size: 1.4rem; }
.work-section__meta { font-size: 0.8rem; color: var(--muted); }
.small { font-size: 0.8rem; }

.data-table--tight th, .data-table--tight td { padding: 9px 12px; }
.data-table--tight tbody tr { cursor: default; }
.data-table .num, .data-table th.num { text-align: right; white-space: nowrap; }
.row-action { white-space: nowrap; text-align: right; width: 1%; }
.row-action .link-btn + form, .row-action form { margin-left: 2px; }
.data-table tbody tr.row-warn { background: #fbeeee; }
.data-table tbody tr.row-warn:hover { background: #f7e3e3; }
.cell-action { text-align: right; white-space: nowrap; width: 1%; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.link-btn:hover { color: var(--err); background: #f7eaea; }
.status-form select { padding: 4px 8px; border: 1px solid #d8d2c6; border-radius: 5px; font-family: var(--sans); font-size: 0.78rem; background: var(--cream); }

.add-form { margin-top: 14px; }
.add-form > summary { cursor: pointer; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--copper); list-style: none; display: inline-block; padding: 6px 0; }
.add-form > summary::-webkit-details-marker { display: none; }
.add-form[open] > summary { color: var(--navy); }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-top: 12px; padding: 16px; background: var(--cream); border: 1px solid var(--line); border-radius: 6px; }
.inline-form .field { gap: 4px; }
.inline-form .btn { margin-bottom: 1px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .sidebar { width: 64px; }
  .sidebar__ops, .sidebar__link span:not(.sidebar__icon) { display: none; }
  .sidebar__logo { width: 42px; }
  .sidebar__brand { justify-content: center; padding: 18px 0; }
  .sidebar__link { justify-content: center; }
  .sidebar__sublink, .nav-subhead, .nav-proplist { display: none; }
  .panel-row, .detail-grid { grid-template-columns: 1fr; }
  .topbar, .page { padding-left: 20px; padding-right: 20px; }
}
