/* Kratt Calendar — circuit-tech green, light + dark. Self-hosted fonts. */
@font-face { font-family: 'Hanken Grotesk'; font-weight: 400; font-display: swap; src: url('/fonts/hanken-400.woff2') format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 500; font-display: swap; src: url('/fonts/hanken-500.woff2') format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 600; font-display: swap; src: url('/fonts/hanken-600.woff2') format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 700; font-display: swap; src: url('/fonts/hanken-700.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 700; font-display: swap; src: url('/fonts/sora-700.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 800; font-display: swap; src: url('/fonts/sora-800.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-display: swap; src: url('/fonts/jbmono-400.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 500; font-display: swap; src: url('/fonts/jbmono-500.woff2') format('woff2'); }
:root {
  --sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Sora', var(--sans);
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --bg: #070b08; --bg-1: #0c120e; --bg-2: #111a14; --bg-3: #19251c;
  --border: #1b291f; --border-2: #294234;
  --text: #e7f0e9; --muted: #84978a; --faint: #56685b;
  --accent: #38c66c; --grad: linear-gradient(135deg, #43d473 0%, #20a24e 60%, #0f7d3c 120%);
  --grad-soft: linear-gradient(135deg, rgba(67,212,115,.16), rgba(31,158,76,.08));
  --ring: rgba(56,198,108,.20); --glow: rgba(31,158,76,.45); --dot: rgba(67,212,115,.05);
  --danger: #f0616d; --shadow: 0 20px 55px -18px rgba(0,0,0,.7); --radius: 16px;
}
[data-theme="light"] {
  --bg: #eef3ec; --bg-1: #ffffff; --bg-2: #ffffff; --bg-3: #e8f0e7;
  --border: #dde8db; --border-2: #c6d8c5;
  --text: #14231a; --muted: #5c6e60; --faint: #93a596;
  --accent: #15873b; --grad: linear-gradient(135deg, #2cb54e, #0f8239);
  --grad-soft: linear-gradient(135deg, rgba(44,181,78,.14), rgba(15,130,57,.07));
  --ring: rgba(21,135,59,.18); --glow: rgba(20,140,62,.3); --dot: rgba(15,130,57,.06);
  --shadow: 0 20px 50px -20px rgba(20,60,35,.26);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; font-size: 14.5px; line-height: 1.5; }
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(56% 42% at 100% -3%, rgba(31,158,76,.12), transparent 60%),
    radial-gradient(46% 38% at -4% 100%, rgba(67,212,115,.06), transparent 60%),
    radial-gradient(circle at 1px 1px, var(--dot) 1px, transparent 1.7px);
  background-size: 100% 100%, 100% 100%, 26px 26px; }
.app, .login { position: relative; z-index: 1; }
.hidden { display: none !important; } .muted { color: var(--muted); }
h1, h2, h3, .brand, .month-label { font-family: var(--display); letter-spacing: -.02em; }
.day-n, .le-time, .chip b, .month-label { font-family: var(--mono); }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 11px; padding: 11px 13px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
::placeholder { color: var(--faint); }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.btn-primary { background: var(--grad); color: #05231b; font-weight: 700; border-radius: 12px; padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .12s, filter .15s; }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary.lg { width: 100%; padding: 13px; font-size: 15px; }
.btn-danger { background: rgba(240,97,109,.12); color: var(--danger); border: 1px solid rgba(240,97,109,.3); border-radius: 11px; padding: 10px 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.icon-btn:hover { background: var(--bg-3); color: var(--text); }

/* Login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); }
.login::before { content: ""; position: fixed; inset: 0; background: radial-gradient(900px 500px at 50% -10%, rgba(67,212,115,.20), transparent 60%), radial-gradient(700px 500px at 90% 110%, rgba(31,158,76,.16), transparent 55%); pointer-events: none; }
.login-card { position: relative; width: 100%; max-width: 380px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 22px; padding: 34px 28px; box-shadow: var(--shadow); text-align: center; }
.login-logo img { height: 60px; width: auto; }
.login-card h1 { margin: 10px 0 2px; font-size: 24px; }
.login-card form { margin-top: 22px; display: flex; flex-direction: column; gap: 11px; }
.login-error { background: rgba(240,97,109,.12); color: var(--danger); border-radius: 10px; padding: 9px; font-size: 13px; }

/* App shell */
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 22px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg-1) 86%, transparent); backdrop-filter: blur(8px); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; }
.brand-logo { height: 28px; width: auto; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.nav-btn { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.nav-btn:hover { background: var(--bg-3); color: var(--text); }
.today-btn { padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border-2); font-weight: 600; font-size: 13px; color: var(--muted); }
.today-btn:hover { border-color: var(--accent); color: var(--accent); }
.month-label { font-weight: 700; font-size: 17px; min-width: 150px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 22px 22px; gap: 8px; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; padding: 2px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; gap: 6px; flex: 1; min-height: 0; }
.day { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; padding: 7px 8px; min-height: 78px; overflow: hidden; cursor: pointer; transition: border-color .12s, background .12s; display: flex; flex-direction: column; }
.day:hover { border-color: var(--border-2); }
.day.other { opacity: .4; }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day-n { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.day.today .day-n { color: var(--accent); }
.day-evs { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.chip { font-size: 11.5px; padding: 2px 7px; border-radius: 7px; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.chip b { font-size: 10.5px; color: var(--muted); }
.chip.done { opacity: .5; text-decoration: line-through; }
.more { font-size: 10.5px; color: var(--muted); padding-left: 2px; }

/* List view */
.ev-list { flex: 1; overflow-y: auto; }
.list-day { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 16px 2px 8px; }
.list-day b { color: var(--text); font-size: 14px; }
.list-day.today b { color: var(--accent); }
.list-ev { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--bg-1); border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: 12px; margin-bottom: 8px; }
.list-ev.done .le-title { text-decoration: line-through; color: var(--muted); }
.tick { width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--border-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); }
.list-ev.done .tick { background: var(--accent); border-color: var(--accent); color: #05231b; }
.tick .ic { width: 16px; height: 16px; }
.le-main { flex: 1; min-width: 0; cursor: pointer; }
.le-title { font-weight: 600; }
.le-note { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.le-time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .ic { width: 46px; height: 46px; margin: 0 auto 12px; color: var(--accent); }
.empty p { margin: 0 0 18px; }

.add-fab { display: none; }

/* Modal */
.modal { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 64%, transparent); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 18px; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 440px; background: var(--bg-1); border: 1px solid var(--border-2); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); animation: pop .2s ease; max-height: 92vh; overflow-y: auto; }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 19px; }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field-row { display: flex; gap: 10px; } .field-row > * { flex: 1; }
.color-row { display: flex; gap: 8px; }
.color-row .sw { width: 28px; height: 28px; border-radius: 9px; border: 2px solid transparent; }
.color-row .sw.on { border-color: var(--text); transform: scale(1.1); }
.done-toggle { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 13.5px; margin-bottom: 14px; cursor: pointer; }
.done-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }

