/* Application controls share the branding site's palette and typography.
   This stylesheet is intentionally not loaded by the wall display. */
.app-ui {
  color-scheme: light;
  --bg: #f5f3ed;
  --panel: #fcfbf7;
  --line: #d9ddd1;
  --text: #243d37;
  --muted: #626a60;
  --accent: #b95132;
  --accent-hover: #963e25;
  --soft: #e9ecdf;
  --serif: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.app-ui ::selection { background: #dfc5ab; color: var(--text); }
.app-ui :is(h1, h2) { font-family: var(--serif); font-weight: 400; letter-spacing: -.045em; line-height: 1.15; }
.app-ui h3 { font-weight: 600; letter-spacing: -.025em; }
.app-ui a { text-underline-offset: 3px; }
.app-ui a:hover { color: var(--accent-hover); }
.app-ui :is(button, .button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;
  padding: .65rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: .84rem;
  font-weight: 600;
  line-height: 1.4;
  transition: background-color .15s, border-color .15s;
}
.app-ui :is(button, .button):hover { background: var(--accent-hover); color: #fff; }
.app-ui :is(button, .button).ghost { background: transparent; border-color: var(--line); color: var(--text); }
.app-ui :is(button, .button).ghost:hover { background: var(--soft); border-color: #b2beaa; }
.app-ui :is(button, .button).danger { background: #a03e35; color: #fff; }
.app-ui :is(button, .button).danger:hover { background: #802d26; }
.app-ui :is(button, input, select, textarea):disabled { opacity: .6; cursor: not-allowed; }
.app-ui :is(a, button, input, select, textarea):focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.app-ui :is(input, select, textarea) {
  min-height: 44px;
  border-radius: 4px;
  background: #fffefa;
  border-color: var(--line);
  color: var(--text);
  font-size: .95rem;
  max-width: 100%;
  accent-color: var(--accent);
}
.app-ui :is(input, textarea)::placeholder { color: #73796e; opacity: 1; }
.app-ui :is(input[type=checkbox], input[type=radio]) { width: auto; min-height: auto; }
.app-ui input[type=file] { overflow: hidden; }
.app-ui input[type=file]::file-selector-button { border: 0; padding: .45rem .6rem; margin-right: .65rem; background: var(--soft); color: var(--text); border-radius: 3px; cursor: pointer; }
.app-ui label { font-size: .8rem; font-weight: 550; color: var(--text); }
.app-ui .eyebrow { font-size: .65rem; letter-spacing: .16em; font-weight: 650; color: var(--accent); }
.app-ui .brand { display: flex; align-items: center; gap: .6rem; color: var(--text); letter-spacing: -.045em; font-size: 1.35rem; font-weight: 600; flex-shrink: 0; }
.app-ui .brand::before { content: '✳'; color: var(--accent); font-size: 1.65rem; line-height: 1; }
.app-ui .topbar { min-height: 88px; height: auto; gap: 1.5rem; padding: 1rem clamp(1.25rem, 3vw, 3rem); background: var(--bg); }
.app-ui .top-actions { gap: .65rem; flex-wrap: wrap; justify-content: flex-end; font-size: .8rem; }
.app-ui .top-actions > span { overflow-wrap: anywhere; }
.app-ui .top-actions .button, .app-ui .top-actions button { font-size: .76rem; min-height: 40px; padding: .6rem .85rem; }
/* Free-tier upgrade call to action: accent-filled (the actions beside it are ghosts) with an
   accent-derived halo, so it keeps reading as the primary action if the palette changes. */
.app-ui .top-actions .upgrade-now { white-space: nowrap; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.app-ui .top-actions .upgrade-now:hover { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent); }
.app-ui .editor-shell { grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 88px); max-width: 1600px; margin-inline: auto; }
.app-ui .panel { padding: 2.25rem 1.5rem; background: #eeeee5; }
.app-ui .panel > .eyebrow:first-child { margin-top: 0; margin-bottom: 1.5rem; }
.app-ui .panel hr { margin-block: 1.8rem; }
.app-ui .component-picker button { justify-content: flex-start; font-size: .78rem; padding: .65rem .7rem; background: #f8f8f0; }
/* Full Screen capable blocks carry the Displazio mark, sized to ~14% of the tile's width so it reads
   as a badge rather than artwork; it sits at the trailing edge, away from the label. */
.app-ui .component-picker button { display: flex; align-items: center; gap: .4rem; }
.app-ui .component-picker .picker-label { min-width: 0; }
.app-ui .component-picker .full-screen-mark { width: 17%; height: auto; max-height: 2em; margin-left: auto; flex: none; }
.app-ui .component-picker button:disabled .full-screen-mark { opacity: .45; }
/* Wallpaper and Wallpaper+ are the display background rather than a positioned module: their
   entries open the Wallpaper tab, so they read as a quieter, dashed variant of the tile. */
.app-ui .component-picker .background-module { border-style: dashed; background: transparent; }
.app-ui .panel > #save { margin-top: 2rem; min-height: 48px; }
.app-ui #status { font-size: .8rem; min-height: 1.7em; }
.app-ui .editor-shell > section { min-width: 0; padding: clamp(1.5rem, 4vw, 4rem); }
.app-ui .editor-shell h1 { font-size: clamp(2.7rem, 5vw, 4.5rem); margin: .35rem 0 1rem; }
.app-ui .editor-shell > section > .muted { max-width: 580px; font-size: .88rem; }
.app-ui .module-workspace { margin-top: 2.2rem; }
.app-ui .module-tabs { gap: .35rem; padding-bottom: .6rem; border-bottom: 0; }
.app-ui .module-tab { border: 1px solid var(--line); border-radius: 4px; background: #eeeee5; color: var(--muted); min-height: 44px; padding: .65rem 1rem; }
.app-ui .module-tab:hover { background: var(--soft); color: var(--text); }
.app-ui .module-tab.active { background: var(--text); border-color: var(--text); color: #f5f3ed; box-shadow: none; }
.app-ui .module-tab.active .tab-grip { color: #d9e0d0; }
.app-ui .module-panel { border: 1px solid var(--line); border-radius: 5px; padding: clamp(1.25rem, 3vw, 2.5rem); background: var(--panel); box-shadow: 0 12px 30px -25px #243d3730; }
.app-ui .module-panel-head { gap: 1rem; margin-bottom: 1.8rem; }
.app-ui .module-panel-head h2 { font-size: 2rem; }
.app-ui .module-panel-head .remove { color: #963e25; }
.app-ui .module-panel-head .remove:hover { background: #f5e7dc; }
.app-ui .module-fields { max-width: 760px; }
.app-ui .optional { color: var(--muted); font-size: .6rem; }
.app-ui .wallpaper-picker { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); }
/* Images and solid colours are separate sets; this picks which set the picker below shows. It
   reuses the module-tab treatment so the editor has one visual language for "choose a view". */
.app-ui .wallpaper-groups { display: flex; gap: .35rem; margin-bottom: 1.1rem; }
.app-ui .wallpaper-group { border: 1px solid var(--line); border-radius: 4px; background: #eeeee5; color: var(--muted); min-height: 44px; padding: .65rem 1.1rem; font: inherit; cursor: pointer; }
.app-ui .wallpaper-group:hover:not(:disabled) { background: var(--soft); color: var(--text); }
.app-ui .wallpaper-group.active { background: var(--text); border-color: var(--text); color: #f5f3ed; }
.app-ui .wallpaper-group:disabled { opacity: .45; cursor: not-allowed; }
.app-ui .wallpaper-group:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.app-ui .wallpaper-preview { border-radius: 4px; }
.app-ui .wallpaper-option input:checked + .wallpaper-preview { box-shadow: 0 0 0 2px #b9513225; }
.app-ui .wallpaper-option input:focus-visible + .wallpaper-preview { outline: 3px solid var(--accent); outline-offset: 4px; }
.app-ui .no-wallpaper .wallpaper-preview { background: #e9ecdf; }
/* A pale solid colour would otherwise bleed into the panel, so outline the colour swatches. */
.app-ui .wallpaper-color .wallpaper-preview { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent); }
.app-ui .wallpaper-name { font-size: .8rem; }
.app-ui .calendar-settings > .button { margin-top: .5rem; }
.app-ui .calendar-settings > .muted { font-size: .8rem; }
.app-ui .calendar-choice { min-height: 44px; }
.app-ui .auth-shell { background: radial-gradient(ellipse at 85% 15%, #e2e8d8, transparent 50%), var(--bg); }
.app-ui .auth-card { width: min(460px, 100%); background: var(--panel); padding: clamp(1.5rem, 5vw, 3rem); border-radius: 5px; box-shadow: 0 20px 55px -40px #243d3755; }
.app-ui .auth-card .brand { margin-bottom: 2.3rem; }
.app-ui .auth-card h1 { font-size: 2.8rem; }
.app-ui .auth-card > .muted { font-size: .9rem; }
.app-ui .google-sign-in { display: flex; width: 100%; background: #fffefa; }
.app-ui .auth-divider, .app-ui .switch { font-size: .8rem; }
.app-ui .alert { border: 1px solid #dbb8ab; background: #f6e7df; color: #813d29; border-radius: 4px; font-size: .88rem; }
.app-ui .alert.success { background: #e6edde; border-color: #bcccae; color: #354c2b; }
/* QR display sign-in (kiosk page + the phone that approves it) */
.app-ui .display-login, .app-ui .display-pair { width: min(520px, 100%); text-align: center; }
.app-ui .display-login { padding-block: clamp(1.2rem, 3vh, 2rem); }
.app-ui .display-login .brand, .app-ui .display-pair .brand { justify-content: center; margin-bottom: 1.4rem; }
.app-ui .display-login .brand { margin-bottom: .9rem; }
.app-ui .display-login h1, .app-ui .display-pair h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
.app-ui .qr-frame { display: flex; justify-content: center; margin: 1.2rem auto .8rem; padding: .8rem; width: fit-content; background: #fffefa; border: 1px solid var(--line); border-radius: 6px; }
.app-ui .qr-frame svg { display: block; width: min(230px, 42vh); height: auto; }
.app-ui .pair-code { font-family: var(--mono, ui-monospace, monospace); font-size: 1.7rem; font-weight: 600; letter-spacing: .18em; margin: 0; color: var(--text); }
.app-ui .pair-url { font-size: .78rem; word-break: break-word; margin-top: .5rem; }
.app-ui .pair-status { font-size: .85rem; margin-top: 1.2rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
/* Kiosks are often 720p: keep the whole card on screen without scrolling. */
@media (max-height: 820px) {
  .display-login-page .auth-shell { padding-block: 1rem; }
  .display-login-page .display-login { padding-block: 1rem; }
  .display-login-page .display-login h1 { font-size: 2rem; }
  .display-login-page .qr-frame { margin-top: .9rem; }
  .display-login-page .qr-frame svg { width: min(200px, 34vh); }
  .display-login-page .pair-status { margin-top: .9rem; padding-top: .9rem; }
}
.app-ui .display-pair { text-align: left; }
.app-ui .display-pair .brand { justify-content: flex-start; }
.app-ui .dashboard-choice { border: 1px solid var(--line); border-radius: 5px; padding: 1rem; margin: 0; }
.app-ui .dashboard-choice legend { padding-inline: .4rem; font-size: .8rem; font-weight: 550; }
.app-ui .dashboard-choice .choice { display: flex; align-items: center; gap: .7rem; min-height: 2.9rem; font-size: 1rem; font-weight: 450; }
.app-ui .dashboard-choice .choice + .choice { border-top: 1px solid var(--line); }
.app-ui .display-pair .button { display: inline-block; margin-top: 1.6rem; }
.app-ui .display-pair form.stack button[type=submit] { margin-top: 1.1rem; }
.app-ui .admin-shell, .app-ui .account-shell { margin-block: 3rem; }
.app-ui .admin-shell > h1, .app-ui .account-shell > h1 { font-size: clamp(2.6rem, 5vw, 4rem); }
.app-ui .admin-form-card, .app-ui .category-card, .app-ui .admin-links a { background: var(--panel); border-radius: 5px; padding: 1.7rem; }
.app-ui .admin-links a { font-size: 1.1rem; font-weight: 550; }
.app-ui .admin-links a:hover { background: #e9ecdf; border-color: #b6c4a5; color: var(--text); }
.app-ui .admin-form-card h2, .app-ui .category-card h2 { font-size: 1.85rem; }
.app-ui .admin-form-card .muted { font-size: .85rem; }
.app-ui .service-summary { overflow-wrap: anywhere; }
.app-ui .role-badge { background: var(--soft); color: #354c2b; }
.app-ui .module-status { background: #e1ead9; color: #36532d; }
.app-ui .module-status.disabled { background: #f0dfd6; color: #85402c; }
.app-ui .module-disabled { opacity: .8; }
.app-ui .table-wrap { border-radius: 5px; }
.app-ui th { background: #e9ecdf; color: #52604b; font-size: .65rem; }
.app-ui td { font-size: .85rem; }
.app-ui tbody tr:last-child td { border-bottom: 0; }
.app-ui .account-shell code, .app-ui .admin-shell code { overflow-wrap: anywhere; }
@media (max-width: 1050px) {
  .app-ui .topbar { flex-wrap: wrap; gap: .85rem; }
  .app-ui .top-actions { justify-content: flex-start; }
  .app-ui .editor-shell { grid-template-columns: 245px minmax(0, 1fr); }
  .app-ui .panel { padding-inline: 1.25rem; }
  .app-ui .service-list article { flex-wrap: wrap; }
  .app-ui .module-actions { width: 100%; }
}
@media (max-width: 750px) {
  .app-ui .editor-shell { grid-template-columns: minmax(0, 1fr); }
  .app-ui .panel { padding: 1.5rem; }
  .app-ui .component-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .app-ui .top-actions { gap: .5rem; }
  .app-ui .editor-shell > section { padding: 1.5rem; }
  .app-ui .editor-shell h1 { font-size: 3rem; }
  .app-ui .admin-shell, .app-ui .account-shell { width: calc(100% - 2.5rem); margin-block: 2rem; }
  .app-ui .field-heading { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .app-ui .topbar { padding: 1rem; }
  .app-ui .brand { font-size: 1.2rem; }
  .app-ui .top-actions .button, .app-ui .top-actions button { font-size: .72rem; padding-inline: .65rem; }
  .app-ui .component-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-ui .editor-shell > section, .app-ui .panel { padding: 1.25rem; }
  .app-ui .editor-shell h1 { font-size: 2.65rem; }
  .app-ui .module-panel-head { flex-wrap: wrap; }
  .app-ui .auth-shell { padding: 1rem; }
  .app-ui .auth-card h1 { font-size: 2.4rem; }
  .app-ui .admin-form-card, .app-ui .category-card { padding: 1.15rem; }
  .app-ui .admin-links { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .app-ui *, .app-ui *::before, .app-ui *::after { transition: none !important; }
}

.app-ui dialog { width: min(440px, calc(100% - 2rem)); border: 1px solid var(--line); border-radius: 5px; background: var(--panel); color: var(--text); padding: 1.5rem; }
.app-ui dialog::backdrop { background: #243d3770; }
.app-ui dialog h2 { font-size: 2rem; }
.app-ui #display-url { font-size: .75rem; }
.app-ui #new-dashboard-error { color: #963e25; }

.app-ui .layout-selector { border: 0; margin: 1.5rem 0 0; padding: 0; min-width: 0; }
.app-ui .layout-selector legend { padding: 0; margin-bottom: .65rem; font-size: .8rem; font-weight: 550; }
.app-ui .layout-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); gap: 1rem; }
.app-ui .layout-option { position: relative; display: block; margin: 0; cursor: pointer; }
.app-ui .layout-option > input { position: absolute; left: 1rem; top: 1.15rem; margin: 0; width: 1rem; height: 1rem; z-index: 1; }
.app-ui .layout-card { display: flex; flex-direction: column; gap: .85rem; height: 100%; padding: 1rem; border: 2px solid var(--line); border-radius: 5px; background: #fffefa; }
.app-ui .layout-name { padding-left: 1.6rem; line-height: 1.3; font-weight: 650; font-size: .9rem; }
.app-ui .layout-diagram { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 1px solid #829384; border-radius: 3px; }
.app-ui .layout-background { fill: #f5f3ed; }
.app-ui .layout-regions { fill: #dce5d5; }
.app-ui .layout-lines { fill: none; stroke: #829384; stroke-width: 1; }
.app-ui .layout-diagram text { text-anchor: middle; dominant-baseline: middle; fill: #243d37; font-family: inherit; font-size: 14px; }
.app-ui .layout-proportions { color: var(--muted); font-size: .72rem; font-weight: 400; }
.app-ui .layout-option:hover .layout-card { border-color: #829384; }
.app-ui .layout-option > input:checked + .layout-card { border-color: var(--accent); background: #faf0e8; }
.app-ui .layout-option > input:focus-visible + .layout-card { outline: 3px solid var(--accent); outline-offset: 3px; }

.app-ui .module-compatibility { display: inline-block; margin-top: .5rem; color: var(--muted); font-size: .75rem; }
.app-ui .layout-error { color: #963e25; }
.app-ui .add-component[hidden] { display: none; }

.app-ui [hidden] { display: none !important; }

.app-ui .display-config-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.app-ui .display-config-heading h1 { min-width: 0; overflow-wrap: anywhere; font-size: clamp(2rem, 4vw, 4rem); }
.app-ui #selected-layout-preview { flex: 0 0 200px; margin: 0; }
.app-ui #selected-layout-preview figcaption { font-size: .7rem; margin-top: .35rem; color: var(--muted); }
.app-ui #selected-layout-preview button { font-size: .7rem; min-height: 32px; margin-top: .4rem; padding: .3rem .6rem; }
.app-ui .layout-preview-slot { fill: #e9ecdf; stroke: #829384; stroke-width: 1; }
.app-ui .layout-preview-slot.occupied { fill: #bcccae; }
.app-ui .layout-preview-slot.selected { fill: #e6b5a4; stroke: #b95132; stroke-width: 3; }
.app-ui #placement-help { font-size: .75rem; }
@media (max-width: 600px) {
  .app-ui .display-config-heading { gap: .8rem; }
  .app-ui .display-config-heading h1 { font-size: 1.8rem; }
  .app-ui #selected-layout-preview { flex-basis: 120px; }
}

.app-ui .wallpaper-rotation-controls { margin-bottom: 1.5rem; max-width: 520px; }
.app-ui .rotation-toggle { display: flex; align-items: center; gap: .6rem; }
.app-ui .rotation-toggle input { margin: 0; }

/* Runtime release information, kept secondary to configuration controls. */
.app-ui .app-version { color: var(--muted); font-size: .72rem; font-weight: 400; letter-spacing: normal; overflow-wrap: anywhere; }
.app-ui .topbar .brand { flex-wrap: wrap; flex-shrink: 1; min-width: 0; }
.app-ui .editor-shell > .panel { display: flex; flex-direction: column; }
.app-ui .editor-shell > .panel > hr { width: 100%; }
.app-ui .sidebar-version { display: block; margin-top: auto; padding-top: 1.5rem; }

.app-ui .subscription-form { display: flex; flex-direction: column; align-items: flex-start; gap: .5rem; }
.app-ui .subscription-form select { display: block; width: 8rem; max-width: 100%; }

.app-ui .user-search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1.5rem; }
.app-ui .user-search label { flex: 1 1 240px; max-width: 28rem; margin: 0; }

/* Wallpaper+ (paid) section in the Wallpaper tab. */
.wallpaper-plus { display:grid; gap:.75rem; padding:1rem; margin-bottom:1.25rem; border:1px solid var(--line); border-radius:8px; }
.wallpaper-plus h3 { margin:0; display:flex; align-items:center; gap:.5rem; }
.wallpaper-plus-status:empty { display:none; }
.wallpaper-plus-status.error { color:#b3261e; }
.wallpaper-plus-upload { justify-self:start; cursor:pointer; }
.wallpaper-plus-upload.disabled { opacity:.5; cursor:not-allowed; }
.wallpaper-plus-image { display:grid; gap:.35rem; }
.wallpaper-plus-image > label { display:grid; gap:.35rem; cursor:pointer; }
.wallpaper-plus-image .wallpaper-preview { display:grid; place-items:center; font-size:.75rem; color:var(--muted); }
.wallpaper-plus-actions { display:flex; gap:.35rem; flex-wrap:wrap; }
.wallpaper-plus-actions button { padding:.25rem .5rem; font-size:.75rem; }
.app-ui .wallpaper-free-heading { margin: 0 0 .75rem; font-size: 1rem; }

/* Billing */
.app-ui .billing-card { margin-top: 1.5rem; display: grid; gap: .75rem; }
.app-ui .billing-card form { margin: 0; }
.app-ui .billing-plans { display: flex; gap: .75rem; flex-wrap: wrap; }
.app-ui .billing-checkout #checkout { margin-top: 1rem; min-height: 420px; }
.app-ui .billing-cell { font-size: .85rem; white-space: nowrap; }
