/* =====================  Lampora  ===================== */

:root {
  --ink: #1f2a44;
  --ink-deep: #161f38;
  --ink-panel: rgba(244, 232, 208, 0.08);
  --cream: #f4e8d0;
  --cream-dim: rgba(244, 232, 208, 0.66);
  --cream-faint: rgba(244, 232, 208, 0.42);
  --paper: #f7efdd;
  --paper-muted: #e3d8bd;
  --ink-text: #25293a;
  --ink-soft: #6f6a58;
  --coral: #e07a5f;
  --coral-deep: #b4452e;
  --amber: #e8b45a;
  --peri: #8fa8d6;
  --sage: #a4b489;
  --lane-tonight: #e07a5f;
  --lane-week: #e8b45a;
  --lane-later: #8fa8d6;
  --shadow: 0 8px 18px rgba(4, 8, 20, 0.38);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* warm lamp glow spilling from the top of the screen */
body::before {
  content: "";
  position: fixed;
  top: -18vh; left: -10vw; right: -10vw;
  height: 52vh;
  background: radial-gradient(58% 82% at 50% 0%,
      rgba(236, 186, 96, 0.32),
      rgba(236, 186, 96, 0.10) 48%,
      transparent 74%);
  pointer-events: none;
  z-index: 0;
}

main { position: relative; z-index: 1; }

button { font: inherit; cursor: pointer; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- screens ---------- */

.screen {
  display: none;
  padding: 0 18px calc(128px + env(safe-area-inset-bottom));
}

.screen.active { display: block; }

/* ---------- desk header ---------- */

.app-head {
  padding: calc(20px + env(safe-area-inset-top)) 0 4px;
  position: relative;
}

.app-head h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--cream);
}

.tagline {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--cream-dim);
}

.cups {
  display: flex;
  gap: 22px;
  margin: 20px 0 16px;
}

.cup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cup-ball {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 22px;
  color: #3a2a10;
  background: radial-gradient(circle at 34% 28%, #f4c97e, #d99b3f);
  box-shadow: inset 0 -4px 7px rgba(60, 30, 0, 0.22),
              0 5px 12px rgba(0, 0, 0, 0.3);
  position: relative;
}

/* a little coral pencil resting in the cup */
.cup-ball::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 20px;
  height: 5px;
  border-radius: 3px;
  background: var(--coral);
  transform: rotate(-38deg);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

.cup-ball.week {
  background: radial-gradient(circle at 34% 28%, #f0d7a2, #cfa04a);
}

.cup-cap {
  font-size: 12px;
  line-height: 1.35;
  color: var(--cream-dim);
}

.cup-cap strong {
  display: block;
  color: var(--cream);
  font-size: 14px;
  letter-spacing: 0.3px;
}

/* ---------- sticky-note add action ---------- */

.sticky-add {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 4px;
  padding: 14px 16px;
  background: linear-gradient(160deg, #f8e8ab, #f1dd96);
  color: #4a3a12;
  transform: rotate(-0.6deg);
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.3),
              inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  position: relative;
}

.sticky-add::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 14px 14px 0;
  border-color: transparent #d9c77f transparent transparent;
  border-radius: 0 4px 0 0;
}

.sticky-add .plus {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--coral);
}

.sticky-txt strong { display: block; font-size: 15px; }
.sticky-txt small { display: block; font-size: 12px; color: #7a6530; margin-top: 1px; }

.sticky-add.slim {
  width: auto;
  padding: 9px 13px;
  gap: 8px;
  transform: rotate(0.6deg);
  border-radius: 3px;
  flex: 0 0 auto;
}

.sticky-add.slim .plus { font-size: 20px; }
.sticky-add.slim .sticky-txt strong { font-size: 13px; }
.sticky-add.slim::after { border-width: 0 10px 10px 0; }

/* ---------- due ladder (Desk) ---------- */

.ladder {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.lane-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 14px;
}

.lane-tag {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--lane-color);
  padding-left: 10px;
  border-left: 3px solid var(--lane-color);
  line-height: 1.1;
}

.lane-count {
  font-size: 12px;
  color: var(--cream-faint);
}

.lane-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lane-tonight { --lane-color: var(--lane-tonight); }
.lane-thisweek { --lane-color: var(--lane-week); }
.lane-later { --lane-color: var(--lane-later); }

/* ---------- assignment cards (cream paper rungs) ---------- */

.rung-card {
  position: relative;
  background: var(--paper);
  color: var(--ink-text);
  border-radius: 12px;
  padding: 20px 16px 12px;
  margin-top: 10px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.rung-card:active { transform: scale(0.985); }

/* binder clip at top center, colour marks the lane */
.clip {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  width: 46px;
  height: 16px;
  border-radius: 5px 5px 3px 3px;
  background: var(--lane-color, var(--coral));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.38),
              0 2px 4px rgba(0, 0, 0, 0.32);
}

.clip::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 6px;
  border-radius: 3px;
  background: rgba(23, 32, 58, 0.55);
}

.rung-card h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-text);
}

