/* 2026-10-14 08:15 | y6y.io v2.10 | shared layout and components for every tool (theme-neutral: colours, lines and shapes come from theme.css tokens)
   Shell: header (brand with tool switcher, the tool's header items, the tool's controls, settings), the tool's main
   area, the settings page. Also auth screens, sheets, settings, admin, toasts. Tool layouts live in apps/<id>/public/css/. */

html, body { min-height: 100%; }
body { overscroll-behavior-y: none; }
[hidden] { display: none !important; }

/* ---------- shell and header ---------- */
.dz-shell { max-width: 1180px; margin: 0 auto; padding: 20px 28px 64px; padding-top: max(20px, env(safe-area-inset-top)); }
/* layout: 'wide' (notepad): the whole window, with a 5% margin each side */
.dz-shell--wide { max-width: none; padding-left: max(16px, 5vw); padding-right: max(16px, 5vw); }
.dz-header { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.dz-brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.dz-brand__name {
  font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1;
  padding: 7px 10px; background: var(--ui-brand-bg); color: var(--ui-brand-ink); border: var(--ui-line-thick); border-radius: var(--ui-r-control); box-shadow: var(--ui-shadow-sm);
}
.dz-brand__sub { font-size: var(--ui-fs-label); font-weight: 800; padding: 3px 8px; background: var(--ui-tag-bg); color: var(--ui-tag-ink); border-radius: var(--ui-r-tag); }
.dz-header__controls { display: flex; align-items: center; gap: 12px; }
.dz-header__items { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* Home and Settings at the far right of every header; the logo also links to home */
a.ui-knob { color: var(--ui-ink); text-decoration: none; }
a.dz-brand__link { text-decoration: none; cursor: pointer; transition: transform 80ms ease, box-shadow 80ms ease; }
a.dz-brand__link:active { transform: var(--ui-press); box-shadow: none; }
a.dz-brand__link:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 3px; }
.dz-badge {
  position: absolute; top: -9px; right: -9px; min-width: 20px; height: 20px; padding: 0 5px;
  background: var(--ui-active); border: var(--ui-line); border-radius: var(--ui-r-tag); color: var(--ui-badge-ink); text-shadow: none;
  font-size: 11px; font-weight: 800; line-height: 16px; text-align: center;
}

/* ---------- main area ---------- */
.dz-main { display: flex; flex-direction: column; gap: 22px; }

/* ---------- list rows (drop_zone items, admin users) ---------- */
.dz-item { cursor: pointer; position: relative; }
.dz-item:hover { background: var(--ui-surface); }
.dz-item:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 2px; }
.dz-item__thumb {
  width: 40px; height: 40px; flex: none; overflow: hidden; border: var(--ui-line);
  background: var(--ui-thumb-bg); color: var(--ui-thumb-ink); border-radius: var(--ui-r-tag);
  display: flex; align-items: center; justify-content: center;
}
.dz-item__thumb--file { background: var(--ui-surface); color: var(--ui-ink); }
.dz-item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dz-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.dz-item__text {
  font-weight: var(--ui-content-weight); white-space: pre-wrap; overflow-wrap: anywhere; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4;
}
.dz-item__meta { display: flex; flex-wrap: wrap; gap: 5px; }
.dz-item__actions { display: flex; gap: 8px; flex: none; }
.dz-icon-btn { width: var(--ui-control-sm); min-height: var(--ui-control-sm); height: var(--ui-control-sm); padding: 0; }
.dz-item__check { width: 22px; height: 22px; flex: none; border: var(--ui-line); border-radius: var(--ui-r-tag); padding: 0; cursor: pointer; background: var(--ui-surface); }
.dz-item__check[aria-checked="true"] { background: var(--ui-active); }
.dz-item.is-selected { background: var(--ui-highlight-bg); color: var(--ui-highlight-ink); }
.dz-item .ui-progress { margin-top: 2px; }

