:root {
  /* Veeam green brand accent */
  --bg: #f5f7fa; --surface: #ffffff; --surface-2: #eef2f7; --border: #d8e0ea;
  --text: #1c2630; --muted: #5a6b7b; --accent: #00732f; --accent-2: #00b336;
  --ok: #1e8e5a; --warn: #b26a1a; --danger: #c0392b; --radius: 12px;
  --shadow: 0 1px 3px rgba(20,40,60,.08), 0 6px 20px rgba(20,40,60,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151b; --surface: #171f28; --surface-2: #1f2a35; --border: #2c3a47;
    --text: #e8eef4; --muted: #9fb0c0; --accent: #00a341; --accent-2: #2ed06f;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0f151b; --surface: #171f28; --surface-2: #1f2a35; --border: #2c3a47;
  --text: #e8eef4; --muted: #9fb0c0; --accent: #00a341; --accent-2: #2ed06f;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }

.demo-banner {
  background: repeating-linear-gradient(45deg, #b26a1a, #b26a1a 12px, #9c5c16 12px, #9c5c16 24px);
  color: #fff; text-align: center; font-weight: 600; font-size: 13px; padding: 6px 10px;
  letter-spacing: .02em;
}

.masthead { background: var(--surface); border-bottom: 2px solid var(--accent-2); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-weight: 700; font-size: 17px; }
.badge {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em;
}
nav a { color: var(--muted); text-decoration: none; margin-left: 16px; font-size: 14px; }
nav a:hover { color: var(--accent); }

.hero { padding: 32px 0 8px; }
.hero h1 { margin: 0 0 6px; font-size: 28px; }
.hero p { color: var(--muted); margin: 0; max-width: 60ch; }

.section-title { margin: 32px 0 14px; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.lock, .hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.hint a { color: var(--accent); font-weight: 600; text-decoration: none; }
.hint a:hover { text-decoration: underline; }
.prose a { color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.card p { color: var(--muted); margin: 0 0 12px; }

.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0; cursor: pointer;
  padding: 9px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--accent-2); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }

/* segmented request-type control */
.seg { display: flex; gap: 6px; margin-bottom: 12px; }
.seg-btn {
  flex: 1; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 9px 10px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted);
}
.seg-btn:hover { border-color: var(--accent); color: var(--text); }
.seg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
form input[type=text], form input[type=email], form input[type=password] {
  width: 100%; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 14px;
}
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }
label.check input { margin: 0; }
.form-msg { font-size: 13px; min-height: 18px; margin: 6px 0 0; }
.form-msg.ok { color: var(--ok); } .form-msg.err { color: var(--danger); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Communication-preference toggles */
.switches { display: flex; flex-direction: column; gap: 10px; margin: 2px 0 14px; }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; color: var(--text); font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative; flex: 0 0 auto; width: 40px; height: 22px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); transition: background .15s, border-color .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.switch .switch-txt { font-weight: 600; }

/* Preference matrix: every processing purpose + its channels (mirrors Securiti) */
.grid-pair { margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
@media (min-width: 900px) { .grid-pair { grid-template-columns: 1.5fr 1fr; align-items: start; } }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Arrange mode: drag to reorder, resize from the corner ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.arrange-tools { display: flex; gap: 8px; }
.arrange-toggle, .arrange-reset {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.arrange-toggle:hover, .arrange-reset:hover { color: var(--accent); border-color: var(--accent); }
.arrange-toggle[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* A customized (resized) layout stays flex so the sizes stick, with no editing chrome. */
#pref-cards.custom { display: flex; flex-wrap: wrap; align-items: flex-start; }
#pref-cards.custom .card { overflow: auto; }
/* In arrange mode the cards become free-width flex items so resize sticks. */
#pref-cards.arranging { display: flex; flex-wrap: wrap; align-items: flex-start; }
#pref-cards.arranging .card {
  resize: both; overflow: auto; min-width: 280px; min-height: 160px; flex: 0 0 auto;
  cursor: grab; outline: 2px dashed var(--accent-2); outline-offset: 2px;
}
/* Default widths so a card never shrink-to-fits to its content's natural width
   (that made the cookie table run away). An inline width from a resize overrides these. */
#pref-cards.arranging .card, #pref-cards.custom .card { width: 380px; max-width: 100%; }
#pref-cards.arranging .pref-card, #pref-cards.custom .pref-card { width: 560px; }
#pref-cards.arranging .card:active { cursor: grabbing; }
#pref-cards.arranging .card::before {
  content: "⠿ drag to move · corner to resize"; display: block;
  font-size: 11px; font-weight: 600; color: var(--accent); margin: -4px 0 8px;
}
#pref-cards.arranging .card.dragging { opacity: .45; }
#pref-cards.arranging .card.drop-target { outline-color: var(--accent); outline-style: solid; }
.chips-row { flex-direction: row; flex-wrap: wrap; margin-bottom: 12px; }
.chips-row .chip { flex: 0 1 auto; }
.pref-matrix { margin: 4px 0 14px; }
.pp-group { padding: 12px 0; border-top: 1px solid var(--border); }
.pp-group:first-child { border-top: 0; padding-top: 4px; }
.pp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pp-head h4 { margin: 0; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); }
.pp-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  padding: 2px 8px; border-radius: 999px; }
.pp-desc { margin: 4px 0 8px; font-size: 12.5px; color: var(--muted); }
.pp-group .switches { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; margin: 0; }
.pp-group .switch { font-size: 13px; }
.pp-group .switch .track { width: 36px; height: 20px; }
.pp-group .switch .track::after { width: 14px; height: 14px; }
.pp-group .switch input:checked + .track::after { transform: translateX(16px); }

