/* Katta Planner — ivory and black, with lilac (Instagram), red (YouTube),
   blue (work in progress) and lime (ready) used sparingly. Mobile first. */

:root {
  --bg: #f4f0e6;
  --surface: #fbf9f3;
  --surface-2: #ebe5d7;
  --surface-3: #e0d9c8;
  --ink: #121211;
  --on-ink: #f4f0e6;
  --text-2: #5f5b52;
  --text-3: #9a9488;
  --line: rgba(18, 18, 17, 0.08);
  --line-strong: rgba(18, 18, 17, 0.16);
  --lilac: #a58bf0;
  --lilac-soft: rgba(165, 139, 240, 0.2);
  --lilac-ink: #5a3fb8;
  --red: #e1403b;
  --red-soft: rgba(225, 64, 59, 0.12);
  --red-ink: #b42620;
  --lime: #c9e64a;
  --lime-soft: rgba(201, 230, 74, 0.38);
  --lime-ink: #4a5f00;
  --blue: #3557e0;
  --blue-soft: rgba(53, 87, 224, 0.11);
  --shadow: 0 1px 2px rgba(18, 18, 17, 0.04), 0 6px 20px rgba(18, 18, 17, 0.05);
  --shadow-lift: 0 18px 50px rgba(18, 18, 17, 0.22);
  --blur-bg: rgba(244, 240, 230, 0.82);
  --backdrop: rgba(14, 14, 13, 0.32);
  --radius: 18px;
  --tabbar-h: 60px;
  --side-w: 228px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --serif: "New York", ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --num: ui-rounded, "SF Pro Rounded", var(--font);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0d; --surface: #181816; --surface-2: #22221f; --surface-3: #2d2d29;
    --ink: #f2ede1; --on-ink: #0e0e0d; --text-2: #aba598; --text-3: #6f6b62;
    --line: rgba(242, 237, 225, 0.08); --line-strong: rgba(242, 237, 225, 0.16);
    --lilac: #b9a3ff; --lilac-soft: rgba(185, 163, 255, 0.16); --lilac-ink: #cdbdff;
    --red: #ff5a52; --red-soft: rgba(255, 90, 82, 0.14); --red-ink: #ff8a84;
    --lime: #d4f25a; --lime-soft: rgba(212, 242, 90, 0.16); --lime-ink: #d4f25a;
    --blue: #7d97ff; --blue-soft: rgba(125, 151, 255, 0.16);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
    --shadow-lift: 0 18px 50px rgba(0, 0, 0, 0.6);
    --blur-bg: rgba(14, 14, 13, 0.82);
    --backdrop: rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0d; --surface: #181816; --surface-2: #22221f; --surface-3: #2d2d29;
  --ink: #f2ede1; --on-ink: #0e0e0d; --text-2: #aba598; --text-3: #6f6b62;
  --line: rgba(242, 237, 225, 0.08); --line-strong: rgba(242, 237, 225, 0.16);
  --lilac: #b9a3ff; --lilac-soft: rgba(185, 163, 255, 0.16); --lilac-ink: #cdbdff;
  --red: #ff5a52; --red-soft: rgba(255, 90, 82, 0.14); --red-ink: #ff8a84;
  --lime: #d4f25a; --lime-soft: rgba(212, 242, 90, 0.16); --lime-ink: #d4f25a;
  --blue: #7d97ff; --blue-soft: rgba(125, 151, 255, 0.16);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.02);
  --shadow-lift: 0 18px 50px rgba(0, 0, 0, 0.6);
  --blur-bg: rgba(14, 14, 13, 0.82);
  --backdrop: rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

/* ---------- base ---------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 96px);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.hint { color: var(--text-3); font-size: 13px; }
.ic { display: inline-flex; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- layout ---------- */

#view { min-height: 60vh; }
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 18px) 16px 0;
  animation: fade-in 0.22s var(--ease);
}
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin: 6px 0 18px;
}
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3);
  margin-bottom: 4px;
}
.page-head h1, .login-title {
  font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.05; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 10px;
}
.page-head-right { display: flex; gap: 4px; align-items: center; }
.plat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.plat-dot.ig { background: var(--lilac); }
.plat-dot.yt { background: var(--red); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}

