/* Life Assistant 2.11.0 visual system: responsive surfaces, motion and accessibility. */
:root {
  --font-body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --content-max: 1440px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --radius-xl: 36px;
  --duration-fast: 140ms;
  --duration-normal: 220ms;
  --duration-slow: 360ms;
  --ease-standard: cubic-bezier(.2, .8, .2, 1);
  --ease-emphasized: cubic-bezier(.16, 1, .3, 1);
  --focus-ring: 0 0 0 4px color-mix(in srgb, var(--primary), transparent 72%);
  --surface-raised: color-mix(in srgb, var(--surface-solid), transparent 2%);
  --surface-glass: color-mix(in srgb, var(--surface-solid), transparent 12%);
  --shadow-card: 0 1px 2px rgba(24, 28, 55, .04), 0 12px 30px rgba(24, 28, 55, .07);
  --shadow-hover: 0 2px 4px rgba(24, 28, 55, .05), 0 20px 46px rgba(24, 28, 55, .12);
  --shadow-float: 0 28px 90px rgba(21, 24, 50, .24);
  font-family: var(--font-body);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fb;
  --surface: rgba(255, 255, 255, .90);
  --surface-solid: #ffffff;
  --surface-soft: #f0f2f8;
  --text: #16192a;
  --muted: #697086;
  --line: rgba(30, 35, 65, .10);
  --primary: #6657e8;
  --primary-strong: #5040d9;
  --primary-soft: #ece9ff;
  --work: #2878dc;
  --success: #16845a;
  --warning: #a86b08;
  --danger: #c83f59;
  --surface-raised: #ffffff;
  --surface-glass: rgba(255, 255, 255, .82);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101426;
  --surface: rgba(25, 30, 52, .90);
  --surface-solid: #191e34;
  --surface-soft: #222943;
  --text: #f5f7ff;
  --muted: #a7aec7;
  --line: rgba(224, 228, 255, .11);
  --primary: #8b7fff;
  --primary-strong: #aaa1ff;
  --primary-soft: #312d5e;
  --work: #69a8ff;
  --success: #55d39d;
  --warning: #efbd5e;
  --danger: #ff7891;
  --surface-raised: #1d233b;
  --surface-glass: rgba(25, 30, 52, .82);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .18), 0 14px 34px rgba(0, 0, 0, .22);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .22), 0 22px 54px rgba(0, 0, 0, .34);
  --shadow-float: 0 30px 96px rgba(0, 0, 0, .55);
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
    --bg: #101426;
    --surface: rgba(25, 30, 52, .90);
    --surface-solid: #191e34;
    --surface-soft: #222943;
    --text: #f5f7ff;
    --muted: #a7aec7;
    --line: rgba(224, 228, 255, .11);
    --primary: #8b7fff;
    --primary-strong: #aaa1ff;
    --primary-soft: #312d5e;
    --work: #69a8ff;
    --success: #55d39d;
    --warning: #efbd5e;
    --danger: #ff7891;
    --surface-raised: #1d233b;
    --surface-glass: rgba(25, 30, 52, .82);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .18), 0 14px 34px rgba(0, 0, 0, .22);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .22), 0 22px 54px rgba(0, 0, 0, .34);
    --shadow-float: 0 30px 96px rgba(0, 0, 0, .55);
  }
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --bg: #f5f6fb;
    --surface: rgba(255, 255, 255, .90);
    --surface-solid: #ffffff;
    --surface-soft: #f0f2f8;
    --text: #16192a;
    --muted: #697086;
    --line: rgba(30, 35, 65, .10);
    --primary: #6657e8;
    --primary-strong: #5040d9;
    --primary-soft: #ece9ff;
    --work: #2878dc;
    --success: #16845a;
    --warning: #a86b08;
    --danger: #c83f59;
    --surface-raised: #ffffff;
    --surface-glass: rgba(255, 255, 255, .82);
  }
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  letter-spacing: -.005em;
  background:
    radial-gradient(circle at 8% -5%, color-mix(in srgb, var(--primary), transparent 86%), transparent 31rem),
    radial-gradient(circle at 102% 105%, color-mix(in srgb, var(--work), transparent 88%), transparent 36rem),
    var(--bg);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .32;
  background-image: linear-gradient(color-mix(in srgb, var(--line), transparent 58%) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--line), transparent 58%) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 66%);
}

::selection { color: white; background: var(--primary); }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--primary), transparent 42%) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: color-mix(in srgb, var(--primary), transparent 42%); background-clip: padding-box; }