/* Toasts */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text); padding: 10px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13.5px; animation: pop .2s ease; }

/* Mobile */
@media (max-width: 720px) {
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 10px; }
  .brand-name { display: none; }
  .month-label { min-width: 0; font-size: 15px; }
  .hide-sm { display: none; }
  .content { padding: 10px 12px calc(20px + env(safe-area-inset-bottom)); }
  .cal-grid { gap: 4px; }
  .day { min-height: 64px; border-radius: 9px; padding: 5px 5px; }
  .chip { font-size: 10px; padding: 1px 5px; }
  .add-fab { display: flex; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 17px; background: var(--grad); color: #05231b; align-items: center; justify-content: center; box-shadow: 0 8px 22px -6px var(--glow); z-index: 40; }
  .add-fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }
  #add-btn .hide-sm { display: none; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { max-width: 100%; border-radius: 22px 22px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
/* ============================================================
   Unified Kratt app bar — shared across chat / calendar / budget.
   One consistent top bar to jump between the apps fast.
   ============================================================ */
.appbar {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 18px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-1, var(--bg, #0b0f10)) 82%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 60;
}
.appbar-brand { display: flex; align-items: center; flex-shrink: 0; }
.appbar-logo { height: 30px; width: auto; display: block; transition: transform .15s ease; }
.appbar-brand:hover .appbar-logo { transform: scale(1.06); }
.app-switch {
  display: flex; align-items: center; gap: 3px; padding: 3px; border-radius: 13px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  border: 1px solid var(--border);
}
.app-switch a {
  display: flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 13.5px; line-height: 1; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.app-switch a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.app-switch a.active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 32%, transparent);
}
.app-switch a.active .sw-ic { color: var(--accent); }
.app-switch .sw-ic { width: 17px; height: 17px; flex: none; }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.appbar .icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; color: var(--muted);
  background: transparent; border: 1px solid transparent; cursor: pointer;
  transition: background .15s, color .15s;
}
.appbar .icon-btn:hover { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
.appbar .icon-btn .ic { width: 18px; height: 18px; }
@media (max-width: 600px) {
  .appbar { padding: calc(7px + env(safe-area-inset-top)) 12px 7px; gap: 9px; }
  .app-switch .sw-l { display: none; }
  .app-switch a { padding: 8px 10px; }
  .appbar-logo { height: 26px; }
}
.app-switch a, .appbar-brand, a.brand { text-decoration: none; color: inherit; }
/* ===================== Kratt List (shopping list) =====================
   Appended onto the shared Kratt base stylesheet (cloned from the Calendar
   app), so login / appbar / app-switch / fonts / buttons all come from there. */
.content { flex: 1; min-height: 0; overflow-y: auto; display: block; padding: 22px; }
.content > * { max-width: 720px; margin-left: auto; margin-right: auto; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px auto 16px; }
.list-head h1 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.list-tools { display: flex; align-items: center; gap: 12px; }
.count { color: var(--muted); font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.btn-ghost { display: inline-flex; align-items: center; gap: 7px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 11px; padding: 9px 12px; color: var(--muted); font-weight: 600; transition: border-color .15s, color .15s; }
.btn-ghost:hover { border-color: var(--border-2); color: var(--text); }

.add-bar { display: flex; gap: 8px; margin: 0 auto 20px; }
.add-bar #add-name { flex: 1; }
.add-bar .qty { width: 84px; flex: none; }
.add-bar .cat-select { width: 152px; flex: none; }
.cat-select { color: var(--text); background: var(--bg-3); border: 1px solid var(--border-2); border-radius: 11px; padding: 11px 12px; cursor: pointer; }
.cat-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }

.items { display: flex; flex-direction: column; gap: 4px; }
.group-head { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 18px 2px 7px; }
.group-head:first-child { margin-top: 2px; }
.g-count { font-family: var(--mono); font-size: 11px; color: var(--faint); background: color-mix(in srgb, var(--text) 7%, transparent); border-radius: 20px; padding: 1px 7px; }

.item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; transition: border-color .12s, opacity .12s; }
.item:hover { border-color: var(--border-2); }
.tick { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--border-2); background: transparent; display: flex; align-items: center; justify-content: center; color: #05231b; cursor: pointer; transition: background .12s, border-color .12s; }
.tick .ic { width: 15px; height: 15px; stroke-width: 3; }
.item.done .tick { background: var(--grad); border-color: transparent; box-shadow: 0 4px 12px -4px var(--glow); }
.it-main { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.it-name { font-weight: 600; word-break: break-word; }
.it-qty { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.item.done .it-name { text-decoration: line-through; color: var(--muted); }
.item.done { opacity: .6; }
.it-del { flex: none; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); background: transparent; cursor: pointer; opacity: 0; transition: opacity .12s, color .12s, background .12s; }
.item:hover .it-del, .it-del:focus { opacity: 1; }
.it-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }
.it-del .ic { width: 16px; height: 16px; }