/* ---------- tab bar / sidebar ---------- */

.tabbar {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding: 0 6px var(--safe-b);
  background: var(--blur-bg);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  position: relative; transition: color 0.15s;
}
.tabbar a.on { color: var(--ink); }
.tabbar a.on::after {
  content: ""; position: absolute; top: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink);
  display: none;
}
.tabbar a[data-tab="ig"].on svg { color: var(--lilac-ink); }
.tabbar a[data-tab="yt"].on svg { color: var(--red); }
.brand { display: none; }
body.locked .tabbar, body.locked .fab { display: none; }

.fab {
  position: fixed; z-index: 45;
  right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  height: 52px; padding: 0 20px 0 8px;
  display: inline-flex; align-items: center; gap: 10px;
  border-radius: 999px;
  background: var(--ink); color: var(--on-ink);
  font-weight: 650; font-size: 15.5px;
  box-shadow: 0 10px 30px rgba(18, 18, 17, 0.28);
  transition: transform 0.15s var(--ease);
}
.fab svg { width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--lime); color: #121211; }
.fab:active { transform: scale(0.96); }
body.dragging .fab { opacity: 0; pointer-events: none; }

@media (min-width: 900px) {
  body { padding-bottom: 80px; padding-left: var(--side-w); }
  .tabbar {
    top: 0; right: auto; width: var(--side-w); height: auto;
    flex-direction: column; gap: 2px; padding: 28px 14px;
    border-top: 0; border-right: 1px solid var(--line);
    background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .brand {
    display: flex; align-items: center; gap: 12px; padding: 0 10px 28px;
    font-family: var(--serif); font-weight: 600; font-size: 18px; line-height: 1.05; letter-spacing: -0.01em;
  }
  .tabbar a {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    height: 44px; padding: 0 12px; border-radius: 12px; font-size: 15px; font-weight: 550; color: var(--text-2);
  }
  .tabbar a:hover { background: var(--surface-2); }
  .tabbar a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
  .fab { right: 28px; bottom: 28px; }
  .page { padding: 36px 32px 0; }
  .page.calendar, .page.board { max-width: 1280px; }
  .page-head h1 { font-size: 40px; }
}

/* brand mark: two stacked trading cards */
.brand-mark { position: relative; width: 30px; height: 34px; flex: none; }
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; inset: 2px 5px; border-radius: 5px;
}
.brand-mark::before { background: var(--lilac); transform: rotate(-12deg) translate(-3px, 1px); }
.brand-mark::after { background: var(--ink); transform: rotate(4deg) translate(3px, 0); }
.brand-mark i { position: absolute; z-index: 1; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); right: 7px; top: 7px; }
.brand-mark.big { transform: scale(2.2); }
.splash { min-height: 80vh; display: grid; place-items: center; }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 14px;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform 0.12s var(--ease), background 0.15s, opacity 0.15s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn.primary { background: var(--ink); color: var(--on-ink); }
.btn.secondary { background: var(--surface-2); color: var(--ink); }
.btn.ghost { border: 1px solid var(--line-strong); color: var(--ink); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger-ghost { color: var(--red-ink); }
.btn.small { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; }
.btn-row > .btn { flex: 1; }
.btn-row.left > .btn { flex: none; }
.btn-row.left { flex-wrap: wrap; }
.link-btn { color: var(--text-2); font-size: 13px; font-weight: 600; padding: 6px 0; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); text-decoration: none;
  transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { background: var(--surface-3); }
.icon-btn.small { width: 32px; height: 32px; border-radius: 10px; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2);
}
.seg button {
  height: 34px; padding: 0 12px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(18, 18, 17, 0.1); }
