/* Flag it on the Shift Pass: the card, the full-screen flag sheet and My flags. */
.flag-card {
  --flag-shell: #1d2031;
  --flag-panel: #282b3e;
  --flag-line: #4c4b5d;
  --flag-ink: #fff4df;
  --flag-muted: #cec8c6;
  --flag-good: #a9e4c3;
  --flag-warn: #ffb89f;
  display: grid; gap: 14px; margin-bottom: 22px; padding: 18px;
  border: 1px solid var(--flag-line); border-radius: 20px;
  background: var(--flag-shell); color: var(--flag-ink); box-shadow: 0 8px 20px #15172726;
}
.flag-card[hidden], .flag-sheet[hidden], .flag-closing[hidden], .flag-open-list[hidden], .flag-news[hidden] { display: none; }
.flag-svg { display: block; flex: none; }

.flag-head { display: flex; align-items: center; gap: 14px; }
.flag-head-icon { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 12px; background: var(--yellow); color: var(--navy); }
.flag-head h2 { margin: 0; font-size: 21px; line-height: 1.2; font-weight: 900; }
.flag-head p { margin: 4px 0 0; color: var(--flag-muted); font-size: 15px; }

.flag-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.flag-go { flex: 1 1 150px; min-height: 52px; gap: 8px; font-size: 17px; }
.flag-mine-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: 0 1 auto; min-height: 52px; padding: 0 16px;
  border-radius: 14px; border: 1px solid var(--navy-border); background: transparent; color: var(--flag-ink);
  font: 800 15px/1.1 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer;
}
.flag-mine-btn:focus-visible, .flag-open-line:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.flag-news { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--flag-good, #a9e4c3); color: var(--navy); font-size: 12px; font-weight: 900; }

.flag-open-line {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 12px 0 0;
  border: 0; border-top: 1px solid var(--flag-line); background: none; color: var(--flag-muted);
  font: 500 13px/1.4 Inter, ui-sans-serif, system-ui, sans-serif; text-align: left; cursor: pointer;
}
.flag-open-line:disabled { cursor: default; }
.flag-open-line b { color: var(--flag-ink); }
.flag-open-line span:nth-child(2) { flex: 1; min-width: 0; }
.flag-caret { color: var(--yellow); font-size: 14px; }
.flag-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--flag-warn); }
.flag-dot-calm { background: var(--flag-good); }

.flag-open-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.flag-open-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--flag-panel); }
.flag-open-text b { display: block; font-size: 14px; line-height: 1.3; }
.flag-open-text small { display: block; margin-top: 2px; color: var(--flag-muted); font-size: 12px; }
.flag-open-text .flag-open-note { color: var(--flag-ink); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flag-open-text { min-width: 0; }

.flag-type-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; }
.flag-type-need { background: var(--blue-soft); color: var(--blue-dark); }
.flag-type-broken { background: var(--coral-soft); color: var(--coral-dark); }
.flag-type-off { background: var(--yellow-soft); color: var(--navy); }
.flag-type-customer { background: var(--border-soft); color: var(--navy); }
.flag-type-good { background: var(--yellow); color: var(--navy); }

