/* FWSK CMS — "Gallery Noir", matching lib/theme/fwsk_theme.dart */
@font-face { font-family: "HelveticaNow"; src: url("/brand/HelveticaNowDisplay-Regular.ttf"); font-weight: 400; font-display: swap; }
@font-face { font-family: "HelveticaNow"; src: url("/brand/HelveticaNowDisplay-Medium.ttf"); font-weight: 500; font-display: swap; }
@font-face { font-family: "HelveticaNow"; src: url("/brand/HelveticaNowDisplay-Bold.ttf"); font-weight: 700; font-display: swap; }
@font-face { font-family: "HelveticaNow"; src: url("/brand/HelveticaNowDisplay-Black.ttf"); font-weight: 900; font-display: swap; }

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --line: #2a2a2a;
  --text: #f2f0ec;
  --muted: #8d8a85;
  --accent: #ff3d00;
  --accent-ink: #0a0a0a;
  --danger: #ff5a5a;
  --ok: #3ddc84;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 "HelveticaNow", "Helvetica Neue", Arial, sans-serif;
}
a { color: inherit; }
img { max-width: 100%; }
h1, h2 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(28px, 5vw, 44px); font-weight: 900; text-transform: uppercase; line-height: 1; }
h2 { font-size: 20px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; }
.accent { color: var(--accent); }
.overline { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; margin: 0 0 8px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --- shell --------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(10,10,10,.92); backdrop-filter: blur(8px); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { height: 40px; width: auto; }
.brand span { font-weight: 900; letter-spacing: .14em; color: var(--accent); font-size: 13px; }
.topbar-tools { display: flex; align-items: center; gap: 18px; }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lang a { padding: 4px 10px; font-size: 12px; font-weight: 700; text-decoration: none; color: var(--muted); }
.lang a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.link-btn:hover { color: var(--text); }

.mainnav {
  display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.mainnav a {
  padding: 14px 12px; text-decoration: none; color: var(--muted); white-space: nowrap;
  font-weight: 500; border-bottom: 2px solid transparent;
}
.mainnav a:hover { color: var(--text); }
.mainnav a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }

.page { max-width: 980px; margin: 0 auto; padding: 32px 24px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }

/* --- components ---------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 0 0 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text); font: 500 13px/1 inherit; font-family: inherit;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-primary:hover { filter: brightness(1.1); border-color: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-block { width: 100%; min-height: 44px; font-size: 15px; }
.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid; }
.flash-ok { border-color: rgba(61,220,132,.4); color: var(--ok); background: rgba(61,220,132,.06); }
.flash-error { border-color: rgba(255,90,90,.4); color: var(--danger); background: rgba(255,90,90,.06); }

.badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); margin-right: 6px;
}
.badge-show { color: var(--accent); border-color: rgba(255,61,0,.5); }

/* --- forms --------------------------------------------------------------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field > label, .field > span { font-size: 13px; font-weight: 500; color: var(--muted); }
.req { color: var(--accent); }
input:not([type=checkbox]), textarea, select {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus, .btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
input[type=file] { padding: 9px; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--danger); }
.error { color: var(--danger); font-size: 13px; margin: 0; }
.form-actions { display: flex; gap: 10px; }
.current-image { display: flex; align-items: center; gap: 14px; }
.current-image img { width: 96px; height: 96px; object-fit: contain; background: var(--surface-2); border-radius: 10px; padding: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.field[hidden], [hidden] { display: none !important; }

.login { max-width: 400px; margin: 8vh auto 0; }
.login h1 { margin-bottom: 22px; }

/* --- dashboard ----------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin: 24px 0; }
.tile {
  display: grid; gap: 6px; padding: 20px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s;
}
.tile:hover { border-color: var(--accent); }
.tile strong { font-size: 20px; font-weight: 700; }
.tile-n { color: var(--accent); font-weight: 900; font-size: 13px; letter-spacing: .1em; }

/* --- lists --------------------------------------------------------------- */
.rows { list-style: none; margin: 0; padding: 0; }
.rows.card { padding: 4px 20px; }
.row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-main p { margin: 3px 0 0; }
.time { width: 92px; flex-shrink: 0; color: var(--accent); font-size: 13px; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.day > .btn { margin-top: 12px; }
.thumb {
  width: 48px; height: 48px; border-radius: 10px; object-fit: contain; flex-shrink: 0;
  background: var(--surface-2); padding: 4px;
}
.thumb-empty { display: grid; place-items: center; font-weight: 900; color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.media-card { margin: 0; padding: 12px; display: grid; gap: 10px; }
.media-card img, .video-tile { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; }
.video-tile {
  display: grid; place-content: center; gap: 8px; text-align: center; padding: 12px;
  background: var(--surface-2); color: var(--muted); word-break: break-all;
}
.video-tile span:first-child { font-size: 32px; color: var(--accent); }
.media-card figcaption { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.media-card .actions { justify-content: flex-start; }

/* --- helpers ------------------------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.warn { color: #ffb020; }
.underline { text-decoration: underline; color: inherit; margin-left: 6px; }
.stack { display: grid; }

/* --- drag & drop ------------------------------------------------------------ */
.drag-handle {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 32px; height: 40px; margin-left: -8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: grab; touch-action: none;
}
.drag-handle:hover, .drag-handle:focus-visible { color: var(--text); background: var(--surface-2); }
.drag-handle:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.is-sorting, .is-sorting * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.is-dragging { opacity: .85; outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 10px; background: var(--surface-2); }
.day-title { display: flex; align-items: center; gap: 6px; }

/* --- announcement ----------------------------------------------------------- */
.announcement { display: grid; gap: 10px; margin-top: 22px; }
.announcement .day-head { margin: 0; }
.announcement p { margin: 0; }
.announcement.is-live { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.announcement .status {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.announcement.is-live .status { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.announcement-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.counter { justify-self: end; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; min-height: 40px; }
.switch input { width: 20px; height: 20px; accent-color: var(--accent); }

/* --- error page -------------------------------------------------------------- */
.error-page { max-width: 520px; margin: 8vh auto 0; display: grid; gap: 14px; }
.error-page h1 { margin: 0; }
.error-page p { margin: 0; }

/* --- tickets ---------------------------------------------------------------- */
.mail-mode { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); margin: -6px 0 18px; }
.mail-file { color: #ffb020; border-color: rgba(255,176,32,.35); background: rgba(255,176,32,.06); }
.mail-smtp { color: var(--muted); }
.tiles-compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin: 0 0 18px; }
.tiles-compact .tile { padding: 14px 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; }
.filters input { flex: 2 1 200px; }
.filters select { flex: 1 1 140px; width: auto; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { font-size: 13px; font-weight: 500; color: var(--muted); padding: 0; margin-bottom: 6px; }
.day-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2);
}
.pick:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); }
.badge-status-sent { color: var(--ok); border-color: rgba(61,220,132,.4); }
.badge-status-used { color: var(--text); border-color: var(--muted); }
.badge-status-failed, .badge-status-revoked { color: var(--danger); border-color: rgba(255,90,90,.45); }
.badge-status-pending { color: #ffb020; border-color: rgba(255,176,32,.45); }
.ticket-row .row-main strong { margin-right: 6px; }
.intro { font-size: 14px; line-height: 1.6; }
.hint a { color: var(--text); }

/* --- scanner ---------------------------------------------------------------- */
.scanner { max-width: 520px; margin: 0 auto; display: grid; gap: 14px; }
.viewfinder {
  position: relative; display: grid; place-items: center; min-height: 120px; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
}
.viewfinder video { width: 100%; display: block; aspect-ratio: 1; object-fit: cover; }
.viewfinder-hint { margin: 0; padding: 12px; text-align: center; }
.viewfinder video:not([hidden]) + canvas + .viewfinder-hint {
  position: absolute; left: 0; right: 0; bottom: 0; background: rgba(10,10,10,.7);
}
.scan-result { border-radius: var(--radius); padding: 22px 20px; text-align: center; display: grid; gap: 6px; }
.scan-result p { margin: 0; }
.scan-result-title { font-size: 24px; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; }
.scan-result-name { font-size: 20px; font-weight: 700; }
.scan-ok { background: #0f7a3d; color: #fff; }
.scan-wrong_day { background: #b86e00; color: #fff; }
.scan-invalid, .scan-used, .scan-revoked { background: #b3261e; color: #fff; }
.scan-force { margin-top: 8px; background: #fff; color: #0a0a0a; border-color: #fff; font-weight: 700; }
.scan-manual { margin: 0; }
.scan-manual input { font-family: ui-monospace, Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; }

/* --- phones ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .topbar, .mainnav { padding-left: 16px; padding-right: 16px; }
  .topbar { padding-top: 10px; padding-bottom: 10px; }
  .brand img { height: 34px; }
  .page { padding: 20px 16px 48px; }
  .card { padding: 16px; }
  .rows.card { padding: 4px 16px; }
  .btn { min-height: 40px; padding: 8px 14px; }
  .lang a { padding: 6px 12px; }
  .page-head { align-items: center; }
  .page-head .btn-primary { width: 100%; }
  .row { flex-wrap: wrap; gap: 10px 12px; }
  .row-main { flex: 1 1 0; min-width: 60%; }
  .row .actions { width: 100%; justify-content: flex-start; }
  .row .time { width: 100%; }
  .actions .btn { flex: 1; }
  .actions .inline { display: contents; }
  .day-head { align-items: flex-start; }
  .day-head .actions { width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-card { padding: 8px; }
  .media-card .actions .btn { padding: 8px 6px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 14px; }
  .tile strong { font-size: 16px; }
  .form-actions .btn { flex: 1; min-height: 44px; }
  input:not([type=checkbox]), textarea, select { font-size: 16px; } /* no iOS zoom on focus */
}
