/* LifeAdmin UK — Distinctive Civic Utility Stylesheet
   Built for T2 Automations. Non-negotiable: zero emoji icons, full theme toggle support, responsive <= 400px. */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --ink: #0f172a;
  --ink-secondary: #475569;
  --ink-muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.12);
  --crimson: #e11d48;
  --crimson-soft: rgba(225, 29, 72, 0.12);
  --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
  --bg: #070d18;
  --surface: #0f172a;
  --surface-alt: #1e293b;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --ink-muted: #94a3b8;
  --line: #1e293b;
  --line-strong: #334155;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.15);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.15);
  --crimson: #f43f5e;
  --crimson-soft: rgba(244, 63, 94, 0.15);
  --card-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: var(--font-sans); background-color: var(--bg); color: var(--ink); line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; padding: 1.25rem 1rem 3.5rem; display: flex; justify-content: center; }
.shell { width: 100%; max-width: 680px; }

/* Header & Meta */
.app-header { margin-bottom: 1.5rem; }
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.trust-pill { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.72rem; font-weight: 600; color: var(--ink-secondary); background: var(--surface); border: 1px solid var(--line); padding: 0.35rem 0.75rem; border-radius: 9999px; }
.pulse-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 2px var(--emerald-soft); }
.theme-toggle { background: var(--surface); border: 1px solid var(--line); color: var(--ink); padding: 0.4rem; border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.theme-icon { display: block; }
:root[data-theme="light"] .moon-icon { display: block; }
:root[data-theme="light"] .sun-icon { display: none; }
:root[data-theme="dark"] .moon-icon { display: none; }
:root[data-theme="dark"] .sun-icon { display: block; }

.brand-row { display: flex; align-items: center; gap: 0.9rem; }
.brand-badge { background: var(--surface-alt); border: 1px solid var(--line-strong); color: var(--accent); padding: 0.5rem; border-radius: var(--radius-md); display: grid; place-items: center; }
h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; }
.tagline { font-size: 0.8rem; color: var(--ink-muted); margin-top: 0.2rem; }

/* Tabs Navigation */
.tabs-nav { display: flex; gap: 0.4rem; background: var(--surface-alt); border: 1px solid var(--line); padding: 0.3rem; border-radius: var(--radius-md); margin-bottom: 1.25rem; }
.tab-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; background: transparent; border: none; border-radius: var(--radius-sm); padding: 0.65rem 0.5rem; font-family: var(--font-sans); font-size: 0.82rem; font-weight: 600; color: var(--ink-secondary); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.tab-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); border: 1px solid var(--line); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Card Surfaces */
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--card-shadow); }
.panel-intro { margin-bottom: 1.25rem; }
.intro-split { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.35rem; }
.panel-intro p { font-size: 0.85rem; color: var(--ink-secondary); line-height: 1.5; }

.progress-pill { background: var(--surface-alt); border: 1px solid var(--line); border-radius: 9999px; padding: 0.3rem 0.75rem; font-size: 0.75rem; font-weight: 700; color: var(--accent); white-space: nowrap; }
.progress-track { width: 100%; height: 6px; background: var(--surface-alt); border-radius: 9999px; overflow: hidden; margin-top: 0.5rem; }
.progress-fill { height: 100%; background: var(--emerald); transition: width 0.25s var(--ease); }

/* Moving Home Checklist */
.interactive-checklist { display: flex; flex-direction: column; gap: 0.75rem; }
.check-row { display: flex; align-items: flex-start; gap: 0.85rem; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0.85rem 1rem; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease; }
.check-row.done { background: var(--emerald-soft); border-color: rgba(5, 150, 105, 0.35); }
.check-row.priority { border-left: 4px solid var(--crimson); }
.task-checkbox { width: 18px; height: 18px; margin-top: 0.15rem; accent-color: var(--emerald); cursor: pointer; }
.task-label { flex: 1; font-size: 0.82rem; line-height: 1.45; cursor: pointer; }
.task-title-row { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.task-title-row strong { color: var(--ink); font-size: 0.88rem; }
.task-label p { font-size: 0.78rem; color: var(--ink-secondary); margin-bottom: 0.4rem; }
.task-links { display: flex; gap: 0.5rem; }
.link-gov-btn { font-size: 0.75rem; font-weight: 700; color: var(--accent); text-decoration: none; padding: 0.3rem 0.65rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* Status Badges */
.status-badge { font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 9999px; text-transform: uppercase; letter-spacing: 0.04em; }
.status-badge.amber { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(217, 119, 6, 0.25); }
.status-badge.green { background: var(--emerald-soft); color: var(--emerald); border: 1px solid rgba(5, 150, 105, 0.25); }
.status-badge.crimson { background: var(--crimson-soft); color: var(--crimson); border: 1px solid rgba(225, 29, 72, 0.25); }
.status-badge.blue { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(2, 132, 199, 0.25); }

/* Form Controls (Name Change) */
.form-container { margin-top: 1.25rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 0.75rem; }
.control-group { margin-bottom: 0.85rem; }
.control-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink); margin-bottom: 0.35rem; }
.text-field { width: 100%; font-family: var(--font-sans); font-size: 0.88rem; background: var(--surface-alt); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.7rem 0.85rem; color: var(--ink); outline: none; }
.text-field:focus { border-color: var(--accent); }

