:root {
  --bg: #f4f3ef;
  --card: #ffffff;
  --text: #1d2125;
  --muted: #6b7178;
  --line: #e2e0da;
  --accent: #1f3a5f;
  --accent-soft: #e4ebf4;
  --done: #2e7d4f;
  --warn: #b3261e;
  --when: #8a5a00;
  --when-bg: #fbefd7;
  --kind: #5b3a8a;
  --kind-bg: #ece4f6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --card: #1f2329;
    --text: #e8e9eb;
    --muted: #9aa1a9;
    --line: #2e333a;
    --accent: #8db4e8;
    --accent-soft: #24344a;
    --done: #6fcf97;
    --warn: #f28b82;
    --when: #f2c46d;
    --when-bg: #3a2f1a;
    --kind: #c9a8f0;
    --kind-bg: #2f2640;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: 0 0 calc(80px + env(safe-area-inset-bottom));
  max-width: 760px;
  margin-inline: auto;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

/* ---- Σύνδεση ---- */
.login { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 24px 16px; }
.login img { border-radius: 18px; }
.login h1 { margin: 4px 0 12px; font-size: 26px; }
.login form { display: grid; gap: 10px; width: min(320px, 90vw); }
.login input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 17px; }
.login button { padding: 12px; border: 0; border-radius: 12px; background: var(--accent); color: var(--card); font-weight: 600; font-size: 17px; }
.hint { color: var(--muted); margin: 4px 0; font-size: 14px; }
.hint.small { font-size: 12px; }
.error { color: var(--warn); margin: 4px 0; font-size: 14px; }

/* ---- Πάνω μπάρα ---- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--bg);
}
.top h1 { font-size: 21px; margin: 0; letter-spacing: -.01em; }
.top .logo { border-radius: 8px; }
.search { padding: 0 16px 8px; }
.search input {
  width: 100%; padding: 10px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); font-size: 16px;
}
.icon { border: 0; background: none; font-size: 22px; line-height: 1; padding: 6px 8px; border-radius: 10px; }
.icon:hover { background: var(--accent-soft); }

/* ---- Καταγραφή ---- */
.capture {
  margin: 4px 16px 8px; padding: 10px 12px 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.capture:focus-within { border-color: var(--accent); }
.capture textarea {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent;
  font-size: 17px; min-height: 52px;
}
.cap-bar { display: flex; align-items: center; gap: 6px; }
.pill {
  cursor: pointer; padding: 6px 12px; border-radius: 999px; font-size: 14px;
  background: var(--bg); border: 1px solid var(--line); white-space: nowrap;
}
.grow { flex: 1; }
button.primary, .primary {
  border: 0; border-radius: 999px; padding: 9px 20px; font-size: 15px;
  background: var(--accent); color: var(--card); font-weight: 600;
}
button.primary:disabled { opacity: .5; }
.cap-files { display: flex; flex-wrap: wrap; gap: 6px; }
.cap-files:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--accent-soft); font-size: 13px;
}
.chip small { color: var(--muted); }
.chip button { border: 0; background: none; padding: 2px 6px; }

/* ---- Προβολές ---- */
.views {
  position: sticky; top: calc(50px + env(safe-area-inset-top)); z-index: 4;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 6px 16px 8px; background: var(--bg);
}
.views::-webkit-scrollbar { display: none; }
.views button {
  flex: none; border: 1px solid var(--line); background: var(--card);
  padding: 7px 13px; border-radius: 999px; font-size: 14px; white-space: nowrap;
}
.view-hint { margin: 0 16px 6px; color: var(--muted); font-size: 13px; }
.view-hint:empty { display: none; }
.views button b { font-weight: 600; color: var(--muted); font-size: 12px; }
.views button.on { background: var(--accent); color: var(--card); border-color: var(--accent); }
.views button.on b { color: inherit; opacity: .8; }