.platform-seg { display: flex; margin-top: 12px; }
.platform-seg button { flex: 1; justify-content: center; height: 42px; }
.quick-add[data-platform="ig"] .platform-seg button.on { color: var(--lilac-ink); }
.quick-add[data-platform="yt"] .platform-seg button.on { color: var(--red-ink); }

.input {
  width: 100%; min-height: 46px; padding: 11px 13px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 13px;
  font-size: 16px; line-height: 1.45;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--lilac-soft); }
.input::placeholder { color: var(--text-3); }
.input.big { font-size: 18px; min-height: 52px; }
textarea.input { resize: none; display: block; overflow: hidden; }
select.input {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239a9488' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input[type="date"].input { min-width: 0; }
.form-error { color: var(--red-ink); font-size: 13.5px; min-height: 0; margin-top: 8px; }
.form-error:empty { display: none; }

.pill-select {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong);
  font-size: 13.5px; font-weight: 600; color: var(--ink); max-width: 100%;
}
.pill-select .pill-label { color: var(--text-3); font-weight: 600; }
.pill-select select { appearance: none; -webkit-appearance: none; border: 0; background: none; font-weight: 600; padding: 0; max-width: 160px; text-overflow: ellipsis; }
.pill-select select:focus { outline: none; }
.pill-select .ic { color: var(--text-3); pointer-events: none; }
.pill-select.active { border-color: var(--ink); }
.filters { display: flex; gap: 8px; flex: 1 1 100%; min-width: 0; }
.filters .pill-select { flex: 1 1 0; min-width: 0; }
.filters .pill-select select { flex: 1; min-width: 0; width: 100%; max-width: none; }
@media (min-width: 900px) { .filters { flex: 0 1 auto; } .filters .pill-select { flex: none; } .filters .pill-select select { width: auto; max-width: 200px; } }

/* ---------- item cards ---------- */

.cards { display: grid; gap: 10px; }
.item {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px 13px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, opacity 0.15s;
}
.item:hover { box-shadow: 0 2px 4px rgba(18, 18, 17, 0.05), 0 10px 28px rgba(18, 18, 17, 0.08); }
.item:active { transform: scale(0.99); }
.item-meta {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  font-size: 12.5px; color: var(--text-2); font-weight: 500;
}
.item-meta .cat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta .sep { color: var(--text-3); }
.item-more { margin: -6px -8px -6px auto; color: var(--text-3); }
.item-title { font-size: 16.5px; line-height: 1.3; font-weight: 620; letter-spacing: -0.01em; margin-top: 5px; overflow-wrap: anywhere; }
.item-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.item-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; }
.tag { font-size: 12.5px; color: var(--text-3); }