/* Organization Selector */
.org-button-group { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.org-btn { background: var(--surface-alt); border: 1px solid var(--line); color: var(--ink-secondary); font-family: var(--font-sans); font-size: 0.8rem; font-weight: 600; padding: 0.45rem 0.75rem; border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s ease; }
.org-btn.active { background: var(--surface); border-color: var(--accent); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* Letter Preview Box */
.letter-box { background: var(--surface-alt); border: 1px solid var(--line-strong); border-radius: var(--radius-md); margin-top: 1.25rem; overflow: hidden; }
.letter-header { display: flex; justify-content: space-between; align-items: center; padding: 0.65rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.letter-tag { font-size: 0.68rem; font-weight: 800; color: var(--accent); letter-spacing: 0.06em; }
.btn-copy { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--ink); color: var(--bg); border: none; font-family: var(--font-sans); font-size: 0.75rem; font-weight: 700; padding: 0.35rem 0.75rem; border-radius: var(--radius-sm); cursor: pointer; }
.letter-body { font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.6; color: var(--ink); padding: 1.25rem; white-space: pre-wrap; max-height: 380px; overflow-y: auto; }

.guidance-box { background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.85rem 1rem; margin-top: 1rem; font-size: 0.8rem; line-height: 1.5; color: var(--ink-secondary); }

/* Audit Stack */
.audit-stack { display: flex; flex-direction: column; gap: 0.85rem; }
.audit-item { background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 1.15rem; }
.audit-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.audit-header h3 { font-size: 1rem; font-weight: 700; color: var(--ink); }
.audit-item p { font-size: 0.82rem; color: var(--ink-secondary); line-height: 1.5; }
.audit-stat { margin-top: 0.65rem; font-size: 0.8rem; font-weight: 700; color: var(--emerald); }

/* Companion App Link */
.synergy-card { margin-top: 1.5rem; background: var(--surface-alt); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-md); padding: 1rem 1.15rem; }
.synergy-badge { font-size: 0.65rem; font-weight: 800; color: var(--accent); letter-spacing: 0.05em; margin-bottom: 0.25rem; }
.synergy-card h4 { font-size: 0.88rem; font-weight: 700; color: var(--ink); margin-bottom: 0.25rem; }
.synergy-card p { font-size: 0.78rem; color: var(--ink-secondary); line-height: 1.45; margin-bottom: 0.5rem; }
.synergy-cta { font-size: 0.78rem; font-weight: 700; color: var(--accent); text-decoration: none; }

/* Footer */
.app-footer { margin-top: 2rem; text-align: center; font-size: 0.78rem; color: var(--ink-muted); }
.footer-meta strong { color: var(--ink-secondary); }
.footer-meta p { font-size: 0.72rem; margin-top: 0.4rem; line-height: 1.45; }

/* Responsive Adjustments */
@media (hover: hover) {
  .theme-toggle:hover { border-color: var(--line-strong); }
  .tab-btn:hover:not(.active) { color: var(--ink); }
  .btn-copy:hover { filter: brightness(1.15); }
  .link-gov-btn:hover { background: var(--accent); color: #fff; }
  .synergy-cta:hover { text-decoration: underline; }
}

@media (max-width: 540px) {
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  body { padding-inline: 0.65rem; }
  .tab-btn { font-size: 0.75rem; padding: 0.55rem 0.35rem; }
  .tab-btn svg { display: none; }
  .check-row { flex-direction: column; }
  .link-gov-btn { align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
