/* ---------- tokens ---------- */
:root {
  --bg: #1a1a1f;
  --surface: #24242b;
  --surface-2: #2d2d36;
  --text: #ece8e1;
  --muted: #a8a39a;
  --accent: #b8553a;
  --accent-hover: #d06849;
  --danger: #a04040;
  --border: #33333c;
  --focus-ring: rgba(184, 85, 58, 0.4);
  --r-card: 12px;
  --r-btn: 8px;
  --r-badge: 4px;
}

/* ---------- fonts ---------- */
@font-face { font-family: Inter; font-weight: 400; font-display: swap; src: url("/assets/fonts/Inter-Regular.woff2")  format("woff2"); }
@font-face { font-family: Inter; font-weight: 500; font-display: swap; src: url("/assets/fonts/Inter-Medium.woff2")   format("woff2"); }
@font-face { font-family: Inter; font-weight: 600; font-display: swap; src: url("/assets/fonts/Inter-SemiBold.woff2") format("woff2"); }

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */
.app { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; }
header.app-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 24px;
}
header.app-header img.logo { height: 56px; width: auto; }
header.app-header .titles { flex: 1; min-width: 0; }
header.app-header h1 { margin: 0; font-size: 22px; font-weight: 600; line-height: 1.25; }
header.app-header p  { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
header.app-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.btn {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-btn);
  padding: 8px 14px; font-weight: 500;
  transition: background 150ms ease-out, border-color 150ms ease-out;
}
.btn:hover { background: var(--surface); }
.btn.primary { background: var(--accent); border-color: transparent; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger  { color: var(--danger); }
.btn.icon { padding: 6px 10px; }

/* ---------- category / item cards ---------- */
.category {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 16px; margin-bottom: 16px;
}
.category h2 {
  margin: 0 0 12px; font-size: 18px; font-weight: 600; color: var(--accent);
}
.item {
  background: var(--surface-2); border-radius: var(--r-btn);
  padding: 12px; margin-bottom: 8px;
  display: flex; gap: 12px; align-items: flex-start;
}
.item .grip { color: var(--muted); cursor: grab; user-select: none; }
.item .body { flex: 1; min-width: 0; }
.item .body h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.item .body p  { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.item .deadline {
  display: inline-block; background: var(--accent); color: white;
  border-radius: var(--r-badge); padding: 2px 8px; font-size: 12px; font-weight: 500;
  margin-left: 8px;
}
.item .links { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.item .actions { display: flex; gap: 4px; flex-shrink: 0; }

.add-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; background: transparent; border: 1px dashed var(--border);
  border-radius: var(--r-btn); padding: 6px 12px; color: var(--muted);
}
.add-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------- edit form ---------- */
.edit-form { display: grid; gap: 8px; }
.edit-form input, .edit-form textarea {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-btn);
  padding: 8px 10px; font: inherit; width: 100%;
}
.edit-form label { font-size: 13px; color: var(--muted); }
.edit-form .row { display: flex; gap: 8px; align-items: center; }
.edit-form .row input { flex: 1; }

/* ---------- toast ---------- */
.toast {
  position: fixed; right: 16px; bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-btn); padding: 10px 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  transition: opacity 200ms ease-out;
}

/* ---------- confirm modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  z-index: 10;
}
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 20px; max-width: 360px; width: 100%;
}
.modal h3 { margin: 0 0 8px; }
.modal p  { margin: 0 0 16px; color: var(--muted); }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- touch targets ---------- */
@media (pointer: coarse) {
  .btn.icon { padding: 10px; min-width: 44px; min-height: 44px; }
  .item { padding: 16px; }
}

/* ---------- print ---------- */
@media print {
  body { background: white; color: black; }
  .app { max-width: none; padding: 0; }
  header.app-header .actions, .btn, .grip, .add-btn { display: none !important; }
  .category, .item { background: white; border: none; box-shadow: none; break-inside: avoid; }
  .category h2 { color: var(--accent); }
  .item .deadline { background: var(--accent); color: white; }
  a { color: black; }
  a::after { content: " (" attr(href) ")"; color: #555; font-size: .85em; }
}