.plat {
  display: inline-flex; align-items: center; height: 19px; padding: 0 6px; border-radius: 6px;
  font-size: 10.5px; font-weight: 750; letter-spacing: 0.05em; flex: none;
}
.plat.ig { background: var(--lilac-soft); color: var(--lilac-ink); }
.plat.yt { background: var(--red-soft); color: var(--red-ink); }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.status .steps { display: inline-flex; gap: 3px; }
.status .steps i { width: 10px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.status .steps i.on { background: var(--blue); }
.status.s-idea .steps i.on { background: var(--text-3); }
.status.s-ready .steps i.on { background: var(--lime); }
.status.s-ready { color: var(--lime-ink); font-weight: 650; }
.status.s-published { color: var(--text-2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.status-dot.s-prep { background: var(--blue); opacity: 0.45; }
.status-dot.s-shoot { background: var(--blue); opacity: 0.72; }
.status-dot.s-edit { background: var(--blue); }
.status-dot.s-ready { background: var(--lime); box-shadow: 0 0 0 2px var(--lime-soft); }
.status-dot.s-published { background: var(--ink); }

.date-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.date-badge .ic { color: var(--text-3); }
.date-badge.today { color: var(--ink); font-weight: 700; }
.date-badge.past { color: var(--red-ink); }

/* ---------- list view ---------- */

.group-list { margin-bottom: 22px; }
.group-title {
  display: flex; align-items: center; gap: 8px; margin: 4px 2px 10px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2);
}
.count {
  font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: 0; text-transform: none;
  background: var(--surface-2); border-radius: 999px; padding: 1px 8px; margin-left: 2px;
}
@media (min-width: 900px) {
  .groups .cards, .archive .cards, .agenda .cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

.empty { text-align: center; padding: 48px 20px; color: var(--text-2); display: grid; justify-items: center; gap: 6px; }
.empty-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); margin-bottom: 8px; }

/* ---------- kanban ---------- */

.kanban-hint { margin: -4px 2px 12px; }
.kanban { display: flex; flex-direction: column; gap: 12px; }
.col {
  background: var(--surface-2); border-radius: 20px; padding: 6px;
  transition: background 0.15s, box-shadow 0.15s;
}
.col-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  padding: 10px 10px; border-radius: 14px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2);
  text-align: left;
}
.col-head .col-name { flex: 1; min-width: 0; }
.col-head .ic { color: var(--text-3); transition: transform 0.2s var(--ease); }
.col.collapsed .col-head .ic { transform: rotate(-90deg); }
.col-head.static { text-transform: none; letter-spacing: 0; font-weight: 600; justify-content: center; }
.col-head.static .col-name { flex: none; }
.col-list { display: flex; flex-direction: column; gap: 8px; min-height: 8px; padding: 0 2px 4px; }
.col.collapsed .col-list { display: none; }
.col-empty { font-size: 13px; color: var(--text-3); text-align: center; padding: 14px 0 12px; border: 1px dashed var(--line-strong); border-radius: 14px; }
.col-list .item ~ .col-empty { display: none; }
.col.drop-over { background: var(--blue-soft); box-shadow: inset 0 0 0 1.5px var(--blue); }
.publish-zone { background: transparent; border: 1.5px dashed var(--line-strong); }
.publish-zone .col-list { min-height: 0; padding: 0; }
.publish-zone .col-list .item { display: none; }
.publish-zone.drop-over { background: var(--lime-soft); border-color: var(--lime-ink); box-shadow: none; }
.publish-zone.drop-over .col-head { color: var(--lime-ink); }

.item.draggable { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.item.pressing { transform: scale(0.975); transition: transform 0.38s var(--ease); }
.drag-src { opacity: 0.3; }
.drag-ghost {
  position: fixed !important; left: 0; top: 0; z-index: 1000; pointer-events: none; margin: 0 !important;
  box-shadow: var(--shadow-lift) !important; opacity: 0.96;
}
body.dragging, body.dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }

@media (min-width: 900px) {
  .kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; gap: 10px; }
  .kanban .publish-zone { grid-column: 1 / -1; }
  .col.collapsed .col-list { display: flex; }
  .col-head { cursor: default; padding: 10px 8px; }
  .col:not(.publish-zone) .col-head .ic { display: none; }
  .col-list { min-height: 80px; }
  .kanban .item { padding: 11px 12px 12px; }
  .kanban .item-title { font-size: 15px; }
}

/* ---------- calendar ---------- */

.overview { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 22px; }
.overview > * { min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 11px 12px 12px; box-shadow: var(--shadow); display: grid; gap: 1px; min-width: 0;
  transition: transform 0.12s var(--ease);
}
.tile:active { transform: scale(0.98); }
.tile-n { font-family: var(--serif); font-size: 30px; line-height: 1; font-weight: 600; letter-spacing: -0.02em; }
.tile-label { font-size: 12.5px; color: var(--text-2); font-weight: 550; line-height: 1.25; margin-top: 4px; }
.tile-split { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: 0.02em; margin-top: 2px; }
.tile.t-ready .tile-n { color: var(--lime-ink); }
.tile.t-ready { position: relative; }
.tile.t-ready::after { content: ""; position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); }

