/* RegistryFlow — shared styles for public site, demo app and admin.
   System fonts only (no downloads) to keep pages light on slow connections. */
:root {
  --navy: #0f2a4a;
  --navy-2: #1a3a60;
  --teal: #0a6e69;
  --teal-dark: #08534f;
  --teal-soft: #e3f3f2;
  --orange: #b9470b;
  --orange-soft: #fdeee3;
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #1b2733;
  --muted: #4b5a6b;
  --line: #d9dfe7;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #8a5300;
  --amber-soft: #fff4dc;
  --green: #1e7a3a;
  --green-soft: #e6f4ea;
  --blue: #1d4f91;
  --blue-soft: #e7eef9;
  --grey-soft: #eef0f3;
  --purple: #5b3a99;
  --purple-soft: #efe9fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 42, 74, .06), 0 2px 8px rgba(15, 42, 74, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --focus: 0 0 0 3px #ffb37a;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--text); background: var(--bg); }
img { max-width: 100%; }
a { color: var(--teal); }
a:hover { color: var(--teal-dark); }
h1, h2, h3, h4 { color: var(--navy); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 6px; z-index: 1000; }
.skip-link:focus { top: 8px; color: #fff; }
.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 2px solid transparent; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--grey-soft); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--grey-soft); color: var(--navy); }
.btn-danger { background: var(--red); color: #fff; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Public header ---------- */
.announcement { background: var(--orange-soft); color: #6b2a05; text-align: center; padding: 8px 16px; font-size: .95rem; border-bottom: 1px solid #f3c9a8; }
.announcement[hidden] { display: none; }
.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.logo:hover { color: #fff; }
.logo-mark { width: 32px; height: 32px; flex: none; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { color: #dfe8f2; text-decoration: none; padding: 10px 12px; border-radius: 6px; font-weight: 500; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: #fff; background: var(--navy-2); }
.site-nav .btn-primary { color: #fff; margin-left: 6px; }
.site-nav .btn-primary:hover { background: var(--teal-dark); }
.nav-toggle { display: none; background: transparent; border: 2px solid #3b5878; color: #fff; border-radius: 8px; min-height: 44px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; }
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--navy); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; border-top: 1px solid var(--navy-2); }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px; }
  .site-nav .btn-primary { margin: 8px 0 0; }
}

/* ---------- Public sections ---------- */
.hero { background: linear-gradient(180deg, var(--navy) 0%, #163a63 100%); color: #e8eef5; padding: 56px 0 64px; }
.hero h1 { color: #fff; max-width: 15em; }
.hero .lead { font-size: 1.15rem; max-width: 36em; color: #d2deea; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 8px; }
.hero .btn-secondary { background: transparent; color: #fff; border-color: #9fb6cf; }
.hero .btn-secondary:hover { background: var(--navy-2); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.tagline { color: #ffb37a; font-weight: 600; letter-spacing: .02em; margin-bottom: 12px; font-size: .95rem; }
section.block { padding: 56px 0; }
section.block.alt { background: #fff; }
.section-head { max-width: 42em; margin-bottom: 28px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.feature-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; margin-bottom: 12px; }
.feature-icon svg { width: 22px; height: 22px; }
.example { background: var(--bg); border-left: 3px solid var(--orange); padding: 10px 12px; border-radius: 0 6px 6px 0; font-size: .92rem; color: var(--muted); margin-top: 10px; }
.example strong { color: var(--text); }

/* Product preview on home page */
.preview { background: #fff; color: var(--text); border-radius: 14px; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); overflow: hidden; border: 1px solid #284a72; }
.preview-bar { background: var(--grey-soft); padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.sample-tag { background: var(--orange-soft); color: #7a3008; border: 1px solid #f0c3a2; font-weight: 700; font-size: .75rem; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.preview-body { padding: 14px; display: grid; gap: 12px; }
.preview-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.preview-stat { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.preview-stat b { display: block; font-size: 1.3rem; color: var(--navy); }
.preview-stat span { font-size: .78rem; color: var(--muted); }
.preview-list { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: 8px; }
.preview-list li { padding: 8px 10px; display: flex; justify-content: space-between; gap: 8px; align-items: center; border-bottom: 1px solid var(--line); font-size: .85rem; }
.preview-list li:last-child { border-bottom: 0; }
.preview-list .ref { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); font-size: .78rem; }

/* Workflow steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; position: relative; padding: 16px 16px 16px 68px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.steps li::before { content: counter(step); position: absolute; left: 16px; top: 14px; width: 36px; height: 36px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; }
.steps h3 { margin-bottom: 4px; }
.steps p { margin: 0; color: var(--muted); }

/* Pricing */
.pricing { display: grid; grid-template-columns: repeat(2, minmax(0, 380px)); gap: 24px; justify-content: center; }
@media (max-width: 760px) { .pricing { grid-template-columns: 1fr; } }
.plan { position: relative; display: flex; flex-direction: column; }
.plan.best { border: 2px solid var(--orange); }
.best-badge { position: absolute; top: -14px; left: 20px; background: var(--orange); color: #fff; font-weight: 700; font-size: .85rem; padding: 4px 12px; border-radius: 999px; }
.price { font-size: 2.4rem; font-weight: 800; color: var(--navy); line-height: 1.1; margin: 8px 0 2px; }
.price small { font-size: 1rem; font-weight: 600; color: var(--muted); }
.billing-note { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.equiv { font-size: .9rem; color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 8px; }
.checklist li { padding-left: 28px; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-weight: 800; display: grid; place-items: center; font-size: .8rem; }
.plan .btn { margin-top: auto; }
.faq details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 600; color: var(--navy); list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--teal); }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 16px 14px; color: var(--muted); }

.notice { border-radius: 8px; padding: 12px 14px; border: 1px solid; margin: 0 0 16px; }
.notice-info { background: var(--blue-soft); border-color: #b8cbe8; color: #17375f; }
.notice-warn { background: var(--amber-soft); border-color: #f0d18f; color: #5e3900; }
.notice-ok { background: var(--green-soft); border-color: #a8d5b5; color: #14532b; }
.notice-error { background: var(--red-soft); border-color: #f2b8b2; color: #7a1a12; }

.cta { background: var(--navy); color: #dbe5ef; border-radius: 14px; padding: 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.cta h2 { color: #fff; margin: 0; }

.page-head { background: #fff; border-bottom: 1px solid var(--line); padding: 40px 0 28px; }
.page-head p { max-width: 42em; color: var(--muted); font-size: 1.05rem; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; font-size: 1.3rem; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 6px; color: var(--navy); }
.field .hint { display: block; font-size: .85rem; color: var(--muted); margin: -2px 0 6px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=datetime-local], input[type=search], input[type=number], input[type=file], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1.5px solid #9aa8b8; border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); }
.field-error { color: var(--red); font-size: .88rem; margin-top: 4px; display: none; }
.field.invalid .field-error { display: block; }
.req { color: var(--red); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .radio-cards { grid-template-columns: 1fr; } }
.radio-card { position: relative; border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; cursor: pointer; display: block; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.radio-card:has(input:focus-visible) { box-shadow: var(--focus); }

/* ---------- Footer ---------- */
.site-footer { background: #0b1f37; color: #b9c7d6; padding: 40px 0 24px; margin-top: 0; }
.site-footer a { color: #dce6f0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.site-footer h4 { color: #fff; font-size: .95rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.footer-bottom { border-top: 1px solid #22395a; margin-top: 24px; padding-top: 16px; font-size: .88rem; }

/* ---------- Offline banner ---------- */
.offline-banner { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 500; max-width: calc(100% - 32px); }
.offline-banner[hidden] { display: none; }

/* ---------- Status badges (text + symbol + colour) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }
.badge::before { font-size: .75em; }
.b-grey { background: var(--grey-soft); color: #3d4a59; border-color: #d3d8df; }
.b-blue { background: var(--blue-soft); color: var(--blue); border-color: #c3d3ec; }
.b-teal { background: var(--teal-soft); color: var(--teal-dark); border-color: #b5ddda; }
.b-amber { background: var(--amber-soft); color: var(--amber); border-color: #efd497; }
.b-red { background: var(--red-soft); color: var(--red); border-color: #f1bdb7; }
.b-green { background: var(--green-soft); color: var(--green); border-color: #b4dcbf; }
.b-purple { background: var(--purple-soft); color: var(--purple); border-color: #d8cbef; }
.b-orange { background: var(--orange-soft); color: #8a3507; border-color: #f1c6a6; }
.b-lock { background: #2c3e55; color: #fff; }

/* =================================================================
   APPLICATION SHELL
   ================================================================= */
.app-body { background: var(--bg); }
.demo-ribbon { background: var(--orange-soft); color: #6b2a05; border-bottom: 1px solid #f0c3a2; padding: 6px 16px; font-size: .88rem; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; justify-content: space-between; }
.demo-ribbon label { font-weight: 600; }
.demo-ribbon select { width: auto; min-height: 34px; padding: 4px 8px; font-size: .88rem; }
.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: calc(100vh - 40px); }
.sidebar { background: var(--navy); color: #cfdbe7; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .logo { padding: 16px; }
.ws-switch { margin: 0 12px 12px; }
.ws-switch label { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #93a9c1; display: block; margin-bottom: 4px; }
.ws-switch select { background: var(--navy-2); color: #fff; border-color: #3b5878; min-height: 40px; font-size: .9rem; }
.side-nav { list-style: none; margin: 0; padding: 4px 8px 16px; display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; color: #d4e0ec; text-decoration: none; border-radius: 7px; font-weight: 500; font-size: .95rem; }
.side-nav a:hover { background: var(--navy-2); color: #fff; }
.side-nav a[aria-current="page"] { background: var(--teal); color: #fff; }
.side-nav svg { width: 18px; height: 18px; flex: none; }
.side-nav .count { margin-left: auto; background: var(--orange); color: #fff; font-size: .72rem; padding: 1px 7px; border-radius: 999px; font-weight: 700; }
.side-sep { border-top: 1px solid #22416a; margin: 8px 12px; }
.side-foot { margin-top: auto; padding: 12px 16px; font-size: .85rem; color: #9fb3c8; border-top: 1px solid #22416a; }

.main { min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; }
.topbar .menu-btn { display: none; }
.topbar-search { flex: 1; max-width: 460px; }
.topbar-search input { min-height: 40px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .7rem; }
.view { padding: 24px; max-width: 1280px; }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.view-head h1 { font-size: 1.6rem; margin: 0; }
.view-head p { margin: 4px 0 0; color: var(--muted); }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 200; transform: translateX(-100%); transition: transform .15s ease-out; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 9999px rgba(10, 25, 45, .45); }
  .topbar { padding: 8px 12px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar-search { display: none; }
  .view { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Dashboard */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filters .field label { font-size: .8rem; margin-bottom: 3px; }
.filters select, .filters input { min-height: 40px; padding: 7px 10px; font-size: .92rem; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { display: block; text-decoration: none; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-top: 4px solid var(--c, var(--teal)); }
.stat-card:hover { border-color: var(--teal); color: var(--text); }
.stat-card .num { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.stat-card .lbl { font-weight: 600; font-size: .92rem; }
.stat-card .sub { font-size: .8rem; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-head h2 { font-size: 1.02rem; margin: 0; }
.panel-body { padding: 12px 16px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 36px; gap: 10px; align-items: center; margin: 7px 0; font-size: .9rem; }
.bar-track { background: var(--grey-soft); border-radius: 4px; height: 14px; overflow: hidden; }
.bar-fill { background: var(--teal); height: 100%; }
.bar-fill.alt { background: var(--navy-2); }
.legend { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
.trend svg { width: 100%; height: auto; display: block; }

/* Tables */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { background: #f7f9fb; color: var(--navy); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
table.data tbody tr:hover { background: #fafcfd; }
table.data a.rowlink { font-weight: 600; text-decoration: none; color: var(--navy); }
table.data a.rowlink:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; font-size: .9rem; color: var(--muted); flex-wrap: wrap; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

/* Mobile cards for tables */
@media (max-width: 720px) {
  table.data.responsive thead { display: none; }
  table.data.responsive tr { display: block; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  table.data.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; }
  table.data.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: .82rem; flex: none; }
  table.data.responsive td.td-main { display: block; padding-bottom: 6px; }
  table.data.responsive td.td-main::before { content: none; }
}

/* Detail page */
.detail-head { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.detail-head h1 { font-size: 1.4rem; margin: 4px 0 10px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: .9rem; }
.meta-row dt { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.meta-row dd { margin: 0; font-weight: 600; }
.meta-row > div { min-width: 110px; }
.actions-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--teal); }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; font-size: .9rem; }
.kv dd { margin: 0; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 8px; } }

/* Conversation: internal vs external must look different */
.thread { display: grid; gap: 12px; }
.msg { border-radius: var(--radius); padding: 12px 14px; border: 1px solid var(--line); background: #fff; }
.msg-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .85rem; margin-bottom: 6px; color: var(--muted); }
.msg-head strong { color: var(--text); }
.msg.internal { background: #fffbea; border-color: #ecd98f; border-left: 5px solid #c79a00; }
.msg.external { background: #fff; border-color: #a9c4e6; border-left: 5px solid var(--blue); }
.msg.draft { background: #f7f7f7; border-style: dashed; border-left: 5px dashed #8a96a3; }
.msg.activity { background: transparent; border: 0; padding: 2px 0; font-size: .88rem; color: var(--muted); }
.msg p { margin: 0; white-space: pre-wrap; }
.mention { background: var(--teal-soft); color: var(--teal-dark); padding: 0 3px; border-radius: 3px; font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 4px 0 12px 16px; position: relative; font-size: .92rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.timeline time { color: var(--muted); font-size: .82rem; display: block; }

/* Board view */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.board-col { background: #e9edf2; border-radius: var(--radius); padding: 10px; }
.board-col h3 { font-size: .9rem; display: flex; justify-content: space-between; margin: 2px 4px 10px; }
.task-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; font-size: .9rem; }
.task-card a { font-weight: 600; text-decoration: none; color: var(--navy); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.cal .dow { background: #f7f9fb; font-weight: 700; font-size: .8rem; padding: 6px; text-align: center; color: var(--navy); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px; font-size: .78rem; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.other { background: #fafbfc; color: #98a3b0; }
.cal .day.today { background: var(--teal-soft); }
.cal .dnum { font-weight: 700; display: block; margin-bottom: 2px; }
.cal .ev { display: block; padding: 1px 4px; border-radius: 3px; margin-bottom: 2px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .cal .day { min-height: 60px; } .cal .ev { font-size: .68rem; } }
.agenda { display: none; }
@media (max-width: 560px) { .cal { display: none; } .agenda { display: block; } }

/* Dialog */
dialog.modal { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100% - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
dialog.modal::backdrop { background: rgba(10, 25, 45, .5); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-body { padding: 16px 20px; display: grid; gap: 14px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }
.icon-btn { background: none; border: 0; cursor: pointer; padding: 8px; min-width: 40px; min-height: 40px; border-radius: 6px; color: var(--navy); font-size: 1.3rem; line-height: 1; }
.icon-btn:hover { background: var(--grey-soft); }

.toast { position: fixed; right: 16px; bottom: 16px; background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 600; max-width: 360px; }
.toast[hidden] { display: none; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--navy); }
.progress { background: var(--grey-soft); border-radius: 6px; height: 12px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal); }
.progress.warn > span { background: var(--orange); }
.lock-note { font-size: .82rem; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.coming { display: inline-block; background: var(--grey-soft); color: var(--muted); border: 1px dashed #b5bfca; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.view-toggle button { border: 0; background: #fff; padding: 8px 14px; font: inherit; cursor: pointer; min-height: 40px; color: var(--muted); font-weight: 600; }
.view-toggle button[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* Admin */
.admin-wrap { max-width: 1000px; margin: 24px auto; padding: 0 16px; }
.sub-item { border: 1px solid var(--line); background: #fff; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.sub-item .msgtext { white-space: pre-wrap; background: var(--bg); border-radius: 6px; padding: 10px; margin: 8px 0; font-size: .92rem; }

@media print {
  .sidebar, .topbar, .demo-ribbon, .actions-bar, .filters, .no-print, .btn { display: none !important; }
  .app-shell { display: block; }
  .view { padding: 0; }
  .panel, .table-wrap { box-shadow: none; }
  body { background: #fff; }
}

/* Collapsible filter box (requests) */
.filter-box > summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: 8px 0; list-style: none; }
.filter-box > summary::before { content: "▸ "; }
.filter-box[open] > summary::before { content: "▾ "; }
.filter-box > summary::-webkit-details-marker { display: none; }
@media (min-width: 721px) { .filter-box > summary { display: none; } }
@media (max-width: 720px) {
  .demo-ribbon { font-size: .8rem; padding: 6px 12px; }
  .filters .field { max-width: none; flex: 1 1 140px; }
}
