/* Component styles, in the same order as src/ui/components. */

/* ---------- FilterTiles ---------- */
.tile {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px 8px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); cursor: pointer;
}
.tile .ico { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); color: var(--c); }
.tile .tv { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.tile b { font-family: var(--display); font-size: 1.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.tile small { font-size: .75rem; font-weight: 600; color: var(--muted); line-height: 1.2; }
.tile:hover { border-color: var(--c); }
.tile[aria-pressed="true"] { background: var(--cs); border-color: var(--c); }
.tile[aria-pressed="true"] .ico { background: var(--surface); }
.tile[aria-pressed="true"] b { color: var(--c); }
.tile[aria-pressed="true"] small { color: var(--ink); }
@media (max-width: 660px) {
  .tile { flex-direction: column; gap: 6px; padding: 10px 2px; }
  .tile .tv { align-items: center; text-align: center; }
  .tile .ico { width: 32px; height: 32px; }
  .tile b { font-size: 1.2rem; }
}

/* ---------- Banners ---------- */
.bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; font-size: .92rem; }
.bar > span { flex: 1; min-width: 200px; }
.bar .row { gap: 6px; }
.bar-info { border: 1.5px dashed var(--primary); background: var(--primary-soft); }
.bar-prompt { background: var(--primary-soft); }
.bar-danger { background: var(--rejected-soft); border: 1.5px solid var(--rejected); }
.bar-danger strong { color: var(--rejected); }

/* ---------- ReminderList ---------- */
.alert { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.alert.soon { border-color: var(--c); }
.badge { flex: none; width: 54px; padding: 6px 0; border-radius: 10px; text-align: center; background: var(--cs); color: var(--c); }
.badge b { display: block; font-family: var(--display); font-size: 1.35rem; font-weight: 800; line-height: 1.05; }
.badge span { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.alert .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.alert .txt strong { font-weight: 600; }
.alert .desc { color: var(--muted); font-size: .9rem; }
.alert-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.to { font-family: var(--mono); font-size: .84rem; color: var(--ink); user-select: all; word-break: break-all; }
.fallback { margin-top: 8px; font-size: .85rem; min-height: 140px; }
.alert.tone-muted .badge { color: var(--muted); }
.allclear { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--offer-soft); color: var(--offer); font-weight: 500; }
.more { align-self: flex-start; }

/* ---------- JobCard ---------- */
.card { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card.flash { animation: flash 1.2s ease; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--primary); } 100% { box-shadow: var(--shadow); } }
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.av { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--display); font-weight: 800; background: hsl(var(--h) 70% var(--av-bg)); color: hsl(var(--h) 60% var(--av-fg)); }
.who { flex: 1; min-width: 0; }
.co { font-family: var(--display); font-weight: 600; font-size: 1.12rem; line-height: 1.25; overflow-wrap: anywhere; }
.role { color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.ex { font-family: var(--body); font-size: .75rem; font-weight: 500; color: var(--muted); border: 1px dashed var(--track); border-radius: 5px; padding: 1px 6px; margin-inline-start: 8px; vertical-align: middle; white-space: nowrap; }

/* Desktop: each card is a wide row — who + details on the left, progress + actions on the right. */
@media (min-width: 1040px) {
  .main .card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; row-gap: 10px; align-items: center; }
  .main .card > .card-top { grid-column: 1; grid-row: 1; }
  .main .card > .stagebar { grid-column: 2; grid-row: 1; }
  .main .card > .meta { grid-column: 1; grid-row: 2; }
  .main .card > .actions { grid-column: 2; grid-row: 2; justify-content: flex-end; }
  .main .card > .actions .spacer { display: none; }
  .main .card > .history, .main .card > .upd { grid-column: 1 / -1; }
  .main .card .card-top .menu-wrap { margin-inline-start: auto; }
}

/* Finished jobs step back visually. */
.card.closed .stage.on i { opacity: .55; }
.card.closed .av { filter: saturate(.4); }

/* StageBar */
.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.stage { display: flex; flex-direction: column; gap: 5px; font-size: .75rem; color: var(--muted); }
.stage i { height: 8px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px var(--track); }
.stage.on i { background: var(--c); box-shadow: none; }
.stage.now { color: var(--c); font-weight: 700; }
.stopped { margin-top: 4px; font-size: .82rem; color: var(--rejected); font-weight: 600; }
.stopped.muted { color: var(--muted); }
.ext { display: inline-block; }
[dir=rtl] .ext { transform: scaleX(-1); }

/* Meta + History */
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--muted); font-size: .86rem; }
.meta .stale { color: var(--warn); font-weight: 600; }
.meta a { display: inline-flex; align-items: center; min-height: 32px; color: var(--primary); font-weight: 600; text-decoration: none; }
.meta a:hover { text-decoration: underline; }
.history { list-style: none; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; font-size: .87rem; }
.history li { display: flex; gap: 10px; align-items: baseline; }
.history .d { flex: none; width: 56px; color: var(--muted); }
.history .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c); transform: translateY(-1px); }
.history .n { color: var(--muted); overflow-wrap: anywhere; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.actions .spacer { flex: 1; }

/* Card menu */
.menu-wrap { position: relative; flex: none; }
.menu-btn { width: 44px; padding: 0; font-size: 1.25rem; line-height: 1; }
.menu { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 20; min-width: 190px; padding: 6px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgb(16 14 32 / .18); }
.menu button { min-height: 44px; padding: 8px 12px; border: none; border-radius: 8px; background: transparent; text-align: start; font-weight: 500; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); }
.menu .danger { color: var(--rejected); }