/* ---- Λίστα ---- */
.list { display: grid; gap: 8px; padding: 0 16px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.day { margin: 10px 4px 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: none; }
.day:first-child { margin-top: 2px; }
.help {
  background: var(--accent-soft); border-radius: 14px; padding: 12px 14px; font-size: 15px;
  display: grid; gap: 6px; justify-items: start;
}
.help ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.card {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; box-shadow: var(--shadow); cursor: pointer;
}
.card .check {
  flex: none; width: 28px; height: 28px; margin-top: 1px; border-radius: 50%;
  border: 2px solid var(--line); background: none; color: var(--line); font-size: 14px; font-weight: 700; padding: 0;
  display: grid; place-items: center;
}
.card .check:hover { border-color: var(--done); color: var(--done); }
.card.done .check { background: var(--done); border-color: var(--done); color: var(--card); }
.card.done .text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.card.pending { opacity: .75; cursor: default; }
.card.pending .check { border: 0; color: inherit; }
.card .body { flex: 1; min-width: 0; }
.text {
  white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical; overflow: hidden;
}
.thumbs { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.thumbs img { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; background: var(--line); cursor: zoom-in; }
.thumbs.one img { width: auto; max-width: 100%; height: auto; max-height: 260px; }
a.link { text-decoration: none; background: var(--accent-soft); border-radius: 6px; padding: 0 5px; white-space: nowrap; }
.docs a.doc { color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; }
.more-imgs { color: var(--muted); font-size: 13px; }
.docs { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.docs a { text-decoration: none; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.tag { padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.tag.when { background: var(--when-bg); color: var(--when); }
.tag.kind { background: var(--kind-bg); color: var(--kind); }
.tag.src, .tag.part { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.more { text-align: center; padding: 16px; }
.more button { border: 1px solid var(--line); background: var(--card); padding: 8px 18px; border-radius: 999px; }

/* ---- Φύλλα (θέμα, μενού) ---- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 760px;
  max-height: 92vh; border-radius: 20px 20px 0 0;
  background: var(--card); color: var(--text);
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, .4); }
@media (min-width: 800px) {
  dialog.sheet { margin: auto; border-radius: 20px; max-width: 640px; }
}
.sheet-in { display: grid; gap: 12px; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.sheet-head b { color: var(--text); font-size: 17px; }
.edit {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: var(--bg); resize: none; font-size: 17px; min-height: 100px;
}
.gallery { display: flex; gap: 8px; overflow-x: auto; }
.gallery img { height: 140px; border-radius: 10px; display: block; cursor: zoom-in; }
dialog.viewer {
  border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none;
  background: #000; display: none; place-items: center;
}
dialog.viewer[open] { display: grid; }
dialog.viewer img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
dialog.viewer .close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; color: #fff; background: rgba(0, 0, 0, .5); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lbl { color: var(--muted); font-size: 13px; min-width: 40px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--card); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.col { flex-direction: column; }
.actions button, .actions .btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; font-size: 14px;
  text-decoration: none; color: var(--text); text-align: center;
}
.actions button.primary { background: var(--accent); color: var(--card); border-color: var(--accent); }
.origin { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 6px; }
.origin[hidden] { display: none; }
.origin-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; background: var(--bg); padding: 10px 12px; border-radius: 10px; }
.origin ol { margin: 0; padding-left: 22px; font-size: 14px; }
.origin li.done { color: var(--muted); text-decoration: line-through; }

/* ---- Χωρισμός ---- */
.split { line-height: 2; font-size: 16px; overflow-wrap: anywhere; }
.split span { padding: 2px 0; border-radius: 4px; }
.split .p0 { background: transparent; }
.split .p1 { background: var(--accent-soft); }
.split .p2 { background: var(--when-bg); }
.split .p3 { background: var(--kind-bg); }
.cut {
  border: 1px dashed var(--line); background: none; border-radius: 6px;
  font-size: 12px; padding: 0 4px; margin: 0 3px; color: var(--muted); vertical-align: middle;
}
.cut.on { border: 1px solid var(--warn); color: var(--card); background: var(--warn); }

/* ---- Μήνυμα κάτω ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
  display: flex; gap: 12px; align-items: center;
}
.toast[hidden] { display: none; }
.toast button { border: 0; background: none; color: var(--accent-soft); font-weight: 700; padding: 0; }

/* ---- Διαγραφή, επιλογή πολλών ---- */
:root { --danger: #b3261e; }
@media (prefers-color-scheme: dark) { :root { --danger: #f28b82; } }
.actions button.danger, .selbar button.danger { color: var(--danger); border-color: var(--danger); background: var(--card); }
.confirm-text { font-size: 17px; margin: 4px 0; }
dialog.sheet.small .actions { justify-content: flex-end; }
dialog.sheet.small .actions .danger { background: var(--danger); color: var(--card); }
.card { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.card.sel .check { display: none; }
.card.sel::before {
  content: ''; flex: none; width: 24px; height: 24px; margin-top: 2px; border-radius: 6px;
  border: 2px solid var(--muted); background: var(--card); box-sizing: border-box;
}
.card.picked { border-color: var(--accent); background: var(--accent-soft); }
.card.picked::before { content: '✓'; color: var(--card); background: var(--accent); border-color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 15px; }
.selbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px; max-width: 760px; margin: 0 auto;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(0, 0, 0, .12);
}
.selbar[hidden] { display: none; }
.selbar button:not(.icon) { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 12px; font-size: 14px; }
.selbar button:disabled { opacity: .4; }
body.selecting .capture { opacity: .4; pointer-events: none; }

/* ---- Κατηγορίες ---- */
.tag.cat { background: var(--accent); color: var(--card); }
.seg.cats .new { border-style: dashed; color: var(--muted); }
.ask-input { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 17px; }

/* ---- Καρτέλες στο PC: ορατή μπάρα κύλισης (στο κινητό κινούνται με το δάχτυλο) ---- */
@media (any-pointer: fine), (min-width: 700px) {
  .views { scrollbar-width: thin; scrollbar-color: var(--muted) transparent; padding-bottom: 6px; }
}