.rung-card .meta {
  margin: 4px 0 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.status-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.st-todo { background: rgba(31, 42, 68, 0.09); color: #3d4a6b; border: 1px solid rgba(31, 42, 68, 0.2); }
.st-wip  { background: #f4dd9d; color: #6b5312; }
.st-fin  { background: #ded4bc; color: #6f6a58; }

/* ---------- finished cards (muted paper + paperweight dot) ---------- */

.finished-card { background: var(--paper-muted); cursor: default; }

.finished-card h3 { color: #6e685a; }
.finished-card .meta { color: #8b8471; }

.finished-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.pw {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.25);
  flex: 0 0 auto;
}

.mini-btn {
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(31, 42, 68, 0.25);
  background: transparent;
  color: #3d4a6b;
}

.mini-btn.coral {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}

.group-h {
  margin: 20px 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cream-dim);
}

#finishedGroups .lane-cards + .group-h { margin-top: 24px; }

/* ---------- other screen headings ---------- */

.screen-h {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-top: calc(18px + env(safe-area-inset-top));
  margin-bottom: 16px;
}

.screen-h h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--cream-faint);
}

/* ---------- search ---------- */

.search-input {
  width: 100%;
  background: var(--ink-panel);
  border: 1.5px solid rgba(244, 232, 208, 0.25);
  color: var(--cream);
  border-radius: 12px;
  padding: 13px 14px;
  font-size: 16px;
}

.search-input::placeholder { color: var(--cream-faint); }
.search-input:focus {
  outline: none;
  border-color: var(--amber);
  background: rgba(244, 232, 208, 0.12);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 6px;
}

.chip {
  border: 1.5px solid rgba(244, 232, 208, 0.3);
  background: transparent;
  color: var(--cream-dim);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
}

.chip.active {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}

.result-note {
  margin: 4px 2px 12px;
  font-size: 12px;
  color: var(--cream-faint);
}

/* ---------- empty states (plain, left-aligned) ---------- */

.empty {
  padding: 22px 4px;
  font-size: 14px;
  color: var(--cream-dim);
  border-left: 3px solid rgba(244, 232, 208, 0.18);
  padding-left: 12px;
}

/* ---------- bottom tab bar (erasers) ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  gap: 8px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: rgba(20, 28, 52, 0.94);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-top: 1px solid rgba(244, 232, 208, 0.12);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 6px 0 2px;
  background: none;
  border: none;
  color: var(--cream-faint);
  font-size: 11px;
  letter-spacing: 0.4px;
}

.eraser {
  width: 88%;
  height: 24px;
  border-radius: 6px;
  background: linear-gradient(180deg,
      #efe3c8 0%, #efe3c8 58%,
      #d9c79d 58%, #d9c79d 100%);
  position: relative;
  opacity: 0.72;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

/* slightly different eraser proportions per tab */
.tab:nth-child(odd)  .eraser { width: 92%; }
.tab:nth-child(even) .eraser { width: 80%; }

/* coloured sleeve at the eraser's end */
.eraser::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 11px;
  border-radius: 0 6px 6px 0;
  background: var(--tab-color, var(--coral));
  opacity: 0.9;
}

.tab[data-tab="desk"]        { --tab-color: var(--coral); }
.tab[data-tab="assignments"] { --tab-color: var(--amber); }
.tab[data-tab="search"]      { --tab-color: var(--peri); }
.tab[data-tab="finished"]    { --tab-color: var(--sage); }

.tab.active { color: var(--cream); }

.tab.active .eraser {
  opacity: 1;
  transform: translateY(-6px);
  box-shadow: 0 9px 16px rgba(0, 0, 0, 0.5),
              inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

/* ---------- create / edit sheet ---------- */

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}

.sheet-wrap.open { display: block; }

body.locked { overflow: hidden; }

.backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 15, 30, 0.62);
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  background: var(--paper);
  color: var(--ink-text);
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.45);
  animation: sheetUp 0.22s ease;
}

@keyframes sheetUp {
  from { transform: translateY(34px); opacity: 0.5; }
  to   { transform: translateY(0);   opacity: 1; }
}

.sheet h3 {
  margin: 2px 0 16px;
  font-size: 19px;
  font-weight: 800;
  text-align: center;
}

.field { margin-bottom: 15px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field .opt { font-weight: 500; text-transform: none; letter-spacing: 0; }

.field input,
.field select {
  width: 100%;
  font-size: 16px;
  padding: 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(31, 42, 68, 0.28);
  background: #fffdf6;
  color: var(--ink-text);
  appearance: none;
  -webkit-appearance: none;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(224, 122, 95, 0.18);
}

.field select { height: 48px; }

.err {
  display: none;
  margin: 5px 2px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--coral-deep);
}

.field.invalid input,
.field.invalid select { border-color: var(--coral-deep); }
.field.invalid .err { display: block; }

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  flex: 1;
  padding: 14px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  font-weight: 700;
}

.btn-ghost {
  background: rgba(31, 42, 68, 0.08);
  color: #3d4a6b;
}

.btn-primary {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 5px 12px rgba(224, 122, 95, 0.35);
}

.btn-primary:active { transform: scale(0.98); }

.btn-danger {
  flex: 0 0 auto;
  display: none;
  padding: 14px 16px;
  background: transparent;
  border: 1.5px solid rgba(180, 69, 46, 0.45);
  color: var(--coral-deep);
}

.sheet.editing .btn-danger { display: block; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(14px);
  background: var(--cream);
  color: var(--ink-text);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 70;
  max-width: 86vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