.upcoming { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 6px; box-shadow: var(--shadow); }
.mini-title { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.upcoming .muted.small { padding: 4px 0 10px; }
.upcoming-list { list-style: none; margin: 0; padding: 0; }
.upcoming-list li + li { border-top: 1px solid var(--line); }
.up-row { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 0; text-align: left; min-height: 44px; }
.up-day { width: 74px; flex: none; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.up-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-fmt { font-size: 12px; color: var(--text-3); font-weight: 600; flex: none; }

.cal-nav { display: flex; align-items: center; gap: 4px; margin: 4px 0 10px; }
.cal-title { font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; flex: 1; text-align: center; }
.cal-title::first-letter { text-transform: uppercase; }
.cal-toolbar { flex-wrap: nowrap; }
.cal-toolbar .seg button { padding: 0 9px; }
.cal-toolbar .mode-seg { flex: 1; }
.cal-toolbar .mode-seg button { flex: 1; justify-content: center; }
@media (min-width: 900px) { .cal-toolbar .mode-seg { flex: none; } .cal-toolbar .seg button { padding: 0 14px; } }
.today-btn { order: 3; }
.cal-nav .icon-btn:first-child { order: 0; }
.cal-nav .icon-btn:nth-child(3) { order: 2; }

.chip-item {
  display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0;
  padding: 6px 8px 6px 9px; border-radius: 10px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--text-3);
  font-size: 13px; line-height: 1.25; box-shadow: var(--shadow);
}
.chip-item.ig { border-left-color: var(--lilac); }
.chip-item.yt { border-left-color: var(--red); }
.chip-fmt { flex: none; display: inline-flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2); }
.chip-item.ig .chip-fmt { color: var(--lilac-ink); }
.chip-item.yt .chip-fmt { color: var(--red-ink); }
.chip-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 580; min-width: 0; }
.chip-item.done { opacity: 0.55; box-shadow: none; }
.chip-item.s-ready .chip-title::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); margin-left: 6px; vertical-align: 1px; }

