/* ─────────────────────────────────────────────────────────────────────── */
/* Trindco Quotes — Stylesheet                                            */
/* ─────────────────────────────────────────────────────────────────────── */

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

:root {
  --blue:    #185FA5; --blue-lt: #E6F1FB; --blue-dk: #0C447C;
  --green:   #3B6D11; --green-lt:#EAF3DE; --green-dk:#27500A;
  --amber:   #854F0B; --amber-lt:#FAEEDA; --amber-dk:#633806;
  --red:     #A32D2D; --red-lt:  #FCEBEB; --red-dk:  #791F1F;
  --purple:  #534AB7; --purple-lt:#EEEDFE; --purple-dk:#3C3489;
  --gray:    #5F5E5A; --gray-lt: #F1EFE8; --gray-dk: #444441;
  --border:  rgba(0,0,0,.12);
  --border2: rgba(0,0,0,.20);
  --bg:      #F8F7F4;
  --surface: #FFFFFF;
  --text:    #1a1a18;
  --muted:   #6b6a66;
  --hint:    #9b9a96;
  --radius:  8px;
  --radius-lg: 12px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

html, body {
  height: 100%; min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px; line-height: 1.5;
  background: var(--bg); color: var(--text);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top nav ─────────────────────────────────────────────────────────── */
#topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 54px;
  padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-logo {
  width: 30px; height: 30px;
  background: var(--blue); color: #fff;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.nav-title { font-size: 14px; font-weight: 600; }
.nav-subtitle { font-weight: 400; color: var(--muted); }
.nav-links { display: flex; gap: 2px; margin-left: 12px; }
.nav-link {
  padding: 7px 14px; border-radius: var(--radius);
  font-size: 12px; font-weight: 500;
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  position: relative;
}
.nav-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--blue-lt); color: var(--blue-dk); }
.nav-badge {
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px;
  min-width: 18px; text-align: center;
  margin-left: 4px;
}
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; }
.nav-user { display: flex; align-items: center; gap: 8px; }
.nav-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--blue-lt); color: var(--blue-dk);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}