/* ---------- auth ---------- */
.dz-auth { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.dz-auth__inner { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 24px; }
.dz-auth .dz-brand { justify-content: center; margin-right: 0; }
.dz-auth .dz-brand__name { font-size: 30px; }
.dz-form { display: flex; flex-direction: column; gap: 14px; }
.dz-form h1 { margin: 0 0 2px; }
.dz-form p { margin: 0; }
.dz-field-label { display: flex; flex-direction: column; gap: 6px; }
.dz-field-label > .ui-label { font-weight: 700; text-transform: var(--ui-chrome-case); }
/* interface labels follow the theme's case; descriptions and user content never do */
.dz-meter > .ui-label, .dz-switch-label, .dz-setting__text > span:first-child, .dz-facts dt, .dz-stat > .ui-meta { text-transform: var(--ui-chrome-case); }
.dz-form__links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.dz-linkbtn { background: none; border: 0; padding: 4px 0; cursor: pointer; font-size: var(--ui-fs-label); font-weight: 700; text-transform: var(--ui-chrome-case); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.dz-linkbtn:hover { background: var(--ui-highlight-bg); color: var(--ui-highlight-ink); }
.dz-error { color: var(--ui-danger-ink); background: var(--ui-danger-bg); border: var(--ui-line); border-color: var(--ui-danger-line); border-radius: var(--ui-r-control); padding: 6px 10px; font-size: var(--ui-fs-label); font-weight: 700; }
.dz-error:empty { display: none; }
.dz-pin { font-size: 26px; letter-spacing: 0.6em; text-align: center; padding-left: calc(12px + 0.6em); font-variant-numeric: tabular-nums; }
/* white behind the QR code in both themes so authenticator apps can scan it */
.dz-qr { display: flex; justify-content: center; padding: 12px; background: #FFFFFF; border: var(--ui-line); border-radius: var(--ui-r-control); align-self: center; }
.dz-qr img { width: 220px; height: 220px; image-rendering: pixelated; }
.dz-secret { word-break: break-all; font-size: var(--ui-fs-label); }
.dz-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; padding: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- sheets (modal panels) ---------- */
.dz-scrim {
  position: fixed; inset: 0; z-index: 50; background: var(--ui-scrim);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: dz-fade 120ms ease;
}
.dz-sheet {
  width: 100%; max-width: 640px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px); overflow: auto;
  display: flex; flex-direction: column; gap: 16px; padding: 20px; overscroll-behavior: contain;
  animation: dz-rise 140ms ease;
}
.dz-sheet--wide { max-width: 920px; }
.dz-sheet__content { display: flex; flex-direction: column; gap: 16px; }
.dz-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dz-sheet__head .ui-title { overflow-wrap: anywhere; }
.dz-detail-text { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; line-height: 1.55; max-height: 46vh; overflow: auto; user-select: text; }
.dz-detail-text textarea { min-height: 200px; }
.dz-preview { display: flex; justify-content: center; padding: 10px; }
.dz-preview img { max-width: 100%; max-height: 52vh; display: block; border: var(--ui-line); border-radius: var(--ui-r-control); }
.dz-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0; }
.dz-facts dt { color: var(--ui-muted); font-size: var(--ui-fs-label); }
.dz-facts dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }
.dz-action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.dz-actions-row { display: flex; gap: 10px; flex-wrap: wrap; }
.dz-actions-row > .ui-btn { flex: 1 1 auto; }
.dz-inline-form { display: flex; gap: 10px; align-items: stretch; }
.dz-inline-form > .ui-field { flex: 1; min-width: 0; }