.empty { text-align: center; color: var(--muted); padding: 54px 20px; }
.empty .ic { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .5; }
.empty p { margin: 4px 0; }

@media (hover: none) { .it-del { opacity: 1; } }
@media (max-width: 560px) {
  .content { padding: 16px; }
  .add-bar { flex-wrap: wrap; }
  .add-bar #add-name { flex: 1 1 100%; }
  .add-bar .qty { flex: 1; }
  .add-bar .cat-select { flex: 2; width: auto; }
}

/* Tabs (lists) */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 14px; margin: 0 auto 6px; scrollbar-width: thin; }
.tabs::-webkit-scrollbar { height: 6px; }
.tab { display: inline-flex; align-items: center; gap: 8px; flex: none; padding: 8px 13px; border-radius: 12px; background: var(--bg-1); border: 1px solid var(--border); color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.tab:hover { color: var(--text); border-color: var(--border-2); }
.tab.on { color: var(--text); border-color: color-mix(in srgb, var(--c) 60%, var(--border)); background: color-mix(in srgb, var(--c) 13%, transparent); }
.tab-ic { font-size: 15px; line-height: 1; }
.tab-name { white-space: nowrap; }
.tab-badge { font-family: var(--mono); font-size: 11px; min-width: 18px; text-align: center; padding: 1px 6px; border-radius: 20px; background: color-mix(in srgb, var(--c, var(--accent)) 24%, transparent); color: var(--text); }
.tab-add { color: var(--muted); border-style: dashed; }
.tab-add .ic { width: 15px; height: 15px; }

/* List header + progress */
.lh-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lh-icon { font-size: 24px; line-height: 1; }
.list-head h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 6px; border-radius: 6px; background: var(--bg-3); overflow: hidden; margin: -8px auto 18px; }
.progress-bar { height: 100%; width: 0; background: var(--grad); border-radius: 6px; transition: width .3s ease; }

/* Kebab menu */
.menu { position: fixed; z-index: 80; min-width: 190px; background: var(--bg-1); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow, 0 18px 50px -18px rgba(0,0,0,.6)); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 11px; border-radius: 9px; color: var(--text); font-weight: 500; font-size: 14px; background: transparent; cursor: pointer; }
.menu-item:hover { background: var(--bg-3); }
.menu-item .ic { width: 17px; height: 17px; color: var(--muted); }
.menu-item.danger, .menu-item.danger .ic { color: var(--danger); }

/* Emoji picker + confirm */
.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji { width: 38px; height: 38px; border-radius: 10px; font-size: 19px; line-height: 1; background: var(--bg-3); border: 1px solid transparent; cursor: pointer; transition: border-color .12s, transform .12s; }
.emoji:hover { transform: translateY(-1px); }
.emoji.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.modal-card.sm { max-width: 360px; }
.confirm-msg { color: var(--muted); margin: 2px 0 18px; line-height: 1.5; }