.cookie-panel { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 6px; }
#cookie-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
#cookie-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
#cookie-table td:first-child { width: auto; }
#cookie-table td.cat-cell { width: 108px; text-align: right; }
#cookie-table code { word-break: break-all; font-size: 12px; }
.cat { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; white-space: nowrap; text-transform: capitalize; }
.cat.necessary { background: #5a6b7b; } .cat.functional { background: #1e8e5a; }
.cat.analytics { background: #1a7db2; } .cat.marketing { background: #b26a1a; }
.cat.unknown { background: #8a4fb0; }
.muted { color: var(--muted); }

.chips { display: flex; flex-direction: column; gap: 8px; }
.chip {
  display: block; width: 100%; text-align: left; font: inherit;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; line-height: 1.35; cursor: pointer; color: var(--text);
}
.chip:hover { border-color: var(--accent); }
.chip .nm { font-weight: 600; display: block; }
.chip small { color: var(--muted); display: block; font-size: 11px; margin-top: 1px; }

/* Console */
.console { margin-top: 4px; }
.console-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; }
.tab { background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.console-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.console-tools input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--text); font-size: 13px; }

.split { display: grid; grid-template-columns: 300px 1fr; gap: 14px; }
.mail-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto;
  border: 1px solid var(--border); border-radius: 8px; }
.mail-list li { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.mail-list li:hover { background: var(--surface-2); }
.mail-list li.active { background: var(--surface-2); border-left: 3px solid var(--accent); }
.mail-list .subj { font-weight: 600; font-size: 13px; }
.mail-list .meta { font-size: 11px; color: var(--muted); }
.mail-view { border: 1px solid var(--border); border-radius: 8px; padding: 14px; min-height: 300px; }
.mail-view .hdrs { font-size: 13px; margin-bottom: 10px; }
.mail-view .hdrs b { color: var(--muted); font-weight: 600; display: inline-block; width: 64px; }
.mail-view iframe { width: 100%; min-height: 260px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.mail-view pre { white-space: pre-wrap; font-size: 13px; }

.data-table, .timeline { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.timeline { list-style: none; padding: 0; }
.timeline li { padding: 8px 10px; border-left: 2px solid var(--border); margin-left: 6px; font-size: 13px; }
.timeline li b { color: var(--accent); }

.footer { color: var(--muted); font-size: 13px; padding: 28px 16px 40px; }
.footer a { color: var(--accent); }
.prose { max-width: 720px; padding-top: 24px; }
.prose h1 { font-size: 26px; } .prose h2 { font-size: 18px; margin-top: 24px; }
.prose code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.center { text-align: center; padding-top: 60px; }

@media (max-width: 640px) {
  .split { grid-template-columns: 1fr; }
  .mail-list { max-height: 220px; }
  .masthead .wrap { height: auto; padding: 10px 16px; flex-direction: column; gap: 6px; align-items: flex-start; }
}