/* ── Layout ──────────────────────────────────────────────────────────── */
main { padding: 20px; max-width: 1100px; margin: 0 auto; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.page-header h1 { font-size: 18px; font-weight: 600; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  overflow: hidden;
}
.card-hdr {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
}
.card-hdr .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 14px 16px; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.fg { display: flex; flex-direction: column; gap: 4px; }
.lbl {
  font-size: 10px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
input[type=text], input[type=number], input[type=email], input[type=password],
select, textarea {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 7px 10px; font-size: 13px;
  color: var(--text); font-family: inherit; outline: none;
  transition: border .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(24,95,165,.1);
  background: #fff;
}
input[disabled], input[readonly] {
  background: var(--bg); color: var(--muted); cursor: not-allowed;
}
input[type=checkbox], input[type=radio] {
  width: 14px; height: 14px; cursor: pointer;
  accent-color: var(--blue);
}
textarea { min-height: 70px; resize: vertical; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dk); }
.btn-success { background: var(--green-lt); color: var(--green-dk); border-color: var(--green); }
.btn-warn    { background: var(--amber-lt); color: var(--amber-dk); border-color: var(--amber); }
.btn-danger  { color: var(--red); border-color: rgba(163,45,45,.3); }
.btn-danger:hover { background: var(--red-lt); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-xs { padding: 2px 8px; font-size: 10px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px; border-radius: 20px;
  font-size: 10px; font-weight: 600;
  text-transform: capitalize;
}
.badge-draft    { background: var(--gray-lt);   color: var(--gray-dk); }
.badge-complete { background: var(--blue-lt);   color: var(--blue-dk); }
.badge-pending  { background: var(--amber-lt);  color: var(--amber-dk); }
.badge-approved { background: var(--green-lt);  color: var(--green-dk); }
.badge-w        { background: var(--blue-lt);   color: var(--blue-dk); }
.badge-p        { background: var(--green-lt);  color: var(--green-dk); }
.badge-r        { background: var(--amber-lt);  color: var(--amber-dk); }
.badge-flag     { background: var(--red-lt);    color: var(--red-dk); }

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert { border-radius: var(--radius); padding: 10px 14px; font-size: 12px; margin-bottom: 10px; }
.alert-info { background: var(--blue-lt);  border: 1px solid var(--blue);  color: var(--blue-dk); }
.alert-warn { background: var(--amber-lt); border: 1px solid var(--amber); color: var(--amber-dk); }
.alert-err  { background: var(--red-lt);   border: 1px solid var(--red);   color: var(--red-dk); }
.alert-ok   { background: var(--green-lt); border: 1px solid var(--green); color: var(--green-dk); }

/* ── Login page ──────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  width: 100%; max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.login-card .login-logo {
  width: 48px; height: 48px;
  background: var(--blue); color: #fff;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  margin: 0 auto 16px;
}
.login-card h1 {
  font-size: 17px; font-weight: 600;
  text-align: center; margin-bottom: 4px;
}
.login-card .sub {
  text-align: center; font-size: 12px; color: var(--muted);
  margin-bottom: 24px;
}

/* ── Tables ──────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
  font-size: 10px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: var(--bg);
  white-space: nowrap;
}
.data-table th.right { text-align: right; }
.data-table th.center { text-align: center; }
.data-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Quote list cards (dashboard) ───────────────────────────────────── */
.quote-list .qrow {
  display: grid;
  grid-template-columns: 120px 1fr auto auto auto;
  gap: 12px; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  transition: background .12s;
}
.quote-list .qrow:last-child { border-bottom: none; }
.quote-list .qrow:hover { background: var(--bg); }
.quote-list .qrow.flagged { background: #FFFBF2; }
.quote-list .qrow .qnum { font-weight: 600; font-variant-numeric: tabular-nums; }
.quote-list .qrow .qcust { font-weight: 500; }
.quote-list .qrow .qsub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.quote-list .qrow .qwhen { font-size: 11px; color: var(--muted); }

/* ── Quote screen — colors table ────────────────────────────────────── */
.colors-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.colors-table th {
  font-size: 9px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase; letter-spacing: .03em;
  padding: 7px 5px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  background: var(--bg);
  white-space: nowrap;
}
.colors-table th.c { text-align: center; }
.colors-table th.r { text-align: right; }
.colors-table td {
  padding: 5px 5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.colors-table tr:last-child td { border-bottom: none; }
.colors-table td input,
.colors-table td select {
  background: transparent; border: none;
  padding: 3px 4px; font-size: 12px;
  width: 100%;
  border-radius: 3px;
}
.colors-table td input:focus,
.colors-table td select:focus {
  background: var(--blue-lt); outline: none;
  box-shadow: none;
}
.colors-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.colors-table td.calc {
  background: var(--bg); color: var(--muted);
  font-weight: 500; text-align: right;
  padding: 5px 8px;
}
.colors-table td.headline {
  text-align: right; font-size: 13px; font-weight: 600;
  color: var(--blue); background: var(--blue-lt);
  font-variant-numeric: tabular-nums; padding: 5px 10px;
}
.colors-table td.diff {
  text-align: right; font-size: 12px; font-weight: 500;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  padding: 5px 8px;
}
.colors-table td.diff.is-base { color: var(--muted); font-style: italic; }
.colors-table td.diff.is-base small { display: block; font-size: 9px; }
.colors-table .row-num {
  font-size: 10px; color: var(--muted);
  width: 22px; text-align: center;
  position: relative;
}
.colors-table .row-flag {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%; background: var(--red);
  margin-left: 3px;
}
.colors-table tr.warn-row td.flag-msg {
  font-size: 10px; color: var(--amber-dk); font-style: italic;
  background: #FFFBF2; padding: 5px 10px;
}
.add-row-btn {
  padding: 10px 14px; text-align: center;
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  margin-top: 8px; cursor: pointer;
  color: var(--blue); font-size: 12px; font-weight: 500;
}
.add-row-btn:hover { background: var(--blue-lt); }

/* ── Toast notifications ────────────────────────────────────────────── */
#toast-host {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--text); color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  box-shadow: var(--shadow);
  animation: slideIn .18s ease;
  max-width: 320px;
}
.toast.ok { background: var(--green-dk); }
.toast.err { background: var(--red-dk); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-overlay.on { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%; max-width: 460px;
  max-height: 90vh;
  overflow: auto;
  padding: 22px 24px;
}
.modal h2 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.modal .sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ── Summary metrics ────────────────────────────────────────────────── */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0 0 14px; }
.metric { background: var(--bg); border-radius: var(--radius); padding: 10px 14px; }
.metric .lbl { font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.metric .val { font-size: 22px; font-weight: 600; }
.metric .val.blue { color: var(--blue); }
.metric .val.green { color: var(--green); }
.metric .val.amber { color: var(--amber); }

/* ── Moraware summary box ───────────────────────────────────────────── */
.moraware {
  background: var(--bg);
  border-radius: var(--radius); padding: 12px 16px;
  margin-top: 14px;
}
.moraware h3 {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 10px;
}
.moraware-line {
  display: flex; justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.moraware-line:last-child { border-bottom: none; }
.moraware-line.base { font-weight: 600; }
.moraware-line .val { color: var(--blue); font-weight: 600; }
.moraware-line.upgrade .val { color: var(--green); }

/* ── History ────────────────────────────────────────────────────────── */
.history-list { font-size: 11px; }
.history-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.history-what strong { font-weight: 600; }

/* ── Empty state ────────────────────────────────────────────────────── */
.empty {
  padding: 40px 20px; text-align: center;
  color: var(--muted); font-size: 12px;
}
.empty a { color: var(--blue); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  main { padding: 14px; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .nav-links { display: none; }
}
