/* Cover Trust CRM — styles. Brand colors match the website. */
:root {
  --navy: #102d44; --navy-deep: #0a1f30; --gold: #c9a24a; --gold-soft: #f4ecd8;
  --bg: #f6f4ef; --card: #ffffff; --text: #16232e; --muted: #5a6772; --border: #e4e0d6;
  --green: #1f6b3a; --green-soft: #e3f1e7; --red: #a12d2d; --red-soft: #f8e3e3; --blue-soft: #e4edf5;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,45,68,.06), 0 8px 24px rgba(16,45,68,.06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --head: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
a { color: var(--navy); }
h1, h2, h3 { margin: 0; line-height: 1.2; color: var(--navy); }
h1 { font: 600 1.9rem var(--head); }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 600; }
[hidden] { display: none !important; }

/* Sidebar */
.sidebar { background: var(--navy-deep); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 0 6px; }
.brand img { width: 150px; height: auto; }
.brand span { font-size: .7rem; font-weight: 700; letter-spacing: .12em; color: var(--navy-deep); background: var(--gold); padding: 3px 7px; border-radius: 6px; }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c9d4de; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(201,162,74,.16); color: #fff; }
.nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.nav a.active svg { color: var(--gold); }
.sidebar-note { margin-top: auto; font-size: .78rem; color: #8ea0b0; padding: 0 8px; }

/* Main */
main { padding: 32px clamp(16px, 3vw, 40px) 80px; min-width: 0; outline: none; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.loading, .empty { color: var(--muted); }
.empty { padding: 18px; text-align: center; }

/* Buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 999px; border: 2px solid var(--navy); background: var(--navy); color: #fff; font: 600 .92rem var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-deep); }
.btn-ghost { background: transparent; color: var(--navy); }
.btn-ghost:hover { background: var(--gold-soft); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
.btn-gold:hover { background: #b8913c; }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .82rem; cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--red); }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font: 400 .95rem var(--font); color: var(--text); background: #fff; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
textarea { resize: vertical; min-height: 80px; }
label { display: grid; gap: 5px; font-size: .85rem; font-weight: 600; color: var(--navy); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inline-form input[type=text], .inline-form input:not([type]) { flex: 1 1 200px; width: auto; }
.inline-form input[type=date], .inline-form select { flex: 0 1 170px; width: auto; }
.hint { font-size: .8rem; color: var(--muted); margin: 6px 0 0; }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head a { font-size: .85rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.kpi span { display: block; font-size: .8rem; color: var(--muted); font-weight: 500; }
.kpi strong { display: block; font: 600 1.8rem var(--head); color: var(--navy); margin-top: 4px; }

/* Lists */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.rows li:first-child { border-top: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .sub { font-size: .82rem; color: var(--muted); }
.rows a.title { font-weight: 600; text-decoration: none; }
.rows a.title:hover { text-decoration: underline; }
.check { width: 20px; height: 20px; accent-color: var(--green); flex-shrink: 0; cursor: pointer; }
.done-text { text-decoration: line-through; color: var(--muted); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #faf8f3; }
td .sub { display: block; font-size: .8rem; color: var(--muted); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; text-transform: capitalize; }
.stage-new { background: var(--blue-soft); color: #1d4a72; }
.stage-contacted { background: var(--gold-soft); color: #7a5b16; }
.stage-quoted { background: #ece4f6; color: #5a3d86; }
.stage-bound { background: var(--green-soft); color: var(--green); }
.stage-lost, .status-cancelled, .status-expired { background: #ecebe8; color: #66605a; }
.status-active { background: var(--green-soft); color: var(--green); }
.status-pending { background: var(--gold-soft); color: #7a5b16; }
.due-over { color: var(--red); font-weight: 600; }
.due-today { color: #7a5b16; font-weight: 600; }

/* Filters */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar input[type=search] { max-width: 340px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font: 500 .85rem var(--font); color: var(--navy); cursor: pointer; text-transform: capitalize; }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Stage picker on contact page */
.stages { display: flex; flex-wrap: wrap; gap: 6px; }
.stages button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font: 600 .82rem var(--font); color: var(--muted); cursor: pointer; text-transform: capitalize; }
.stages button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }

/* Contact detail */
.detail-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: start; margin-bottom: 20px; }
.back { display: inline-block; margin-bottom: 8px; font-size: .85rem; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--navy); }
dl.info { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0; font-size: .92rem; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; word-break: break-word; }
.note { padding: 12px 0; border-top: 1px solid var(--border); }
.note:first-child { border-top: 0; }
.note p { margin: 0 0 4px; white-space: pre-wrap; }
.note .sub { font-size: .78rem; color: var(--muted); }
.policy { padding: 14px 0; border-top: 1px solid var(--border); }
.policy:first-child { border-top: 0; }
.policy-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.policy .sub { font-size: .84rem; color: var(--muted); }

/* Pipeline board */
.board { display: grid; grid-template-columns: repeat(5, minmax(170px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #efece4; border-radius: var(--radius); padding: 12px; min-height: 300px; }
.col.drop { outline: 2px dashed var(--gold); }
.col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.col-head h2 { text-transform: capitalize; font-size: .95rem; }
.col-head span { font-size: .78rem; color: var(--muted); }
.deal { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(16,45,68,.05); }
.deal:active { cursor: grabbing; }
.deal a { font-weight: 600; text-decoration: none; }
.deal .sub { font-size: .8rem; color: var(--muted); }
.deal select { margin-top: 8px; padding: 5px 8px; font-size: .8rem; }

/* Modal & toast */
dialog { border: 0; border-radius: var(--radius); padding: 26px; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(10,31,48,.3); }
dialog::backdrop { background: rgba(10,31,48,.45); }
dialog h2 { font: 600 1.4rem var(--head); margin-bottom: 16px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--navy-deep); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }
.notice { padding: 12px 16px; border-radius: 10px; background: var(--gold-soft); font-size: .88rem; margin-bottom: 16px; }

/* Responsive */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-detail { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 40; flex-direction: row; padding: 6px; gap: 0; }
  .brand, .sidebar-note { display: none; }
  .nav { grid-template-columns: repeat(6, 1fr); width: 100%; gap: 2px; }
  .nav a { flex-direction: column; gap: 3px; padding: 7px 2px; font-size: .68rem; text-align: center; }
  main { padding: 20px 16px 96px; }
  .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.6rem; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .kpi strong { font-size: 1.4rem; }
  .hide-sm { display: none; }
  dl.info { grid-template-columns: 90px 1fr; }
}

/* Sign-in page */
.login-body { display: block; background: var(--navy-deep); min-height: 100vh; }
.login { max-width: 460px; margin: 0 auto; padding: 48px 16px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.login-brand img { width: 220px; height: auto; }
.login-brand span { font-size: .75rem; font-weight: 700; letter-spacing: .12em; color: var(--navy-deep); background: var(--gold); padding: 3px 8px; border-radius: 6px; }
.login-card { background: #fff; border-radius: 18px; padding: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-card form, .login-card > div { display: grid; gap: 16px; }
.login-card h1 { font-size: 1.7rem; }
.login-sub { margin: -8px 0 4px; color: var(--muted); font-size: .92rem; }
.btn-block { width: 100%; padding: 13px 18px; font-size: 1rem; }
.btn[aria-disabled="true"] { opacity: .5; }
.login-alt { justify-self: center; }
.login-error { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-weight: 500; font-size: .92rem; }
.login-foot { text-align: center; color: #8ea0b0; font-size: .82rem; margin-top: 18px; }
.code-input { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.enroll-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: .95rem; }
.qr { display: grid; place-items: center; padding: 8px; }
.qr svg { width: 220px; height: 220px; border: 1px solid var(--border); border-radius: 12px; }
.manual-key { font-size: .9rem; }
.manual-key summary { cursor: pointer; color: var(--navy); font-weight: 600; }
.manual-key code { display: block; margin-top: 6px; padding: 10px; background: var(--bg); border-radius: 8px; font-size: 1rem; letter-spacing: .08em; word-break: break-all; }
.recovery-list { list-style: none; padding: 14px; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--bg); border-radius: 12px; }
.recovery-list code { font-size: 1rem; letter-spacing: .06em; }
.login-row { display: flex; gap: 10px; }
.login-row .btn { flex: 1; }
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check-row input { width: 18px; height: 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.signout { margin: 0 8px; padding: 10px 12px; border-radius: 10px; background: none; border: 1px solid rgba(255,255,255,.15); color: #c9d4de; font: 500 .88rem var(--font); cursor: pointer; text-align: left; }
.signout:hover { background: rgba(255,255,255,.06); color: #fff; }
@media (max-width: 860px) { .signout { display: none; } .login-body { display: block; } }
.card > h2 { margin-bottom: 12px; }
.btn-google { background: #fff; color: #1f1f1f; border: 1px solid #c7c7c7; gap: 12px; }
.btn-google:hover { background: #f5f5f5; }
.who { margin: -8px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--bg); font-size: .88rem; color: var(--navy); word-break: break-all; }
.team-table td { cursor: default; }
.team-table tbody tr:hover { background: none; }

/* Home-screen app (iPhone): keep content clear of the notch and home bar */
@media (max-width: 860px) {
  .sidebar { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
  main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); padding-top: calc(20px + env(safe-area-inset-top)); }
}
.login { padding-top: calc(48px + env(safe-area-inset-top)); padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
