/* Base for every Dinesia site. Each site sets its palette on :root (or a theme class) with these roles,
   named like Material 3 so the values can be copied from Theme.kt and the Clepsidra mock:
   --bg ground · --on text · --onv secondary text · --pri accent · --onPri text on accent
   --low / --lowest / --high surfaces · --outV hairlines · --act selected fill · --onAct text on it
   --rail sunken track · --sheet dialogs · --scrim behind dialogs */
:root {
  --bg: #FAF6EB; --on: #2A2233; --onv: #5E5369; --pri: #654F7C; --onPri: #FFFFFF;
  --low: #FFFFFF; --lowest: #FFFFFF; --high: #EFE8F2; --outV: #D9CFE0; --act: #E4DAEE; --onAct: #2A1F37;
  --rail: #EDE6F1; --sheet: #FFFFFF; --scrim: rgba(20, 14, 26, .5);
  --r-s: 12px; --r-m: 16px; --r-l: 24px;
  --font: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--on); font-family: var(--font);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--pri); text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Stroke icons from /_shared/icons/ui.svg */
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.s { width: 16px; height: 16px; }
.ic.l { width: 24px; height: 24px; }

/* Buttons: p = primary, t = tonal, o = outlined, g = text */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 22px; background: var(--high); color: var(--on); font-weight: 600; font-size: 15px;
  text-decoration: none; white-space: nowrap; transition: filter .15s, background-color .15s;
}
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.p { background: var(--pri); color: var(--onPri); }
.btn.t { background: var(--act); color: var(--onAct); }
.btn.o { background: transparent; box-shadow: inset 0 0 0 1px var(--outV); color: var(--on); }
.btn.g { background: transparent; color: var(--pri); padding: 0 10px; }
.btn.l { min-height: 52px; border-radius: 26px; padding: 0 24px; font-size: 16px; }
.btn.w { width: 100%; }
.btn .ic { width: 18px; height: 18px; }
/* Google's own light button (fill #FFF, stroke #747775, text #1F1F1F), the same on dark themes so it never loses its text. */
.btn.google { background: #FFFFFF; color: #1F1F1F; box-shadow: inset 0 0 0 1px #747775; }
.btn.google svg { width: 18px; height: 18px; }

/* Icon-only round button */
.ib {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--onv);
}
.ib:hover { background: color-mix(in srgb, var(--on) 8%, transparent); }

/* Avatar with initials */
.av {
  width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: #654F7C; color: #FAF6EB; font-weight: 700; font-size: 14px; letter-spacing: .02em; border: 0;
}
.av.l { width: 56px; height: 56px; font-size: 20px; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em; background: var(--act); color: var(--onAct);
}
.tag.prov { background: transparent; color: var(--onv); box-shadow: inset 0 0 0 1px var(--outV); font-weight: 600; }

/* Dialog: centred card on wide screens, bottom sheet on phones */
.dz-scrim {
  position: fixed; inset: 0; z-index: 100; background: var(--scrim); display: flex; align-items: center;
  justify-content: center; padding: 16px; animation: dz-fade .15s ease-out;
}
.dz-dlg {
  width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--sheet); color: var(--on);
  border-radius: var(--r-l); padding: 22px 22px 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.dz-dlg.wide { width: min(560px, 100%); }
.dz-dlg h2 { font-size: 20px; line-height: 28px; font-weight: 700; margin-bottom: 8px; }
.dz-dlg .lead { color: var(--onv); margin-bottom: 16px; }
.dz-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@media (max-width: 599px) {
  .dz-scrim { align-items: flex-end; padding: 0; }
  .dz-dlg { width: 100%; border-radius: var(--r-l) var(--r-l) 0 0; max-height: 92dvh; padding-bottom: 24px; }
}
@keyframes dz-fade { from { opacity: 0; } }

/* Simulated account chooser (demo only: nothing leaves the browser) */
.gsim-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.gsim-head svg { width: 22px; height: 22px; }
.gsim-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; }
.gsim-acc {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--r-m);
  background: var(--high); text-align: left;
}
.gsim-acc:hover { filter: brightness(.97); }
.gsim-acc b { display: block; font-weight: 600; }
.gsim-acc small { display: block; color: var(--onv); font-size: 13px; }
.gsim-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--onv); margin-top: 12px; }
.gsim-note .ic { margin-top: 1px; }

/* Form fields */
.fld { display: block; margin: 12px 0 0; }
.fld > span { display: block; font-size: 13px; font-weight: 600; color: var(--onv); margin-bottom: 6px; }
.inp {
  width: 100%; height: 48px; padding: 0 14px; border-radius: var(--r-s); border: 1px solid var(--outV);
  background: var(--lowest); color: var(--on); font-size: 16px;
}
.inp:focus { outline: 2px solid var(--pri); outline-offset: -1px; border-color: transparent; }

/* App switcher popover */
.dz-pop {
  position: fixed; z-index: 90; width: 300px; padding: 10px; border-radius: var(--r-l); background: var(--sheet);
  color: var(--on); box-shadow: 0 12px 40px rgba(0, 0, 0, .22), 0 0 0 1px color-mix(in srgb, var(--on) 8%, transparent);
  animation: dz-fade .12s ease-out;
}
.dz-pop h3 { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--onv); padding: 6px 8px 8px; }
.dz-apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dz-app {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: var(--r-m);
  color: var(--on); text-decoration: none; font-size: 13px; font-weight: 600;
}
.dz-app:hover { background: color-mix(in srgb, var(--on) 7%, transparent); }
.dz-app[aria-current="true"] { background: color-mix(in srgb, var(--pri) 14%, transparent); }
.dz-app img { width: 44px; height: 44px; border-radius: 12px; }
.dz-pop .dz-acc { display: flex; align-items: center; gap: 10px; padding: 10px 8px 4px; margin-top: 6px; border-top: 1px solid var(--outV); }
.dz-acc b { display: block; font-size: 14px; }
.dz-acc small { display: block; font-size: 12px; color: var(--onv); }
.dz-pop .dz-links { display: flex; flex-direction: column; margin-top: 6px; }
.dz-pop .dz-links a, .dz-pop .dz-links button {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 8px; border: 0; border-radius: 10px;
  background: none; color: var(--on); text-decoration: none; font-size: 14px; font-weight: 500; text-align: left;
}
.dz-pop .dz-links a:hover, .dz-pop .dz-links button:hover { background: color-mix(in srgb, var(--on) 7%, transparent); }
.dz-pop .dz-links .ic { color: var(--onv); width: 18px; height: 18px; }

/* Toast */
.dz-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 120; transform: translate(-50%, 20px); opacity: 0;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px; background: #1F1A24; color: #F4EEF7;
  font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.dz-toast.on { opacity: 1; transform: translate(-50%, 0); }
.dz-toast.on button { pointer-events: auto; }
.dz-toast button {
  margin: -6px -8px -6px 10px; padding: 6px 10px; border: 0; border-radius: 10px; background: none;
  color: #CDB8F2; font-weight: 800; font-size: 14px;
}
.dz-toast button:hover { background: rgba(255, 255, 255, .08); }

/* Demo ribbon: always visible, so nobody mistakes the prototype for the real thing */
.dz-demo {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; color: var(--onv);
  box-shadow: inset 0 0 0 1px var(--outV); white-space: nowrap;
}

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