/* V0.2 interface layer. Existing records, chart components and layouts are retained. */
:root {
  --bg: #f4f5f6;
  --ink: #243243;
  --muted: #7a838d;
  --line: #e3e6e9;
  --teal: #234c7f;
  --teal-soft: #edf1f5;
  --sidebar: #172a42;
  --radius: 20px;
  --shadow: 0 5px 24px #24344804, 0 1px 3px #24344803;
}
body { background: radial-gradient(ellipse at 100% 0, #e6ebf0 0, transparent 36%), var(--bg); }
button, a, input, select, textarea { touch-action: manipulation; }
button, a { transition: background .2s, color .2s, box-shadow .2s, transform .2s; }
button:active:not(:disabled), .primary:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; }
.primary { background: #234c7f; box-shadow: 0 4px 12px #234c7f15; border: 1px solid #ffffff12; }
.primary:hover { box-shadow: 0 6px 18px #234c7f26; transform: translateY(-1px); }
.secondary { background: #ffffffc9; }
.card { border-color: #e0e3e7; box-shadow: var(--shadow); }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.nav-icon { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sidebar {
  position: fixed; inset: 12px auto 12px 12px; width: 72px; border-radius: 23px;
  padding: 23px 12px 15px; background: linear-gradient(165deg, #21354d, #13263d 84%);
  z-index: 40; overflow: hidden; box-shadow: 0 9px 36px #182a4015;
  transition: width .22s ease, box-shadow .22s;
}
.sidebar:hover, .sidebar:focus-within, .nav-pinned .sidebar { width: 248px; box-shadow: 0 16px 42px #17294029; }
.sidebar .brand { height: 36px; width: 219px; gap: 16px; padding-left: 8px; font-size: 19px; color: #f4f7fb; }
.sidebar .brand img { width: 31px; height: 31px; border-radius: 10px; }
.sidebar .version { height: 15px; min-height: 15px; margin: 5px 0 13px 55px; white-space: nowrap; color: #9ca9b8; font-size: 8px; letter-spacing: 1px; opacity: 0; transition: opacity .2s; }
.sidebar .nav-label { opacity: 0; white-space: nowrap; transition: opacity .15s; pointer-events: none; }
.sidebar:hover .nav-label, .sidebar:focus-within .nav-label, .nav-pinned .sidebar .nav-label,
.sidebar:hover .version, .sidebar:focus-within .version, .nav-pinned .sidebar .version { opacity: 1; pointer-events: auto; }
.pin-nav { color: #a7b3c2; display: flex; align-items: center; gap: 23px; height: 29px; flex-shrink: 0; width: 219px; padding: 0 17px; margin-bottom: 15px; font-size: 15px; text-align: left; }
.pin-nav .nav-label { font-size: 10px; }
.pin-nav[aria-pressed=true] { color: #99b8df; }
.sidebar nav { overflow: auto; scrollbar-width: none; display: flex; flex-direction: column; gap: 5px; margin: 0; }
.sidebar nav button { position: relative; width: 48px; min-height: 43px; padding: 11px 13px; gap: 18px; border-radius: 12px; color: #9eacbd; font-size: 12px; flex-shrink: 0; }
.sidebar:hover nav button, .sidebar:focus-within nav button, .nav-pinned .sidebar nav button { width: 224px; }
.sidebar nav button.active { color: #ecf5ff; background: #a5bedc1c; }
.sidebar nav button.active:before { content: ''; display: block; left: -12px; width: 3px; height: 17px; background: #90b4df; }
.sidebar nav button:hover { color: #f5f8fb; background: #ffffff0a; }
.sidebar nav .badge { display: none; }
.sidebar:hover .badge, .sidebar:focus-within .badge, .nav-pinned .sidebar .badge { display: inline; }
.sidebar-foot { flex-shrink: 0; margin-top: auto; padding-top: 17px; gap: 16px; width: 224px; }
.sidebar-foot .avatar { width: 36px; height: 36px; margin-left: 5px; background: #cfdae7; color: #213348; font-weight: 700; }
.sidebar-foot small { color: #909caa; }
.sidebar-foot>button:last-child { margin-right: 8px; }
main { margin-left: 100px; max-width: 1550px; padding: 28px 42px 24px; transition: margin-left .22s ease; }
.nav-pinned main { margin-left: 276px; }
.workspace-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 24px; color: #899099; font-size: 10px; letter-spacing: .9px; }
.workspace-line i { padding: 0 11px; font-style: normal; color: #bbc1c8; }
.workspace-account { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: #fff9; border: 1px solid #dde2e7; border-radius: 30px; color: #636e7b; font-size: 10px; letter-spacing: 0; }
.status-dot { display: inline-block; width: 6px; height: 6px; background: #718baa; border-radius: 50%; }
.topbar { margin-bottom: 28px; align-items: center; }
.topbar .eyebrow { font-size: 10px; letter-spacing: 1px; color: #8c939b; margin-bottom: 8px; }
.topbar h1 { font-size: clamp(23px, 2vw, 30px); font-weight: 600; letter-spacing: -.9px; }
.topbar>.secondary { border-radius: 12px; padding: 11px 17px; }
.welcome-strip { display: flex; gap: 20px; align-items: center; color: #878d95; font-size: 11px; padding-bottom: 17px; }
.welcome-strip>span:first-child { font-size: 9px; letter-spacing: 1.4px; color: #89929e; font-weight: 700; }
.live-label { margin-left: auto; font-size: 9px; white-space: nowrap; }
.live-label i { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #7b92ad; margin-right: 7px; box-shadow: 0 0 0 4px #7b92ad11; }
.composer { position: relative; overflow: hidden; padding: 28px; background: linear-gradient(120deg, #fff 45%, #ebf0f6 100%); border-color: #d6dde5; }
.composer:before { content: ''; position: absolute; top: -72px; right: -60px; width: 200px; height: 200px; border: 1px solid #a7b5c62b; border-radius: 50%; box-shadow: 0 0 0 26px #a7b5c60c, 0 0 0 58px #a7b5c609; pointer-events: none; }
.composer .section-heading { position: relative; }
.composer h2 { font-size: 21px; font-weight: 600; letter-spacing: -.5px; }
.composer textarea { background: #f3f5f7; border: 1px solid #e2e6ec; min-height: 92px; border-radius: 13px; font-size: 14px; padding: 18px; }
.composer textarea:focus { border-color: #92a1b4; box-shadow: 0 0 0 4px #94a3b50c; }
.examples button { border-radius: 20px; color: #76808c; padding: 5px 11px; background: #ffffffb3; border-color: #dde2e8; }
.composer .micro { margin-top: 13px; font-size: 10px; color: #8d939b; }
.composer .pill { background: #dbe4ef; color: #5e6e81; }
.dashboard-grid { grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); gap: 20px; }
.dashboard-grid>.card { padding: 25px; min-height: 254px; }
.dashboard-grid>.card h2 { font-size: 15px; }
.dashboard-grid>.card:nth-child(4n+1) { border-top-color: #ccd3dc; }
.dashboard-grid>.card:nth-child(4n+2) { border-top-color: #d5dce5; }
.metric strong { font-size: 32px; font-weight: 550; letter-spacing: -1.3px; line-height: 1.65; }
.metric small { color: #9198a0; }
.metric .unit { color: #9aa0a8; font-weight: 400; }
.metric-row { margin: 15px 0 20px; }
.progress { height: 6px; background: #ebeef2; }
.progress>span { background: linear-gradient(90deg, #8ea1b9, #4e6d93); }
.timeline { border-bottom-color: #ebeef1; }
.timeline small { display: block; margin-top: 2px; }
.subtle-link { font-size: 10px; }
.pill { font-size: 10px; background: #ebeff4; }
.onboarding { background: #e9eef5; border-color: #d6dee8; }
.chart .bar { filter: saturate(.83); }
.chart-card { margin-top: 18px; }
.record-icon { border-radius: 12px; }
.record-card { transition: border-color .2s, box-shadow .2s; }
.record-card:hover { border-color: #b9c3d0; box-shadow: 0 7px 26px #24344808; }
.record-sync { margin: 12px 0 0; padding: 9px 11px; background: #edf1f6; border-radius: 9px; font-size: 10px; color: #677485; overflow-wrap: anywhere; }
.record-sync .sync-target { display: block; font-size: 9px; margin-top: 3px; opacity: .8; }
.draft-expiry { font-size: 9px; color: #9ca2aa; margin-top: 9px; }
.settings-intro { margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(115deg,#fff,#e9eff6); }
.settings-intro .muted { font-size: 12px; margin-top: 8px; }
.account-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.account-hero { grid-column: 1/-1; display: flex; justify-content: space-between; align-items: center; gap: 20px; background: linear-gradient(110deg,#1f324a,#2c425e); color: #e9eef5; border: 0; padding: 28px; }
.account-hero .eyebrow { color: #b3bfce; }
.account-hero h2 { font-size: 24px; font-weight: 550; }
.account-hero .muted { color: #a5b2c1; font-size: 12px; }
.account-hero .avatar-large { width: 64px; height: 64px; border: 1px solid #ffffff26; border-radius: 22px; display: grid; place-items: center; background: #cddff415; font-size: 25px; }
.account-card h2 { margin-bottom: 10px; font-size: 17px; }
.account-card>.muted { font-size: 12px; margin-bottom: 16px; }
.security-row { padding: 15px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.security-row h3 { font-size: 13px; }
.security-row small { color: var(--muted); overflow-wrap: anywhere; display: block; font-size: 10px; }
.security-row button { font-size: 11px; }
.account-card .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.policy-options { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.policy-options .check { border: 1px solid #e0e5eb; padding: 7px 10px; border-radius: 9px; font-size: 11px; }
.mode-card { background: #ebf0f6; border: 1px solid #d9e0e8; border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.mode-card strong { font-size: 12px; display: block; }
.mode-card p { font-size: 11px; color: #878f99; margin-top: 5px; }
.policy-list { margin-top: 20px; }
.policy-item { border-top: 1px solid var(--line); padding: 13px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.policy-item h3 { font-size: 12px; }
.policy-item p { font-size: 10px; color: var(--muted); word-break: break-word; margin-top: 3px; }
.policy-item button { font-size: 10px; }
.security-qr { display: block; width: 180px; height: 180px; border: 1px solid var(--line); margin: 15px auto; }
.recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; background: #f2f4f7; padding: 15px; border-radius: 12px; margin: 15px 0; }
.recovery-codes code { font-size: 11px; overflow-wrap: anywhere; }
.secret-code { word-break: break-all; display: block; padding: 12px; border-radius: 9px; background: #f2f4f7; font-size: 12px; }
#account-dialog { width: 540px; }
#account-dialog .dialog-footer { flex-wrap: wrap; }
.account-table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line); }
.account-table { border-collapse: collapse; width: 100%; font-size: 11px; text-align: left; }
.account-table th { color: #848d98; background: #f1f4f8; white-space: nowrap; font-size: 10px; }
.account-table th, .account-table td { padding: 12px 14px; border-bottom: 1px solid #e5e9ee; }
.account-table td { overflow-wrap: anywhere; }
.admin-stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.admin-stat-grid strong { display: block; font-size: 27px; font-weight: 550; }
.admin-stat-grid p { font-size: 11px; color: var(--muted); }
.admin-user-actions { display: flex; gap: 6px; align-items: center; min-width: 260px; }
.admin-user-actions input { width: 65px; font-size: 11px; padding: 7px; }
.admin-user-actions select { max-width: 110px; font-size: 11px; padding: 7px; }
.admin-user-actions button { white-space: nowrap; font-size: 10px; }
.auth-shell { background: #f7f9fb; }
.auth-story { background: linear-gradient(145deg,#21354d 0,#14273e 70%); overflow: hidden; position: relative; }
.auth-story:after { content: ''; position: absolute; width: 500px; height: 500px; border: 1px solid #d2e0f112; border-radius: 50%; right: -245px; bottom: -230px; box-shadow: 0 0 0 64px #b1cbea06,0 0 0 128px #b1cbea04; pointer-events: none; }
.auth-story h1 { font-weight: 500; letter-spacing: -1.6px; }
.auth-story .eyebrow { color: #a5b4c7; }
.auth-story .story-cards>div { background: #ffffff05; border-color: #ffffff10; border-radius: 14px; }
.auth-story .story-cards b { color: #b6c9e0; }
.auth-panel>div { width: 100%; max-width: 370px; }
.auth-panel h2 { font-weight: 550; }
.auth-divider { display: flex; align-items: center; gap: 13px; font-size: 10px; color: #999fa6; margin: 9px 0 16px; }
.auth-divider:before,.auth-divider:after { content: ''; height: 1px; background: #dee3ea; flex: 1; }
#google-signin { display: flex; justify-content: center; min-height: 42px; }
#google-login-hint { text-align: center; font-size: 10px; }
#google-login-hint:empty { display: none; }
.consent-page { display: grid; min-height: 100dvh; place-items: center; padding: 30px 16px; }
.consent-page main { margin: 0; max-width: 600px; padding: 32px; width: 100%; }
.consent-scopes { margin: 20px 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.consent-scopes li { background: #eff3f7; border: 1px solid #dee3ea; padding: 12px 16px; border-radius: 12px; }
.consent-scopes strong { display: block; font-size: 12px; }
.consent-scopes small { color: var(--muted); font-size: 11px; }
.page-footer { color: #a1a7af; margin-top: 32px; }
.mobile-nav { display: none; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more-grid button { display: flex; align-items: center; gap: 12px; text-align: left; padding: 16px; background: #edf1f5; border-radius: 12px; color: #526275; font-size: 12px; }
dialog::backdrop { background: #192a3f55; backdrop-filter: blur(5px); }
dialog[open] { animation: dialog-enter .22s ease-out; }
.view { animation: v02-enter .35s ease-out; }
.dashboard-grid>.card { animation: v02-enter .5s backwards; }
.dashboard-grid>.card:nth-child(2) { animation-delay: .04s; }
.dashboard-grid>.card:nth-child(3) { animation-delay: .08s; }
.dashboard-grid>.card:nth-child(4) { animation-delay: .12s; }
@keyframes v02-enter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(12px) scale(.99); } to { opacity: 1; transform: none; } }
@media (min-width: 1600px) { main { margin-right: auto; } }
@media (max-width: 1100px) {
  main { padding: 24px 27px; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .composer-footer { flex-wrap: wrap; }
  .account-grid { grid-template-columns: 1fr; }
  .admin-stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 820px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .welcome-strip>p { display: none; }
  .composer-footer .examples { max-width: 100%; }
}
@media (max-width: 700px) {
  .sidebar { display: none; }
  main, .nav-pinned main { margin: 0; padding: 19px 16px calc(100px + env(safe-area-inset-bottom)); max-width: none; }
  .workspace-line { padding-bottom: 19px; font-size: 8px; letter-spacing: .6px; }
  .workspace-line i { padding: 0 6px; }
  .workspace-account { font-size: 9px; padding: 6px 9px; }
  .topbar { gap: 10px; margin-bottom: 20px; }
  .topbar h1 { font-size: clamp(19px,5.1vw,25px); line-height: 1.45; letter-spacing: -.7px; }
  .topbar .eyebrow { font-size: 9px; letter-spacing: 0; margin-bottom: 7px; }
  .topbar>.secondary { font-size: 10px; padding: 9px 11px; min-height: 38px; }
  .welcome-strip { padding-bottom: 12px; }
  .welcome-strip>span:first-child { font-size: 8px; }
  .live-label { font-size: 8px; }
  .card { border-radius: 16px; padding: 20px; }
  .composer { padding: 20px; margin-bottom: 18px; }
  .composer h2 { font-size: 17px; }
  .composer .eyebrow { font-size: 8px; }
  .composer textarea { min-height: 108px; padding: 13px; font-size: 13px; }
  .composer .pill { font-size: 8px; padding: 4px 8px; }
  .examples { gap: 5px; }
  .examples button { font-size: 9px; padding: 6px 8px; }
  .composer-footer>.row { width: 100%; justify-content: space-between; }
  .dashboard-grid { gap: 15px; }
  .dashboard-grid>.card { padding: 21px; min-height: 230px; }
  .metric strong { font-size: 30px; }
  .mobile-nav { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); position: fixed; z-index: 50;
    bottom: 0; left: 0; right: 0; padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    background: #fffffff2; border-top: 1px solid #dbe0e7; backdrop-filter: blur(18px); box-shadow: 0 -5px 25px #24344806; }
  .mobile-nav button { padding: 6px 2px; color: #979ea6; display: flex; align-items: center; flex-direction: column; gap: 4px; font-size: 9px; border-radius: 12px; min-height: 48px; }
  .mobile-nav .nav-icon { width: 20px; height: 20px; }
  .mobile-nav button.active { color: #2e4f77; background: #e7edf4; }
  .mobile-nav button:focus-visible { outline-offset: -2px; }
  .more-sheet { position: fixed; top: auto; bottom: 0; margin: 0; width: 100%; max-width: none; max-height: 85dvh; padding: 25px 20px calc(27px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; }
  .more-grid button { min-height: 65px; }
  #toast { bottom: calc(90px + env(safe-area-inset-bottom)); left: 50%; font-size: 11px; padding: 12px 15px; }
  dialog { max-height: calc(100dvh - 28px); }
  .settings-intro { flex-direction: column; align-items: flex-start; gap: 15px; }
  .account-hero { padding: 24px 20px; }
  .account-hero h2 { font-size: 22px; }
  .account-card .form-grid { grid-template-columns: 1fr 1fr; }
  .admin-stat-grid { gap: 12px; }
  .admin-stat-grid .card { padding: 17px; }
  .admin-stat-grid strong { font-size: 25px; }
  .consent-page main { padding: 24px; }
  .auth-story { padding: 78px 27px 29px; }
  .auth-story h1 { font-size: 28px; }
  .auth-panel { padding: 30px 27px 40px; display: flex; justify-content: center; }
  .page-footer { margin-top: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