/* ---------- settings page: General, Tools and Admin blocks down the left, the chosen category on the right ---------- */
.dz-page { display: flex; flex-direction: column; gap: 20px; }
.dz-page__head { display: flex; align-items: center; gap: 14px; }
/* categories on the left, the chosen one on the right; on a phone they take turns */
.dz-settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.dz-settings__navcol { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.dz-settings__nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.dz-settings__navhead { padding: 4px 12px 2px; font-weight: 700; text-transform: var(--ui-chrome-case); letter-spacing: 0.04em; }
.dz-settings__navitem {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 10px 12px; min-height: 44px;
  border: 0; border-radius: var(--ui-r-control); background: none; color: var(--ui-ink); font: inherit; font-weight: 700;
  text-align: left; cursor: pointer; text-transform: var(--ui-chrome-case); text-decoration: none;
}
.dz-settings__navitem:hover { background: var(--ui-tint); }
.dz-settings__navitem[aria-current="true"] { background: var(--ui-highlight-bg); color: var(--ui-highlight-ink); }
.dz-settings__navitem:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 1px; }
.dz-settings__panel { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dz-settings__back { display: none; align-self: flex-start; }
.dz-settings__group { display: flex; flex-direction: column; gap: 16px; }
.dz-settings__headrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dz-settings__heading { display: inline-block; align-self: flex-start; padding: var(--ui-heading-pad); background: var(--ui-heading-bg); color: var(--ui-heading-ink); border: var(--ui-heading-line); }
.dz-settings__body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dz-settings__toolgroup { display: flex; flex-direction: column; gap: 14px; }
.dz-settings__toolgroup + .dz-settings__toolgroup { border-top: var(--ui-line-dashed); padding-top: 18px; }
.dz-settings__subhead { margin: 0; font-size: 16px; font-weight: var(--ui-strong-weight); letter-spacing: -0.01em; text-transform: var(--ui-chrome-case); }
.dz-section { display: flex; flex-direction: column; gap: 10px; }
.dz-section h3 { margin: 0; font-size: 14px; font-weight: var(--ui-strong-weight); text-transform: var(--ui-chrome-case); }
.dz-section p { margin: 0; }
.dz-form > .ui-btn[type="submit"]:not(.ui-btn--danger) { background: var(--ui-submit-bg); color: var(--ui-submit-ink); }
.dz-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dz-setting__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dz-device { display: flex; align-items: center; gap: 12px; }
.dz-device__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

/* ---------- admin ---------- */
.dz-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.dz-stat { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.dz-stat__value { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.dz-user { flex-direction: column; align-items: stretch; gap: 10px; }
.dz-user__head { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.dz-user__panel { display: flex; flex-direction: column; gap: 10px; }
.dz-user__tool { display: flex; flex-direction: column; gap: 10px; }
.dz-limits { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.dz-errors { max-height: 240px; overflow: auto; font-size: var(--ui-fs-meta); }
.dz-errors div { padding: 3px 0; overflow-wrap: anywhere; }

/* ---------- toasts ---------- */
.dz-toasts { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.dz-toast { display: flex; align-items: center; gap: 10px; padding: 8px 14px; max-width: 100%; pointer-events: auto; font-weight: 700; animation: dz-rise 140ms ease; }

/* ---------- splash ---------- */
.dz-splash { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; }

@keyframes dz-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dz-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- narrow desktop and tablet ---------- */
@media (max-width: 760px) {
  .dz-settings { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .dz-settings__navcol { position: static; }
  .dz-settings__navitem::after { content: '›'; font-size: 20px; line-height: 1; color: var(--ui-muted); }
  .dz-settings__navitem[aria-current="true"] { background: none; color: var(--ui-ink); }
  .dz-settings:not(.is-open) .dz-settings__panel { display: none; }
  .dz-settings.is-open .dz-settings__navcol { display: none; }
  .dz-settings__back { display: inline-flex; }
}
/* ---------- phone (Fold7 cover screen and folded) ---------- */
@media (max-width: 640px) {
  .dz-shell { padding: 14px 14px 40px; padding-top: max(14px, env(safe-area-inset-top)); }
  .dz-header { gap: 10px; margin-bottom: 16px; }
  .dz-brand__name { font-size: 18px; padding: 5px 8px; }
  .dz-header__controls { gap: 10px; }
  .dz-header__items { order: 3; flex: 1 1 100%; }
  .dz-item { gap: 10px; padding: 8px 10px; }
  .dz-item__actions .dz-icon-btn:not(.dz-keep) { display: none; }
  .dz-scrim { padding: 0; align-items: flex-end; }
  .dz-sheet { max-width: none; max-height: 92vh; max-height: 92dvh; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); border-bottom: 0; box-shadow: none; border-radius: var(--ui-r-panel) var(--ui-r-panel) 0 0; }
  .dz-settings__panel { padding: 16px 14px; }
  .dz-limits { grid-template-columns: 1fr 1fr; }
  .dz-limits > .ui-btn { grid-column: 1 / -1; }
  .dz-action-grid { grid-template-columns: 1fr 1fr; }
  .dz-auth .dz-brand__name { font-size: 26px; }
  .ui-card.dz-auth-card { padding: 20px 16px; }
}

/* volume slider (settings: interface sounds) */
.dz-vol { display: grid; grid-template-columns: minmax(0, 1fr) 3.6em; align-items: center; gap: 8px; min-height: 34px; min-width: min(240px, 50vw); }
.dz-vol__range { width: 100%; min-width: 0; margin: 0; accent-color: var(--ui-ink); }
.dz-vol__range:disabled { opacity: 0.4; }
.dz-vol__out { text-align: right; font-variant-numeric: tabular-nums; }
