/* Internal app theme — Property Launch Co brand (brand/brand-kit.md).
   Linen #EDEBE6 · Near-black #1C1C1A · Clay #B79784 · White.
   Cormorant Garamond Italic (page titles) · Be Vietnam Pro (labels/headings)
   · Montserrat (body). Class names match every internal view so the whole
   app shares this theme. */

:root {
  --linen: #EDEBE6;
  --ink: #1C1C1A;
  --clay: #B79784;
  --clay-dark: #8a6850; /* links/secondary text — contrast-safe on linen */
  --white: #FFFFFF;
  --line: #ddd8cf;       /* borders on linen */
  --line-soft: #ece8e1;  /* row dividers inside cards */
  --muted: #6f685f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--linen);
  line-height: 1.55;
}

main {
  max-width: 980px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}
main.wide { max-width: 1200px; }

h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 2.4rem;
  margin: 0 0 0.75rem;
}

h2, h3 { font-family: 'Be Vietnam Pro', sans-serif; font-weight: 600; }

a { color: var(--clay-dark); }
a:hover { color: var(--ink); }

/* ---- top nav (near-black bar with logo) ---- */
.topnav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem 1.5rem;
  background: var(--ink);
}

.topnav .brand { margin-right: auto; display: inline-flex; align-items: center; }
.topnav .brand img {
  height: 30px;
  filter: invert(1) brightness(1.7); /* dark logo shown light on near-black */
}

