/* wallcal - phone + desktop app shell */

:root {
  color-scheme: dark;
  --bg: #0c0f1a;
  --bg-raised: #161b2b;
  --bg-sunken: #080b14;
  --panel: #1a2032;
  --panel-2: #232a40;
  --line: #303952;
  --line-soft: #232a3d;
  --text: #f2f5fc;
  --muted: #9aa6c2;
  --faint: #6f7b98;
  --accent: #7aa9ff;
  --tint: #5a6172;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(122, 169, 255, .13), transparent 62%),
    radial-gradient(900px 560px at 92% 4%, rgba(255, 61, 154, .10), transparent 58%),
    radial-gradient(800px 500px at 50% 108%, rgba(31, 224, 208, .08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(var(--safe-top) + 10px) 12px 8px;
  background: linear-gradient(180deg, var(--bg) 72%, transparent);
  backdrop-filter: blur(12px);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.title h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.title .sub {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3aa76d;
  flex: none;
}
.dot.off { background: var(--faint); }

.iconbtn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex: none;
  transition: background .12s ease, transform .08s ease;
}
.iconbtn:active { transform: scale(.94); }
.iconbtn:hover { background: var(--panel-2); }
.iconbtn.wide { width: auto; padding: 0 13px; font-size: 13px; font-weight: 600; gap: 6px; display: inline-flex; align-items: center; }

.segmented {
  display: flex;
  gap: 2px;
  margin-top: 10px;
  padding: 3px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.segmented button {
  flex: 1;
  padding: 7px 4px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: background .14s ease, color .14s ease;
}
.segmented button[aria-selected='true'] {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

/* ---------- scroll body ---------- */

.viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px calc(var(--safe-bottom) + 90px);
  -webkit-overflow-scrolling: touch;
}

/* ---------- day tinting ---------- */

.tinted {
  --tint: var(--day-color, #5a6172);
  /* Mixed into a solid base rather than layered over one - transparency was
     draining the colour straight out of every day. */
  background: linear-gradient(150deg,
    color-mix(in srgb, var(--tint) 76%, #121628) 0%,
    color-mix(in srgb, var(--tint) 56%, #121628) 55%,
    color-mix(in srgb, var(--tint) 44%, #121628) 100%);
  border: 1px solid color-mix(in srgb, var(--tint) 68%, var(--line));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--tint) 55%, transparent),
    0 3px 16px color-mix(in srgb, var(--tint) 22%, transparent);
}
.tinted.low-confidence {
  position: relative;
  background: color-mix(in srgb, var(--tint) 42%, #121628);
  border-style: dashed;
}
.tinted.low-confidence::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: repeating-linear-gradient(135deg,
    color-mix(in srgb, var(--tint) 62%, transparent) 0 8px,
    transparent 8px 16px);
}
.tinted.low-confidence > * { position: relative; z-index: 1; }

/* ---------- together: overlapped avatars read as "the two of us" ---------- */

.pair {
  display: inline-flex;
  flex: none;
  align-items: center;
  isolation: isolate;
}
.pair > * { flex: none; }
/* Percentage margins resolve against the container, not the avatar, so the
   overlap has to be stated in pixels per avatar size. */
.pair > *:first-child { z-index: 1; }
.pair > *:not(:first-child) { box-shadow: -1.5px 0 0 rgba(10, 13, 18, .8); }
.pair .avatar:not(:first-child) { margin-left: -9px; }
.pair .avatar.sm:not(:first-child) { margin-left: -6px; }
.pair .who:not(:first-child) { margin-left: -5px; }

.together-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tint) 30%, #fff);
}

/* ---------- day title ---------- */

.day-title {
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- drag to move a day ---------- */

.dragging { opacity: .35; }
.drop-target {
  outline: 2px dashed var(--accent) !important;
  outline-offset: -2px;
  background-color: color-mix(in srgb, var(--accent) 16%, transparent) !important;
}
.drag-ghost {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 650;
  opacity: .95;
  transform: translate(-50%, -130%);
  white-space: nowrap;
  max-width: 62vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.dragging-day { -webkit-user-select: none; user-select: none; }
body.dragging-day .viewport { overflow: hidden; }

/* ---------- icon themes: the icon sets the day's whole look ---------- */

.themed {
  border-color: color-mix(in srgb, var(--theme) 72%, transparent) !important;
  box-shadow:
    inset 0 0 26px color-mix(in srgb, var(--theme) 16%, transparent),
    0 2px 16px color-mix(in srgb, var(--theme) 20%, transparent) !important;
}
.theme-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--theme) 70%, #fff),
    var(--theme) 45%,
    color-mix(in srgb, var(--theme) 62%, transparent));
  z-index: 2;
}
.theme-wm {
  position: absolute;
  right: -4%;
  bottom: -12%;
  font-size: 3.3em;
  line-height: 1;
  opacity: .34;
  transform: rotate(-11deg);
  pointer-events: none;
  z-index: 0;
  filter: saturate(1.3);
}
.theme-label {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--theme) 26%, #fff);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* A run of days sharing a theme squares off its inner corners so the stretch
   reads as one block rather than separate days. */
.block-start { border-top-right-radius: 2px; border-bottom-right-radius: 2px; }
.block-mid { border-radius: 2px; }
.block-end { border-top-left-radius: 2px; border-bottom-left-radius: 2px; }
.block-mid .theme-wm, .block-end .theme-wm { opacity: .1; }

/* ---------- month grid ---------- */

.month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 6px 0 4px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.month-head span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--faint);
  text-transform: uppercase;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.mcell {
  position: relative;
  isolation: isolate;
  min-height: 78px;
  border-radius: 12px;
  padding: 6px 5px 5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  overflow: hidden;
}
.mcell.outside { opacity: .34; }
.mcell.today {
  outline: 2px solid #fff;
  outline-offset: -2px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .09), 0 4px 18px rgba(0, 0, 0, .45);
}
.mcell:active { transform: scale(.97); }
.mcell, .wcard, .arow { cursor: pointer; -webkit-user-select: none; user-select: none; }
.mcell:focus-visible, .wcard:focus-visible, .arow:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.mcell .num, .mcell .day-title, .mcell .badge, .mcell .pips, .mcell .theme-label { position: relative; z-index: 1; }
.mcell .num {
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.mcell .day-title {
  font-size: 11.5px;
  letter-spacing: -.01em;
  line-height: 1.2;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mcell .badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mcell .pips {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pip {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  line-height: 1.15;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.pip .who {
  width: 13px;
  height: 13px;
  flex: none;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 800;
  color: #0b0e13;
}
.pip .em { font-size: 10px; flex: none; }
.pip .txt { overflow: hidden; text-overflow: ellipsis; }
.pip.maybe { opacity: .6; }

/* ---------- week strip ---------- */

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(148px, 1fr));
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
}
.week-strip::-webkit-scrollbar { height: 6px; }
.week-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.wcard {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  scroll-snap-align: start;
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  min-height: 190px;
}
.wcard.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.wcard > * { position: relative; z-index: 1; }
.wcard .theme-wm { z-index: 0; font-size: 4.6em; }
.wcard .whead { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.wcard .wday { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wcard .wnum { font-size: 20px; font-weight: 700; line-height: 1; }
.wcard .day-title { font-size: 15px; line-height: 1.2; white-space: normal; }
.wcard .wtype {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tint) 46%, transparent);
  color: color-mix(in srgb, var(--tint) 14%, #ffffff);
  align-self: flex-start;
}

.prow {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding: 6px 7px;
  border-radius: var(--radius-sm);
  background: rgba(7, 10, 18, .74);
  border: 1px solid rgba(255, 255, 255, .09);
}
.prow.maybe { border-style: dashed; border-color: color-mix(in srgb, var(--tint) 50%, var(--line)); }
.prow .avatar {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #0b0e13;
}
.prow .body { min-width: 0; flex: 1; }
.prow .line1 { display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.prow .line1 .loc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .line2 { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow.joint { background: rgba(7, 10, 18, .8); }
.prow.joint .em { font-size: 15px; }
.prow.joint .line1 { font-size: 14px; }
.prow .conf { font-size: 10px; font-weight: 700; color: #aab5c8; letter-spacing: .03em; }

/* ---------- agenda / list ---------- */

.agenda { display: flex; flex-direction: column; gap: 8px; }
.arow {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  text-align: left;
  align-items: stretch;
}
.arow > * { position: relative; z-index: 1; }
.arow .theme-wm { z-index: 0; font-size: 3.6em; }
.arow .adate {
  flex: none;
  width: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}
.arow .adate .dow { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.arow .adate .dnum { font-size: 21px; font-weight: 700; line-height: 1; }
.arow .day-title { font-size: 15px; }
.arow .abody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.arow.today .adate .dnum { color: var(--accent); }

.month-label {
  padding: 14px 2px 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------- single day view ---------- */

.dayview { display: flex; flex-direction: column; gap: 12px; }
.day-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.day-hero > * { position: relative; z-index: 1; }
.day-hero .theme-wm { z-index: 0; font-size: 7em; opacity: .2; }
.day-hero .dh-dow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.day-hero .dh-date { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.day-hero .dh-title { font-size: 20px; font-weight: 700; line-height: 1.2; margin-top: 2px; }
.day-hero .dh-type { font-size: 14px; font-weight: 600; color: color-mix(in srgb, var(--tint) 62%, var(--text)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.card h3 { margin: 0 0 8px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* ---------- editor sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }

.sheet {
  width: 100%;
  max-width: 620px;
  max-height: 92dvh;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  animation: rise .2s cubic-bezier(.2, .8, .3, 1);
}
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 18px; border-bottom: 1px solid var(--line); max-height: 88dvh; }
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line-soft);
}
.sheet-head .sh-title { flex: 1; min-width: 0; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 650; }
.sheet-head .sh-sub { font-size: 12px; color: var(--muted); }

.sheet-body {
  overflow-y: auto;
  padding: 12px 14px calc(var(--safe-bottom) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Blocks with overflow:hidden get an automatic minimum size of 0, which lets
   this flex column squash them and clip their fields. Keep them at full height. */
.sheet-body > * { flex: 0 0 auto; }

.person-block {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}
.person-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  background: var(--panel-2);
}
.person-head .avatar { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #0b0e13; }
.person-head .pname { font-weight: 650; flex: 1; }
.person-head .clear { font-size: 12px; color: var(--faint); padding: 4px 8px; border-radius: 8px; }
.person-head .clear:hover { color: var(--text); background: rgba(255, 255, 255, .06); }

.person-body { padding: 11px 12px 13px; display: flex; flex-direction: column; gap: 11px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .12s ease;
}
.chip[aria-pressed='true'] {
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-sunken));
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  color: var(--text);
}
.chip:active { transform: scale(.95); }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 5px;
}
.field input[type='text'],
.field input[type='date'],
.field textarea,
.field select {
  width: 100%;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  outline: none;
  font-size: 16px; /* keeps iOS from zooming on focus */
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 62px; }

.prob-row { display: flex; align-items: center; gap: 10px; }
.prob-row input[type='range'] { flex: 1; accent-color: var(--accent); }
.prob-val { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; min-width: 74px; text-align: right; color: var(--muted); }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 5px;
  max-height: 118px;
  overflow-y: auto;
  padding: 3px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.icon-grid button {
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 18px;
  display: grid;
  place-items: center;
}
.icon-grid button[aria-pressed='true'] { background: color-mix(in srgb, var(--accent) 28%, transparent); outline: 1px solid var(--accent); }
.icon-grid button:hover { background: rgba(255, 255, 255, .07); }

.repeat-box {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.repeat-box .field { flex: 1; min-width: 150px; }

.btn {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-weight: 650;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active { transform: scale(.97); }
.btn.primary { background-image: linear-gradient(135deg, #7aa9ff, #9d7bff); background-color: var(--accent); border-color: transparent; color: #071021; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8f7d; }
.btn.block { width: 100%; }

/* ---------- bookings ---------- */

.irow {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  padding: 6px 8px;
  margin-top: 5px;
  border-radius: var(--radius-sm);
  background: rgba(7, 10, 18, .74);
  border: 1px solid rgba(255, 255, 255, .09);
  border-left: 3px solid var(--kind);
}
.irow .iem { font-size: 14px; flex: none; line-height: 1.2; }
.irow .ibody { min-width: 0; flex: 1; }
.irow .iline { display: flex; align-items: center; gap: 6px; min-width: 0; }
.irow .itime {
  flex: none;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--kind);
  letter-spacing: .02em;
}
.irow .ititle { font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irow .iwho {
  flex: none;
  width: 14px; height: 14px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 8px;
  font-weight: 800;
  color: #0b0e13;
}
.irow .idetail { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pip.items .txt { font-style: italic; }

.item-list { display: flex; flex-direction: column; gap: 9px; }
.item-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px;
  background: var(--bg-sunken);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.item-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.item-grid { display: flex; gap: 8px; }
.item-grid .field { flex: 1; }
.chips.tight { gap: 4px; }
.chip.mini { padding: 5px 8px; font-size: 14px; line-height: 1; }
.chip.mini.wide { font-size: 12px; padding: 6px 10px; }

/* ---------- editor extras ---------- */

.hint { font-size: 11.5px; color: var(--faint); line-height: 1.35; }

.title-card input { font-size: 17px !important; font-weight: 650; }

.mode-toggle { display: flex; gap: 7px; }
.chip.mode {
  flex: 1;
  justify-content: center;
  padding: 10px 8px;
  font-size: 13px;
}
.avatar.sm { width: 17px; height: 17px; border-radius: 5px; font-size: 9px; font-weight: 800; display: grid; place-items: center; color: #0b0e13; }
.pair .avatar.sm:not(:first-child) { border: 1.5px solid var(--bg-sunken); }

.sheet-foot {
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(var(--safe-bottom) + 14px);
  border-top: 1px solid var(--line-soft);
}

.icon-grid { max-height: 172px; }
.icon-group-label {
  grid-column: 1 / -1;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--group-color, var(--faint));
  padding: 5px 3px 2px;
}
.icon-grid button[aria-pressed='true'] {
  background: color-mix(in srgb, var(--group-color, var(--accent)) 34%, transparent);
  outline: 1px solid var(--group-color, var(--accent));
}

.log { display: flex; flex-direction: column; gap: 1px; max-height: 230px; overflow-y: auto; }
.log-row {
  display: flex;
  gap: 9px;
  align-items: baseline;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--bg-sunken);
  font-size: 12px;
}
.log-row.undone { opacity: .6; }
.log-when { flex: none; color: var(--faint); font-variant-numeric: tabular-nums; font-size: 11px; }
.log-what { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.undecided {
  align-self: flex-start;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: #ffd23f;
  color: #1a1206;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.wcard .undecided, .arow .undecided { font-size: 10px; padding: 3px 8px; }

.opt-group-name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.opt-group-name:first-of-type { margin-top: 4px; }
.opt-state { font-size: 10px; letter-spacing: .08em; color: #ffd23f; }
.opt-state.done { color: #2fd47c; }

.opt-list { display: flex; flex-direction: column; gap: 7px; }
.opt-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  min-height: 56px;            /* comfortable on a tablet */
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.opt-row:active { transform: scale(.995); }
.opt-row.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg-sunken)); }
.opt-check {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #071021;
}
.opt-check.on { background: var(--accent); border-color: var(--accent); }
.opt-remove {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  color: var(--faint);
  font-size: 15px;
  display: grid;
  place-items: center;
}
.opt-remove:hover { color: #ff8f7d; background: rgba(255, 255, 255, .06); }
.opt-tradeoff { font-size: 11.5px; color: var(--faint); margin-top: 3px; font-style: italic; }
.opt-main { flex: 1; min-width: 0; }
.opt-title { display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 14px; }
.opt-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--muted);
  flex: none;
}
.opt-detail { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.btn.tiny { padding: 7px 11px; font-size: 12.5px; flex: none; }

.fab.plan { background-image: linear-gradient(135deg, #2fd47c, #1fe0d0); color: #06251a; }
.fab .plan-count {
  background: rgba(6, 37, 26, .28);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 13px;
  font-weight: 800;
}

.plan-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.plan-bar { height: 6px; border-radius: 999px; background: var(--bg-sunken); overflow: hidden; }
.plan-fill { height: 100%; background: linear-gradient(90deg, #2fd47c, #1fe0d0); transition: width .3s ease; }

.plan-when { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.plan-dow { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.plan-date { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.plan-title { font-size: 15px; font-weight: 650; color: var(--accent); }

.plan-q {
  margin: 4px 0 0;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -.01em;
}

.plan-options { display: flex; flex-direction: column; gap: 10px; }
.plan-option {
  padding: 15px 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1.5px solid var(--line);
  cursor: pointer;
  min-height: 68px;
  transition: border-color .12s ease, transform .08s ease, background .12s ease;
}
.plan-option:hover { border-color: var(--accent); background: var(--panel-2); }
.plan-option:active { transform: scale(.99); }
.plan-option-head { display: flex; align-items: center; gap: 8px; }
.plan-option-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.plan-option .opt-detail { font-size: 13px; margin-top: 5px; }

.plan-done { text-align: center; padding: 26px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.plan-done-mark {
  width: 62px; height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 800;
  color: #06251a;
  background: linear-gradient(135deg, #2fd47c, #1fe0d0);
}
.plan-done h3 { margin: 0; font-size: 19px; }

/* ---------- legend ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 7px; }
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
}
.swatch { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* ---------- embedded in Home Assistant ---------- */

.embedded body { background: transparent; }
.embedded .app { max-width: none; }
.embedded .topbar { padding-top: 10px; }
.embedded .fab-row { display: none; }
.embedded .viewport { padding-bottom: 24px; }

/* ---------- misc ---------- */

.empty-note {
  padding: 34px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
}

.fab {
  background-image: linear-gradient(135deg, #7aa9ff, #b465ff);
  position: fixed;
  right: 16px;
  bottom: calc(var(--safe-bottom) + 18px);
  z-index: 25;
  height: 50px;
  padding: 0 18px;
  border-radius: 25px;
  background: var(--accent);
  color: #08111f;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .5);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.fab:active { transform: scale(.96); }
.fab.alt { background-image: linear-gradient(135deg, #ffd23f, #ff9f2e); color: #1a1206; }
.fab.fun { background-image: linear-gradient(135deg, #ffd83d, #ff9f2e); color: #241a05; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 80px);
  transform: translateX(-50%);
  z-index: 80;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: fade .15s ease;
}

@media (max-width: 1000px) {
  .pip .txt { display: none; }
  .pip { gap: 4px; }
  .mcell .badge { font-size: 8px; letter-spacing: 0; }
  .pip { justify-content: flex-start; }
}

@media (hover: none) and (pointer: coarse) {
  .chip { padding: 10px 14px; font-size: 14px; }
  .btn { padding: 13px 17px; }
  .iconbtn { width: 44px; height: 44px; }
  .icon-grid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); max-height: 210px; }
  .icon-grid button { font-size: 22px; }
  .mcell { min-height: 92px; }
  .segmented button { padding: 11px 4px; }
  .opt-row { min-height: 64px; }
}

@media (min-width: 760px) {
  .mcell { min-height: 108px; padding: 7px 6px; }
  .mcell .num { font-size: 15px; }
  .pip { font-size: 11.5px; }
  .viewport { padding: 6px 18px 40px; }
  .topbar { padding-top: 16px; }
  .title h1 { font-size: 24px; }
  .week-strip { grid-template-columns: repeat(7, 1fr); overflow-x: visible; }
}
