/* styles.css — how everything looks (colours, spacing, layout). */
:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #16202e;
  --muted: #6b7686;
  --line: #e3e7ee;
  --brand: #0f4c81;
  --brand-2: #1a6fb5;
  --good: #1a8f5a;
  --good-bg: #e6f6ee;
  --warn: #b36b00;
  --warn-bg: #fff4e0;
  --bad: #c0392b;
  --bad-bg: #fdecea;
  --radius: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
.muted { color: var(--muted); font-weight: 400; font-size: 12px; }

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 14px 24px; background: var(--brand); color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 20px;
}
.brand-name { font-size: 20px; letter-spacing: .2px; }
.brand-tag { font-size: 12px; opacity: .85; }
.demo-pill { background: #ffd35a; color: #3d2c00; padding: 1px 6px; border-radius: 4px; font-weight: 700; font-size: 10px; }
.demo-pill.ai { background: #7ee2b0; color: #063d24; }
.hint { font-weight: 400; color: var(--muted); font-size: 11px; }
.engine { font-size: 11px; color: var(--muted); margin: -4px 0 10px; }
.engine.fallback { color: var(--warn); background: var(--warn-bg); padding: 6px 10px; border-radius: 8px; margin: 0 0 10px; }
.stats { display: flex; gap: 10px; }
.stat {
  background: rgba(255,255,255,.12); border-radius: 10px; padding: 6px 14px; text-align: center; min-width: 110px;
}
.stat span { display: block; font-size: 22px; font-weight: 700; }
.stat small { opacity: .85; font-size: 11px; }
.stat.accent { background: #ffd35a; color: #3d2c00; }

/* Layout */
.layout {
  display: grid; grid-template-columns: 280px minmax(300px, 1fr) minmax(420px, 1.4fr);
  gap: 16px; padding: 16px 24px; align-items: start;
}
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; min-height: 300px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.panel-head h2 { font-size: 16px; margin: 0; }

/* Inbox */
.inbox-list { list-style: none; margin: 0 0 12px; padding: 0; }
.inbox-item {
  position: relative; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 6px;
}
.inbox-item:hover { background: #f6f8fb; }
.inbox-item.active { background: #eaf2fb; border-color: #bcd6f0; }
.inbox-item .row { display: flex; justify-content: space-between; }
.inbox-item .from { font-weight: 600; }
.inbox-item .time { color: var(--muted); font-size: 11px; }
.inbox-item .subject { font-size: 13px; margin: 2px 0; padding-right: 70px; }
.inbox-item .preview { color: var(--muted); font-size: 12px; }
.badge { position: absolute; right: 10px; top: 30px; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px; }
.badge.new { background: #e8eefc; color: var(--brand-2); }
.badge.done { background: var(--good-bg); color: var(--good); }

/* Email */
.mail-meta { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #dde8f5; color: var(--brand);
  display: grid; place-items: center; font-weight: 700;
}
.mail-body {
  white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.55;
  background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 0 0 12px;
}
.attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

/* Buttons */
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px;
  padding: 9px 14px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.btn:hover { background: #f4f6f9; }
.btn.primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.primary:hover { background: var(--brand); }
.btn.primary:disabled { opacity: .6; cursor: wait; }
.btn.big { width: 100%; padding: 13px; font-size: 15px; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; }

/* Empty state */
.empty { color: var(--muted); text-align: center; padding: 50px 20px; line-height: 1.6; }
.empty-icon { font-size: 34px; margin-bottom: 8px; }

/* Processing steps */
.steps { list-style: none; padding: 0; margin: 10px 0; }
.steps li { padding: 10px 12px 10px 36px; position: relative; color: var(--muted); }
.steps li::before { content: "○"; position: absolute; left: 12px; }
.steps li.busy { color: var(--ink); font-weight: 600; }
.steps li.busy::before { content: "◌"; animation: spin 1s linear infinite; display: inline-block; }
.steps li.ok { color: var(--good); }
.steps li.ok::before { content: "✓"; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Result */
.status { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }
.status.ok { background: var(--good-bg); color: var(--good); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.timebox {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(90deg, #fdf2f0, #e9f7f0); border-radius: 10px; padding: 10px; margin-bottom: 12px;
}
.timebox small { display: block; color: var(--muted); font-size: 11px; }
.timebox b { font-size: 18px; }
.timebox b.good { color: var(--good); }
.timebox .arrow { font-size: 20px; color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; }
.card h3 { font-size: 14px; margin: 0 0 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 14px; }
.field span { overflow-wrap: anywhere; }
.field small { display: block; color: var(--muted); font-size: 11px; }
.field .missing { color: var(--bad); font-style: italic; }
.specs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { background: #eef2f7; border-radius: 20px; padding: 3px 10px; font-size: 12px; }
.chip-missing { background: var(--bad-bg); color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; padding: 6px; border-bottom: 1px solid var(--line); }
td { padding: 7px 6px; border-bottom: 1px solid #f0f2f5; white-space: nowrap; }
td:last-child { white-space: normal; min-width: 180px; } /* long AI notes wrap instead of widening the page */
.panel { min-width: 0; } /* let grid columns shrink so the table scrolls inside its card */
td[contenteditable]:hover { background: #f6f9fd; outline: 1px dashed #bcd6f0; }
td[contenteditable]:focus { outline: 2px solid var(--brand-2); background: #fff; }
.cell-missing { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.cell-approx { background: var(--warn-bg); color: var(--warn); }
.legend { margin-top: 8px; font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.missing { background: var(--bad-bg); border: 1px solid var(--bad); }
.dot.approx { background: var(--warn-bg); border: 1px solid var(--warn); margin-left: 8px; }
.notes { margin: 0; padding-left: 18px; line-height: 1.6; }
.notes.checklist { list-style: none; padding-left: 0; }
.notes.checklist li::before { content: "☐ "; color: var(--brand-2); }
textarea {
  width: 100%; font-family: inherit; font-size: 13px; line-height: 1.5; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px; resize: vertical;
}
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.footnote { text-align: center; color: var(--muted); font-size: 12px; padding: 4px 24px 24px; }

/* Dialog */
dialog { border: none; border-radius: 14px; padding: 0; width: min(560px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 20, 35, .45); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog-body h3 { margin: 0; }
.dialog-body label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.dialog-body input { border: 1px solid var(--line); border-radius: 8px; padding: 9px; font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Company switcher + settings page */
.client-switch { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.client-switch select { border-radius: 8px; border: none; padding: 6px 8px; font-size: 13px; max-width: 240px; }
.btn.top-link { background: rgba(255,255,255,.15); color: #fff; border-color: transparent; text-decoration: none; font-size: 13px; }
.btn.top-link:hover { background: rgba(255,255,255,.25); }
.settings-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; padding: 16px 24px; align-items: start; max-width: 1200px; margin: 0 auto; }
.client-list { list-style: none; padding: 0; margin: 0 0 12px; }
.client-list li { padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; margin-bottom: 4px; }
.client-list li:hover { background: #f6f8fb; }
.client-list li.active { background: #eaf2fb; border-color: #bcd6f0; font-weight: 600; }
.new-client { display: flex; flex-direction: column; gap: 6px; }
.new-client input, #profile-form input:not([type=checkbox]), #profile-form select, #profile-form textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; width: 100%;
}
.intro { color: var(--muted); margin: -4px 0 12px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 14px; margin: 0 0 12px; }
legend { font-weight: 700; padding: 0 6px; color: var(--brand); }
#profile-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 10px; }
#profile-form label.check { flex-direction: row; align-items: center; font-weight: 400; margin: 0; }
.profile-tag { font-size: 11px; color: var(--muted); margin: -4px 0 10px; }

/* Tablet & phone */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 260px 1fr; }
  .result { grid-column: 1 / -1; }
}
@media (max-width: 800px) {
  .topbar { flex-direction: column; align-items: flex-start; padding: 12px 16px; }
  .layout { grid-template-columns: 1fr; padding: 12px; }
  .settings-layout { grid-template-columns: 1fr; padding: 12px; }
}

/* "van Urasync" next to the product name */
.brand-name .by { font-size: 12px; font-weight: 400; opacity: .75; margin-left: 4px; letter-spacing: 0; }

/* Login page */
.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--brand); padding: 20px; }
.login-card { background: var(--panel); border-radius: 16px; padding: 28px; width: min(400px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-brand { margin-bottom: 18px; }
.login-brand .logo { background: var(--brand); color: #fff; }
.login-brand .brand-tag { color: var(--muted); opacity: 1; }
.login-step { display: flex; flex-direction: column; gap: 12px; }
.login-step[hidden] { display: none; }
.login-step h2 { margin: 0; font-size: 18px; }
.login-step label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.login-step input { border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 15px; }
.login-error { color: var(--bad); min-height: 1em; margin: 0; font-size: 13px; }
.login-note { color: var(--muted); font-size: 11px; text-align: center; margin: 14px 0 0; }
button.btn.top-link { font-family: inherit; }

/* Dashboard */
.dash { max-width: 1200px; margin: 0 auto; padding: 16px 24px; display: flex; flex-direction: column; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi span { display: block; font-size: 26px; font-weight: 700; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.good span { color: var(--good); }
.new-inline { display: flex; gap: 8px; }
.new-inline input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; min-width: 200px; }
.clients-table td { vertical-align: middle; }
.status-select { border-radius: 20px; border: 1px solid var(--line); padding: 4px 8px; font-size: 12px; font-weight: 600; background: #fff; }
.status-select.status-live { background: var(--good-bg); color: var(--good); border-color: #bfe6d2; }
.status-select.status-pilot { background: var(--warn-bg); color: var(--warn); border-color: #f3d9a6; }
.status-select.status-paused { background: #eef0f3; color: var(--muted); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.btn.small { padding: 5px 10px; font-size: 12px; text-decoration: none; }
.small-note { margin: 10px 0 0; }
@media (max-width: 800px) {
  .dash { padding: 12px; }
  .panel-head { flex-wrap: wrap; }
  .new-inline input { min-width: 0; flex: 1; }
  .row-actions { flex-wrap: wrap; justify-content: flex-start; }
}

/* Two-step verification */
.login-help { color: var(--muted); font-size: 13px; margin: 0; line-height: 1.5; }
.login-help code { word-break: break-all; color: var(--ink); }
.qr { width: 200px; height: 200px; align-self: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
#code, #enroll-code { font-size: 22px; letter-spacing: 6px; text-align: center; }

/* Wizard */
.wizard { max-width: 860px; margin: 0 auto; padding: 16px 24px 40px; display: flex; flex-direction: column; gap: 14px; }
.wizard h2 { font-size: 17px; margin: 0 0 10px; }
.steps-bar { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; margin: 0; counter-reset: s; }
.steps-bar li { counter-increment: s; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; font-size: 13px; color: var(--muted); cursor: pointer; }
.steps-bar li::before { content: counter(s) " · "; }
.steps-bar li.active { border-color: var(--brand-2); color: var(--brand); font-weight: 700; background: #eaf2fb; }
.steps-bar li.done { color: var(--good); }
.steps-bar li.done::before { content: "✓ "; }
.wiz-step label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; margin-top: 8px; }
.wiz-step label.check, .wiz-step label.choice { margin-top: 0; }
.wiz-step input:not([type=checkbox]):not([type=radio]), .wiz-step select, .wiz-step textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font-size: 14px; font-family: inherit; width: 100%;
}
.mailcheck { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.mailcheck-result { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; background: #f4f7fb; border-radius: 10px; padding: 12px; }
.mailcheck-result small { display: block; color: var(--muted); font-size: 11px; }
.status-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; display: grid !important; grid-template-columns: auto 1fr; column-gap: 8px; }
.choice small { grid-column: 2; color: var(--muted); font-weight: 400; }
.choice:has(input:checked) { border-color: var(--brand-2); background: #eaf2fb; }
.wiz-nav { display: flex; justify-content: space-between; align-items: center; gap: 10px; position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; }
#demo-result { margin-top: 12px; }
@media (max-width: 800px) { .wizard { padding: 12px; } .status-choice { grid-template-columns: 1fr; } .steps-bar li { font-size: 11px; padding: 6px 2px; } }

/* Mailbox connection */
.mailbox-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 14px; }
.mailbox-card h3 { margin: 0 0 6px; font-size: 15px; }
.mailbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; background: #f4f7fb; border-radius: 10px; padding: 10px; margin: 8px 0; }
.mailbox-grid small { display: block; color: var(--muted); font-size: 11px; }
.ok-note { color: var(--good); background: var(--good-bg); padding: 8px 10px; border-radius: 8px; }
