/* DeepShare Connector's stylesheet: design tokens, layout and components shared by every page. No inline styles anywhere:
   the Content-Security-Policy forbids them. */
:root {
  color-scheme: light dark;
  --bg: #f5f7f5; --surface: #ffffff; --surface-2: #eef2ef; --text: #17211c; --muted: #4b5a52; --border: #d9e1db;
  --accent: #176b45; --accent-hover: #11553a; --on-accent: #ffffff; --accent-soft: #e2f1e8;
  --danger: #b3261e; --danger-soft: #fbe9e7; --warn: #8a5a00; --warn-soft: #fff4d6; --ok: #146c43;
  --shadow: 0 1px 2px rgb(23 33 28 / 8%), 0 4px 16px rgb(23 33 28 / 6%);
  --radius: 12px; --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1411; --surface: #17201b; --surface-2: #1e2923; --text: #e9f0eb; --muted: #a8b6ad; --border: #2c3931;
    --accent: #52b685; --accent-hover: #6cc698; --on-accent: #06130c; --accent-soft: #1b3427;
    --danger: #ff8a80; --danger-soft: #3a1f1d; --warn: #f2c15d; --warn-soft: #3a2f12; --ok: #6fd3a0;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 16px rgb(0 0 0 / 30%);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--text); background: var(--bg); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
code, pre { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; overflow-wrap: anywhere; }
pre { background: var(--surface-2); padding: 12px 14px; border-radius: var(--radius-sm); overflow: auto; margin: 0; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); color: var(--text); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.skip:focus { top: 8px; }
.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
[hidden] { display: none !important; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; font: inherit; font-weight: 650;
  border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.92); color: #fff; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn img { width: 20px; height: 20px; }

/* Site chrome */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--text); }
.bar nav { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; }
.bar nav a:not(.btn) { color: var(--text); text-decoration: none; padding: 8px 0; }
.bar nav a:not(.btn):hover, .bar nav a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
.site-footer { margin-top: 72px; border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; }
.site-footer nav { display: flex; gap: 8px 20px; flex-wrap: wrap; }

/* Public pages */
.hero { padding: 72px 0 56px; }
.hero .container { display: grid; gap: 40px; grid-template-columns: 1.15fr .85fr; align-items: center; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 36em; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 12px; }
.eyebrow { display: inline-block; font-size: .85rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.section { padding: 48px 0; }
.section.alt { background: var(--surface); border-block: 1px solid var(--border); }
.section > .container > h2 { margin-bottom: 8px; }
.section > .container > .intro { color: var(--muted); max-width: 40em; margin-bottom: 28px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.step-number { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; margin-bottom: 12px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checks li { position: relative; padding-left: 28px; }
.checks li::before { position: absolute; left: 0; top: 0; font-weight: 800; }
.checks.yes li::before { content: "✓"; color: var(--ok); }
.checks.no li::before { content: "✕"; color: var(--danger); }
.mock { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: grid; gap: 12px; }
.mock .row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .95rem; }
.mock .row span:last-child { color: var(--muted); white-space: nowrap; }
.prose { padding-top: 48px; }
.prose h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.prose h2 { margin-top: 1.8em; font-size: 1.4rem; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: .95rem; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.updated { color: var(--muted); font-size: .9rem; }
.copy-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.copy-row code { flex: 1; min-width: 12em; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* Messages, badges, forms */
.notice { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); margin: 0 0 16px; }
.notice.ok { background: var(--accent-soft); border-color: var(--accent); }
.notice.error { background: var(--danger-soft); border-color: var(--danger); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn); }
.notice.device { margin: 16px 0 0; }
.notice.device a { overflow-wrap: anywhere; }
.device-code { font-size: 1.6rem; font-weight: 700; letter-spacing: .12em; padding: 6px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); user-select: all; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.ok { background: var(--accent-soft); color: var(--ok); border-color: transparent; }
.badge.error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
label { display: grid; gap: 6px; font-weight: 600; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); padding: 10px 12px; min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
input[type="checkbox"] { min-height: 0; width: 20px; height: 20px; }

/* Centered single-purpose pages: errors and consent */
.focus-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.focus-card { width: min(100%, 520px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.focus-card .brand { margin-bottom: 20px; }
.focus-card .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.status-code { font-size: .9rem; color: var(--muted); font-family: var(--mono); }

@media (max-width: 800px) {
  .hero { padding: 40px 0 32px; }
  .hero .container { grid-template-columns: 1fr; }
  .bar nav { gap: 4px 14px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* The signed-in app */
.app-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.app-header .bar { min-height: 60px; }
.app-header .who { display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.tabs { display: flex; gap: 4px; flex-wrap: nowrap; padding: 0; margin: 0; list-style: none; border-top: 1px solid var(--border); }
.tabs-wrap { background: var(--surface); border-bottom: 1px solid var(--border); }
.tabs-wrap .container { overflow-x: auto; }
.tabs a { display: block; padding: 12px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.app-main { padding-top: 32px; outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 4px; }
.page-head p { margin: 0; color: var(--muted); }
.stack { display: grid; gap: 20px; }
.stack.tight { gap: 12px; }
.cluster { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.card.flat { box-shadow: none; }
.card h2 { font-size: 1.15rem; margin-bottom: .4em; }
.stat { font-size: 1.8rem; font-weight: 750; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .9rem; }
.meter { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter > span.high { background: var(--warn); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.checklist .mark { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; font-weight: 800; font-size: .85rem; color: transparent; background: var(--surface); }
.checklist li.done { background: var(--accent-soft); border-color: transparent; }
.checklist li.done .mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.checklist strong { display: block; }
.entry { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.entry-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.entry-title { font-weight: 650; }
.entry-meta { color: var(--muted); font-size: .9rem; }
.entry details, .preview { margin-top: 10px; }
.entry summary, .preview summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.entry dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0; }
.entry dt { color: var(--muted); }
.entry dd { margin: 0; overflow-wrap: anywhere; }
.entry pre { max-height: 260px; margin-top: 8px; }
.events { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.events li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.events li span:last-child { color: var(--muted); white-space: nowrap; font-size: .9rem; }
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.filters label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.filters select { min-width: 10em; }
.empty { text-align: center; padding: 36px 20px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }
.empty h3 { color: var(--text); }
.skeleton { height: 90px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.steps { padding-left: 1.3em; margin: 0 0 1em; }
.steps li { margin-bottom: .5em; }
.danger-zone { border-color: var(--danger); }

dialog { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 0; width: min(92vw, 460px); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / 55%); }
dialog h2 { font-size: 1.25rem; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
dialog form { display: block; padding: 24px; }
dialog input { width: 100%; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; max-width: min(92vw, 380px); }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--text); color: var(--bg); box-shadow: var(--shadow); }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--accent); color: var(--on-accent); }

@media (max-width: 600px) {
  .app-header .who span { display: none; }
  .entry dl { grid-template-columns: 1fr; }
}