/* week: one row per day on the phone, seven columns on wide screens */
.week { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.day {
  position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 10px;
  padding: 10px 44px 10px 12px; min-height: 60px; cursor: pointer;
  border-top: 1px solid var(--line);
  transition: background 0.15s;
}
.day:first-child { border-top: 0; }
.day:active { background: var(--surface-2); }
.day-head { display: flex; flex-direction: column; align-items: center; gap: 0; padding-top: 2px; }
.day-head .wd { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.day-head .num { font-family: var(--serif); font-size: 21px; font-weight: 600; line-height: 1.15; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; }
.day.today .day-head .num { background: var(--ink); color: var(--on-ink); }
.day.today .day-head .wd { color: var(--ink); }
.day.past .day-head { opacity: 0.5; }
.day-list { display: flex; flex-direction: column; gap: 6px; justify-content: center; min-width: 0; }
.day-add { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); opacity: 0.6; }
.day.drop-over, .cell.drop-over { background: var(--blue-soft); }

@media (min-width: 900px) {
  .week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .day { grid-template-columns: 1fr; grid-template-rows: auto 1fr; align-content: start; padding: 10px 8px 36px; min-height: 380px; border-top: 0; border-left: 1px solid var(--line); }
  .day:first-child { border-left: 0; }
  .day-head { flex-direction: row; justify-content: space-between; padding: 0 4px; }
  .day-list { justify-content: flex-start; }
  .day-add { top: auto; bottom: 10px; right: 50%; transform: translateX(50%); opacity: 0; transition: opacity 0.15s; }
  .day:hover { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
  .day:hover .day-add { opacity: 1; }
  .chip-item { cursor: grab; }
}

/* month */
.month { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.month-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.month-head span { text-align: center; padding: 8px 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cell {
  min-height: 62px; padding: 5px 4px 6px; border-top: 1px solid var(--line); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; min-width: 0;
  transition: background 0.15s;
}
.cell:nth-child(7n + 1) { border-left: 0; }
.cell:nth-child(-n + 7) { border-top: 0; }
.cell .num { font-size: 13px; font-weight: 600; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.cell.today .num { background: var(--ink); color: var(--on-ink); }
.cell.out { background: color-mix(in srgb, var(--surface-2) 40%, transparent); }
.cell.out .num { color: var(--text-3); }
.cell.past:not(.today) .num { color: var(--text-3); }
.cell:active { background: var(--surface-2); }
.cell .day-list { width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; }
/* phone: contents as small coloured bars */
.cell .chip-item { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; box-shadow: none; background: var(--text-3); pointer-events: none; }
.cell .chip-item.ig { background: var(--lilac); }
.cell .chip-item.yt { background: var(--red); }
.cell .chip-item > * { display: none; }
.cell .more { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
@media (min-width: 900px) {
  .cell { min-height: 128px; align-items: stretch; padding: 6px; }
  .cell .num { align-self: flex-end; }
  .cell .day-list { flex-direction: column; flex-wrap: nowrap; }
  .cell .chip-item { width: 100%; height: auto; padding: 4px 6px 4px 7px; border: 1px solid var(--line); border-left: 3px solid var(--text-3); border-radius: 8px; background: var(--surface); pointer-events: auto; font-size: 12px; }
  .cell .chip-item.ig { border-left-color: var(--lilac); background: var(--surface); }
  .cell .chip-item.yt { border-left-color: var(--red); background: var(--surface); }
  .cell .chip-item > * { display: inline-flex; }
  .cell .chip-item > .chip-title { display: block; }
  .cell .more { padding-left: 4px; }
  .overview { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); align-items: stretch; }
  .tiles { align-content: stretch; }
  .tile { align-content: center; padding: 16px; }
}

/* agenda */
.agenda > .btn { margin-bottom: 14px; }
.agenda-day { margin-bottom: 20px; }
.agenda-date { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 8px; text-transform: capitalize; }
.agenda-date span:first-child { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.agenda-num { font-size: 13px; color: var(--text-2); font-weight: 600; text-transform: none; }
.agenda-day.today .agenda-date span:first-child::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); margin-left: 8px; vertical-align: 3px; }
.agenda-day.past { opacity: 0.6; }

.day-sheet .cards { margin: 4px 0 16px; }
.sheet-title .count { margin-left: 8px; vertical-align: 3px; }

/* ---------- archive ---------- */

.search { flex: 1 1 260px; position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 13px; color: var(--text-3); pointer-events: none; }
.search-input { padding-left: 40px; }
.result-count { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin: 14px 2px 10px; }
.archive .hint { margin: -4px 2px 0; }

/* ---------- sheets ---------- */

.sheet-wrap { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.sheet-wrap.open { pointer-events: auto; }
.backdrop { position: absolute; inset: 0; background: var(--backdrop); opacity: 0; transition: opacity 0.28s; }
.sheet-wrap.open .backdrop { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: calc(100% - var(--safe-t) - 28px);
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--bg); border-radius: 26px 26px 0 0;
  padding: 8px 18px calc(22px + var(--safe-b));
  transform: translateY(105%);
  transition: transform 0.34s var(--ease);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
}
.sheet.tall { height: calc(100% - var(--safe-t) - 12px); }
.sheet-wrap.open .sheet { transform: none; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet-title { font-family: var(--serif); font-size: 23px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 14px; text-transform: none; }
.sheet-title.small { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--text-2); text-align: center; margin-bottom: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm p { margin-bottom: 4px; }
.quick-date { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--text-2); background: var(--surface-2); border-radius: 999px; padding: 5px 12px; margin-bottom: 12px; }
@media (min-width: 700px) {
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, calc(100% - 48px));
    max-height: min(860px, calc(100% - 64px));
    border-radius: 24px; padding: 22px 26px 26px;
    transform: translate(-50%, -48%) scale(0.98); opacity: 0;
    transition: transform 0.26s var(--ease), opacity 0.2s;
    box-shadow: var(--shadow-lift);
  }
  .sheet.tall { height: min(860px, calc(100% - 64px)); }
  .sheet.editor-sheet { width: min(720px, calc(100% - 48px)); }
  .sheet-wrap.open .sheet { transform: translate(-50%, -50%); opacity: 1; }
  .grabber { display: none; }
}

.actions .group { background: var(--surface); border-radius: 16px; overflow: hidden; margin-bottom: 10px; border: 1px solid var(--line); }
.row.action { width: 100%; display: flex; align-items: center; gap: 12px; padding: 0 16px; min-height: 50px; text-align: left; font-size: 15.5px; border-top: 1px solid var(--line); }
.row.action:first-child { border-top: 0; }
.row.action span:not(.ic) { flex: 1; }
.row.action .ic { color: var(--text-2); }
.row.action.current { color: var(--text-3); }
.row.action.current .ic:last-child { color: var(--ink); }
.row.action.danger, .row.action.danger .ic { color: var(--red-ink); }
.row.action:active { background: var(--surface-2); }

/* ---------- editor ---------- */

.ed-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; position: sticky; top: -8px; background: var(--bg); z-index: 2; padding: 4px 0; }
.ed-plat { font-size: 13px; font-weight: 600; color: var(--text-2); }
.save-state { margin-left: auto; font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.save-state.err { color: var(--red-ink); }
.save-state.busy, .save-state.dirty { color: var(--text-2); }
.title-input {
  font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.2;
  border: 0; background: transparent; padding: 6px 0 8px; min-height: 0; border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.title-input:focus { box-shadow: none; border-bottom-color: var(--ink); }

.status-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 16px 0 18px; }
.status-picker button span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
@media (max-width: 420px) { .status-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.status-picker button {
  display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 6px 9px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); text-align: left;
  font-size: 12.5px; line-height: 1.15; font-weight: 600; color: var(--text-2);
  transition: background 0.15s, color 0.15s, transform 0.12s var(--ease);
}
.status-picker button:active { transform: scale(0.97); }
.status-picker .n {
  flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 750; background: var(--surface-2); color: var(--text-3); font-family: var(--num);
}
.status-picker button.done .n { background: var(--blue-soft); color: var(--blue); }
.status-picker button.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.status-picker button.on .n { background: var(--on-ink); color: var(--ink); }
.status-picker button.s-ready.on { background: var(--lime); border-color: var(--lime); color: #121211; }
.status-picker button.s-ready.on .n { background: #121211; color: var(--lime); }
@media (min-width: 700px) { .status-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); } .status-picker button { flex-direction: column; align-items: flex-start; padding: 8px 9px; } }

.ed-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.ed-grid .full { grid-column: 1 / -1; }
.field { display: block; min-width: 0; }
.field-label, .ed-section h4 { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 7px; }
.date-field { display: flex; align-items: center; gap: 4px; }
.date-field .icon-btn { color: var(--text-3); }
.date-field:not(.has-value) .clear-date { display: none; }
.date-field .input { padding-left: 10px; padding-right: 8px; }
.format-seg { display: flex; }
.format-seg button { flex: 1; justify-content: center; padding: 0 4px; white-space: nowrap; font-size: 13px; }
.ed-section { margin-top: 24px; }
.ed-section .hint { margin: -2px 0 8px; }
.ed-section > textarea + textarea { margin-top: 8px; }

.variants, .links { display: grid; gap: 8px; justify-items: start; }
.variant { display: flex; align-items: center; gap: 4px; width: 100%; }
.variant .input { flex: 1; min-width: 0; }
.variant .star { color: var(--text-3); }
.variant.chosen .star { color: #121211; background: var(--lime); }
.variant.chosen .input { border-color: var(--ink); }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "label label label" "url open del"; gap: 6px 4px; width: 100%; align-items: center; padding-bottom: 6px; }
.link-row + .link-row { border-top: 1px solid var(--line); padding-top: 10px; }
.link-label { grid-area: label; }
.link-url { grid-area: url; }
.link-row a.icon-btn { grid-area: open; }
.link-row button.icon-btn { grid-area: del; }
@media (min-width: 700px) {
  .link-row { grid-template-columns: 170px minmax(0, 1fr) auto auto; grid-template-areas: "label url open del"; padding: 0; }
  .link-row + .link-row { border: 0; padding: 0; }
}

.tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 46px; padding: 7px 8px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface);
  cursor: text;
}
.tag-input:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--lilac-soft); }
.tag-input input { flex: 1; min-width: 110px; border: 0; background: none; font-size: 16px; padding: 4px; }
.tag-input input:focus { outline: none; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 14px; font-weight: 550; }
.chip button { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); }

