/* Tokens mirror the Figma variables ("Gün / Renk (ipad-dashboard)"). */
:root {
  --bg: #e4e8f1;
  --surface: #f8f9fc;
  --surface-2: #d9dde7;
  --ink: #1b1d24;
  --muted: #5a5f70;
  --line: #d3d7e0;
  --primary: #1b1d24;
  --on-primary: #ffffff;
  --now: #e23e3e;
  --soon: #3e88ff;
  --later: #139257;
  --scrim: rgba(27, 29, 36, .28);
  --shadow: 0 -12px 40px rgba(27, 29, 36, .14);
  --font: "Outfit", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --pad: 24px;
  --vh: 100dvh;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #2d2d2d;
  --surface: #3a3a3a;
  --surface-2: #252525;
  --ink: #ededed;
  --muted: #a6a6a6;
  --line: #454545;
  --primary: #ededed;
  --on-primary: #1f1f1f;
  --now: #ff7b7b;
  --soon: #7fb0ff;
  --later: #4fd18e;
  --scrim: rgba(0, 0, 0, .45);
  --shadow: 0 -12px 40px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2d2d2d; --surface: #3a3a3a; --surface-2: #252525; --ink: #ededed; --muted: #a6a6a6;
    --line: #454545; --primary: #ededed; --on-primary: #1f1f1f;
    --now: #ff7b7b; --soon: #7fb0ff; --later: #4fd18e;
    --scrim: rgba(0, 0, 0, .45); --shadow: 0 -12px 40px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body {
  font-family: var(--font);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  transition: background-color .3s ease;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--soon); outline-offset: 2px; border-radius: 8px; }

.app {
  height: var(--vh);
  display: flex;
  padding-top: env(safe-area-inset-top);
  overflow: hidden;
}
.pane-list {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* header */
.header { padding: 12px calc(var(--pad) - 10px) 8px var(--pad); }
.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.date { font-size: 13px; font-weight: 500; color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.logo { width: 28px; height: 28px; border-radius: 7px; display: block; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 22px;
  display: grid; place-items: center;
  color: var(--ink);
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: var(--surface-2); }
#theme .sun { display: none; }
:root[data-theme="dark"] #theme .sun { display: block; }
:root[data-theme="dark"] #theme .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) #theme .sun { display: block; }
  :root:not([data-theme]) #theme .moon { display: none; }
}

.tabs { display: flex; gap: 20px; align-items: baseline; }
.tab {
  font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  color: var(--muted); opacity: .55;
  min-height: 44px; display: inline-flex; align-items: baseline; gap: 6px;
  transition: opacity .2s ease, color .2s ease;
}
.tab[aria-selected="true"] { color: var(--ink); opacity: 1; }
.tab .count { font-size: 15px; font-weight: 500; color: var(--muted); display: none; }
.tab[aria-selected="true"] .count { display: inline; }

/* list */
.list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--pad) 16px;
  scrollbar-width: none;
}
.list::-webkit-scrollbar { display: none; }
.group { margin-top: 22px; }
.group-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 500; color: var(--muted);
  margin: 0 0 2px;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--soon)); flex: none; }
[data-tag="now"] { --dot: var(--now); }
[data-tag="soon"] { --dot: var(--soon); }
[data-tag="later"] { --dot: var(--later); }

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: 6px;
  min-height: 52px;
  margin: 0 -12px;
  padding: 0 12px 0 1px;
  border-radius: 12px;
  transition: background-color .2s ease, opacity .25s ease, transform .25s ease;
}
.row.selected { background: var(--surface); }
.row.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 30% { background: var(--surface); } 100% { background: transparent; } }
.row.leaving { opacity: 0; transform: translateX(16px); }
.check {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
}
.check span {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--muted);
  display: grid; place-items: center;
  transition: background-color .15s ease, border-color .15s ease;
}
.check svg { width: 12px; height: 12px; fill: none; stroke: var(--bg); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.row.done .check span { background: var(--muted); border-color: var(--muted); }
.row.done .check svg { opacity: 1; }
.row-main {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; text-align: left;
}
.row-text { flex: 1; min-width: 0; font-size: 18px; line-height: 22px; padding: 15px 0; overflow-wrap: anywhere; }
.row.done .row-text { color: var(--muted); text-decoration: line-through; }
.row-meta { font-size: 15px; color: var(--muted); white-space: nowrap; }

.month { margin-top: 10px; }
.month-text { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; color: var(--muted); }
.bar { height: 2px; background: var(--surface-2); margin-top: 10px; border-radius: 1px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); transition: width .4s ease; }

.done-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; margin-top: 12px;
  font-size: 15px; font-weight: 500; color: var(--muted);
}
.done-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.empty { margin-top: 28vh; text-align: center; color: var(--muted); font-size: 16px; line-height: 1.5; }
.empty strong { display: block; color: var(--ink); font-size: 18px; font-weight: 600; margin-bottom: 4px; }

