:root {
  --bg: #EDF2EE;
  --surface: #FFFFFF;
  --ink: #16332B;
  --muted: #6E837C;
  --line: #DDE7E1;
  --primary: #1F8A70;
  --primary-dark: #16644F;
  --honey: #F6B93B;
  --danger: #CE4F3A;
  --radius: 18px;
  --tap: 52px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
  padding-bottom: 40px;
  -webkit-tap-highlight-color: transparent;
}

h1 { font-size: 1.35rem; margin: 0; font-weight: 800; letter-spacing: -0.01em; }

a { color: var(--primary-dark); }

.muted { color: var(--muted); }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 14px 0;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--primary-dark);
  color: #fff;
  padding: 14px 14px 12px;
  padding-top: max(14px, env(safe-area-inset-top));
  box-shadow: 0 6px 18px rgba(22, 51, 43, .18);
}

.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-title { color: #fff; }
.topbar-sub { margin: 2px 0 0; font-size: .85rem; color: rgba(255,255,255,.72); }
.topbar-actions { display: flex; gap: 8px; }

/* ---------- Tabs ---------- */
.tabs {
  max-width: 640px;
  margin: 12px auto 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: rgba(255,255,255,.14);
  color: rgba(255,255,255,.9);
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.tab.is-active {
  background: #fff;
  color: var(--primary-dark);
  font-weight: 800;
}

.tab-count {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
  font-size: .78rem;
  font-weight: 800;
  text-align: center;
}
.tab.is-active .tab-count { background: var(--honey); color: #4A3200; }

/* ---------- Λίστα ψωνιών ---------- */
.panel-list { display: none; }
.panel-list.is-active { display: block; }

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.item-btn {
  width: 100%;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.item-btn:active { transform: scale(.995); }

.tick {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #C4D5CC;
  position: relative;
  transition: background-color .15s ease, border-color .15s ease;
}

.tick::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 3.5px;
  width: 6px;
  height: 12px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s ease;
}

.item-name { flex: 1 1 auto; font-weight: 600; }

.badge {
  flex: 0 0 auto;
  background: #FFF1D2;
  color: #7A5300;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .85rem;
  font-weight: 800;
}

.item.is-checked .tick { background: var(--primary); border-color: var(--primary); }
.item.is-checked .tick::after { transform: rotate(45deg) scale(1); }
.item.is-checked .item-name { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.item.is-checked .item-btn { background: #F4F8F5; }
.item.is-checked .badge { background: #EAF0EC; color: var(--muted); }

.list-tools {
  display: flex;
  gap: 8px;
  margin: 18px 0 8px;
  flex-wrap: wrap;
}

/* ---------- Κάρτες διαχείρισης ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.new-list { background: #E4EFE8; border-color: #CFE1D6; }

.row-form { display: flex; gap: 8px; }
.row-form .field { flex: 1 1 auto; }

.list-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.rename { flex: 1 1 auto; display: flex; align-items: center; gap: 8px; }

.list-name-input {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  padding: 4px 0;
  min-width: 0;
}
.list-name-input:focus { outline: none; border-bottom: 2px solid var(--primary); }

.linkish {
  border: 0;
  background: none;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  padding: 6px;
}

.admin-items { list-style: none; margin: 6px 0 12px; padding: 0; }

.admin-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #EFF4F1;
}

.admin-item-name { flex: 1 1 auto; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.qty { display: flex; align-items: center; gap: 2px; }

.qty-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #F6F9F7;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary-dark);
  cursor: pointer;
}

.qty-input {
  width: 46px;
  height: 34px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}

.add-item { display: flex; gap: 8px; align-items: center; }
.add-item .field { flex: 1 1 auto; }
.qty-field { width: 70px; flex: 0 0 auto; text-align: center; }

/* ---------- Χρήστες ---------- */
.users-card { background: #F7F9F7; }

.card-title { font-size: 1.1rem; font-weight: 800; margin: 0 0 4px; }
.small { font-size: .88rem; }

.user-row { flex-wrap: wrap; }
.user-row .admin-item-name { flex: 1 1 120px; }

.inline-form { display: flex; align-items: center; gap: 6px; }
.small-field { width: 140px; min-height: 38px; padding: 6px 10px; font-size: .9rem; }

.add-user { display: grid; gap: 8px; margin-top: 12px; }

.pill {
  display: inline-block;
  background: #E4EFE8;
  color: var(--primary-dark);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: .75rem;
  font-weight: 800;
  vertical-align: middle;
}

.ok-note { color: var(--primary-dark); font-weight: 600; }

/* ---------- Στοιχεία φόρμας ---------- */
.field {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 10px 14px;
  font: inherit;
  color: var(--ink);
  width: 100%;
}
.field:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }

.btn-add {
  background: var(--primary);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  width: 50px;
  padding: 0;
}

.btn-ghost {
  background: rgba(255,255,255,.16);
  color: #fff;
  min-height: 38px;
  padding: 6px 12px;
  font-size: .9rem;
}

.list-tools .btn-ghost {
  background: #fff;
  color: var(--primary-dark);
  border: 1px solid var(--line);
  min-height: 44px;
}
.list-tools .btn-ghost.danger { color: var(--danger); }

.btn-block { width: 100%; }

.icon-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  background: #F3F6F4;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
}
.icon-btn.danger { color: var(--danger); background: #FBEEEB; }

.empty, .empty-row {
  color: var(--muted);
  font-size: .95rem;
  padding: 14px 2px;
  list-style: none;
}

/* ---------- Login / install ---------- */
.plain-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.panel {
  background: var(--surface);
  border-radius: 22px;
  padding: 28px 22px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 30px rgba(22, 51, 43, .1);
}

.login { text-align: center; }
.login-mark { font-size: 2.4rem; margin-bottom: 6px; }
.login form { margin-top: 18px; display: grid; gap: 10px; }
.login .field { margin: 0; }

.install-log { padding-left: 18px; color: var(--muted); }
.install-log li { margin: 6px 0; }

.warn { color: var(--danger); font-weight: 600; }

code {
  background: #F1F5F2;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: .9em;
}

@media (min-width: 640px) {
  body { font-size: 17px; }
  .wrap { padding-top: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
