/* Admin density. Loaded only by index.html, after theme.css.
   The management screens use a tighter scale than the public form; the live preview keeps the public scale. */
.app-shell, .create-dialog, .login-screen, #toast {
  --type-body: 14px;
  --type-ui: 14px;
  --type-caption: 12px;
  --type-minor: 16px;
  --type-section: 18px;
  --type-welcome: 20px;
  --type-title: 24px;
  --type-input: 14px;
  font-size: var(--type-body);
  word-break: auto-phrase;
  line-break: strict;
}
.preview-frame { --type-input: 16px; word-break: normal; line-break: auto; }

/* Controls */
.app-shell .btn, .create-dialog .btn { min-height: 40px; padding: 8px 16px; }
.app-shell .btn.back, .app-shell .btn.danger-text, .app-shell .btn.welcome-button { padding: 8px 0; }
.app-shell .btn.tab { padding: 8px 4px; }
.app-shell .btn.field-name { padding: 8px; }
.app-shell .btn.device { min-height: 32px; padding: 4px 12px; }
.app-shell .btn.icon { width: 32px; min-width: 32px; min-height: 32px; padding: 4px; border: 1px solid var(--line); background: var(--surface); }
.app-shell .btn.icon:disabled, .app-shell .btn.icon:disabled:hover { border-color: transparent; background: transparent; opacity: 0.4; }
.app-shell .auth-logout { min-height: 32px; padding: 4px 12px; }
.app-shell .control, .create-dialog .control { gap: 4px; margin-bottom: 16px; }
.app-shell .control input, .app-shell .control select, .app-shell .control textarea, .app-shell .add-field-row select,
.create-dialog .control select, .app-shell .booking-slot-editor input:not([type=checkbox]) {
  min-height: 40px; padding: 8px 12px;
}
.app-shell .control input, .app-shell .control select, .app-shell .add-field-row select, .create-dialog .control select { line-height: var(--leading-ui); }
.app-shell .control input[type=color] { padding: 4px; }
/* The native arrow sits flush against the border, so selects draw their own, inset 16px. */
.app-shell .control select, .app-shell .add-field-row select, .create-dialog .control select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: right 22px center, right 16px center; background-size: 6px 6px; background-repeat: no-repeat;
}
.app-shell .control textarea { min-height: 88px; field-sizing: content; }
.app-shell .toggle { min-height: 40px; margin: 8px 0 16px; }
#toast { padding: 12px 16px; }

/* Shell */
.app-shell .workspace { margin: 16px 0; padding: 8px 12px; }
.app-shell .brand { margin-bottom: 16px; }
.app-shell .warning-text:empty { display: none; }
.app-shell .btn.nav { margin: 0 0 4px; padding: 8px 12px; background: transparent; }
.app-shell .btn.nav.active, .app-shell .btn.nav.active:hover { color: var(--accent); background: var(--surface-selected); font-weight: 700; }
.nav-icon { flex: none; }
.app-shell .topbar { min-height: 56px; padding: 8px 24px; }
.app-shell .dashboard-main, .app-shell .editor-main { padding: 24px; }
.app-shell h1 { margin: 0 0 8px; }
.app-shell .page-heading, .app-shell .editor-heading { margin-bottom: 24px; }
.app-shell .note-box { padding: 12px 16px; margin: 0 0 16px; }
/* The note that follows the publish button must not touch it. */
.app-shell #publish-button ~ .note-box { margin-top: 16px; }
.app-shell .abuse-notice p { margin: 4px 0 0; }

/* Lists */
.app-shell .form-list-row { padding: 12px 16px; }
.app-shell .form-icon { width: 32px; height: 32px; font-size: var(--type-minor); }
.app-shell .receipt-card { padding: 16px; }
.app-shell .receipt-card h2 { font-size: var(--type-section); margin: 0 0 16px; }
.app-shell .receipt-list { margin-top: 16px; }
.app-shell .production-list-controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 16px 0; }
.app-shell .production-list-controls .control { flex: 0 1 320px; max-width: 320px; }
.app-shell .production-list-controls .warning-text { flex-basis: 100%; margin: 0; }
.app-shell .production-pagination .btn { min-height: 32px; padding: 4px 12px; }