/* capture */
.capture { padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
.input {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border-radius: 26px;
  padding: 6px;
}
.prio {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 12px; border-radius: 20px;
  background: var(--bg);
  font-size: 16px; font-weight: 500; white-space: nowrap;
  transition: transform .12s ease;
}
.prio:active { transform: scale(.95); }
.prio .dot { width: 8px; height: 8px; }
#text {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: none;
  font-size: 17px; height: 40px;
}
#text::placeholder { color: var(--muted); }
.add {
  width: 40px; height: 40px; border-radius: 20px; flex: none;
  background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center;
  transition: opacity .15s ease, transform .12s ease;
}
.add:active { transform: scale(.94); }
.add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.capture:not(.has-text) .add { opacity: .35; }

/* detail: bottom sheet on the closed (narrow) screen */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.pane-detail {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-height: calc(var(--vh) - 48px);
  overflow-y: auto;
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow);
  padding: 8px var(--pad) calc(20px + env(safe-area-inset-bottom));
  transform: translateY(105%);
  transition: transform .32s cubic-bezier(.2, .8, .2, 1);
}
.pane-detail.open { transform: none; }
.detail-empty { display: none; }
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 4px; }
.detail-body { position: relative; }
.close { position: absolute; right: -12px; top: 4px; color: var(--muted); }

.d-title {
  width: 100%; resize: none; border: 0; outline: 0; background: none;
  font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 34px;
  padding: 16px 40px 0 0; overflow: hidden;
}
.d-prio { display: flex; gap: 0; margin-top: 20px; margin-left: -10px; }
.d-prio button {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 10px; border-radius: 20px; white-space: nowrap;
  font-size: 15px; color: var(--muted);
}
.d-prio button .dot { width: 8px; height: 8px; }
.d-prio button[aria-checked="true"] { background: var(--bg); color: var(--ink); font-weight: 600; }

.fields { margin-top: 24px; }
.field {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; border-top: 1px solid var(--line);
  font-size: 16px;
}
.field > span { color: var(--muted); }
.field input[type="datetime-local"], .field select {
  border: 0; background: none; text-align: right; font-size: 16px;
  min-height: 44px; color: var(--ink); max-width: 60%;
}
.field input[type="datetime-local"]::-webkit-date-and-time-value { text-align: right; }
.switch {
  appearance: none; -webkit-appearance: none;
  width: 44px; height: 26px; border-radius: 13px; margin: 0;
  background: var(--surface-2); position: relative; cursor: pointer;
  transition: background-color .2s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .2s ease;
}
.switch:checked { background: var(--ink); }
.switch:checked::after { transform: translateX(18px); }

.note { display: block; margin-top: 24px; }
.note > span { font-size: 13px; font-weight: 500; color: var(--muted); }
.note textarea {
  display: block; width: 100%; margin-top: 8px; resize: none;
  border: 0; outline: 0; background: none; font-size: 16px; line-height: 23px; padding: 0;
}
.note textarea::placeholder { color: var(--muted); opacity: .7; }

.d-actions { margin-top: 28px; display: flex; flex-direction: column; gap: 4px; }
.btn-primary {
  height: 52px; border-radius: 26px;
  background: var(--primary); color: var(--on-primary);
  font-size: 16px; font-weight: 600;
}
.btn-primary:active { opacity: .85; }
.btn-text { height: 44px; color: var(--now); font-size: 15px; font-weight: 500; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 30;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: var(--primary); color: var(--on-primary);
  padding: 6px 6px 6px 18px; border-radius: 24px;
  font-size: 15px; white-space: nowrap;
  animation: rise .25s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast button { height: 36px; padding: 0 14px; border-radius: 18px; font-weight: 600; background: rgba(127, 127, 127, .22); }

/* login (one-time per device) */
.login {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: grid; place-items: center;
  padding: 24px; padding-top: calc(24px + env(safe-area-inset-top));
}
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; }
.login-logo { width: 72px; height: 72px; border-radius: 17px; margin-bottom: 20px; display: block; }
.login h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.login p { margin: 8px 0 24px; color: var(--muted); font-size: 16px; line-height: 1.45; }
.login input[type="password"] {
  height: 52px; border: 0; outline: 0; border-radius: 26px;
  background: var(--surface); padding: 0 20px; font-size: 17px;
}
.login input[type="password"]:focus-visible { box-shadow: 0 0 0 2px var(--soon); }
.login .login-error { min-height: 22px; margin: 10px 4px 10px; color: var(--now); font-size: 15px; }
.login .btn-primary:disabled { opacity: .5; }

/* open iPhone Duo (inner display, 669pt) and wider: two equal panes split at the fold */
@media (min-width: 600px) {
  .app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .pane-list { flex: 1 1 50%; padding: 0; border-right: 1px solid var(--line); }
  .list { padding-right: 16px; }
  .scrim { display: none !important; }
  .pane-detail {
    position: static; transform: none; flex: 1 1 50%;
    max-height: none; height: 100%;
    background: var(--bg); box-shadow: none; border-radius: 0;
    padding: 70px var(--pad) calc(24px + env(safe-area-inset-bottom));
    transition: none;
  }
  .detail-body { display: flex; flex-direction: column; min-height: 100%; }
  .detail-body[hidden] { display: none; }
  .d-actions { margin-top: auto; padding-top: 28px; }
  .sheet-grip, .close { display: none; }
  .detail-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; font-size: 16px; }
  .detail-empty[hidden] { display: none; }
  .d-prio button[aria-checked="true"] { background: var(--surface); }
  .toast { left: 25%; }
}

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