.skip-link {
  position: fixed;
  z-index: 999;
  top: max(10px, var(--safe-top));
  left: max(10px, var(--safe-left));
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-standard);
}
.skip-link:focus { transform: translateY(0); }

button, a, input, select, textarea { transition: border-color var(--duration-fast) var(--ease-standard), background-color var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), opacity var(--duration-fast) var(--ease-standard); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .52; }

.desktop-sidebar {
  padding: 22px 16px;
  border-right-color: color-mix(in srgb, var(--line), transparent 18%);
  background: var(--surface-glass);
  box-shadow: inset -1px 0 color-mix(in srgb, white, transparent 92%);
}
.brand { min-height: 58px; border-radius: 18px; }
.brand-mark { box-shadow: 0 12px 30px color-mix(in srgb, var(--primary), transparent 68%); }
.side-nav { gap: 5px; overflow: auto; padding: 2px; }
.nav-button { min-height: 46px; border-radius: 14px; position: relative; }
.nav-button::before { content: ""; position: absolute; left: 3px; width: 3px; height: 0; border-radius: 999px; background: var(--primary); transition: height var(--duration-normal) var(--ease-emphasized); }
.nav-button.active::before { height: 22px; }
.nav-button.active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary), transparent 78%); }
.primary-action { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--work), white 8%)); box-shadow: 0 16px 36px color-mix(in srgb, var(--primary), transparent 72%); }
.sync-pill { border: 1px solid var(--line); background: color-mix(in srgb, var(--surface-soft), transparent 10%); }

.topbar { min-height: 76px; background: color-mix(in srgb, var(--bg), transparent 20%); box-shadow: 0 1px 0 var(--line); }
.topbar > * { min-width: 0; }
.search-box { min-width: 220px; border-radius: 16px; background: var(--surface-glass); box-shadow: 0 1px 0 color-mix(in srgb, white, transparent 92%); }
.search-box:focus-within { border-color: color-mix(in srgb, var(--primary), transparent 34%); box-shadow: var(--focus-ring); }
.icon-button { border-radius: 15px; background: var(--surface-glass); }
.workspace-switcher { border: 1px solid color-mix(in srgb, var(--line), transparent 18%); }
.workspace-button.active { box-shadow: 0 5px 16px rgba(30, 34, 70, .10), inset 0 0 0 1px color-mix(in srgb, var(--line), transparent 25%); }

.content { width: min(100%, var(--content-max)); margin: 0 auto; padding-top: 30px; }
.page-head { align-items: center; margin-bottom: 26px; }
.page-head > div:first-child { min-width: 0; }
.page-head h1, .hero-card h2, .connection-card h1 { font-family: var(--font-display); text-wrap: balance; }
.page-head h1 { font-weight: 850; }
.page-head p { max-width: 760px; line-height: 1.55; }
.eyebrow { letter-spacing: .14em; }

.hero-card {
  isolation: isolate;
  border-color: color-mix(in srgb, var(--primary), transparent 74%);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 82% 10%, color-mix(in srgb, var(--work), transparent 76%), transparent 18rem),
    linear-gradient(135deg, color-mix(in srgb, var(--primary), transparent 84%), transparent 62%),
    var(--surface-raised);
  box-shadow: var(--shadow-card);
}
.hero-card::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .4; background: linear-gradient(115deg, transparent 35%, color-mix(in srgb, white, transparent 88%), transparent 70%); transform: translateX(-100%); animation: hero-sheen 1.1s var(--ease-emphasized) .12s both; }
.hero-card::after { opacity: .8; }
.hero-stat { padding: 12px 18px; border-radius: 24px; background: color-mix(in srgb, var(--surface-solid), transparent 22%); backdrop-filter: blur(12px); }
.hero-actions .button { min-width: 130px; }

