/* ===================================================================
   Dogodki — Linear-style svetlo, krem + ink, Geist.
   =================================================================== */

:root {
  /* Surfaces */
  --bg:        #FAFAF7;
  --surface:   #FFFFFF;
  --surface-2: #F5F3ED;
  --surface-3: #EFEDE5;
  --tint:      #F9F8F3;

  /* Lines */
  --line:        #EDEAE2;
  --line-2:      #E1DED4;
  --line-strong: #C9C5B8;

  /* Ink */
  --ink:    #0A0A0A;
  --ink-2:  #1C1B17;
  --ink-3:  #44423B;
  --muted:  #6E6B62;
  --muted-2:#9A968A;
  --muted-3:#BAB6A8;

  /* Accent — sober ink-on-cream */
  --accent:     #0A0A0A;
  --accent-soft:#1C1B17;
  --on-accent:  #FAFAF7;

  /* Semantic (RSVP / status) */
  --yes:    #1F7A4D; --yes-bg: #E4F1E9;
  --maybe:  #8A5A12; --maybe-bg: #F5EBD7;
  --no:     #A6361E; --no-bg:    #F4DED7;
  --info:   #2D4F8E; --info-bg:  #E4ECF7;

  /* Type */
  --font-body: 'Geist', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, monospace;

  /* Radius */
  --r-xs:  5px;
  --r-sm:  7px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;
  --r-pill:999px;

  /* Shadow */
  --sh-xs: 0 1px 0 rgba(20,18,12,.03);
  --sh-sm: 0 1px 2px rgba(20,18,12,.04), 0 0 0 1px rgba(20,18,12,.03);
  --sh-md: 0 2px 6px rgba(20,18,12,.05), 0 8px 24px rgba(20,18,12,.06);
  --sh-lg: 0 6px 16px rgba(20,18,12,.08), 0 20px 40px rgba(20,18,12,.08);

  /* Layout */
  --appbar-h: 56px;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Legacy aliases (kept so existing classes still work) */
  --bg-grad: var(--bg);
  --surface-4: var(--surface-3);
  --line-3: var(--line-strong);
  --muted-2: #9A968A;
  --mint:        var(--ink);
  --mint-bright: var(--ink-2);
  --mint-deep:   var(--ink-2);
  --mint-glow:   rgba(20,18,12,0.08);
  --mint-soft:   var(--surface-2);
  --coral:       var(--no);
  --coral-soft:  var(--no-bg);
  --amber:       var(--maybe);
  --amber-soft:  var(--maybe-bg);
  --sky:         var(--info);
  --sky-soft:    var(--info-bg);
  --violet:      #6E4C8E;
  --violet-soft: #ECE4F2;
  --radius-xs: var(--r-xs);
  --radius-sm: var(--r-sm);
  --radius:    var(--r-md);
  --radius-lg: var(--r-lg);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: -0.018em;
  color: var(--ink);
  line-height: 1.15;
}
h1 { font-size: 26px; letter-spacing: -0.022em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }

::selection { background: var(--surface-3); color: var(--ink); }

button { cursor: pointer; background: none; border: 0; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-3); }

.mono, .item-qty, .item-qty.strong, .stepper-input {
  font-family: var(--font-mono);
  font-feature-settings: 'ss01' on, 'cv11' on, 'tnum' on;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}

/* ===== Layout shell ===== */
.layout-shell { display: block; min-height: 100vh; }

/* ===== Appbar (mobile) ===== */
.appbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(250,250,247,0.92);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  height: var(--appbar-h);
}
.appbar-inner {
  display: flex; align-items: center; gap: 10px;
  height: 100%;
  padding: 0 18px;
  max-width: none;
  width: 100%;
}
.appbar-back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  font-size: 16px; line-height: 1;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line-2);
  transition: background .15s ease, transform .12s ease;
}
.appbar-back:hover { background: var(--surface-2); color: var(--ink); transform: translateX(-1px); text-decoration: none; }
.appbar-title {
  flex: 1;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.018em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appbar-actions { display: flex; align-items: center; gap: 4px; }
.appbar-actions .link {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--line-2);
  font-size: 0;
  padding: 0;
}
.appbar-actions .link::before {
  content: '';
  width: 16px; height: 16px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M10 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM4 17c0-3 3-5 6-5s6 2 6 5'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M10 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM4 17c0-3 3-5 6-5s6 2 6 5'/></svg>") center/contain no-repeat;
}
.appbar-actions .link:hover { background: var(--surface-2); color: var(--ink); }

/* ===== Content ===== */
.content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 18px 18px 28px;
}
.content.with-nav { padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 24px); }
.page { display: flex; flex-direction: column; gap: 14px; width: 100%; }

