:root {
  --primary: #5f9ea0;
  --secondary: #ffdab9;
  --accent: #ff6f61;
  --ink: #37474f;
  --muted: #8a97a0;
  --paper: #fffdf7;
  --card-blue: #bfe3e8;
  --card-yellow: #ffe9a8;
  --card-pink: #f8c8c8;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: #cdd8d9;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Fridge door ---- */
#fridge {
  position: relative;
  min-height: 100%;
  padding-bottom: calc(96px + var(--safe-b));
  background:
    linear-gradient(120deg, rgba(255,255,255,.5), rgba(255,255,255,0) 40%),
    linear-gradient(#eef3f4, #dde7e8);
  overflow: hidden;
}

.smudge {
  position: absolute;
  border-radius: 50%;
  filter: blur(22px);
  pointer-events: none;
  opacity: .4;
}
.smudge-a { width: 180px; height: 160px; top: 4%; left: -40px; background: rgba(255,255,255,.8); }
.smudge-b { width: 200px; height: 190px; top: 40%; right: -60px; background: rgba(160,180,182,.4); }
.smudge-c { width: 150px; height: 150px; bottom: 20%; left: 12%; background: rgba(255,255,255,.7); }

/* ---- Header ---- */
.fridge-header {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: calc(14px + var(--safe-t)) 18px 10px;
  background: rgba(221,231,232,.85);
  backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(95,158,160,.25);
}
.logo {
  margin: 0;
  font-size: 26px;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--primary);
}
.logo-note {
  display: inline-block;
  width: 20px; height: 20px;
  background: var(--secondary);
  border: 2px solid var(--accent);
  border-radius: 3px;
  position: relative;
  transform: rotate(-6deg);
}
.logo-note::after {
  content: "";
  position: absolute;
  top: -6px; right: -6px;
  width: 0; height: 0;
  border-style: solid;
  border-width: 0 0 10px 10px;
  border-color: transparent transparent #fff transparent;
}
.tagline { margin: 2px 0 0 30px; font-size: 12px; color: var(--muted); }

/* ---- Notepad area ---- */
.notepad {
  position: relative;
  z-index: 1;
  margin: 16px 12px;
  background:
    repeating-linear-gradient(transparent, transparent 27px, rgba(95,158,160,.15) 27px, rgba(95,158,160,.15) 28px),
    linear-gradient(var(--paper), var(--paper));
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(0,0,0,.18), inset 0 0 0 1px rgba(0,0,0,.05);
  padding: 20px 16px 24px;
  min-height: 45vh;
}
.notepad::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 90px; height: 14px;
  background: var(--secondary);
  border-radius: 0 0 8px 8px;
  box-shadow: 0 3px 5px rgba(0,0,0,.12);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.pane-title {
  margin: 6px 0 14px;
  font-size: 20px;
  color: var(--primary);
  border-bottom: 2px dashed rgba(95,158,160,.4);
  padding-bottom: 8px;
}