.panel, .content-card, .settings-row, .more-card, .list-item, .empty-state {
  border-color: color-mix(in srgb, var(--line), transparent 8%);
  box-shadow: var(--shadow-card);
}
.panel, .content-card, .settings-row { background: var(--surface-glass); backdrop-filter: blur(12px); }
.panel { padding: 22px; }
.panel-head h3, .content-card h3 { font-weight: 800; }
.metric { font-variant-numeric: tabular-nums; }
.list-item { position: relative; background: color-mix(in srgb, var(--surface-soft), transparent 6%); box-shadow: none; }
.list-item::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 1px color-mix(in srgb, white, transparent 92%); }
.task-check { display: grid; place-items: center; }
.content-card { display: flex; flex-direction: column; min-height: 178px; }
.content-card > footer { margin-top: auto; padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--line), transparent 24%); }
.card-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 16px; }
.badge { gap: 5px; border: 1px solid color-mix(in srgb, currentColor, transparent 78%); }
.progress-track { height: 9px; }
.progress-fill { background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--work), white 8%)); }
.empty-state { background: linear-gradient(145deg, color-mix(in srgb, var(--surface), transparent 8%), color-mix(in srgb, var(--primary-soft), transparent 65%)); }
.empty-icon { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary), transparent 78%); }

.button { position: relative; overflow: hidden; min-height: 46px; border: 1px solid transparent; border-radius: 14px; }
.button.primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--work), white 8%)); box-shadow: 0 10px 24px color-mix(in srgb, var(--primary), transparent 74%); }
.button.secondary { border-color: var(--line); background: var(--surface-soft); }
.button.danger { border-color: color-mix(in srgb, var(--danger), transparent 72%); }
.text-button { min-height: 36px; padding: 0 6px; border-radius: 10px; }

.stack-form { gap: 17px; }
.stack-form label { color: color-mix(in srgb, var(--muted), var(--text) 18%); }
.stack-form input, .stack-form textarea, .stack-form select { min-height: 50px; border-radius: 15px; background: color-mix(in srgb, var(--surface-soft), transparent 4%); }
.stack-form input:hover, .stack-form textarea:hover, .stack-form select:hover { border-color: color-mix(in srgb, var(--primary), transparent 58%); }
.modal-card, .bottom-sheet, .connection-card { border-color: color-mix(in srgb, var(--line), transparent 5%); background: var(--surface-raised); box-shadow: var(--shadow-float); }
.modal-card { border-radius: 30px; }
.bottom-sheet { border-radius: 32px; }
.quick-action { border-radius: 20px; background: linear-gradient(145deg, var(--surface-soft), color-mix(in srgb, var(--surface-solid), transparent 20%)); }
.quick-action.primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--work), white 8%)); box-shadow: 0 16px 34px color-mix(in srgb, var(--primary), transparent 70%); }
.toast { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; border-radius: 16px; background: var(--surface-raised); }
.toast-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--success), transparent 86%); color: var(--success); }
.toast.error .toast-icon { background: color-mix(in srgb, var(--danger), transparent 86%); color: var(--danger); }

.mobile-fab { will-change: transform; }
.mobile-fab:active { transform: translate(-50%, 2px) scale(.96); }
.mobile-nav-button.active { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary), transparent 78%); }

[data-enter] { animation: content-enter var(--duration-slow) var(--ease-emphasized) both; }
.content > * { animation: content-enter var(--duration-normal) var(--ease-emphasized) both; }
.content > *:nth-child(2) { animation-delay: 35ms; }
.content > *:nth-child(3) { animation-delay: 70ms; }
.bottom-sheet:not([hidden]) { animation: sheet-in var(--duration-slow) var(--ease-emphasized) both; }
.modal:not([hidden]) .modal-card { animation: modal-in var(--duration-normal) var(--ease-emphasized) both; }
.scrim:not([hidden]), .modal:not([hidden]) { animation: fade-in var(--duration-fast) ease both; }

@keyframes content-enter { from { opacity: 0; transform: translateY(8px); } }
@keyframes sheet-in { from { opacity: 0; transform: translate(-50%, 18px) scale(.985); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes hero-sheen { to { transform: translateX(100%); } }

@media (hover: hover) and (pointer: fine) {
  .nav-button:hover, .mobile-nav-button:hover, .workspace-button:hover, .icon-button:hover { transform: translateY(-1px); }
  .panel[data-view]:hover, .content-card:hover, .more-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--primary), transparent 58%); box-shadow: var(--shadow-hover); }
  .button:hover, .primary-action:hover { transform: translateY(-1px); }
  .button:active, .primary-action:active, .quick-action:active { transform: translateY(1px) scale(.99); }
}

