/* Colours and type follow the Sembcorp visitor photo gallery template. */
@font-face {
  font-family: "Open Sans";
  src: url("/open-sans-latin.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: hsl(160 10% 97%); --surface: #fff; --ink: hsl(180 15% 15%); --muted: hsl(180 8% 37%); --line: hsl(174 20% 88%);
  --accent: hsl(178 100% 26%); --accent-hover: hsl(178 100% 21%); --accent-ink: #fff; --tint: hsl(174 30% 92%);
  --brand-dark: hsl(178 100% 8%); --ok: hsl(150 60% 28%); --warn: hsl(32 100% 32%); --danger: hsl(0 70% 42%);
  --radius: 4px; color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 "Open Sans", Arial, sans-serif; }
button:hover:not(:disabled):not(.ghost):not(.tab):not(.danger), .button:hover:not(.ghost) { background: var(--accent-hover); }
h1 { font-size: 22px; margin: 0 0 16px; } h2 { font-size: 17px; margin: 0 0 10px; }
a { color: var(--accent); }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
input, select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); min-height: 38px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-weight: 400; color: var(--muted); }
button, .button { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: var(--radius); padding: 8px 14px; min-height: 38px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:disabled { opacity: .55; cursor: progress; }
button.ghost, .button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.small, .button.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
button.danger { background: var(--danger); }
.danger-text { color: var(--danger) !important; }
.warn-text { color: var(--warn); margin-right: 6px; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 100%; max-width: 400px; }
.card input { width: 100%; }
.card button[type=submit] { width: 100%; margin-top: 16px; justify-content: center; }
.card .ghost { width: 100%; margin-top: 8px; justify-content: center; }
.eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 6px; }
.code { font-size: 24px; letter-spacing: .3em; text-align: center; }
.qr { display: block; margin: 12px auto; background: #fff; padding: 6px; border-radius: 6px; }
.qr.small { margin: 0; }
.secret { display: block; padding: 8px; background: var(--bg); border-radius: 6px; margin-top: 6px; word-break: break-all; }
.steps { padding-left: 18px; color: var(--muted); }
.fine { color: var(--muted); font-size: 12px; }
.notice, .flash { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); padding: 10px 12px; border-radius: var(--radius); }
.flash { background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.error { color: var(--danger); margin: 8px 0 0; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: var(--brand-dark); color: #fff; }
.bar .pill { background: rgb(255 255 255 / 12%); border-color: rgb(255 255 255 / 30%); color: #fff; }
.bar .muted { color: rgb(255 255 255 / 75%); }
.bar button.ghost { color: #fff; border-color: rgb(255 255 255 / 45%); }
.bar button.ghost:hover { background: rgb(255 255 255 / 12%); }
.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; }
.tabs { display: flex; gap: 2px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { background: transparent; color: var(--muted); border: 0; border-bottom: 3px solid transparent; border-radius: 0; white-space: nowrap; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.content { max-width: 1280px; margin: 0 auto; padding: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.toolbar.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 160px; }
.muted { color: var(--muted); } .small-text { font-size: 12px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; border: 1px solid var(--line); background: var(--bg); }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table tr.click { cursor: pointer; } .table tr.click:hover { background: var(--bg); }
.matrix td.c { text-align: center; font-size: 16px; }
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.visit-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
code.big { font-size: 22px; letter-spacing: .08em; }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 16px; }
.drop.over { border-color: var(--accent); }
.drop label { font-weight: 400; color: var(--muted); margin-top: 0; }
.photos { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.tile-img { position: relative; display: block; }
.tile-badge { position: absolute; top: 6px; left: 6px; background: var(--surface); }
.tile-meta { display: flex; flex-direction: column; line-height: 1.35; overflow-wrap: anywhere; }
.tile img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 6px; display: block; background: var(--bg); }
.tile p { margin: 0; }
.tile-actions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: auto; }
.hidden-photo img { opacity: .35; }
.secret-panel { margin-top: 12px; padding: 14px; border: 2px solid var(--warn); border-radius: 10px; background: var(--bg); }
.secret-panel code.big, .secret-panel code.key { display: block; margin: 6px 0; user-select: all; word-break: break-all; }
.roles dt { font-weight: 600; margin-top: 10px; } .roles dd { margin: 2px 0 0; color: var(--muted); }
details summary { cursor: pointer; color: var(--muted); }
.env-banner { background: hsl(40 95% 45%); color: hsl(30 60% 10%); text-align: center; font-weight: 700; padding: 6px 12px; letter-spacing: .04em; font-size: 13px; }
[hidden] { display: none !important; }
@media (max-width: 640px) { .table { font-size: 13px; } .bar { padding: 8px 12px; } }
.link-box { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; max-width: 760px; }
.link-box .toolbar { margin: 0; }
input.mono { font-family: ui-monospace, Consolas, monospace; }
.qr-fig { margin: 0; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.frame-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); align-items: stretch; }
.frame-grid .panel { margin-bottom: 0; }
.frame-card { display: flex; flex-direction: column; }
.frame-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.frame-card-head h2 { margin: 0; }
/* Both previews are the same height (up to 360 px); the checkerboard shows the transparent window. */
.frame-preview { display: grid; place-items: center; margin: 16px auto 8px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius);
  background: repeating-conic-gradient(#e6ecea 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.frame-preview.portrait { aspect-ratio: 3 / 4; width: min(100%, 270px); }
.frame-preview.landscape { aspect-ratio: 4 / 3; width: min(100%, 480px); }
.frame-preview.empty { background: var(--bg); border-style: dashed; }
.frame-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.frame-preview p { padding: 16px; text-align: center; margin: 0; }
.frame-meta { text-align: center; margin: 0 0 12px; }
.frame-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.frame-actions label.button { margin: 0; font-weight: 600; color: var(--ink); }
/* Photo upload: one large drop zone, then options and the upload button on one row. */
.upload .drop-zone { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; padding: 28px 16px; text-align: center;
  border: 2px dashed var(--line); border-radius: 12px; background: var(--bg); color: var(--muted); font-weight: 400; cursor: pointer; }
.upload .drop-zone:hover, .upload.over .drop-zone { border-color: var(--accent); background: var(--tint); }
.upload input[type=file]:focus-visible + .drop-zone { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop-zone strong { color: var(--ink); font-size: 15px; }
.drop-zone .link { color: var(--accent); text-decoration: underline; }
.drop-zone .chosen { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.drop-zone .chosen:empty { display: none; }
.drop-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--accent); font-size: 22px; font-weight: 700; }
.upload-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.upload-options label.check, .upload-options .fine { margin: 0; }
.upload-bar button { min-width: 140px; justify-content: center; }
.upload p[role=status]:empty { display: none; }
@media (max-width: 720px) { .upload-bar button { flex: 1 1 100%; } }
.frame-actions .file-name { flex: 1; min-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
label.check { margin: 10px 0; color: var(--ink); }
label.check input { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.pager .toolbar { margin: 0; }

/* ---- small screens ---- */
@media (max-width: 720px) {
  .content { padding: 10px; }
  .panel { padding: 14px; border-radius: 10px; }
  .bar .who strong { display: none; }
  .grow { min-width: 0; flex-basis: 100%; }
  .toolbar > button, .toolbar > .button { flex: 0 0 auto; }
  input, select { max-width: 100%; }
  /* Wide tables scroll inside their panel instead of stretching the page. */
  .table:not(.stack) { display: block; overflow-x: auto; }
  /* The visit list becomes one card per visit. */
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
  .table.stack td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  .table.stack td.lead { display: block; font-weight: 600; font-size: 15px; }
  .table.stack td.lead::before { content: none; }
  .visit-head { flex-direction: column; }
  .qr-fig { align-self: center; }
  .link-box input { flex-basis: 100%; }
  /* Photos: two per row on phones, with full-width tile buttons. */
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 6px; }
  .tile-meta { font-size: 11px; }
  .tile-actions > *, .tile-actions span > button { flex: 1 1 auto; justify-content: center; }
  .tile-actions span { display: flex; flex: 1 1 100%; gap: 4px; flex-wrap: wrap; }
  .qr.small { width: 110px; height: 110px; }
}

/* Table cells: date over time, name over role, readable audit details. */
.when, .who-cell { display: inline-flex; flex-direction: column; line-height: 1.35; }
.when { white-space: nowrap; }
.when .muted, .who-cell .muted { font-size: 12px; }
.table td.nowrap, .table td code { white-space: nowrap; }
.table.audit td.details { min-width: 240px; max-width: 460px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.table.audit td.details div + div { margin-top: 2px; }
@media (max-width: 720px) {
  .table.stack td.lead .when { flex-direction: row; gap: 8px; }
  .table.stack td.block { display: block; }
  .table.stack td.block::before { display: block; margin-bottom: 4px; }
  .table.stack td.block:not([data-label])::before { content: none; }
  .table.stack .who-cell { align-items: flex-end; text-align: right; }
  .table.audit td.details { max-width: none; min-width: 0; }
  .table.audit td.details:empty { display: none; }
  .table.stack td code { white-space: normal; overflow-wrap: anywhere; }
}