.ed-foot { display: flex; gap: 10px; justify-content: space-between; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); }
.ed-created { font-size: 12px; color: var(--text-3); margin-top: 12px; text-align: center; }

/* ---------- settings ---------- */

.set-section { margin-bottom: 30px; }
.set-section h2 { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 20px; font-weight: 600; margin-bottom: 10px; }
.set-section > .muted { margin-bottom: 4px; }
.group.cat-list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 8px; }
.cat-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 14px; min-height: 50px; border-top: 1px solid var(--line); }
.cat-row:first-child { border-top: 0; }
.cat-name { flex: 1; min-width: 0; font-weight: 550; }
.cat-row.fixed { color: var(--text-2); padding-right: 14px; }
.theme-seg { display: flex; max-width: 380px; }
.theme-seg button { flex: 1; justify-content: center; }
.footnote { text-align: center; color: var(--text-3); font-size: 12px; margin: 20px 0; }

/* ---------- login ---------- */

.login { max-width: 380px; margin: 0 auto; padding: calc(var(--safe-t) + 16vh) 24px 40px; display: grid; gap: 6px; animation: fade-in 0.3s var(--ease); }
.login-title { font-size: 42px; margin-bottom: 4px; }
.login > .muted { margin-bottom: 26px; }
.login form { display: grid; gap: 12px; }
.login-mark { position: relative; width: 64px; height: 76px; margin-bottom: 26px; }
.lm-card { position: absolute; inset: 4px 10px; border-radius: 9px; }
.lm-card.back { background: var(--lilac); transform: rotate(-12deg) translate(-7px, 2px); }
.lm-card.front { background: var(--ink); transform: rotate(5deg) translate(7px, 0); }
.lm-card.front i { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--lime); right: 8px; top: 8px; }

