:root {
  --bg: #eef3fb;
  --surface: #ffffff;
  --surface-2: #f6f9fe;
  --sunken: #e7eef9;
  --text: #15213b;
  --muted: #64718a;
  --border: #dfe7f3;
  --primary: #2563eb;
  --danger: #d23c3c;
  --shadow: 0 1px 2px rgba(30, 64, 175, .06), 0 1px 3px rgba(30, 64, 175, .06);
  --shadow-lift: 0 6px 16px rgba(30, 64, 175, .12);
  --hero: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 55%, #3b82f6 100%);
  --c0: #2563eb;
  --c1: #0d9488;
  --c2: #4f46e5;
  --c3: #0284c7;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220;
    --surface: #152036;
    --surface-2: #101a2c;
    --sunken: #0d1626;
    --text: #e6ecf7;
    --muted: #93a1ba;
    --border: #22304a;
    --primary: #4f8cff;
    --danger: #f07373;
    --shadow: none;
    --shadow-lift: 0 6px 18px rgba(0, 0, 0, .35);
    --hero: linear-gradient(135deg, #0f1f4d 0%, #1a3a9c 60%, #2557d6 100%);
    --c0: #4f8cff;
    --c1: #2dd4bf;
    --c2: #8b8cf8;
    --c3: #38bdf8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }

.c0 { --accent: var(--c0); }
.c1 { --accent: var(--c1); }
.c2 { --accent: var(--c2); }
.c3 { --accent: var(--c3); }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 40%, transparent) transparent; }

/* Μπλε κεφαλίδα με το πεδίο νέας εργασίας */
.hero {
  flex: none; background: var(--hero); color: #fff;
  padding: 0 0 16px; margin-bottom: 14px;
  box-shadow: 0 4px 20px rgba(29, 78, 216, .18);
}
.top { display: flex; align-items: center; gap: 10px; padding: 12px 18px 10px; }
.logo { width: 28px; height: 28px; border-radius: 8px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.top h1 { font-size: 19px; margin: 0; flex: 1; font-weight: 700; letter-spacing: .01em; }
.icon-btn {
  border: 0; background: none; color: rgba(255, 255, 255, .85);
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; cursor: pointer; transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.banner {
  margin: 0 18px 12px; padding: 7px 12px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 10px; font-size: 13px;
}

.quick { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 0 18px; }
.q-wrap { flex: 1 1 280px; min-width: 0; position: relative; display: block; }
.q-plus {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 600; line-height: 1;
  pointer-events: none; transition: background .2s;
}
.q-input {
  width: 100%; padding: 13px 120px 13px 46px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 0; border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 30, 80, .18);
}
.q-input::placeholder { color: var(--muted); }
.q-input:focus { outline: 3px solid rgba(255, 255, 255, .45); outline-offset: 0; }
.q-add {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; border-radius: 9px; padding: 8px 16px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
  transition: filter .15s, background .2s;
}
.q-add:hover { filter: brightness(1.1); }
.q-add:active { transform: translateY(-50%) scale(.97); }
.targets {
  display: flex; gap: 4px; padding: 4px; flex: none;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px;
}
.target {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; background: none; color: rgba(255, 255, 255, .85); cursor: pointer;
  padding: 8px 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s;
}
.target::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--accent); box-shadow: 0 0 0 2px rgba(255, 255, 255, .75);
}
.target:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.target.on { background: var(--surface); color: var(--accent); box-shadow: 0 2px 8px rgba(15, 30, 80, .2); }
.target.on::before { box-shadow: none; }

/* Πίνακας με στήλες */
.tabs { display: none; }
.board {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
  gap: 14px; padding: 0 14px 14px;
}
.col {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
}
.col-head { display: flex; align-items: center; gap: 9px; padding: 14px 16px 10px; }
.bar { width: 4px; height: 18px; border-radius: 4px; background: var(--accent); flex: none; }
.col-head h2 { font-size: 15px; margin: 0; flex: 1; font-weight: 700; }
.count {
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-radius: 999px;
  padding: 1px 9px; min-width: 26px; text-align: center;
}
.field {
  width: 100%; padding: 9px 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
}
.field:focus { outline: 2px solid var(--accent, var(--primary)); outline-offset: -1px; border-color: transparent; }
.col-body { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 12px 14px; display: flex; flex-direction: column; }
.list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 64px; flex: 1 0 auto;
}
.list:empty::before {
  content: "Καμία εργασία εδώ"; color: var(--muted); font-size: 13px; text-align: center;
  padding: 22px 0; border: 1.5px dashed color-mix(in srgb, var(--accent) 25%, var(--border)); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 3%, transparent);
}