.nav-link {
  color: var(--linen);
  text-decoration: none;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.nav-link:hover { color: var(--clay); }

.nav-user { color: #b8b2a8; font-size: 0.85rem; text-decoration: none; }
.nav-user:hover { color: var(--clay); }

.logout-form { margin: 0; }
.logout-form button,
.login button,
.stacked-form button,
.upload-form button,
.button {
  background: var(--clay);
  color: var(--white);
  border: none;
  border-radius: 5px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}
.logout-form button:hover,
.button:hover,
.stacked-form button:hover { background: #a3836f; color: var(--white); }

/* ---- page heading row ---- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.page-head h1, .page-head h2 { margin-bottom: 0; }

/* ---- cards ---- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem 1.35rem;
  margin: 1rem 0;
}
.card h2 { margin-top: 0; font-size: 1.15rem; }
.card.internal { border-left: 4px solid var(--clay); }

/* ---- tables ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}
.data-table thead th {
  font-family: 'Be Vietnam Pro', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.money { text-align: right; white-space: nowrap; }
tr.grand td { font-weight: 700; }
.pcf-desc { color: var(--muted); font-size: 0.9rem; }
tr.row-inactive td { opacity: 0.5; }

.muted { color: var(--muted); }

/* ---- detail lists ---- */
.details { display: grid; grid-template-columns: 8rem 1fr; gap: 0.25rem 1rem; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.details .notes, .notes { white-space: pre-wrap; }

/* ---- forms ---- */
.stacked-form { display: flex; flex-direction: column; gap: 0.5rem; max-width: 480px; }
.wide-form { max-width: none; }
.wide-form .card > label { display: block; margin-top: 0.5rem; }
.wide-form .card > textarea { width: 100%; }

.stacked-form input,
.stacked-form textarea,
.stacked-form select,
.login input,
.field-grid input,
.field-grid select,
.data-table input,
.data-table select,
.data-table textarea,
.upload-form select,
.upload-form input[type="file"],
.gst-helper input[type="text"] {
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: inherit;
  background: var(--white);
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--clay);
  outline-offset: 0;
  border-color: var(--clay);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.field-grid label { display: block; }
.field-grid input, .field-grid select, .stacked-form select { width: 100%; }
.data-table input, .data-table select, .data-table textarea { width: 100%; }
.data-table textarea { resize: vertical; min-height: 2.4rem; line-height: 1.4; }
textarea.autogrow { overflow: hidden; resize: none; }
.data-table .trade-select { margin-bottom: 0.25rem; }

.form-actions { display: flex; align-items: center; gap: 1rem; }
.form-error {
  color: #8f2018;
  background: #f7e3e0;
  border: 1px solid #e6c4bf;
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  max-width: 560px;
}
.form-warning {
  color: #6f4a00;
  background: #fbf1d8;
  border: 1px solid #ecd9a6;
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  max-width: 640px;
}

/* ---- buttons: variants ---- */
.button.danger, button.danger { background: #9c2a20; }
.button.danger:hover, button.danger:hover { background: #82231a; }

/* Secondary brand button — near-black with linen text (brand-kit). Used for the
   primary action of a state (Mark as sent, Revise) so it reads distinctly from
   the clay utility buttons (Download PDF, Edit). */
.button-dark { background: var(--ink); color: var(--linen); }
.button-dark:hover { background: #000; color: var(--linen); }

button.secondary {
  background: var(--white);
  color: var(--clay-dark);
  border: 1px solid var(--clay);
  border-radius: 5px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font: inherit;
  margin-top: 0.5rem;
}
button.secondary:hover { background: var(--linen); }

.inline-form { display: inline; margin: 0; }
.inline-role { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; }
.inline-role select { width: auto; min-width: 7rem; }

.row-actions { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; }
.reset-box summary { list-style: none; cursor: pointer; }
.reset-box[open] { background: var(--linen); border-radius: 6px; padding: 0.6rem; margin-bottom: 0.3rem; }
.reset-box .stacked-form { max-width: 280px; margin-top: 0.4rem; }

.link-btn, .link-danger {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}
.link-btn { color: var(--clay-dark); }
.link-danger { color: #9c2a20; }

.remove-row { background: none; border: none; color: #9c2a20; cursor: pointer; font-size: 1rem; }

/* ---- badges (semantic, brand-toned) ---- */
.badge {
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  background: #e6e1d8;
  color: var(--ink);
  text-transform: capitalize;
}
.badge-accepted { background: #d8ecdd; color: #1f5b39; }
.badge-declined { background: #f3ddd9; color: #8f2018; }
.badge-sent, .badge-viewed { background: #e3e7d9; color: #4a5a2e; }
.badge-draft { background: #e6e1d8; color: var(--muted); }
.badge-superseded { background: #e6e1d8; color: var(--muted); }

/* ---- timeline ---- */
.timeline { list-style: none; padding-left: 0; }
.timeline li { padding: 0.25rem 0; }

/* ---- documents ---- */
.doc-category-count {
  display: inline-block;
  background: var(--linen);
  border-radius: 999px;
  padding: 0 0.6rem;
  font-weight: 700;
  margin-left: 0.5rem;
}
.upload-form {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding-bottom: 0.75rem; border-bottom: 1px solid var(--line-soft);
}
.doc-section { margin-top: 1rem; }
.doc-section-head { font-size: 1rem; margin: 0 0 0.25rem; display: flex; align-items: baseline; gap: 0.5rem; }
.doc-hint { font-weight: 400; font-size: 0.8rem; }

/* ---- totals (quote internal) ---- */
.totals { display: grid; grid-template-columns: max-content max-content; gap: 0.25rem 2rem; margin: 0; }
.totals dd { margin: 0; text-align: right; }
.totals .grand { font-weight: 700; }

.gst-helper { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.gst-helper input[type="text"] { max-width: 160px; }

.actions { display: flex; align-items: center; gap: 0.75rem; }
.decline-box summary { list-style: none; cursor: pointer; display: inline-block; }
.decline-box[open] { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem; margin-top: 0.5rem; }

/* ---- login ---- */
.login { max-width: 360px; margin: 4rem auto; text-align: center; }
.login-logo { width: 220px; max-width: 80%; margin-bottom: 1.5rem; }
.login form { display: flex; flex-direction: column; gap: 0.5rem; text-align: left; }
.login .form-error { text-align: left; }

/* ---- dashboard ---- */
.range-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 0.4rem; font-size: 0.9rem; }
.range-links strong { font-weight: 700; }
.range-form { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.range-form label { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--muted); font-size: 0.8rem; }
.range-form input { padding: 0.3rem; border: 1px solid var(--line); border-radius: 5px; font: inherit; }
.range-form button { background: var(--clay); color: #fff; border: none; border-radius: 5px; padding: 0.35rem 0.8rem; cursor: pointer; }
.range-active { margin-top: 0.25rem; }
@media (max-width: 700px) { .range-controls { align-items: flex-start; } }

.counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1rem 0 0.5rem;
}
.counter {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--clay);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.counter-out  { border-top-color: #647d92; } /* muted slate blue — distinct from Won */
.counter-read { border-top-color: var(--clay); }
.counter-won  { border-top-color: #1f5b39; }
.counter-lost { border-top-color: #9c2a20; }
.counter-label { font-family: 'Be Vietnam Pro', sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; font-size: 0.72rem; }
.counter-count { font-size: 2rem; font-weight: 700; line-height: 1.1; font-family: 'Be Vietnam Pro', sans-serif; }
.counter-sub { color: var(--muted); font-size: 0.8rem; }
.counter-total { font-weight: 600; margin-top: 0.25rem; }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
@media (max-width: 800px) { .dash-cols { grid-template-columns: 1fr; } }

.task-list, .quote-list { list-style: none; padding-left: 0; margin: 0; }
.task-list li { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.35rem 0; border-bottom: 1px solid var(--line-soft); }
.task-done {
  background: var(--white);
  border: 1px solid var(--clay);
  color: var(--clay-dark);
  border-radius: 4px;
  cursor: pointer;
  padding: 0 0.4rem;
  line-height: 1.4;
}
.task-done:hover { background: var(--clay); color: var(--white); }
.task-text { flex: 1; }
.dash-status { font-size: 0.9rem; margin: 0.75rem 0 0.25rem; }
.quote-list li { padding: 0.2rem 0; }

.task-edit { font-size: 0.8rem; text-decoration: none; }
.task-edit:hover { color: var(--clay-dark); text-decoration: underline; }
.task-completed a, .task-completed { color: var(--muted); text-decoration: line-through; }
.task-done.done { border-color: #1f5b39; color: #1f5b39; }
.add-task, .done-history { margin-top: 0.75rem; }
.add-task[open], .done-history[open] { background: var(--linen); border-radius: 6px; padding: 0.6rem 0.75rem; }
.add-task summary, .done-history summary { cursor: pointer; }
.add-task .stacked-form { margin-top: 0.5rem; }