.section-title {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 18px 0 4px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::after {
  content: '';
  height: 1px; background: var(--line);
  flex: 1;
}

/* ===== Bottom nav (mobile only) ===== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex;
  background: rgba(250,250,247,0.94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  z-index: 40;
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted-2);
  padding: 6px 4px;
  text-transform: none;
  letter-spacing: 0;
}
.bottom-nav a:hover { text-decoration: none; color: var(--ink-3); }
.bottom-nav a .icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 0; }
.bottom-nav a .icon::before {
  content: '';
  width: 20px; height: 20px;
  background-color: currentColor;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
}
.bottom-nav a[href="/events"] .icon::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4v2M15 4v2M3.5 8.5h13M4.5 6h11a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4v2M15 4v2M3.5 8.5h13M4.5 6h11a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z'/></svg>");
}
.bottom-nav a[href="/guests"] .icon::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M7.5 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm6 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM2.5 16.5c0-2.5 2.5-4 5-4s5 1.5 5 4M13 12.5c2 0 4.5 1.2 4.5 3.5'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M7.5 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm6 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM2.5 16.5c0-2.5 2.5-4 5-4s5 1.5 5 4M13 12.5c2 0 4.5 1.2 4.5 3.5'/></svg>");
}
.bottom-nav a[href="/items"] .icon::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7h14l-1.2 8.4a1 1 0 0 1-1 .9H5.2a1 1 0 0 1-1-.9L3 7Zm3 0 1.5-3h5L14 7M8 11v3M12 11v3'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7h14l-1.2 8.4a1 1 0 0 1-1 .9H5.2a1 1 0 0 1-1-.9L3 7Zm3 0 1.5-3h5L14 7M8 11v3M12 11v3'/></svg>");
}
.bottom-nav a[href="/profile"] .icon::before {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M10 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM4 17c0-3 3-5 6-5s6 2 6 5'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M10 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM4 17c0-3 3-5 6-5s6 2 6 5'/></svg>");
}
.bottom-nav a.active { color: var(--ink); }

/* iOS-like home indicator */
.bottom-nav::after {
  display: none; /* let's keep clean for now */
}

/* ===== Subnav (event tabs) ===== */
.subnav {
  display: flex;
  gap: 2px;
  padding: 4px;
  margin: 8px 0 12px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  flex: 1; min-width: 70px;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.subnav a:hover { color: var(--ink-3); text-decoration: none; }
.subnav a.active {
  color: var(--ink);
  font-weight: 600;
  background: var(--surface);
  box-shadow: var(--sh-xs);
}
.subnav .tab-icon { width: 15px; height: 15px; flex-shrink: 0; }
.subnav .tab-count {
  font-size: 12px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.subnav a.active .tab-count { color: var(--muted); }

/* ===== Cards ===== */
.cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.cards > li { min-width: 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.card:hover { border-color: var(--line-2); }

.cards > .card { animation: card-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.cards > .card:nth-child(1) { animation-delay: 0.02s; }
.cards > .card:nth-child(2) { animation-delay: 0.04s; }
.cards > .card:nth-child(3) { animation-delay: 0.06s; }
.cards > .card:nth-child(4) { animation-delay: 0.08s; }
.cards > .card:nth-child(5) { animation-delay: 0.10s; }
.cards > .card:nth-child(n+6) { animation-delay: 0.12s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-body {
  display: block;
  padding: 14px 16px;
  color: var(--ink);
}
.card-body:hover { text-decoration: none; background: var(--tint); }
.card-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.014em;
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.card-sub {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.card .checkable {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
}
.card .checkable input[type=checkbox] {
  width: 18px; height: 18px;
  accent-color: var(--ink);
  flex-shrink: 0;
}
.card .checkable > div { flex: 1; }

/* ===== Hero (next event) ===== */
.hero-card {
  background:
    linear-gradient(135deg, #F2E9D8 0%, #EFE8DA 60%, #E8DFCA 100%);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 22px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  display: block;
  box-shadow: var(--sh-sm);
}
.hero-card:hover { text-decoration: none; color: var(--ink); }
.hero-card::before {
  content: '';
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #B7502B 0%, #8B3A1A 100%);
}

.hero-card-2col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.hero-left { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.hero-right { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }

.hero-gauge { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }
.hero-pct { font-size: 38px; font-weight: 600; letter-spacing: -0.025em; color: #8B3A1A; }
.hero-pct-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.hero-card-2col .hero-progress { width: 200px; max-width: 100%; }

@media (min-width: 1024px) {
  .hero-card { padding: 28px 32px; margin-bottom: 24px; }
  .hero-card-2col { flex-direction: row; align-items: flex-start; gap: 36px; }
  .hero-card-2col .hero-left { gap: 14px; }
  .hero-card-2col .hero-name { font-size: 36px; letter-spacing: -0.028em; }
  .hero-card-2col .hero-right { min-width: 220px; align-items: flex-end; }
  .hero-card-2col .hero-gauge { align-items: flex-end; }
  .hero-pct { font-size: 44px; }
}
.hero-card .hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8B3A1A;
  font-weight: 600;
  margin-bottom: 8px;
}
.hero-card .hero-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1.12;
  margin-bottom: 12px;
}
.hero-card .hero-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3);
  margin-bottom: 16px;
}
.hero-card .hero-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.hero-card .hero-progress {
  display: flex; align-items: center; gap: 12px;
}
.hero-card .progress-track {
  flex: 1;
  position: relative;
  height: 6px;
  background: rgba(20,18,12,0.10);
  border-radius: 99px;
  overflow: hidden;
}
.hero-card .progress-fill {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, #B7502B 0%, #8B3A1A 100%);
  border-radius: 99px;
}
.hero-card .progress-num {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}
.hero-card .hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: #8B3A1A;
  color: #FFF6EE;
  border-radius: var(--r-md);
  font-weight: 500;
  font-size: 13px;
  margin-top: 16px;
}
.hero-card .hero-cta:hover { text-decoration: none; background: #6E2D11; color: #FFF6EE; }

/* ===== Date pill (used in event cards) ===== */
.date-pill {
  width: 48px;
  display: flex; flex-direction: column; align-items: center;
  padding: 5px 0;
  background: var(--tint);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.date-pill .month {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.date-pill .day {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1;
}

/* RSVP barchart inside event cards */
.rsvp-bar {
  display: flex; height: 5px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 10px;
}
.rsvp-bar > span { display: block; }
.rsvp-bar .seg-yes   { background: var(--yes); }
.rsvp-bar .seg-maybe { background: var(--maybe); }
.rsvp-bar .seg-no    { background: var(--no); }

.rsvp-legend {
  display: flex; gap: 12px;
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.rsvp-legend span { display: inline-flex; align-items: center; gap: 5px; }
.rsvp-legend .dot { width: 6px; height: 6px; border-radius: 99px; }
.rsvp-legend .dot.dot-yes { background: var(--yes); }
.rsvp-legend .dot.dot-maybe { background: var(--maybe); }
.rsvp-legend .dot.dot-no { background: var(--no); }
.rsvp-legend .total { margin-left: auto; color: var(--muted); }

/* ===== Buttons (sm / md / lg) ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); text-decoration: none; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--ink);
  color: var(--on-accent);
  border-color: var(--ink);
  box-shadow: var(--sh-sm);
}
.btn.primary:hover { background: var(--ink-2); border-color: var(--ink-2); color: var(--on-accent); }
.btn.danger {
  background: var(--surface);
  color: var(--no);
  border-color: var(--line-2);
}
.btn.danger:hover { background: var(--no-bg); border-color: rgba(166, 54, 30, 0.3); }
.btn.block { width: 100%; }
.btn.sm, .btn.small { min-height: 30px; padding: 0 11px; font-size: 13px; gap: 6px; }
.btn.lg { min-height: 44px; padding: 0 18px; font-size: 15px; gap: 10px; }
.btn.plus {
  min-height: 36px; min-width: 36px; padding: 0;
  font-size: 16px; font-weight: 400;
}

.iconbtn {
  background: transparent; border: 1px solid transparent;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s ease, color .12s ease;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }

.link {
  background: transparent; border: none;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
}
.link:hover { text-decoration: underline; color: var(--ink); }

.actions { display: flex; flex-direction: column; gap: 8px; }
.danger-form { margin-top: 28px; }

/* ===== Forms ===== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form > label,
.auth-card label,
.row-form label {
  display: flex; flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input[type=text], input[type=password], input[type=date],
input[type=number], input[type=search], input[type=email],
textarea, select {
  min-height: 40px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20,18,12,0.06);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}
input[type=number] { font-feature-settings: 'tnum' on; font-variant-numeric: tabular-nums; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* Segmented control */
.seg {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
  padding: 4px; background: var(--surface-2);
  border-radius: var(--r-md);
}
.seg-opt { position: relative; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span {
  display: block;
  text-align: center;
  padding: 8px 12px;
  background: transparent;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.seg-opt input:checked + span {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--sh-xs);
}

/* Search bar */
.searchbar { display: flex; gap: 8px; align-items: stretch; }
.searchbar input[type=search] { flex: 1; }
.searchbar input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.chip:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.chip.active { background: var(--ink); color: var(--on-accent); border-color: var(--ink); }
.chip.on { background: var(--yes-bg); color: var(--yes); border-color: rgba(31, 122, 77, 0.25); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  border: none;
  letter-spacing: 0;
  text-transform: none;
}
.badge.ghost { background: transparent; border: 1px solid var(--line-2); color: var(--ink-3); }
.badge.ok    { background: var(--yes-bg);   color: var(--yes); }
.badge.warn  { background: var(--maybe-bg); color: var(--maybe); }
.badge.bad   { background: var(--no-bg);    color: var(--no); }
.badge.cat-M { background: var(--info-bg);  color: var(--info); }
.badge.cat-F { background: #F4E4EC;         color: #8E2D5D; }
.badge.cat-C { background: var(--maybe-bg); color: var(--maybe); }

/* Empty state */
.empty {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 48px 20px 40px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
}
.empty h2 { font-size: 18px; }
.empty .muted { max-width: 30em; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.strong { font-weight: 600; }

/* Alerts */
.alert {
  padding: 12px 14px;
  background: var(--no-bg);
  border: 1px solid rgba(166, 54, 30, 0.2);
  color: var(--no);
  border-radius: var(--r-md);
  font-size: 13px;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert.ok {
  background: var(--yes-bg);
  border-color: rgba(31, 122, 77, 0.2);
  color: var(--yes);
}
.alert::before {
  content: '';
  width: 3px; align-self: stretch;
  background: currentColor;
  border-radius: 2px;
  margin-right: 4px;
  opacity: 0.5;
}

/* ===== Auth ===== */
.auth-page {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 20px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  box-shadow: var(--sh-md);
  position: relative;
}
.auth-card h1 {
  margin: 8px 0 4px;
  font-size: 28px;
  text-align: center;
  letter-spacing: -0.022em;
  font-weight: 600;
  color: var(--ink);
}
.auth-card > p.muted {
  text-align: center;
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn.primary { margin-top: 6px; }

.brand-mark {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: center;
  margin: 0 0 12px;
  text-transform: none;
}
.brand-mark svg { flex-shrink: 0; color: var(--ink); }

/* ===== Meals & items ===== */
.meal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
}
.meal-card + .meal-card { margin-top: 10px; }
.meal-card .meal-header {
  display: flex; align-items: center; gap: 10px;
}
.meal-card .meal-header h3,
.meal-card .meal-header h4 {
  flex: 1;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.014em;
}
.meal-card .meal-header h4 { font-size: 13px; }
.meal-rename { display: flex; gap: 6px; flex: 1; align-items: center; }
.meal-rename input {
  flex: 1; min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: var(--r-sm);
}
.meal-rename .link { padding: 4px 8px; }

.items { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0; }
.item-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--line);
  transition: background .12s ease;
}
.items li:last-child .item-row { border-bottom: 0; }
a.item-row:hover {
  background: var(--tint);
  text-decoration: none;
}
.item-name { font-weight: 500; font-size: 13.5px; }
.item-qty {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.item-qty.strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.total-card {
  border: 1px solid var(--line-2);
  background:
    linear-gradient(135deg, #EAF1E0 0%, #E3ECDA 60%, #DCE5D0 100%);
  color: var(--ink);
  box-shadow: var(--sh-sm);
  position: relative;
  overflow: hidden;
}
.total-card::before {
  content: '';
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #6B7A3F 0%, #4E5A2C 100%);
}
.total-card .meal-header { padding-bottom: 4px; border-bottom: 1px solid rgba(20,18,12,0.08); }
.total-card .meal-header h3 { color: #4E5A2C; font-size: 15px; font-weight: 600; }
.total-card .item-row { color: var(--ink); border-bottom-color: rgba(20,18,12,0.06); }
.total-card .item-qty { color: var(--muted); }
.total-card .item-qty.strong { color: #4E5A2C; font-weight: 700; }
.total-card .btn.small {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-2);
}
.total-card .btn.small:hover { background: var(--surface-2); }

/* Row form */
.row-form { display: flex; gap: 8px; align-items: stretch; }
.row-form input[type=text] { flex: 1; }
.row-form .btn { min-width: 48px; padding: 0 14px; font-size: 16px; font-weight: 400; }

/* RSVP select pill */
.rsvp {
  min-height: 30px;
  padding: 4px 26px 4px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background-color: var(--surface);
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  background-position: calc(100% - 12px) 50%, calc(100% - 7px) 50%;
  background-size: 5px 5px;
}
.rsvp-YES   { background-color: var(--yes-bg);   color: var(--yes);   border-color: rgba(31, 122, 77, 0.25); }
.rsvp-MAYBE { background-color: var(--maybe-bg); color: var(--maybe); border-color: rgba(138, 90, 18, 0.25); }
.rsvp-NO    { background-color: var(--no-bg);    color: var(--no);    border-color: rgba(166, 54, 30, 0.25); }
.rsvp-NONE  { background-color: var(--surface-2); color: var(--muted); }

.status-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.inline-form { display: inline-flex; margin: 0; }

.summary {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  padding: 0;
}
.summary .stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 12px;
}
.summary .stat .label {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary .stat .dot {
  width: 6px; height: 6px; border-radius: 99px;
}
.summary .stat .num {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.018em;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* Fallback: when .summary contains badges (older markup), keep them as badges */
.summary > .badge {
  /* no-op — badges already styled */
}

/* Toggles */
.toggles {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
}
.toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--ink); }

/* Sticky bottom */
.sticky-bottom {
  position: sticky; bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  margin-top: 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--sh-md);
}

/* Info dl */
.info {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
}
.info dt {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.info dd { margin: 0; color: var(--ink); }
.info .pre { white-space: pre-wrap; }

/* ===== Login / Register split-screen (desktop) ===== */
.auth-brand { display: none; }
.auth-brand h1 .muted { color: var(--muted); }
.feature-line { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--ink-3); }
.feature-line .feature-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .auth-page {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    padding: 0;
    min-height: 100vh;
    background: var(--bg);
  }
  .auth-brand {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 48px;
    background: var(--tint);
    border-right: 1px solid var(--line);
  }
  .auth-brand .brand-title {
    font-size: 44px;
    font-weight: 600;
    letter-spacing: -0.024em;
    line-height: 1.05;
    max-width: 460px;
  }
  .auth-brand .brand-lede {
    font-size: 15px;
    color: var(--muted);
    line-height: 1.55;
    max-width: 460px;
    margin-top: 12px;
  }
  .auth-brand .brand-features { display: flex; flex-direction: column; gap: 10px; }
  .auth-form-panel { display: flex; align-items: center; justify-content: center; padding: 48px; }
  .auth-form-panel .auth-card {
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: 360px;
    background: transparent;
  }
  .auth-form-panel .auth-card h1 {
    text-align: left;
    font-size: 26px;
    margin: 0;
  }
  .auth-form-panel .auth-card > p.muted { text-align: left; margin: 4px 0 18px; }
  .auth-form-panel .brand-mark { display: none; }
}

/* ===== Shopping purchase checkbox ===== */
.shop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 720px) {
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .shop-grid .shop-row:nth-child(odd) { border-right: 1px solid rgba(20,18,12,0.06); }
}
.shop-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(20,18,12,0.06);
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  user-select: none;
}
.shop-row:hover { background: rgba(20,18,12,0.03); }
.shop-row.purchased { opacity: 0.55; }
.shop-row.purchased .item-name { text-decoration: line-through; }
.shop-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border-radius: 5px;
  border: 1.5px solid rgba(78,90,44,0.4);
  flex-shrink: 0;
  color: transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.shop-row.purchased .shop-check {
  background: var(--yes);
  border-color: var(--yes);
  color: var(--bg);
}
.shop-row .item-name { flex: 1; font-weight: 500; }
.shop-row form { margin: 0; flex: 1; display: flex; gap: 12px; align-items: center; }

/* ===== Events list section head + type filter chips ===== */
.list-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin: 18px 0 6px;
}
.list-section-title {
  display: flex; align-items: center; gap: 10px;
}
.list-section-title .section-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.012em;
}
.type-filters {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.type-chip {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  text-decoration: none;
}
.type-chip:hover {
  color: var(--ink);
  text-decoration: none;
}
.type-chip.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-2);
}

/* ===== Meal items thead table ===== */
.meal-card-detailed .grip-icon { color: var(--muted-2); display: inline-flex; align-items: center; cursor: grab; padding: 2px; }
.items-thead {
  display: flex;
  padding: 6px 12px;
  background: var(--tint);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  gap: 8px;
  margin-bottom: 2px;
}
.items-thead .col-name { flex: 1 1 40%; }
.items-thead .col-qty { flex: 0 0 50px; text-align: right; }
.items-thead .col-unit { flex: 0 0 60px; text-align: right; }
.items-thead .col-del { flex: 0 0 24px; }
.items-rows { display: flex; flex-direction: column; }
.item-row-full {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 13.5px;
  transition: background .12s ease;
}
.item-row-full:last-child { border-bottom: 0; }
.item-row-full:hover { background: var(--tint); text-decoration: none; }
.item-row-full .col-grip { color: var(--muted-3); display: inline-flex; flex: 0 0 14px; }
.item-row-full .col-name { flex: 1 1 40%; font-weight: 500; }
.item-row-full .col-qty { flex: 0 0 50px; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.item-row-full .col-unit { flex: 0 0 60px; text-align: right; font-size: 12px; color: var(--muted); }
.item-row-full .col-del { flex: 0 0 24px; text-align: right; color: var(--muted-2); }
.item-row-full:hover .col-del { color: var(--no); }
.item-row-full.is-fixed { background: rgba(78,90,44,0.04); }
.fixed-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #4E5A2C;
  background: rgba(78,90,44,0.10);
  border: 1px solid rgba(78,90,44,0.25);
  border-radius: 4px;
  vertical-align: middle;
}
.ai-replace-opt {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.ai-replace-opt input { width: 16px; height: 16px; accent-color: var(--no); }

/* ===== AI generate items (meals) ===== */
.ai-meal-prompt {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px dashed var(--line-2);
}
.ai-gen-form { display: flex; flex-direction: column; gap: 8px; }
.ai-gen-form textarea { background: var(--surface); }
.ai-or {
  text-align: center;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--muted-2);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  position: relative;
  margin: 6px 0;
}
.ai-or::before, .ai-or::after {
  content: '';
  position: absolute; top: 50%;
  width: 40%;
  height: 1px;
  background: var(--line);
}
.ai-or::before { left: 0; }
.ai-or::after { right: 0; }

.ai-meal-extra summary { list-style: none; cursor: pointer; user-select: none; }
.ai-meal-extra summary::-webkit-details-marker { display: none; }
.ai-meal-extra summary::marker { content: ''; }
.ai-meal-extra[open] summary { color: var(--ink); }

/* ===== AI result page ===== */
.ai-cta-form { margin-top: 14px; }
.ai-cta { gap: 10px; }
.ai-cta-icon {
  font-size: 14px;
  display: inline-flex;
  width: 18px; height: 18px;
  align-items: center; justify-content: center;
}
.ai-result-header { margin-bottom: 10px; }
.ai-result-header h2 { font-size: 22px; letter-spacing: -0.02em; }
.ai-response {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  line-height: 1.62;
  font-size: 14px;
  color: var(--ink-2);
  box-shadow: var(--sh-xs);
}
.ai-response h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 22px 0 8px;
  letter-spacing: -0.012em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.ai-response h3:first-child { margin-top: 0; }
.ai-response h4 { font-size: 13px; margin: 14px 0 6px; color: var(--ink); }
.ai-response p { margin: 6px 0; }
.ai-response strong { color: var(--ink); font-weight: 600; }
.ai-response ul { padding-left: 20px; margin: 6px 0; }
.ai-response li { margin: 4px 0; }

/* ===== Top header (breadcrumb + h1 + actions) ===== */
.appbar-crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted);
  margin-bottom: 4px;
}
.appbar-crumbs .chev { color: var(--muted-2); display: inline-flex; }
.appbar-crumbs .here { color: var(--ink); font-weight: 500; }
.appbar-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
.appbar-actions-area {
  display: flex; gap: 10px; align-items: center;
  margin-left: auto;
}
.appbar-actions-area .search-input {
  height: 36px;
  width: 240px;
  padding: 0 12px;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 8px;
}
.appbar-actions-area .search-input input {
  flex: 1; min-height: 0; padding: 0; border: 0; background: transparent; font-size: 13.5px;
}
.appbar-actions-area .search-input input:focus { box-shadow: none; outline: none; }

/* ===== Avatars ===== */
.avatar {
  width: 32px; height: 32px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

/* ===== Category tag (M / Ž / O) ===== */
.cat-tag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.cat-tag.cat-M { background: #E4ECF7; color: #2D4F8E; }
.cat-tag.cat-F { background: #F4E4EC; color: #8E2D5D; }
.cat-tag.cat-C { background: #F5EBD7; color: #8A5A12; }

/* ===== Page toolbar (search + add button row) ===== */
.page-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}
.page-toolbar .grow-search { flex: 1; }
.toolbar-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.chips-bar {
  align-items: center;
  padding: 0 0 4px;
}

/* ===== Data table (desktop) ===== */
.data-table {
  display: none;  /* hidden by default on mobile */
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  width: 100%;
}
.page, .cards, .data-table, .meal-card { width: 100%; box-sizing: border-box; }
.page.page-narrow { max-width: 720px; margin: 0 auto; }
.data-thead {
  display: flex;
  padding: 10px 18px;
  background: var(--tint);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: 12px;
}
.data-row {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13.5px;
  transition: background .12s ease;
}
.data-row:last-child { border-bottom: 0; }
.data-row:hover { background: var(--tint); text-decoration: none; }
.data-row .name { font-weight: 500; }
.data-row .col-name { display: flex; align-items: center; gap: 12px; flex: 1 1 38%; min-width: 0; }
.data-row .col-cat { flex: 0 0 90px; }
.data-row .col-notes { flex: 1 1 40%; min-width: 0; color: var(--muted); font-size: 13px; }
.data-row .col-actions { flex: 0 0 60px; text-align: right; }
.data-row .col-unit { flex: 0 0 80px; }
.data-row .col-qty { flex: 0 0 90px; text-align: right; font-variant-numeric: tabular-nums; }
.data-row .col-invite { flex: 0 0 130px; }
.data-row .col-rsvp { flex: 0 0 180px; }
.data-row .col-events { flex: 0 0 130px; font-size: 13px; color: var(--ink-3); }
.data-thead .col-events { flex: 0 0 130px; }
.ink-3 { color: var(--ink-3); }
.data-thead .col-name { flex: 1 1 38%; min-width: 0; }
.data-thead .col-cat { flex: 0 0 90px; }
.data-thead .col-notes { flex: 1 1 40%; min-width: 0; }
.data-thead .col-actions { flex: 0 0 60px; text-align: right; }
.data-thead .col-unit { flex: 0 0 80px; }
.data-thead .col-qty { flex: 0 0 90px; text-align: right; }
.data-thead .col-invite { flex: 0 0 130px; }
.data-thead .col-rsvp { flex: 0 0 180px; }

/* Guest event row: avatar+name no clickable wrap */
.data-guests .data-row { cursor: default; }
.data-guests .data-row:hover { background: transparent; }
.data-guests .data-row .col-rsvp .rsvp { width: 100%; }
.muted-3 { color: var(--muted-3); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.iconbtn-svg {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  color: var(--muted);
  transition: background .12s ease, color .12s ease;
}
.data-row:hover .iconbtn-svg { color: var(--ink); }

/* ===== Info banner (e.g. on /items) ===== */
.info-banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.info-icon {
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
  flex-shrink: 0;
}
.info-title { font-size: 13px; font-weight: 500; color: var(--ink); }
.info-sub { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }

/* Mobile card row for guest list */
.row-card { display: flex; align-items: center; gap: 12px; }

/* Picker toolbar (select all / clear) */
.picker-toolbar {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 0 4px;
}

/* ===== Desktop sidenav ===== */
.side-nav { display: none; }

/* ===== Responsive — tablet ===== */
@media (min-width: 640px) {
  body { font-size: 14.5px; }
  .content { padding: 24px 22px 32px; }
  h1 { font-size: 28px; }
  .auth-card h1 { font-size: 32px; }
  .summary { gap: 12px; }
  .summary .stat .num { font-size: 26px; }
}

/* ===== Responsive — desktop ===== */
@media (min-width: 1024px) {
  .bottom-nav { display: none; }

  .appbar {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: none;
    height: auto;
    position: static;
    padding-top: 22px;
  }
  .appbar-inner { padding: 0; max-width: none; }
  .appbar-title {
    font-size: 26px;
    letter-spacing: -0.022em;
    font-weight: 600;
  }
  .appbar-actions { display: none; }

  .layout-shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    max-width: none;
    margin: 0;
    min-height: 100vh;
    width: 100%;
  }
  .layout-shell:not(:has(.side-nav)) { display: block; max-width: none; }
  .layout-main { display: flex; flex-direction: column; min-width: 0; width: 100%; }

  .side-nav {
    display: flex; flex-direction: column;
    position: sticky; top: 0;
    height: 100vh;
    padding: 22px 12px 14px;
    border-right: 1px solid var(--line);
    background: var(--bg);
  }
  .side-nav-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px 14px;
    margin-bottom: 0;
    text-decoration: none;
    color: var(--ink);
  }
  .side-nav-section {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 14px 10px 4px;
  }
  .side-nav-links a .count {
    margin-left: auto;
    font-size: 12px;
    color: var(--muted-2);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
  }
  .side-nav-links a.active .count { color: var(--muted); }
  .side-nav-links a .pill {
    margin-left: auto;
    padding: 1px 7px;
    background: var(--ink);
    color: var(--on-accent);
    border-radius: var(--r-pill);
    font-size: 11px;
    font-weight: 500;
  }
  .side-nav-user {
    display: flex; gap: 10px; align-items: center;
    padding: 10px;
    border-top: 1px solid var(--line);
    margin-top: auto;
    text-decoration: none;
    color: var(--ink);
  }
  .side-nav-user:hover { text-decoration: none; }
  .side-nav-user .name { font-size: 13px; font-weight: 500; color: var(--ink); }
  .side-nav-user .email { font-size: 11px; color: var(--muted); }
  .side-nav-user .meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
  .side-nav-user .name, .side-nav-user .email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-nav-user .settings-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: var(--r-sm);
    color: var(--muted);
  }
  .side-nav-user .settings-btn:hover { background: var(--surface-2); color: var(--ink); }
  .side-nav-brand .brand-mark-svg { flex-shrink: 0; color: var(--ink); }
  .side-nav-brand .mark {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.022em;
    color: var(--ink);
  }
  .side-nav-brand .sub { display: none; }

  .side-nav-links { display: flex; flex-direction: column; gap: 2px; }
  .side-nav-links a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--ink-3);
    font-size: 13.5px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: background .12s ease, color .12s ease, border-color .12s ease;
  }
  .side-nav-links a:hover { background: var(--surface); color: var(--ink); text-decoration: none; border-color: var(--line); }
  .side-nav-links a.active {
    background: var(--surface);
    color: var(--ink);
    font-weight: 500;
    border-color: var(--line-2);
  }
  .side-nav-links a .icon {
    width: 17px; height: 17px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0;
    opacity: 0.85;
  }
  .side-nav-links a .icon::before {
    content: '';
    width: 17px; height: 17px;
    background-color: currentColor;
    -webkit-mask-position: center; mask-position: center;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-size: contain; mask-size: contain;
  }
  .side-nav-links a[href="/events"] .icon::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4v2M15 4v2M3.5 8.5h13M4.5 6h11a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M5 4v2M15 4v2M3.5 8.5h13M4.5 6h11a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Z'/></svg>");
  }
  .side-nav-links a[href="/guests"] .icon::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M7.5 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm6 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM2.5 16.5c0-2.5 2.5-4 5-4s5 1.5 5 4M13 12.5c2 0 4.5 1.2 4.5 3.5'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M7.5 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm6 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM2.5 16.5c0-2.5 2.5-4 5-4s5 1.5 5 4M13 12.5c2 0 4.5 1.2 4.5 3.5'/></svg>");
  }
  .side-nav-links a[href="/items"] .icon::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7h14l-1.2 8.4a1 1 0 0 1-1 .9H5.2a1 1 0 0 1-1-.9L3 7Zm3 0 1.5-3h5L14 7M8 11v3M12 11v3'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7h14l-1.2 8.4a1 1 0 0 1-1 .9H5.2a1 1 0 0 1-1-.9L3 7Zm3 0 1.5-3h5L14 7M8 11v3M12 11v3'/></svg>");
  }
  .side-nav-links a[href="/profile"] .icon::before {
    -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M10 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM4 17c0-3 3-5 6-5s6 2 6 5'/></svg>");
            mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='currentColor' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M10 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6ZM4 17c0-3 3-5 6-5s6 2 6 5'/></svg>");
  }
  .side-nav-footer {
    margin-top: auto;
    padding: 10px;
    font-size: 11px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-family: var(--font-mono);
    word-break: break-all;
  }

  .content {
    max-width: none;
    margin: 0;
    padding: 4px 24px 56px;
    width: 100%;
  }
  .content.with-nav { padding-bottom: 56px; }
  .content .page { gap: 18px; }

  .appbar {
    padding: 20px 24px 18px;
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
    background: var(--bg);
    height: auto;
  }
  .appbar-inner {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 24px;
    padding: 0;
    max-width: none;
  }
  .appbar-titleblock { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
  .appbar-title { font-size: 22px; letter-spacing: -0.016em; font-weight: 600; }

  .subnav { background: transparent; padding: 0 24px; border-radius: 0; margin: 4px -24px 18px; border-bottom: 1px solid var(--line); gap: 0; }
  .subnav a {
    flex: 0 0 auto;
    padding: 12px 16px 10px;
    font-size: 13px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
  }
  .subnav a:hover { background: transparent; color: var(--ink); }
  .subnav a.active { background: transparent; box-shadow: none; border-bottom-color: var(--ink); }

  h1 { font-size: 30px; }
  .card-title { font-size: 15.5px; }
  .auth-card { max-width: 400px; }
  .auth-card h1 { font-size: 30px; }
  .summary { grid-template-columns: repeat(4, 1fr); }

  /* Cards grid: 2 columns on desktop */
  .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

  /* Hero card grows on desktop with side-by-side layout */
  .hero-card { padding: 28px 32px; margin-bottom: 28px; }
  .hero-card .hero-eyebrow { font-size: 11px; margin-bottom: 10px; }
  .hero-card .hero-name { font-size: 36px; letter-spacing: -0.028em; margin-bottom: 14px; }
  .hero-card .hero-meta { font-size: 13px; margin-bottom: 0; }
  .hero-card .hero-progress { max-width: 320px; margin-top: 18px; }

  /* Meals + shopping: wider cards & 2-column for compact summaries */
  .meal-card { padding: 18px 22px; }
}

@media (min-width: 1280px) {
  /* On very wide screens, allow 3-column card grid for event lists */
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Desktop: show data tables, hide mobile cards on .has-table pages */
@media (min-width: 1024px) {
  .has-table .data-table { display: block; }
  .has-table .mobile-cards { display: none; }
}
/* Mobile: hide data tables (cards already visible) */
@media (max-width: 1023px) {
  .data-table { display: none; }
}

/* Tiny phones */
@media (max-width: 380px) {
  .content { padding: 14px 14px 24px; }
  .subnav a { font-size: 12px; padding: 7px 8px; }
  .seg-opt span { padding: 7px 6px; font-size: 12px; }
  .auth-card { padding: 26px 22px; }
  .auth-card h1 { font-size: 26px; }
}

/* ===== Stepper + drinks list (guest edit) ===== */
.stepper {
  display: inline-flex; align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
  flex-shrink: 0;
}
.stepper-btn {
  background: transparent;
  border: none;
  width: 36px;
  font-size: 18px;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  transition: background .12s ease;
}
.stepper-btn:hover { background: var(--surface-2); color: var(--ink); }
.stepper-input {
  width: 64px;
  min-height: 36px;
  text-align: center;
  background: var(--surface);
  border: none;
  border-left: 1px solid var(--line-2);
  border-right: 1px solid var(--line-2);
  border-radius: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  padding: 0 4px;
}
.stepper-input:focus {
  outline: none;
  background: var(--tint);
  box-shadow: none;
  border-color: var(--line-2);
}
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-input[type=number] { -moz-appearance: textfield; }
.stepper.big .stepper-btn { width: 40px; height: 40px; font-size: 20px; }
.stepper.big .stepper-input { width: 68px; min-height: 40px; font-size: 16px; }

/* Mini stepper for inline guest list */
.stepper.mini { border-radius: var(--r-sm); }
.stepper.mini .stepper-btn { width: 26px; min-height: 28px; height: 28px; font-size: 14px; }
.stepper.mini .stepper-input { width: 44px; min-height: 28px; height: 28px; font-size: 12px; font-weight: 600; padding: 0 2px; }
.stepper.mini.is-default .stepper-input { color: var(--muted-2); font-weight: 400; }
.stepper.mini.saving { opacity: 0.5; }
.stepper.mini.saved { border-color: var(--yes); background: var(--yes-bg); transition: background 0.4s; }
.stepper.mini.save-err { border-color: var(--no); background: var(--no-bg); }

/* Guests wide table: CSS grid for perfect column alignment */
.data-table.guests-wide {
  display: grid;
  grid-template-columns:
    minmax(180px, 1fr)  /* Ime + avatar */
    56px                /* Kat */
    repeat(var(--drinks-count, 4), minmax(96px, 1fr))
    64px                /* Dogodki */
    44px;               /* Actions */
  gap: 0;
}
.data-table.guests-wide .data-thead,
.data-table.guests-wide .data-row,
.data-table.guests-wide .data-row.guest-row { display: contents; }
.data-table.guests-wide .data-thead > span,
.data-table.guests-wide .data-row > * {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  background: var(--surface);
  min-width: 0;
}
.data-table.guests-wide .data-thead > span {
  background: var(--tint);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table.guests-wide .data-row:last-of-type > * {
  border-bottom: 0;
}
.data-table.guests-wide .data-row:hover > * { background: var(--tint); }
.data-table.guests-wide .col-name { gap: 10px; }
.data-table.guests-wide .col-cat { justify-content: center; }
.data-table.guests-wide .col-drink { justify-content: center; }
.data-table.guests-wide .col-events { justify-content: flex-end; font-size: 13px; font-family: var(--font-mono); font-weight: 500; }
.data-table.guests-wide .col-actions { justify-content: flex-end; }
.data-table.guests-wide .data-thead .col-name,
.data-table.guests-wide .data-thead .col-events { justify-content: flex-start; }
.data-table.guests-wide .data-thead .col-drink { font-size: 11px; }
.data-table.guests-wide .data-thead .col-actions { content: ''; }

/* Drinks summary on mobile guest cards */
.guest-drinks-strip {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 6px;
}
.drink-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--ink-3);
  white-space: nowrap;
}
.drink-pill .pill-name { color: var(--muted); }
.drink-pill.zero { opacity: 0.4; }

.drinks-list {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.drink-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background .12s ease;
}
.drink-row:last-child { border-bottom: 0; }
.drink-row.is-default { background: var(--tint); }
.drink-name { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.drink-title { font-size: 15px; font-weight: 500; color: var(--ink); }
.drink-unit-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.drink-row.is-default .drink-title::after {
  content: 'privzeto';
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  vertical-align: middle;
  font-weight: 500;
}

.prefs-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