/* Κάρτα εργασίας */
.card {
  position: relative; display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 6px 10px 12px; box-shadow: var(--shadow);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.card:not(.is-done):not(.editing):hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  box-shadow: var(--shadow-lift); transform: translateY(-1px);
}
.card .body { flex: 1; min-width: 0; padding-top: 1px; cursor: pointer; }
.title { white-space: pre-wrap; overflow-wrap: anywhere; }
.notes {
  margin-top: 4px; font-size: 13px; color: var(--muted);
  white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  padding-left: 8px; border-left: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.check {
  flex: none; position: relative; width: 20px; height: 20px; margin-top: 1px; padding: 0;
  border: 2px solid color-mix(in srgb, var(--accent) 45%, var(--border)); border-radius: 50%;
  background: none; cursor: pointer; transition: background .15s, border-color .15s;
}
.check:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.more, .del {
  flex: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 1px 8px 4px; border-radius: 8px;
  opacity: .7; transition: opacity .15s, background .15s;
}
.card:hover .more, .card:hover .del { opacity: 1; }
.more:hover, .del:hover { background: var(--sunken); color: var(--text); }
.del { font-size: 14px; padding: 3px 8px; }

/* Προσοχή: τρίγωνο ΚΟΚ, σβηστό ή αναμμένο */
.flag {
  flex: none; border: 0; background: none; padding: 2px; margin: -2px 0 0 -2px;
  border-radius: 6px; cursor: pointer; line-height: 0;
}
.flag .tri { fill: none; stroke: var(--muted); opacity: .45; transition: all .15s; }
.flag .mark { stroke: var(--muted); opacity: .45; }
.flag .dotm { fill: var(--muted); opacity: .45; }
.flag:hover .tri, .flag:hover .mark, .flag:hover .dotm { opacity: .9; }
.alert .flag .tri { fill: #fff; stroke: #d7261e; opacity: 1; }
.alert .flag .mark { stroke: #111; opacity: 1; }
.alert .flag .dotm { fill: #111; opacity: 1; }
.card.alert {
  border-color: color-mix(in srgb, #d7261e 45%, var(--border));
  background: color-mix(in srgb, #d7261e 6%, var(--surface));
  box-shadow: inset 4px 0 0 #d7261e, var(--shadow);
}
.card.alert .title { font-weight: 600; }

.trash {
  flex: none; border: 0; background: none; color: var(--muted); cursor: pointer;
  padding: 3px 6px; border-radius: 8px; line-height: 0; opacity: .7;
  transition: opacity .15s, background .15s, color .15s;
}
.card:hover .trash { opacity: 1; }
.trash:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.ghost { opacity: .35; }
.dragging { box-shadow: 0 14px 32px rgba(30, 64, 175, .25) !important; }

/* Ολοκληρωμένα */
.done { margin-top: 14px; }
.done summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; padding: 4px 2px; user-select: none; }
.done summary:hover { color: var(--accent); }
.done ul { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.card.is-done { cursor: default; box-shadow: none; background: transparent; border-style: dashed; }
.is-done .title { text-decoration: line-through; color: var(--muted); }
.is-done .check { background: var(--accent); border-color: var(--accent); }
.is-done .check::after {
  content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* Επεξεργασία */
.card.editing {
  cursor: default; padding: 10px; user-select: auto; -webkit-user-select: auto;
  border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.edit { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.edit textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; resize: none; overflow: hidden;
}
.edit textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.e-title { font-weight: 600; }
.e-notes { font-size: 14px; }
.edit-actions { display: flex; gap: 6px; align-items: center; }
.hint { font-size: 12px; color: var(--muted); margin-left: auto; }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; padding: 7px 14px; border-radius: 9px; cursor: pointer;
}
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); background: var(--primary); }
.btn:disabled { opacity: .5; cursor: default; }

/* Μενού κάρτας */
.menu {
  position: fixed; z-index: 50; padding: 5px; min-width: 220px; max-width: calc(100vw - 16px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 14px 36px rgba(15, 30, 80, .22);
}
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
}
.menu button:hover { background: color-mix(in srgb, var(--primary) 9%, var(--surface)); }
.menu .danger { color: var(--danger); }
.menu .danger:hover { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* Ρυθμίσεις */
dialog {
  border: 0; border-radius: 18px; padding: 22px; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(15, 30, 80, .3);
}
dialog::backdrop { background: rgba(15, 25, 60, .45); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 14px; font-size: 18px; }
dialog h3 { margin: 18px 0 8px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.set-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.set-row .field { flex: 1; }
.set-row .del { opacity: 1; }
.set-row .del:disabled { opacity: .3; cursor: default; }
.dlg-actions { display: flex; gap: 8px; margin-top: 22px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.linkish { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 6px 0; font-size: 14px; font-weight: 600; }

/* Σύνδεση */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--hero); }
.auth-box {
  width: min(340px, 100%); background: var(--surface); padding: 26px; border-radius: 18px;
  display: flex; flex-direction: column; gap: 10px; box-shadow: 0 24px 60px rgba(15, 30, 80, .35);
}
.auth-box h1 { margin: 0; font-size: 21px; color: var(--primary); }
.auth-box p { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: #1e3a8a; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; max-width: calc(100vw - 32px); box-shadow: 0 10px 28px rgba(15, 30, 80, .35);
}

@keyframes slide-r { from { opacity: 0; transform: translateX(24px); } }
@keyframes slide-l { from { opacity: 0; transform: translateX(-24px); } }

/* Υπολογιστής σε στενό παράθυρο: οι στήλες μένουν όλες, με οριζόντια κύλιση */
@media (min-width: 761px) and (max-width: 900px) {
  .board { grid-template-columns: repeat(var(--n), minmax(240px, 1fr)); overflow-x: auto; }
}

/* Κινητό ή στενό παράθυρο: μία στήλη τη φορά, με καρτέλες */
@media (max-width: 760px) {
  #app { height: auto; min-height: 100vh; min-height: 100dvh; }
  .hero { margin-bottom: 0; padding-bottom: 14px; border-radius: 0 0 20px 20px; }
  .top { padding: 10px 14px 8px; }
  .banner { margin: 0 14px 10px; }
  .quick { padding: 0 14px; }
  .targets { display: none; } /* στο κινητό οι καρτέλες κάνουν και επιλογή στήλης */
  /* Μπάρα καρτελών κάτω, όπως στις εφαρμογές κινητού */
  .tabs {
    display: flex; gap: 4px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border); box-shadow: 0 -6px 24px rgba(15, 30, 80, .08);
  }
  .tab {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
    border: 0; background: none; color: var(--muted); cursor: pointer;
    padding: 5px 2px 3px; font-size: 12px; font-weight: 600; line-height: 1.2;
  }
  .tab .ico {
    position: relative; width: 56px; height: 32px; border-radius: 999px;
    display: grid; place-items: center; transition: background .2s, color .2s;
  }
  .tab .count {
    position: absolute; top: -3px; right: 4px; min-width: 19px; padding: 0 5px;
    font-size: 10.5px; line-height: 15px; color: #fff; background: var(--accent);
    border: 2px solid var(--surface); border-radius: 999px;
  }
  .tab-name { text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .tab.on { color: var(--accent); }
  .tab.on .ico { background: color-mix(in srgb, var(--accent) 15%, transparent); }

  .board { display: block; padding: 0 12px calc(96px + env(safe-area-inset-bottom)); }
  .col { display: none; background: none; border: 0; }
  .col.active { display: flex; }
  .col.from-right { animation: slide-r .22s ease-out; }
  .col.from-left { animation: slide-l .22s ease-out; }
  .col-head { padding: 16px 4px 10px; }
  .col-head h2 { font-size: 20px; }
  .bar { height: 22px; }
  .col-body { padding: 0; overflow: visible; }
  .card { padding: 13px 6px 13px 13px; gap: 11px; }
  .check { width: 24px; height: 24px; }
  .is-done .check::after { left: 7px; top: 2px; width: 6px; height: 12px; }
  .more { padding: 2px 8px 6px; opacity: 1; }
  .trash { padding: 3px 8px; opacity: 1; }
  .flag svg { width: 25px; height: 23px; }
  .field, .edit textarea { font-size: 16px; }
  .hint { display: none; }
}