.flag-chip { display: inline-block; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.flag-chip-open { background: var(--yellow-soft); color: var(--navy); }
.flag-chip-seen { background: var(--blue-soft); color: var(--blue-dark); }
.flag-chip-done { background: var(--flag-good, #a9e4c3); color: var(--navy); }
.flag-chip-type { border: 1px solid currentColor; }
.flag-chip-watch { background: #ece7ff; color: #3e2a9c; }
.flag-chip-worse { background: var(--coral); color: var(--navy); }

/* Watching 👀: "Got worse" (on the card's open list and in My flags) */
.flag-open-text .flag-watch-line { color: #cfc4ff; }
.flag-worse-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 50px; padding: 0 16px;
  border: 0; border-radius: 14px; background: var(--flag-warn, #ffb89f); color: var(--navy);
  font: 900 16px/1.1 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer;
}
.flag-worse-btn:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.flag-worse-btn-sm { grid-column: 2 / -1; min-height: 44px; font-size: 14px; }
.flag-step.is-on.is-watch .flag-step-dot { background: #7b5cff; color: #fff; }
.flag-step.is-on.is-worse .flag-step-dot { background: var(--coral); color: var(--navy); }
.flag-step.is-on.is-wont .flag-step-dot { background: var(--text-muted); color: var(--cream); }

/* Closing question (shows right after the Daily Count closing) */
.flag-closing { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--flag-panel); border: 1px solid var(--yellow); }
.flag-closing h3 { margin: 0; font-size: 19px; line-height: 1.25; }
.flag-closing p { margin: 0; color: var(--flag-muted); font-size: 14px; line-height: 1.5; }
.flag-closing-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.flag-closing-actions .btn, .flag-closing-actions .flag-mine-btn { width: 100%; }

.flag-kicker { margin: 0; color: var(--text-muted); font: 800 11px/1.4 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.flag-kicker-gold { color: var(--yellow); }

/* ---------- Full-screen sheet ---------- */
body.flag-sheet-open { overflow: hidden; }
.flag-sheet {
  position: fixed; inset: 0; z-index: 900; overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: linear-gradient(180deg, var(--yellow-soft) 0%, var(--cream) 55%, var(--blue-soft) 100%); color: var(--navy);
}
.flag-sheet-inner {
  display: flex; flex-direction: column; gap: 16px; max-width: 520px; min-height: 100%; margin: 0 auto; box-sizing: border-box;
  padding: max(18px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}
.flag-sheet-top { display: flex; align-items: center; gap: 12px; }
.flag-back {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px;
  background: var(--cream); border: 1px solid var(--border); color: var(--navy); cursor: pointer;
}
.flag-sheet-title { margin: 0; font-size: 28px; line-height: 1.1; font-weight: 900; letter-spacing: -.02em; outline: none; }
.flag-sheet-sub { margin: -8px 0 0; color: var(--text-muted); font-size: 15px; }
.flag-foot { margin: auto 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.5; text-align: center; }

.flag-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.flag-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 132px; padding: 14px; box-sizing: border-box;
  border: 2px solid var(--navy); border-radius: 18px; box-shadow: 4px 4px 0 var(--navy-deep);
  color: var(--navy); text-align: left; font: inherit; cursor: pointer;
}
.flag-tile:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--navy-deep); }
.flag-tile:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.flag-tile-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; }
.flag-tile-name { margin-top: auto; font-size: 18px; font-weight: 900; line-height: 1.2; }
.flag-tile-hint { color: var(--text-muted); font-size: 13px; line-height: 1.3; }
.flag-tile-need { background: var(--blue-soft); }
.flag-tile-need .flag-tile-icon { background: var(--blue); color: var(--cream); }
.flag-tile-broken { background: var(--coral-soft); }
.flag-tile-broken .flag-tile-icon { background: var(--coral); color: var(--navy); }
.flag-tile-off { background: var(--yellow-soft); }
.flag-tile-off .flag-tile-icon { background: var(--yellow); color: var(--navy); }
.flag-tile-customer { background: var(--cream); }
.flag-tile-customer .flag-tile-icon { background: var(--navy); color: var(--cream); }
.flag-tile-good {
  grid-column: span 2; display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 14px; row-gap: 2px;
  align-items: center; min-height: 88px; color: var(--cream); border-color: var(--yellow);
  background: linear-gradient(135deg, var(--navy), var(--navy-gradient));
}
.flag-tile-good .flag-tile-icon { grid-row: span 2; background: var(--yellow); color: var(--navy); }
.flag-tile-good .flag-tile-name { margin-top: 0; align-self: end; }
.flag-tile-good .flag-tile-hint { color: var(--light-muted); align-self: start; }

.flag-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.flag-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.flag-choice {
  min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--cream); color: var(--navy);
  font: 700 14px/1.2 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer;
}
.flag-choice[aria-pressed="true"] { border: 2px solid var(--navy); background: var(--navy); color: var(--yellow); font-weight: 800; }
.flag-choice:focus-visible, .flag-seg-btn:focus-visible, .flag-photo-add:focus-visible, .flag-back:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.flag-photo-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; padding: 14px;
  border-radius: 16px; border: 2px dashed var(--navy-border); background: var(--cream); color: var(--navy);
  font: 800 15px/1.2 Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer;
}
.flag-photo-add small { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.flag-photo-add:disabled { opacity: .7; cursor: progress; }
.flag-photo-preview { display: grid; gap: 4px; }
.flag-photo-preview img { display: block; width: 100%; max-height: 240px; object-fit: contain; border-radius: 16px; border: 1px solid var(--border); background: var(--navy); }
.flag-photo-actions { display: flex; gap: 16px; }

.flag-field { display: grid; gap: 6px; }
.flag-field label, .flag-label { margin: 0; font-size: 13px; font-weight: 800; }
.flag-optional { color: var(--text-muted); font-weight: 600; }
.flag-field input {
  min-height: 48px; box-sizing: border-box; width: 100%; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--cream); color: var(--navy); font: 500 16px Inter, ui-sans-serif, system-ui, sans-serif;
}
.flag-field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--mix-blue-12-transparent); }
.flag-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.flag-seg-btn {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--border); background: var(--cream); color: var(--navy);
  font: 700 15px Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer;
}
.flag-seg-btn[aria-pressed="true"] { border: 2px solid var(--navy); background: var(--navy); color: var(--yellow); font-weight: 900; }
.flag-seg-urgent[aria-pressed="true"] { background: var(--coral); color: var(--navy); }