/* UpdateForm + Pill */
.upd { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 600; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill:hover { border-color: var(--c); }
.pill:has(input:checked) { background: var(--cs); border-color: var(--c); color: var(--c); }
.pill:has(input:focus-visible) { outline: 2px solid var(--c); outline-offset: 2px; }

/* ---------- Search ---------- */
.search { position: relative; flex: 1; min-width: 180px; max-width: 280px; }
.search #q { padding-inline-start: 38px; }
.search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ---------- EmptyState ---------- */
.empty { padding: 28px 16px; border: 1.5px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 4px; font-family: var(--display); font-size: 1.05rem; color: var(--ink); }

/* ---------- Your data + SyncPanel ---------- */
.data .data-backup { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.sync { display: flex; flex-direction: column; gap: 12px; }
.sync:empty { display: none; }
.sync-head { display: flex; align-items: center; gap: 10px; }
.sync-head h3 { font-size: 1rem; font-weight: 600; }
.sync-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.sync-status { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 500; color: var(--ink); }
.sync-status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.sync-status .dot.pulse { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .3; } to { opacity: 1; } }
.code-box { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.qr-wrap { flex: none; padding: 8px; border-radius: 12px; background: #ffffff; line-height: 0; }
.qr { width: 160px; height: 160px; image-rendering: pixelated; }
.code-side { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; }
.code { font-size: .95rem; letter-spacing: .04em; word-break: break-all; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--track); user-select: all; }
.secret { display: flex; gap: 8px; align-items: flex-start; font-size: .84rem; color: var(--warn); }
.secret svg { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.join { display: flex; flex-direction: column; gap: 10px; }
.sync-off { padding-top: 4px; }
.guessed { font-size: .82rem; color: var(--offer); }

/* ---------- iPhone guide ---------- */
.steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.step-n { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-weight: 700; font-size: .85rem; }
.step-ico { flex: none; color: var(--primary); }
.noscript { padding: 16px; }

/* ---------- Your data ---------- */
.data { padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.data .desc { color: var(--muted); font-size: .9rem; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- Sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.sheet {
  width: 100%; max-width: 540px; max-height: 92vh; overflow: auto;
  display: flex; flex-direction: column; gap: 16px;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 22px max(20px, env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  animation: sheet-up .22s ease;
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { .scrim { align-items: center; padding: 24px; } .sheet { border-radius: 20px; padding: 24px; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-head h2 { font-size: 1.35rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg .pill { border-radius: 10px; }
.export-text { min-height: 200px; font-family: var(--mono); font-size: .8rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 32px); min-height: 48px;
  padding: 6px 8px 6px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: .92rem;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.act { pointer-events: auto; }
.toast .btn { flex: none; color: var(--primary-soft); text-decoration: underline; }
@media (max-width: 660px) { .toast { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); } }

/* ---------- Sign in / create account (src/ui/auth-view.js) ---------- */
body.signed-out .wrap, body.signed-out .fab { display: none; }
#sync[hidden] { display: none; }
.auth {
  min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 85% 8%, color-mix(in srgb, var(--signal) 22%, transparent) 0 120px, transparent 121px),
    radial-gradient(120% 70% at 50% 0%, var(--primary-soft), transparent 70%), var(--bg);
}
.auth[hidden] { display: none; }
.auth-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; padding: 28px 24px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 1px 2px rgb(29 27 51 / .05), 0 20px 50px rgb(29 27 51 / .10); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-top .logo { font-family: var(--display); font-weight: 800; font-size: 1.45rem; letter-spacing: -.02em; margin: 0; }
.auth-top .lang select { min-height: 40px; font-size: .85rem; }
.auth-body { display: flex; flex-direction: column; gap: 14px; }
.auth-body h2 { font-family: var(--display); font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; margin: 0; }
.auth-body h2:focus { outline: none; }
.auth-body .desc { margin: 0; color: var(--muted); }
.auth-body form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.auth-submit { width: 100%; min-height: 50px; font-size: 1rem; }
.auth-row-end { display: flex; justify-content: flex-end; margin-top: -6px; }
.auth-switch { margin: 0; text-align: center; color: var(--muted); font-size: .92rem; }
.auth-error-slot:empty { display: none; }
.auth-error-slot { display: flex; flex-direction: column; gap: 10px; }
.auth-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--rejected-soft); }
.auth-notice { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--offer-soft); color: var(--offer); font-weight: 500; font-size: .92rem; }
.auth-notice svg { flex: none; margin-top: 1px; }
.auth-mail { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); position: relative; }
.auth-mail::after { content: ""; position: absolute; top: 8px; inset-inline-end: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 2px var(--primary-soft); }
.auth-mail svg { width: 28px; height: 28px; }
.auth-privacy { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.auth-privacy svg { flex: none; margin-top: 1px; color: var(--offer); }
.auth-guest { font-size: .95rem; }
.auth-tagline { margin: 0; max-width: 420px; text-align: center; color: var(--muted); font-size: .9rem; }
.link-btn { appearance: none; border: 0; background: none; padding: 4px 2px; min-height: 32px; font: inherit; font-weight: 600; color: var(--primary); cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.link-btn:hover { text-decoration-thickness: 2px; }
.pw { position: relative; }
.pw input { width: 100%; padding-inline-end: 84px; }
.pw-toggle { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 4px 12px; font-size: .85rem; }
.pw-toggle:active { transform: translateY(-50%) scale(.98); }

/* ---------- Account panel (components/AccountPanel.js) ---------- */
.sync-head h3 { margin: 0; }
.acct-email { margin: 0; font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.acct-form { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 12px; background: var(--surface-2); }
.danger-zone { background: var(--rejected-soft); }
.danger-text { color: var(--rejected); }
.secret.safe { color: var(--muted); }
.secret.safe svg { color: var(--offer); }
.auth-top .mark { color: var(--wordmark-dot); }
