@import url('/assets/brand.css');

/* ── Surface tokens (brand colours come ONLY from /assets/brand.css) ─────────────────────── */
:root {
  --bg: var(--brand-background);
  --fg: var(--brand-text);
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --border: #e2e6ec;
  --muted: #5b6573;
  --primary: var(--brand-primary);
  /* Deeper tone of the brand green for text-on-white / white-on-green (WCAG AA ≥ 4.5:1); still derived from the brand token. */
  --primary-strong: color-mix(in srgb, var(--brand-primary) 70%, #000);
  --primary-soft: color-mix(in srgb, var(--brand-primary) 14%, transparent);
  --primary-ink: #ffffff;
  --accent: var(--brand-accent);
  --accent-deep: #1e3a8a;
  --link: var(--brand-link);
  --danger: #b91c1c;
  --danger-ink: #b91c1c;
  --warn: #92400e;
  --warn-ink: #92400e;
  --warn-bg: #fff4e5;
  --ok: var(--primary-strong);
  --shadow: 0 1px 2px rgba(10,10,10,.06), 0 8px 24px -12px rgba(10,10,10,.18);
  --radius: 14px;
  --font: var(--brand-font-body);
  --header-bg: var(--brand-header-background);
  --header-fg: var(--brand-header-text);
}
[data-theme="dark"] {
  --bg: #0b1220;
  --fg: #e6ebf2;
  --surface: #111a2b;
  --surface-2: #172236;
  --border: #253148;
  --muted: #9aa7b8;
  --accent-deep: #93b4ff;
  --link: color-mix(in srgb, var(--brand-accent) 55%, #fff);
  --ok: color-mix(in srgb, var(--brand-primary) 55%, #fff);
  --danger-ink: #fca5a5;
  --warn-ink: #fbbf24;
  --warn-bg: #3a2a10;
  --header-bg: #0b1220;
  --header-fg: #e6ebf2;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--fg); background: var(--bg); line-height: 1.55; font-size: 16px; overflow-x: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.15; letter-spacing: -.01em; color: var(--fg); }
h1 { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 750; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .75rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ── Icons (SVG sprite; emoji are never icons) ── */
.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.25em; flex: none; }
.icon-btn .icon { width: 22px; height: 22px; }
.confirm-mark { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: var(--surface-2); color: var(--accent-deep); margin-bottom: .75rem; }
.confirm-mark .icon { width: 40px; height: 40px; }
.confirm-mark-ok { color: var(--ok); background: var(--primary-soft); }

/* ── Layout ── */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 1rem; }
.section { padding: clamp(2.5rem, 6vw, 5rem) 0; }
.section-alt { background: var(--surface-2); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.section-head p { margin: 0; max-width: 60ch; }
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.right { text-align: right; }
.center { text-align: center; }

/* ── Header / nav ── */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--header-bg); color: var(--header-fg); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--header-fg); text-decoration: none; }
.brand img { width: 36px; height: 36px; }
.brand span { font-size: 1.1rem; }
.nav { display: flex; gap: .25rem; align-items: center; }
.nav a { color: var(--header-fg); padding: .6rem .8rem; border-radius: 10px; font-weight: 600; font-size: .95rem; min-height: 44px; display: inline-flex; align-items: center; }
.nav a:hover, .nav a.active { background: var(--surface-2); text-decoration: none; color: var(--accent-deep); }
.nav-actions { display: flex; gap: .5rem; align-items: center; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--header-bg); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: .75rem 1rem 1rem; gap: .25rem; box-shadow: var(--shadow); }
  .nav.open { display: flex; }
  .nav a { min-height: 48px; }
  .menu-btn { display: inline-flex; }
  .hide-mobile { display: none !important; }
}

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .65rem 1.15rem; border-radius: 12px; border: 1px solid transparent; font-weight: 700; cursor: pointer; text-decoration: none !important; transition: transform .08s ease, box-shadow .15s ease, background .15s ease; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--primary-strong); color: var(--primary-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--brand-primary) 62%, #000); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--fg); }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 38px; padding: .45rem .85rem; font-size: .9rem; }
.btn-lg { min-height: 52px; padding: .85rem 1.5rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); cursor: pointer; }
.admin-side .icon-btn { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); }