.flag-told { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--blue-soft); font-size: 13px; line-height: 1.4; }
.flag-told .flag-svg { color: var(--blue-dark); }
.flag-error { margin: 0; min-height: 1px; color: var(--coral-dark); font-size: 14px; font-weight: 700; }
.flag-error:empty { display: none; }
.flag-send { width: 100%; min-height: 56px; margin-top: auto; font-size: 17px; }
.flag-send:disabled { opacity: .7; cursor: progress; }

/* Sent */
.flag-sent-top { display: grid; justify-items: center; gap: 10px; padding-top: 18px; text-align: center; }
.flag-sent-stamp {
  display: grid; place-items: center; width: 84px; height: 84px; border-radius: 24px;
  background: var(--yellow); color: var(--navy); border: 2px solid var(--navy); box-shadow: 5px 5px 0 var(--navy-deep);
}
.flag-sent-top .flag-sheet-sub { margin: 0; }
.flag-box { display: grid; gap: 12px; padding: 16px; border-radius: 18px; background: var(--cream); border: 1px solid var(--border); }

.flag-tracker { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.flag-step { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding-bottom: 14px; }
.flag-step:last-child { padding-bottom: 0; }
.flag-step:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.flag-step.is-on:not(:last-child)::before { background: var(--navy); }
.flag-step-dot { display: grid; place-items: center; width: 28px; height: 28px; box-sizing: border-box; border-radius: 50%; border: 2px dashed var(--text-muted); background: var(--cream); }
.flag-step.is-on .flag-step-dot { border: 0; background: var(--navy); color: var(--yellow); }
.flag-step b { display: block; font-size: 15px; padding-top: 3px; }
.flag-step small { display: block; color: var(--text-muted); font-size: 13px; }

.flag-spotter {
  display: grid; gap: 10px; padding: 16px; border-radius: 18px; color: var(--cream);
  background: linear-gradient(135deg, var(--navy), var(--navy-gradient)); border: 2px solid var(--yellow); box-shadow: 6px 6px 0 var(--navy-deep);
}
.flag-spotter-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.flag-spotter-count { color: var(--light-muted); font: 800 12px/1.3 ui-monospace, monospace; }
.flag-spotter p { margin: 0; font-size: 15px; line-height: 1.45; }
.flag-spotter b { color: var(--yellow); }
.flag-spotter small { color: var(--light-muted); font-size: 12px; }
.flag-pips { display: grid; grid-template-columns: repeat(auto-fit, minmax(14px, 1fr)); gap: 6px; }
.flag-pip { height: 8px; border-radius: 4px; background: var(--navy-border); }
.flag-pip.is-on { background: var(--yellow); }
.flag-done-btn { width: 100%; margin-top: auto; background: var(--cream); color: var(--navy); border: 1px solid var(--border); }

/* My flags */
.flag-mine-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.flag-mine-item { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--cream); border: 1px solid var(--border); }
.flag-mine-item.is-new { border: 2px solid var(--navy); box-shadow: 4px 4px 0 var(--navy-deep); }
.flag-mine-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flag-mine-time { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.flag-mine-title { margin: 0; font-size: 16px; font-weight: 900; line-height: 1.3; }
.flag-mine-note { margin: -4px 0 0; color: var(--text-muted); font-size: 14px; line-height: 1.45; }
.flag-replies { list-style: none; margin: 0; padding: 10px 12px; display: grid; gap: 6px; border-radius: 12px; background: var(--blue-soft); font-size: 14px; }
.flag-useful { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--navy); font-size: 13px; font-weight: 800; }
.flag-useful .flag-svg { color: var(--blue-dark); }
.flag-empty { margin: 0; padding: 18px; border-radius: 14px; border: 1px dashed var(--border); text-align: center; color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) { .flag-tile:active { transform: none; } }
