:root {
  --cream: #FBF6F2;
  --surface: #FFFFFF;
  --blush: #F7E4E7;
  --blush-deep: #F0D2D9;
  --rose: #D98CA0;
  --rose-deep: #B05C76;
  --sand: #EADFD3;
  --ink: #4B3B41;
  --muted: #9B8890;
  --line: #EFE5E3;
  --danger: #C2607A;
  --radius: 20px;
  --tap: 54px;
}

* { 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(--cream);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
  padding-bottom: 48px;
  -webkit-tap-highlight-color: transparent;
}

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

a { color: var(--rose-deep); }

.muted { color: var(--muted); }
.small { font-size: .88rem; }

.wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 18px 14px 0;
}

/* ---------- Topbar ---------- */
.topbar {
  background: var(--blush);
  padding: 20px 14px 14px;
  padding-top: max(20px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--blush-deep);
}

.front .topbar { text-align: center; }

.topbar-inner { max-width: 620px; margin: 0 auto; }

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.topbar-sub {
  margin: 6px auto 0;
  font-size: .92rem;
  color: var(--rose-deep);
  max-width: 44ch;
}

.topbar-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ---------- Tabs ---------- */
.tabs {
  max-width: 620px;
  margin: 16px auto 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.tab {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: rgba(255,255,255,.7);
  color: var(--rose-deep);
  font: inherit;
  font-weight: 600;
  font-size: .82rem;
  line-height: 1.2;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
}

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

.tab-count {
  min-width: 19px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--sand);
  color: var(--ink);
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
}
.tab.is-active .tab-count { background: rgba(255,255,255,.9); color: var(--rose-deep); }

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

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

.item-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px 8px 6px;
}

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

.item-btn:disabled { cursor: default; }

.link-btn {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  background: var(--rose);
  color: #fff;
  text-decoration: none;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .01em;
  padding: 9px 14px;
  border-radius: 999px;
}
.link-btn:active { background: var(--rose-deep); }

.tick {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--sand);
  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; }

.state {
  flex: 0 0 auto;
  font-size: .78rem;
  font-weight: 700;
  color: var(--rose);
}

.item.is-taken .item-row { background: var(--blush); border-color: var(--blush-deep); }
.item.is-taken .link-btn { background: rgba(255,255,255,.85); color: var(--rose-deep); }
.item.is-taken .tick { background: var(--rose); border-color: var(--rose); }
.item.is-taken .tick::after { transform: rotate(45deg) scale(1); }
.item.is-taken .item-name { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.item.is-taken .state { color: var(--rose-deep); }

.foot-note {
  margin: 26px 4px 0;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
}

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

.new-list { background: var(--blush); border-color: var(--blush-deep); }

.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-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  padding: 4px 0;
  min-width: 0;
}
.list-name-input:focus { outline: none; border-bottom: 2px solid var(--rose); }

.linkish {
  border: 0;
  background: none;
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  color: var(--rose-deep);
  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 #F6EFEC;
}

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

.mark {
  flex: 0 0 auto;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}

.admin-item.is-taken .tick { background: var(--rose); border-color: var(--rose); }
.admin-item.is-taken .tick::after { transform: rotate(45deg) scale(1); }
.admin-item.is-taken .admin-item-name { text-decoration: line-through; color: var(--muted); font-weight: 400; }

.admin-item { flex-wrap: wrap; }

.mark-note {
  flex: 0 0 auto;
  display: none;
  border: 1px solid var(--blush-deep);
  background: var(--blush);
  color: var(--rose-deep);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
}
.admin-item.is-taken .mark-note { display: inline-block; }

.link-row {
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 4px 36px;
}

.size-input {
  flex: 0 0 110px;
  min-height: 38px;
  padding: 6px 12px;
  font-size: .88rem;
  border-radius: 11px;
  background: #FDFAF8;
}

.size-field { flex: 0 0 45%; }

.size-badge {
  flex: 0 0 auto;
  align-self: center;
  background: var(--sand);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: .8rem;
  font-weight: 800;
  white-space: nowrap;
}
.item.is-taken .size-badge { background: rgba(255,255,255,.75); color: var(--muted); }

.link-input {
  flex: 1 1 auto;
  min-height: 38px;
  padding: 6px 12px;
  font-size: .88rem;
  border-radius: 11px;
  background: #FDFAF8;
}

.link-open, .saved-note {
  flex: 0 0 auto;
  font-size: .8rem;
  font-weight: 700;
  color: var(--rose-deep);
}
.saved-note { color: var(--muted); }

.add-item { display: grid; gap: 8px; }
.add-row { display: flex; gap: 8px; align-items: center; }
.add-row .field { flex: 1 1 auto; min-width: 0; }

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

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

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

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

.btn-ghost {
  background: rgba(255,255,255,.75);
  color: var(--rose-deep);
  min-height: 38px;
  padding: 6px 12px;
  font-size: .9rem;
}

.btn-block { width: 100%; }

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

.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;
  background: var(--blush);
}

.panel {
  background: var(--surface);
  border-radius: 24px;
  padding: 30px 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 12px 34px rgba(176, 92, 118, .12);
  text-align: center;
}

.panel form { margin-top: 18px; display: grid; gap: 10px; }
.back-link { margin: 18px 0 0; font-size: .9rem; }

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

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

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

@media (min-width: 620px) {
  .wrap { padding-top: 24px; }
  h1 { font-size: 1.75rem; }
  .tab { font-size: .9rem; padding: 9px 14px; }
}

@media (max-width: 360px) {
  .tab { font-size: .76rem; padding: 7px 10px; }
}

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