/* ── Cards ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.card-body { padding: 1.25rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.card-media { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card-title { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.card-title h3 { margin: 0; }
.card-foot { margin-top: auto; padding-top: .75rem; display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.stat .value { font-size: 1.75rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--accent-deep); }
.stat .label { color: var(--muted); font-size: .85rem; }

/* ── Price token: one unbreakable unit ── */
.price { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 800; color: var(--accent-deep); }
.price-lg { font-size: 1.6rem; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Badges (every text/background pair ≥ 4.5:1 in both themes) ── */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-ok { background: var(--primary-soft); color: var(--ok); border-color: transparent; }
.badge-accent { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-deep); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.badge-danger { background: #fde8e8; color: var(--danger-ink); border-color: transparent; }
[data-theme="dark"] .badge-danger { background: #3f1a1a; }

/* ── Hero ── */
.hero { position: relative; color: #fff; overflow: hidden; background: #0b1220 url('/assets/stock-1.webp') center / cover no-repeat; }
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, rgba(8,18,40,.92) 0%, rgba(8,18,40,.78) 45%, rgba(5,150,105,.35) 100%); }
.hero .container { position: relative; padding-top: clamp(3.5rem, 9vw, 7rem); padding-bottom: clamp(3.5rem, 9vw, 7rem); }
.hero h1 { color: #fff; font-size: clamp(2.25rem, 5.5vw, 3.75rem); max-width: 16ch; line-height: 1.05; }
.hero p { color: rgba(255,255,255,.85); font-size: clamp(1.05rem, 1.8vw, 1.25rem); max-width: 56ch; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25); font-size: .85rem; font-weight: 600; margin-bottom: 1.25rem; }
.hero .btn-outline { border-color: rgba(255,255,255,.4); color: #fff; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-top: 2.5rem; }
.hero-stats div { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: .9rem 1rem; }
.hero-stats b { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Forms ── */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field { display: flex; flex-direction: column; gap: .25rem; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=url], select, textarea {
  width: 100%; min-height: 46px; padding: .6rem .8rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--fg);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.hint { color: var(--muted); font-size: .8rem; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: .6rem; }
.choice { border: 2px solid var(--border); border-radius: 12px; padding: .8rem; cursor: pointer; background: var(--surface); text-align: left; min-height: 44px; }
.choice.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.notice { border-left: 4px solid var(--accent); background: var(--surface-2); padding: .85rem 1rem; border-radius: 10px; }
.notice-warn { border-left-color: var(--warn); }
.notice-ok { border-left-color: var(--primary); }
.notice-danger { border-left-color: var(--danger); }
.error { color: var(--danger-ink); font-weight: 600; }

/* ── Dialogs (accessible modals; never native confirm/prompt) ── */
dialog.dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--fg); padding: 1.25rem; width: min(520px, calc(100% - 2rem)); box-shadow: var(--shadow); margin: auto; }
dialog.dialog::backdrop { background: rgba(5, 10, 20, .55); }
dialog.dialog:not([open]) { display: none; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

/* ── Map ── */
.gis { position: relative; width: 100%; aspect-ratio: 16 / 10; min-height: 260px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #0f172a; touch-action: pan-y; }
.gis .tiles { position: absolute; inset: 0; overflow: hidden; }
.gis .tiles img { position: absolute; width: 256px; height: 256px; image-rendering: auto; }
.gis svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.gis .legend { position: absolute; left: .75rem; bottom: .75rem; background: rgba(11,18,32,.82); color: #fff; padding: .5rem .7rem; border-radius: 10px; font-size: .75rem; display: flex; gap: .8rem; flex-wrap: wrap; max-width: calc(100% - 1.5rem); }
.gis .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: middle; }
.gis .attribution { position: absolute; right: .5rem; bottom: .5rem; background: rgba(255,255,255,.85); color: #222; font-size: .65rem; padding: .15rem .4rem; border-radius: 6px; }
.gis .controls { position: absolute; right: .75rem; top: .75rem; display: flex; flex-direction: column; gap: .4rem; }
.gis .controls button { width: 44px; height: 44px; border-radius: 10px; border: 0; background: rgba(255,255,255,.95); color: #0a0a0a; font-size: 1.25rem; font-weight: 800; cursor: pointer; }
.gis .basemap-note { position: absolute; left: .75rem; top: .75rem; background: rgba(11,18,32,.82); color: #fff; padding: .35rem .6rem; border-radius: 8px; font-size: .7rem; }
.gis-tall { aspect-ratio: 16 / 9; min-height: 340px; }

/* ── Timeline ── */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding-left: 1.75rem; padding-bottom: 1.1rem; }
.timeline li::before { content: ""; position: absolute; left: .45rem; top: .35rem; bottom: -.2rem; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: .35rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--primary); border: 3px solid var(--surface); box-shadow: 0 0 0 2px var(--primary); }
.stages { display: flex; gap: .4rem; flex-wrap: wrap; }
.stages span { padding: .3rem .7rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .75rem; font-weight: 600; color: var(--muted); }
.stages span.done { background: var(--primary-soft); color: var(--ok); border-color: transparent; }
.stages span.current { background: var(--accent); color: #fff; border-color: transparent; }

/* ── Certificate ── */
.certificate { background: var(--surface); border: 2px solid var(--accent-deep); border-radius: 18px; padding: clamp(1.25rem, 4vw, 2.5rem); position: relative; overflow: hidden; }
.certificate::before { content: ""; position: absolute; inset: 10px; border: 1px solid var(--border); border-radius: 12px; pointer-events: none; }
.certificate .seal { position: absolute; right: 1.5rem; top: 1.5rem; width: 64px; height: 64px; opacity: .9; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 1rem; margin: 1.25rem 0; }
.cert-grid .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cert-grid .v { font-weight: 700; }

/* ── Footer ── */
.footer { border-top: 1px solid var(--border); background: var(--surface-2); padding: 2.5rem 0 1.5rem; margin-top: 3rem; }
.footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1.5rem; }
.footer .trust { display: flex; gap: .5rem; flex-wrap: wrap; }
.footer small { color: var(--muted); }

/* ── Admin console ── */
.admin { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-side { background: var(--accent-deep); color: #fff; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: .25rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
[data-theme="dark"] .admin-side { background: #0f1b33; }
.admin-side .brand { color: #fff; margin-bottom: 1.25rem; }
.admin-side .brand small { display: block; font-size: .7rem; opacity: .75; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.admin-side a { color: #fff; padding: .7rem .8rem; border-radius: 10px; font-weight: 600; display: flex; gap: .6rem; align-items: center; min-height: 44px; }
.admin-side a:hover, .admin-side a.active { background: rgba(255,255,255,.14); text-decoration: none; }
.admin-side .spacer { flex: 1; }
.admin-main { padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem; min-width: 0; }
.admin-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.admin-top h1 { font-size: 1.6rem; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { position: sticky; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .6rem .75rem; gap: .25rem; }
  .admin-side .brand { margin: 0 .5rem 0 0; }
  .admin-side a { min-height: 44px; padding: .5rem .7rem; font-size: .85rem; }
  .admin-side .spacer { display: none; }
}
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.module-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); margin-right: .4rem; }
.module-dot.on { background: var(--primary); }

/* ── Misc ── */
.toast { position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: .8rem 1.1rem; border-radius: 12px; box-shadow: var(--shadow); z-index: 100; max-width: calc(100% - 2rem); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; min-height: 120px; }
@keyframes sk { to { background-position: -200% 0; } }
.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.chip-row { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { min-height: 40px; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--fg); }
.chip.active { background: var(--accent-deep); color: #fff; border-color: transparent; }
[data-theme="dark"] .chip.active { color: #0b1220; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.chat { display: flex; flex-direction: column; gap: .6rem; max-height: 320px; overflow-y: auto; padding: .25rem; }
.bubble { padding: .65rem .9rem; border-radius: 14px; max-width: 90%; }
.bubble.me { align-self: flex-end; background: var(--accent-deep); color: #fff; }
[data-theme="dark"] .bubble.me { color: #0b1220; }
.bubble.ai { align-self: flex-start; background: var(--surface-2); }
@media print { .topbar, .footer, .btn, .no-print { display: none !important; } body { background: #fff; color: #000; } }