/* ---- Dashboard counters ---- */
.counters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.counter {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.counter-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  min-width: 64px;
  text-align: center;
  background: #fff;
  border: 3px solid var(--primary);
  border-radius: 12px;
  padding: 4px 8px;
  box-shadow: 1px 2px 0 rgba(0,0,0,.15);
}
.counter-label { font-size: 15px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.counter-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-green { background: #7cc57c; }
.dot-orange { background: #f5a623; }
.dot-neutral { background: #9aa6ac; }

/* ---- New button ---- */
.btn-new {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #4f8587);
  box-shadow: 0 4px 10px rgba(95,158,160,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}
.btn-new:active { transform: translateY(1px); }
.btn-new-plus {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
  line-height: 24px;
  text-align: center;
}

.list-heading {
  font-size: 15px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 4px 0 8px;
}

/* ---- Sticky note cards ---- */
.sticky {
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 10px;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,.16);
  cursor: pointer;
  transform: rotate(-.6deg);
}
.sticky:nth-child(even) { transform: rotate(.5deg); }
.sticky .note-title {
  font-family: "Segoe Script", "Comic Sans MS", cursive;
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}
.sticky .note-date {
  position: absolute;
  top: 8px; right: 10px;
  font-family: "Segoe Script", "Comic Sans MS", cursive;
  font-size: 11px;
  color: rgba(0,0,0,.55);
  transform: rotate(3deg);
}
.sticky .note-guests {
  font-size: 12px;
  color: rgba(0,0,0,.6);
  margin-top: 6px;
}
.sticky .note-status {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 8px;
  margin-top: 6px;
  background: rgba(255,255,255,.6);
}
.sticky.planning { background: var(--card-blue); }
.sticky.confirmed { background: var(--card-yellow); }
.sticky.past { background: var(--card-pink); }

.sticky.dash { cursor: default; }
.sticky.dash .note-title { font-size: 16px; }
.sticky.dash .note-date { position: static; float: right; transform: rotate(3deg); }

/* ---- Forms ---- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 5px; }
.field input, .field select {
  width: 100%;
  padding: 12px 12px;
  font-size: 16px;
  border: 2px solid #dfe6e7;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(95,158,160,.2);
}
.field-err { color: #e53935; font-size: 12px; min-height: 15px; display: block; margin-top: 3px; }

.btn-save {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #e85b4f);
  box-shadow: 0 4px 10px rgba(255,111,97,.4);
  margin-top: 4px;
}
.btn-save:active { transform: translateY(1px); }

/* ---- Search ---- */
.search-wrap { margin-bottom: 14px; }
.search {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 2px solid #dfe6e7;
  border-radius: 10px;
  background: #fff;
}
.search:focus { outline: none; border-color: var(--primary); }

/* ---- Empty state ---- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 12px;
  font-size: 15px;
  font-style: italic;
}
.empty .empty-note { font-size: 34px; }

/* ---- Bottom bar magnets ---- */
.bottom-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 10px 8px calc(10px + var(--safe-b));
  background: linear-gradient(rgba(238,243,244,.92), rgba(221,231,232,.96));
  border-top: 1px solid rgba(95,158,160,.35);
  backdrop-filter: blur(4px);
}
.magnet {
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
}
.magnet-letter {
  width: 46px; height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  background: linear-gradient(135deg, #ffffff, #e8eef0);
  border: 2px solid rgba(95,158,160,.4);
  box-shadow: 0 3px 5px rgba(0,0,0,.22);
  transition: transform .15s ease;
}
.magnet-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
}
.magnet.active .magnet-letter {
  transform: rotate(-8deg);
  background: linear-gradient(135deg, #ffffff, #dbe8ea);
  border-color: var(--primary);
  box-shadow: 0 6px 12px rgba(0,0,0,.3), inset 0 0 6px rgba(255,255,255,.9);
  color: var(--primary);
}
.magnet.active .magnet-label { color: var(--primary); }

/* ---- Sheet ---- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 30;
}
.sheet {
  position: fixed;
  left: 12px; right: 12px;
  bottom: calc(96px + var(--safe-b));
  z-index: 31;
  background: var(--paper);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  max-height: 70vh;
  overflow-y: auto;
}
.sheet-title {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 19px;
  padding-right: 30px;
}
.sheet-close {
  position: absolute;
  top: 10px; right: 12px;
  border: none;
  background: transparent;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.sheet-summary {
  background: var(--secondary);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 14px;
}
.sheet-summary p { margin: 4px 0; }
.sheet-actions { display: flex; gap: 10px; margin-top: 8px; }
.sheet-actions .btn-del {
  flex: 1;
  border: 2px solid var(--accent);
  background: #fff;
  color: var(--accent);
  font-weight: 700;
  border-radius: 12px;
  padding: 12px;
  font-size: 15px;
}
.sheet-actions .btn-save { flex: 2; margin-top: 0; }
.sheet-summary .readonly-title {
  font-family: "Segoe Script", "Comic Sans MS", cursive;
  font-size: 18px;
  margin: 0 0 6px;
  color: var(--ink);
}

@media (min-width: 720px) {
  .notepad { max-width: 560px; margin-left: auto; margin-right: auto; }
  .sheet { max-width: 560px; margin: 0 auto; }
}