/* Tablet: compact navigation rail rather than stretched desktop or premature mobile. */
@media (min-width: 821px) and (max-width: 1180px) {
  :root { --sidebar: 92px; }
  .desktop-sidebar { align-items: stretch; padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand > span:last-child, .nav-button span, .primary-action:not(:focus) { font-size: 0; }
  .brand-mark { flex: 0 0 auto; }
  .nav-button { justify-content: center; padding: 0; }
  .nav-button svg { width: 23px; height: 23px; }
  .nav-button::before { left: 0; }
  .primary-action { display: grid; place-items: center; font-size: 0; }
  .primary-action span { font-size: 25px; }
  .sync-pill { padding: 7px 4px; font-size: 0; }
  .sync-pill::before { content: "●"; color: var(--success); font-size: 13px; }
  .topbar { padding-inline: 22px; }
  .workspace-button { padding-inline: 11px; }
  .content { padding-inline: 24px; }
}

@media (max-width: 820px) {
  body::before { background-size: 48px 48px; opacity: .20; }
  .topbar { box-shadow: 0 8px 28px color-mix(in srgb, var(--bg), transparent 35%); }
  .mobile-nav { border-radius: 24px; background: var(--surface-glass); box-shadow: var(--shadow-float); }
  .mobile-fab { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--work), white 8%)); box-shadow: 0 18px 40px color-mix(in srgb, var(--primary), transparent 60%); }
  .page-head { align-items: flex-start; }
  .page-head > .button { flex: 0 0 auto; }
  .hero-card { border-radius: 28px; }
  .hero-stat { width: fit-content; }
  .panel, .content-card { border-radius: 20px; }
  .bottom-sheet { animation-name: mobile-sheet-in; }
  .toast { box-shadow: var(--shadow-float); }
}

@media (max-width: 560px) {
  .content { padding-inline: calc(14px + var(--safe-left)) calc(14px + var(--safe-right)); }
  .page-head { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
  .page-head > div:first-child { grid-column: 1 / -1; }
  .page-head > .button { grid-column: 2; grid-row: 2; }
  .hero-card { padding: 21px; }
  .hero-card h2 { font-size: clamp(28px, 9vw, 36px); }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .hero-actions .button { min-width: 0; padding-inline: 10px; }
  .metric { font-size: 32px; }
  .panel { padding: 18px; }
  .content-card { min-height: 0; padding: 17px; }
  .quick-grid { grid-template-columns: 1fr 1fr; }
  .quick-action { min-height: 108px; }
  .form-actions { position: sticky; bottom: calc(-22px - var(--safe-bottom)); margin-inline: -22px; margin-bottom: calc(-22px - var(--safe-bottom)); padding: 14px 22px calc(14px + var(--safe-bottom)); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-solid), transparent 4%); backdrop-filter: blur(16px); }
  .form-actions .button { flex: 1; }
}

@keyframes mobile-sheet-in { from { opacity: 0; transform: translateY(24px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (prefers-contrast: more) {
  :root { --line: color-mix(in srgb, currentColor, transparent 55%); }
  .panel, .content-card, .list-item, .button.secondary, .settings-row, .more-card { border-width: 2px; }
  .muted, .list-item-meta, .metric-label, .panel-subtle { color: var(--text); }
}

@media (forced-colors: active) {
  * { forced-color-adjust: auto; }
  .brand-mark, .mobile-fab, .button.primary, .quick-action.primary { border: 2px solid ButtonText; }
  .task-check.done::after { color: ButtonText; }
}

@media print {
  .desktop-sidebar, .topbar, .mobile-nav, .mobile-fab, .sync-status-bar, .offline-banner, .security-banner, .update-banner, .hero-actions { display: none !important; }
  .main-area { margin: 0; }
  .content { max-width: none; padding: 0; }
  body { background: white; color: black; }
  .panel, .content-card, .list-item { break-inside: avoid; box-shadow: none; }
}

.conflict-list { display: grid; gap: 1rem; }
.conflict-card { display: grid; gap: 1rem; }
.conflict-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.conflict-version { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-soft); }
.conflict-version h3 { margin: 0 0 .75rem; }
.conflict-field { display: grid; gap: .25rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.conflict-field:first-of-type { border-top: 0; }
.conflict-field strong { font-size: .75rem; color: var(--text-muted); }
.conflict-field span { white-space: pre-wrap; overflow-wrap: anywhere; }
.conflict-field.changed { padding-inline: .65rem; border-radius: var(--radius-md); background: color-mix(in srgb, var(--accent) 10%, transparent); }
@media (max-width: 760px) { .conflict-comparison { grid-template-columns: 1fr; } .conflict-actions { position: sticky; bottom: calc(5.5rem + env(safe-area-inset-bottom)); background: var(--surface); padding: .75rem; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); } }