/* Settings and members: bounded forms, one line per member */
.site-form, .member-form { max-width: 720px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.member-table { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.member-head, .member-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 136px 112px; gap: 16px; align-items: center; padding: 8px 16px; }
.member-head { color: var(--text-muted); font-size: var(--type-caption); border-bottom: 1px solid var(--line); }
.member-row + .member-row { border-top: 1px solid var(--line); }
.member-row strong { font-size: var(--type-ui); overflow-wrap: anywhere; word-break: normal; }
.member-row small { font-size: var(--type-ui); color: var(--text-muted); }
.member-row .member-action { justify-self: end; min-height: 32px; }
.app-shell .member-row .btn { min-height: 32px; padding: 4px 12px; margin: 0; }

/* AI connection: the token shown once after its issue, then one line per issued token */
.token-form, .token-issued { max-width: 720px; }
.token-issued { margin: 0 0 16px; padding: 16px; border: 1px solid var(--state-success); border-radius: 8px; background: var(--state-success-bg); }
.token-issued h2 { font-size: var(--type-section); margin: 0 0 8px; }
.token-issued h3 { font-size: var(--type-ui); margin: 16px 0 0; }
.token-issued p { margin: 0; font-size: var(--type-ui); line-height: var(--leading-body); }
.ai-settings .code-output { display: block; width: 100%; max-width: 720px; overflow-wrap: anywhere; word-break: break-all; }
.token-issued .code-output { margin: 8px 0; }
.ai-settings .folder-section > .helper { margin: 0 0 16px; }
.token-table { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.token-head, .token-row { display: grid; grid-template-columns: minmax(0, 1fr) 104px 104px 104px 112px; gap: 16px; align-items: center; padding: 8px 16px; }
.token-head { color: var(--text-muted); font-size: var(--type-caption); border-bottom: 1px solid var(--line); }
.token-row + .token-row { border-top: 1px solid var(--line); }
.token-name { display: grid; gap: 4px; min-width: 0; }
.token-name strong { font-size: var(--type-ui); overflow-wrap: anywhere; word-break: normal; }
.token-name small, .token-cell small { color: var(--text-muted); font-size: var(--type-caption); overflow-wrap: anywhere; }
.token-cell { font-size: var(--type-ui); }
.token-cell small { display: none; }
.token-row .token-action { justify-self: end; }
.app-shell .token-row .btn { min-height: 32px; padding: 4px 12px; margin: 0; }
.ai-settings .empty { margin: 0; }

/* Clients: one line per client, then a folder of sites with their forms nested one step inside */
.app-shell .list-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 16px; flex: 1 1 480px; }
.app-shell .list-filters .control { flex: 1 1 240px; }
.form-place { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.app-shell .kind-chip { flex: none; }
.client-list-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; margin: 16px 0; }
.app-shell .client-list-controls .control { flex: 0 1 320px; margin-bottom: 0; }
.client-count { flex: 1 1 auto; color: var(--text-muted); font-size: var(--type-caption); padding-bottom: 8px; }
.client-table { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.client-head, .client-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px 112px; gap: 16px; align-items: center; padding: 8px 16px; }
.client-head { color: var(--text-muted); font-size: var(--type-caption); border-bottom: 1px solid var(--line); }
.client-row { width: 100%; min-height: 48px; border: 0; color: var(--ink); background: var(--surface); font: inherit; font-size: var(--type-ui); text-align: left; cursor: pointer; }
.client-row + .client-row { border-top: 1px solid var(--line); }
.client-row:hover { background: var(--surface-hover); }
.client-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.client-row strong { overflow-wrap: anywhere; }
.client-name { display: grid; gap: 4px; min-width: 0; }
.client-name small { color: var(--text-muted); font-size: var(--type-caption); overflow-wrap: anywhere; }
.site-list > [hidden], .nested-form[hidden], .folder-section > .empty[hidden] { display: none; }
.app-shell .control .pick-search, .create-dialog .control .pick-search { min-height: 32px; padding: 4px 12px; }
.client-cell small { display: none; color: var(--text-muted); font-size: var(--type-caption); }
.client-rows .empty { margin: 0; border: 0; }
.inline-form { max-width: 720px; margin: 0 0 16px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.folder-section { margin-top: 32px; }
.folder-section > h2 { font-size: var(--type-section); margin: 0 0 16px; }
.site-block { margin: 0 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.site-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; }
.site-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.site-title h3 { margin: 0; font-size: var(--type-minor); }
.site-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.app-shell .site-actions .btn, .app-shell .nested-form .btn, .app-shell .company-summary .btn, .app-shell .check-body .btn { min-height: 32px; padding: 4px 12px; }
.site-block .inline-form { margin: 0 16px 16px; }
.nested-forms { margin: 0 16px 16px 32px; padding: 0 16px; border-radius: 8px; background: var(--surface-subtle); }
.nested-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 4px 0; }
.nested-form + .nested-form { border-top: 1px solid var(--line); }
.app-shell .nested-form .text-button { min-height: 32px; padding: 4px 0; text-align: left; }
.nested-empty { margin: 0; padding: 12px 0; color: var(--text-muted); font-size: var(--type-ui); }
.company-summary { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; max-width: 720px; padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.company-summary dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; flex: 1 1 320px; margin: 0; }
.company-summary dt { color: var(--text-muted); font-size: var(--type-caption); line-height: var(--leading-body); }
.company-summary dd { margin: 0; font-size: var(--type-ui); overflow-wrap: anywhere; }
.company-summary dd.missing { color: var(--state-warning); }
.company-summary .helper { margin: 0; }

/* Editor */
.publish-readiness { margin: 16px 0; }
.app-shell .publish-readiness .control { margin-bottom: 4px; }
.publish-readiness .allowed-origins { margin: 0 0 16px; overflow-wrap: anywhere; }
.publish-readiness h3 { font-size: var(--type-ui); margin: 16px 0 8px; }
.publish-problem { margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--state-error); border-radius: 8px; color: var(--state-error); background: var(--state-error-bg); }
.publish-problem strong { display: block; font-size: var(--type-ui); }
.publish-problem p { margin: 4px 0 0; font-size: var(--type-ui); }
.readiness-list { margin: 0; padding: 0; list-style: none; }
.readiness-list li { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.readiness-list .chip { flex: none; }
.check-body { min-width: 0; }
.check-body strong { display: block; font-size: var(--type-ui); line-height: var(--leading-body); }
.check-body p { margin: 4px 0 8px; color: var(--text-muted); font-size: var(--type-ui); }
.check-ask { color: var(--state-warning); font-size: var(--type-ui); }
.chip.amber { color: var(--state-warning); background: var(--state-warning-bg); }
/* What will be sent once published, below the conditions and above the publish button */
.notification-review { margin: 24px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.notification-review h3 { font-size: var(--type-ui); margin: 0 0 8px; }
.notification-review .helper { margin: 0 0 16px; }
.review-list { margin: 0; }
.review-row { padding: 8px 0; border-top: 1px solid var(--line); }
.review-row dt { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: var(--text-muted); font-size: var(--type-caption); line-height: var(--leading-body); }
.review-row dd { margin: 4px 0 0; font-size: var(--type-ui); line-height: var(--leading-body); overflow-wrap: anywhere; }
.review-body { max-height: 240px; margin: 0; padding: 12px; overflow: auto; border-radius: 8px; color: var(--ink); background: var(--surface-subtle); font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-body:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dialog-place { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.dialog-place .helper, .dialog-place .no-site { grid-column: 1 / -1; }
.dialog-place .no-site { padding: 12px 16px; margin: 0 0 16px; }
.dialog-place .no-site p { margin: 0 0 8px; }
.dialog-place .no-site p:last-child { margin: 0; }
.create-dialog .template-card:disabled { color: var(--state-disabled); background: var(--state-disabled-bg); cursor: not-allowed; }
.app-shell .section-heading { margin-bottom: 16px; }
.app-shell .field-item { padding: 4px 8px; }
.app-shell .field-settings { padding: 16px; }
.app-shell .template-variables { padding: 12px 16px; margin-top: 16px; }
.variable-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 8px 0 0; }
.variable-list dt, .variable-list dd { margin: 0; font-size: var(--type-ui); line-height: var(--leading-body); }
.variable-list code { font-size: var(--type-caption); word-break: normal; }
.create-dialog { padding: 24px; }
.create-dialog .dialog-problem { margin: 16px 0 0; }
.create-dialog .dialog-problem:empty { display: none; }
.create-dialog .template-card { padding: 16px; }
.create-dialog .template-icon { width: 32px; height: 32px; font-size: var(--type-minor); margin-bottom: 8px; }
.create-dialog .template-card p { margin: 4px 0 8px; }

/* Login */
.login-screen .login-card { max-width: 400px; gap: 16px; }
.login-screen .login-card h1 { font-size: 20px; margin: 0; }
.login-screen .login-card p { font-size: 14px; }
.login-screen .login-card .control { margin: 0; }
.login-screen .login-card input { font-size: 16px; min-height: 44px; padding: 8px 12px; }
.login-screen .login-card .btn { font-size: 14px; min-height: 44px; padding: 8px 24px; }
.login-screen .login-card .login-or { font-size: 12px; }
.login-card .login-message.notice { color: var(--text-muted); }
.login-card.signing-in > p, .login-card.signing-in > .control, .login-card.signing-in > a.btn { display: none; }

@media (min-width: 701px) {
  .app-shell .form-row-name .text-button { min-height: 24px; padding: 0; }
  .app-shell .sidebar { width: 224px; padding: 16px; }
  .app-shell .main-shell { width: calc(100% - 224px); margin-left: 224px; }
  .create-dialog .template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .app-shell, .create-dialog, .login-screen, #toast {
    --type-body: 12px;
    --type-ui: 12px;
    --type-caption: 10px;
    --type-minor: 14px;
    --type-section: 16px;
    --type-welcome: 18px;
    --type-title: 22px;
    --type-input: 16px;
  }
  /* Navigation is one row of equal buttons; the page starts right below it. */
  .app-shell .sidebar { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 8px 16px; }
  .app-shell .brand { flex: 0 0 100%; min-height: 40px; margin-bottom: 0; }
  .app-shell .btn.nav { flex: 1 1 0; width: auto; min-width: 0; min-height: 48px; margin: 0; padding: 4px; flex-direction: column; gap: 4px; justify-content: center; font-size: var(--type-caption); line-height: var(--leading-heading); }
  .app-shell .topbar { min-height: 48px; padding: 8px 16px; flex-wrap: nowrap; }
  .app-shell .topbar > span:first-child { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-shell .dashboard-main, .app-shell .editor-main { padding: 16px; }
  /* Touch widths keep the 44px target and 16px inputs of docs/02-design.md; only PC is denser. */
  .app-shell .btn, .create-dialog .btn, .app-shell .btn.device, .app-shell .auth-logout, .app-shell .production-pagination .btn, .app-shell .member-row .btn { min-height: 44px; }
  .app-shell .btn.icon { width: 44px; min-width: 44px; min-height: 44px; }
  .app-shell .control input, .app-shell .control select, .app-shell .control textarea, .app-shell .add-field-row select, .create-dialog .control select, .app-shell .booking-slot-editor input:not([type=checkbox]) { min-height: 48px; }
  .app-shell .toggle { min-height: 44px; }
  .app-shell .production-list-controls .control { flex-basis: 100%; max-width: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .app-shell .list-filters { flex-basis: 100%; }
  .client-head { display: none; }
  .client-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 16px; padding: 12px 16px; }
  .client-row .client-name { grid-column: 1 / -1; }
  .app-shell .control .pick-search, .create-dialog .control .pick-search { min-height: 48px; }
  .client-cell { display: flex; flex-direction: column; gap: 4px; }
  .client-cell small { display: block; }
  .client-cell .chip { align-self: flex-start; }
  .app-shell .client-list-controls .control { flex-basis: 100%; }
  .app-shell .site-actions .btn, .app-shell .nested-form .btn, .app-shell .company-summary .btn, .app-shell .check-body .btn { min-height: 44px; }
  .site-actions { flex-basis: 100%; }
  .site-actions .btn { flex: 1 1 auto; }
  .nested-forms { margin: 0 8px 16px 16px; padding: 0 12px; }
  .nested-form { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 8px 0; }
  .nested-form .text-button { grid-column: 1 / -1; }
  .app-shell .nested-form .text-button { min-height: 44px; }
  .nested-form .chip { justify-self: start; }
  .site-block .inline-form { margin: 0 8px 16px; }
  .readiness-list li { flex-direction: column; gap: 8px; }
  .dialog-place { grid-template-columns: minmax(0, 1fr); }
  .token-head { display: none; }
  .token-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; padding: 12px 16px; }
  .token-row .token-name, .token-row .token-action { grid-column: 1 / -1; }
  .token-cell { display: flex; flex-direction: column; gap: 4px; }
  .token-cell small { display: block; }
  .token-row .token-action { justify-self: stretch; }
  .app-shell .token-row .btn { width: 100%; min-height: 44px; }
  .member-head { display: none; }
  .member-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 16px; }
  .member-row strong { grid-column: 1; }
  .member-row small { grid-column: 1; grid-row: 2; }
  .member-row .member-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .member-row .member-action { grid-column: 2; grid-row: 2; }
  .variable-list { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .variable-list dd { margin: 0 0 8px; }
  .create-dialog { padding: 16px; }
  .login-screen .login-card h1 { font-size: 18px; }
  .login-screen .login-card p { font-size: 12px; }
  .login-screen .login-card .btn { font-size: 12px; }
  .login-screen .login-card .login-or { font-size: 10px; }
}

/* Unslop 2026-11-08: quiet chrome. Weights 400/500/600 only, no tracking outside big headings, small shadows. */
.app-shell h1, .app-shell h2, .app-shell h3, .create-dialog h2, .login-screen h1 { font-weight: 600; letter-spacing: 0; }
.app-shell .brand { font-weight: 600; letter-spacing: 0; }
.app-shell .btn.nav.active, .app-shell .btn.nav.active:hover { font-weight: 500; }
.app-shell .text-button, .app-shell .btn.tab.selected, .app-shell .btn.site-nav.selected { font-weight: 500; }
.create-dialog { box-shadow: 0 8px 24px var(--shadow-color); }
.login-card { box-shadow: 0 4px 16px var(--shadow-color); }
.app-shell .chip, .create-dialog .chip { border-radius: 4px; }
/* Signature: the dot moved from behind the logo to forms that are live. Static, always next to its text. */
.chip.live { display: inline-flex; align-items: center; gap: 8px; }
.chip.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.app-shell .heading-meta { color: var(--text-muted); font-size: var(--type-caption); margin: 0; }
.create-dialog .template-icon { display: grid; place-items: center; color: var(--accent); }
.create-dialog .template-svg { display: block; }
.create-dialog .template-card:hover { transform: none; }
.app-shell .local-pill i { display: none; }
.app-shell .receipt-empty { border-style: solid; }