/* ---------- toast, offline ---------- */

#toast {
  position: fixed; z-index: 200; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  transition: transform 0.25s var(--ease), opacity 0.2s; width: max-content; max-width: calc(100% - 32px);
}
#toast.top { bottom: auto; top: calc(var(--safe-t) + 14px); transform: translate(-50%, -16px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast { display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--on-ink); border-radius: 14px; padding: 12px 16px; font-size: 14.5px; font-weight: 550; box-shadow: var(--shadow-lift); }
.toast.error { background: var(--red); color: #fff; }
.toast button { color: var(--lime); font-weight: 700; }
:root[data-theme="dark"] .toast button { color: #4a5f00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast button { color: #4a5f00; } }
@media (min-width: 900px) { #toast { bottom: 32px; margin-left: calc(var(--side-w) / 2); } }

.offline-pill { position: fixed; z-index: 150; top: calc(var(--safe-t) + 8px); left: 50%; transform: translate(-50%, -60px); transition: transform 0.3s var(--ease); pointer-events: none; }
.offline-pill span { display: block; background: var(--ink); color: var(--on-ink); font-size: 13px; font-weight: 600; border-radius: 999px; padding: 7px 14px; white-space: nowrap; }
body.offline .offline-pill { transform: translate(-50%, 0); }

.boot-error { min-height: 60vh; align-content: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (pointer: fine) { .kanban-hint { display: none; } }
