:root {
  --blue-950: #063653;
  --blue-900: #084262;
  --blue-700: #0f78ae;
  --blue-500: #1998d5;
  --ink: #172131;
  --muted: #66738a;
  --line: #d2dce8;
  --soft: #f3f7fb;
  --white: #ffffff;
  --brand: #1998d5;
  --brand-dark: #0f78ae;
  --brand-navy: #084262;
  --brand-soft: #e8f6ff;
  --danger: #cf2e43;
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: var(--soft);
  color: var(--ink);
  font-family: Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  overflow: hidden;
}

.app-shell.is-logged-out {
  display: block;
  height: auto;
  overflow: visible;
}

.sidebar {
  height: 100vh;
  min-height: 0;
  overflow: auto;
  padding: 28px 14px;
  background: var(--blue-950);
  color: var(--white);
}

.brand {
  margin-bottom: 30px;
  font-size: 28px;
  letter-spacing: 3px;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.nav-group-label {
  border: 0;
  border-radius: 6px;
  padding: 13px 14px;
  background: transparent;
  color: #d8ebf7;
  text-align: left;
  cursor: pointer;
}

.nav-group-label {
  color: #ffffff;
  cursor: default;
  font-weight: 800;
  opacity: .95;
}

.nav-group-label:disabled {
  color: #ffffff;
}

.nav-item.is-active {
  background: #10567a;
  color: var(--white);
  font-weight: 700;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-subgroup {
  display: grid;
  gap: 4px;
  margin-left: 10px;
}

.nav-subgroup-label {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 14px;
}

.nav-subitem {
  margin-left: 18px;
  padding-top: 9px;
  padding-bottom: 9px;
  color: #c7e3f2;
  font-size: 14px;
}

.main {
  height: 100vh;
  min-width: 0;
  overflow: auto;
  padding: 22px 28px;
}

.is-logged-out .main {
  height: auto;
  min-height: 100vh;
  overflow: visible;
  padding: 0;
}

.topbar {
  min-height: 68px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
}

.topbar strong,
.topbar span {
  display: block;
}

.topbar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-icon-button,
.login-card button {
  border: 0;
  border-radius: 6px;
  padding: 12px 18px;
  background: var(--blue-500);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.user-icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #b9d8ef;
  border-radius: 50%;
  background: var(--white);
  color: var(--blue-700);
}

.user-icon-button span {
  display: block;
  width: 16px;
  height: 16px;
  margin: 0 auto;
  border: 2px solid currentColor;
  border-radius: 50% 50% 45% 45%;
  position: relative;
}

.user-icon-button span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -14px;
  width: 22px;
  height: 14px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  transform: translateX(-50%);
}

.user-dropdown {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 22px 50px rgba(23, 33, 49, .12);
}

.user-dropdown button {
  width: 100%;
  border: 0;
  border-radius: 4px;
  padding: 10px 12px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

.user-dropdown button:hover {
  background: #eef6fb;
}

.login-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 22px 50px rgba(23, 33, 49, .08);
}

.login-card h1 {
  margin: 0 0 22px;
}

.login-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
}

.error-text {
  min-height: 20px;
  margin: 12px 0 0;
  color: #cf2e43;
  font-weight: 700;
}

.password-dialog {
  width: min(440px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(23, 33, 49, .2);
}

.password-dialog::backdrop {
  background: rgba(8, 18, 30, .35);
}

.password-dialog form {
  padding: 24px;
}

.password-dialog h2 {
  margin: 0 0 18px;
}

.password-dialog label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.password-dialog input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--ink);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.dialog-actions button {
  border: 0;
  border-radius: 6px;
  padding: 11px 15px;
  background: var(--blue-500);
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
}

.dialog-actions .secondary-button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}

.admin-panel {
  padding-top: 26px;
}

.page-heading p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.page-heading h1 {
  margin: 0 0 22px;
  font-size: 36px;
}

.stat-grid,
.data-grid {
  display: grid;
  gap: 16px;
}

.stat-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.stat-card {
  padding: 18px;
}

.stat-card strong {
  display: block;
  font-size: 34px;
}

.stat-card span {
  color: var(--muted);
  font-weight: 700;
}

.panel {
  margin-top: 18px;
  overflow: hidden;
}

.panel-like {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 22px 50px rgba(23, 33, 49, .04);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-header h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.panel h2 {
  margin: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 20px;
}

.app-manager-form {
  display: grid;
  gap: 14px;
  max-width: 520px;
  padding: 18px;
}

.app-manager-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.app-manager-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.app-manager-form button {
  justify-self: start;
}

.muted-text,
.form-message {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.form-message {
  font-weight: 800;
  color: #0a7a45;
}

.form-message.is-error {
  color: #c23143;
}

.empty-module {
  padding: 18px;
  color: var(--muted);
}

.empty-module strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.empty-module p {
  margin: 0;
}

.screen-overview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.filter-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segmented {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.segmented button {
  border: 0;
  border-radius: 6px;
  padding: 9px 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.segmented button.active {
  background: #17202a;
  color: #fff;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 320px;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
}

.screen-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 360px));
  gap: 10px;
  align-items: start;
  justify-content: start;
}

.screen-card {
  box-sizing: border-box;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 22px 50px rgba(23, 33, 49, .06);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.screen-card:hover {
  border-color: rgba(14, 149, 217, .45);
}

.screen-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
  border-radius: 7px;
  background: linear-gradient(135deg, #142634, #0e95d9 56%, #efb84a);
  color: #fff;
  overflow: hidden;
}

.screen-thumb-preview {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 7px;
}

.screen-thumb.is-portrait {
  aspect-ratio: 16 / 9;
  background: #e6edf4;
}

.screen-thumb.is-portrait .screen-thumb-preview {
  height: 100%;
  width: auto;
  aspect-ratio: var(--screen-ratio, .5625);
  background: linear-gradient(135deg, #142634, #0e95d9 56%, #efb84a);
}

.screen-thumb strong {
  font-size: 23px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.screen-card h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.screen-card p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.screen-card .screen-owner {
  margin-top: 5px;
  font-size: 14px;
  font-weight: 700;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  gap: 18px;
}

.preview-panel,
.playlist-panel {
  min-width: 0;
  padding: 18px;
}

.live-preview {
  position: relative;
  display: grid;
  place-items: center;
  margin-top: 18px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  overflow: hidden;
}

.live-preview.is-playing .screen-play-button {
  opacity: 0;
  pointer-events: none;
}

.preview-clock {
  position: absolute;
  top: 38px;
  right: 46px;
  color: rgba(255,255,255,.82);
  font-size: 30px;
  font-weight: 850;
}

.preview-title {
  position: absolute;
  left: 50px;
  top: 34%;
  max-width: 70%;
  font-size: clamp(36px, 6vw, 72px);
  font-weight: 900;
  line-height: 1.12;
}

.preview-subtitle {
  position: absolute;
  left: 50px;
  top: 64%;
  color: rgba(255,255,255,.86);
  font-size: clamp(20px, 3vw, 34px);
}

.screen-playback-frame,
.slide-row-thumb-frame,
.editor-preview-frame {
  position: absolute;
  left: 0;
  top: 0;
  border: 0;
  background: #050b14;
  transform-origin: top left;
  pointer-events: none;
}

.screen-play-button,
.screen-stop-button {
  position: absolute;
  z-index: 5;
  right: 28px;
  bottom: 28px;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--blue-500);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
}

.screen-stop-button {
  opacity: 0;
  pointer-events: none;
}

.live-preview.is-playing:hover .screen-stop-button {
  opacity: 1;
  pointer-events: auto;
}

.screen-playback-slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  animation: playbackSlideFadeIn 650ms cubic-bezier(.22, 1, .36, 1) both;
  will-change: opacity, transform;
}

.live-preview[data-transition="none"] .screen-playback-slide {
  animation: none;
}

.live-preview[data-transition="slide-left-right"] .screen-playback-slide.is-entering {
  animation-name: playbackWholeSlideInLeft;
}

.live-preview[data-transition="slide-left-right"] .screen-playback-slide.is-exiting {
  animation-name: playbackWholeSlideOutRight;
}

.live-preview[data-transition="slide-right-left"] .screen-playback-slide.is-entering {
  animation-name: playbackWholeSlideInRight;
}

.live-preview[data-transition="slide-right-left"] .screen-playback-slide.is-exiting {
  animation-name: playbackWholeSlideOutLeft;
}

.live-preview[data-transition="slide-top-bottom"] .screen-playback-slide.is-entering {
  animation-name: playbackWholeSlideInTop;
}

.live-preview[data-transition="slide-top-bottom"] .screen-playback-slide.is-exiting {
  animation-name: playbackWholeSlideOutBottom;
}

.live-preview[data-transition="slide-bottom-top"] .screen-playback-slide.is-entering {
  animation-name: playbackWholeSlideInBottom;
}

.live-preview[data-transition="slide-bottom-top"] .screen-playback-slide.is-exiting {
  animation-name: playbackWholeSlideOutTop;
}

.live-preview[data-transition="zoom"] .screen-playback-slide.is-entering {
  animation-name: playbackWholeZoomIn;
}

.live-preview[data-transition="zoom"] .screen-playback-slide.is-exiting {
  animation-name: playbackWholeZoomOut;
}

.screen-playback-slide.is-exiting {
  animation-name: playbackSlideFadeOut;
}

.screen-playback-progress {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  background: rgba(255,255,255,.24);
  overflow: hidden;
}

.screen-playback-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue-500);
}

.screen-playback-progress.is-playing span {
  animation: screenPlaybackProgress var(--screen-playback-duration, 10s) linear forwards;
}

@keyframes screenPlaybackProgress {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes playbackSlideFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes playbackSlideFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes playbackWholeSlideInLeft {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes playbackWholeSlideOutRight {
  from { transform: translateX(0); }
  to { transform: translateX(100%); }
}

@keyframes playbackWholeSlideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes playbackWholeSlideOutLeft {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

@keyframes playbackWholeSlideInTop {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes playbackWholeSlideOutBottom {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

@keyframes playbackWholeSlideInBottom {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes playbackWholeSlideOutTop {
  from { transform: translateY(0); }
  to { transform: translateY(-100%); }
}

@keyframes playbackWholeZoomIn {
  from { opacity: 0; transform: scale(.88); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes playbackWholeZoomOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(1.12); }
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.metric-row div {
  display: grid;
  gap: 4px;
}

.metric-row span {
  font-weight: 850;
}

.metric-row small {
  color: var(--muted);
}

.detail-tabs {
  display: inline-flex;
  width: 100%;
  padding: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.detail-tabs button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.detail-tabs button.active {
  background: var(--brand-navy);
  color: #fff;
}

.detail-tab-panel {
  display: none;
}

.detail-tab-panel.active {
  display: block;
}

.slide-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.slide-row {
  display: grid;
  grid-template-columns: 28px 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.slide-row.is-playing {
  border-color: var(--blue-500);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(25, 152, 213, .12);
}

.slide-row.is-playing h3::after {
  content: "Playing";
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--blue-500);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.slide-row-move {
  width: 28px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: grab;
  font-weight: 850;
}

.slide-row-move:active {
  cursor: grabbing;
}

.slide-row-move:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.slide-row-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: #17202a;
  overflow: hidden;
}

.slide-row h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.slide-row p {
  margin: 0;
  color: var(--muted);
}

.slide-row-action,
.secondary-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  padding: 0 12px;
  cursor: pointer;
}

.primary-button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: var(--blue-500);
  color: #fff;
  font-weight: 800;
  padding: 0 16px;
  cursor: pointer;
}

.admin-editor-heading {
  margin-bottom: 16px;
}

.editor-shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 270px;
  gap: 16px;
  min-height: calc(100vh - 190px);
}

.editor-shell.is-locked-template {
  grid-template-columns: minmax(0, 1fr) 270px;
}

.editor-shell.is-locked-template .tool-panel {
  display: none;
}

.tool-panel,
.properties-panel {
  padding: 14px;
}

.properties-panel {
  margin-top: 58px;
  padding-top: 10px;
}

.panel-block + .panel-block {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel-block h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.tool-button {
  width: 100%;
  min-height: 40px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  padding: 0 12px;
  cursor: grab;
}

.canvas-area {
  min-width: 0;
}

.editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  margin-bottom: 14px;
  gap: 12px;
}

.slide-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.slide-meta input {
  width: min(36vw, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 750;
}

.slide-meta span {
  color: var(--muted);
}

.canvas-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 260px);
  border: 1px dashed #bdc7d2;
  border-radius: 8px;
  background:
    linear-gradient(45deg, #e7ecf1 25%, transparent 25%),
    linear-gradient(-45deg, #e7ecf1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e7ecf1 75%),
    linear-gradient(-45deg, transparent 75%, #e7ecf1 75%);
  background-color: #f9fafb;
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  overflow: auto;
  padding: 28px;
}

.slide-canvas {
  position: relative;
  width: min(100%, 960px);
  background: #111827;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(18, 28, 39, .24);
  overflow: hidden;
}

.editor-stage {
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
  transform-origin: top left;
}

.editor-hit-stage {
  background: transparent;
  pointer-events: auto;
}

.canvas-element {
  position: absolute;
  box-sizing: border-box;
  outline: 2px solid transparent;
  background: transparent;
  cursor: move;
  overflow: hidden;
  user-select: none;
}

.canvas-element.selected {
  outline-color: var(--brand);
}

.panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.panel-collapse {
  margin-top: 12px;
}

.properties-panel label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.properties-panel input,
.properties-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.elements-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.elements-header h2 {
  margin: 0;
}

.elements-header span,
.element-list-index {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 850;
}

.elements-header span {
  min-width: 28px;
  height: 28px;
  font-size: 13px;
}

.element-list {
  display: grid;
  gap: 8px;
}

.element-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.element-card.is-selected {
  border-color: var(--brand);
  background: #f8fcff;
}

.element-list-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 7px 9px;
}

.element-list-index {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.element-list-name {
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.element-settings {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.element-settings label {
  margin-bottom: 0;
}

.element-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.menu-board-detail-editor,
.menu-template-editor,
.menu-template-column,
.menu-template-items {
  display: grid;
  gap: 10px;
}

.menu-template-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.menu-board-accordion {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.menu-board-accordion summary {
  cursor: pointer;
  padding: 12px 14px;
  background: #fff;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  font-weight: 850;
  list-style-position: inside;
}

.menu-board-accordion:not([open]) summary {
  border-bottom: 0;
}

.menu-template-editor,
.menu-template-properties {
  padding: 14px;
}

.menu-template-properties {
  display: grid;
  gap: 12px;
}

.menu-template-position-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.menu-style-group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.menu-style-group legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 14px;
}

.menu-template-column {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.menu-template-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-template-column-header strong {
  margin-right: auto;
}

.menu-template-items {
  min-height: 22px;
  border-radius: 7px;
}

.menu-template-items.is-drop-empty {
  box-shadow: inset 0 0 0 2px rgba(14, 149, 217, .35);
}

.menu-template-column-header button,
.menu-template-row button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-weight: 750;
}

.menu-template-row {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 72px auto;
  gap: 6px;
  align-items: center;
}

.menu-template-row input {
  width: 100%;
  min-width: 0;
}

.menu-template-row button {
  white-space: nowrap;
}

.menu-template-row:has(input[data-menu-field="title"]) {
  grid-template-columns: 28px minmax(0, 1fr) auto;
}

.menu-template-row.is-dragging {
  opacity: .55;
}

.menu-template-drag-handle {
  display: grid;
  width: 28px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  cursor: grab;
  font-weight: 850;
  user-select: none;
}

.menu-template-drag-handle:active {
  cursor: grabbing;
}

.menu-template-drag-handle:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.menu-template-row.is-drop-before::before,
.menu-template-row.is-drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--brand);
}

.menu-template-row.is-drop-before::before {
  top: -5px;
}

.menu-template-row.is-drop-after::after {
  bottom: -5px;
}

.snack-menu-template-preview {
  position: absolute;
  inset: 10%;
  display: grid;
  gap: 8px;
  color: #e8f18a;
}

.snack-menu-template-preview strong {
  font-size: 18px;
  font-weight: 500;
}

.snack-menu-template-preview span {
  height: 5px;
  border-radius: 99px;
  background: rgba(255,255,255,.55);
}

.weather-template-preview {
  position: absolute;
  inset: 12%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: 8px;
  color: #fff;
}

.weather-template-preview strong {
  grid-column: 1 / -1;
  font-size: 20px;
  font-weight: 900;
}

.weather-template-preview small {
  font-size: 20px;
}

.weather-template-preview em {
  font-size: 28px;
  font-style: normal;
  text-align: right;
}

.context-menu {
  position: fixed;
  z-index: 30;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(17, 24, 39, .18);
}

.context-menu__section + .context-menu__section {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.context-menu button {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 750;
  text-align: left;
  padding: 0 10px;
}

.context-menu button:hover {
  background: var(--brand-soft);
}

.screen-settings-form {
  display: grid;
  gap: 14px;
}

.screen-settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.screen-settings-form input,
.screen-settings-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.orientation-field {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.orientation-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.orientation-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
}

.orientation-field input {
  width: auto;
  min-height: 0;
}

.screen-format-preview {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.screen-format-preview div {
  width: min(100%, 220px);
  aspect-ratio: var(--screen-preview-ratio, 16 / 9);
  border-radius: 6px;
  background: linear-gradient(135deg, #142634, #0e95d9 56%, #efb84a);
}

.screen-format-preview span {
  color: var(--muted);
  font-weight: 800;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.template-dialog {
  width: min(820px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 18px;
  color: var(--ink);
  box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
}

.template-dialog::backdrop {
  background: rgba(5, 43, 70, .45);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.dialog-header h2 {
  margin: 0;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.template-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.template-card:hover {
  border-color: var(--blue-500);
}

.template-preview {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  background: linear-gradient(135deg, #111827, #1998d5);
}

.template-preview.is-menu {
  background: linear-gradient(#eef6ff 0 22%, #202342 22%);
}

.template-card h3,
.template-card p {
  margin: 0;
}

.template-card p {
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: #e8f6ff;
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 800;
}

.status-pill.offline {
  background: #fde8ed;
  color: #cf2e43;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--muted);
}

.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.customer-card {
  display: grid;
  gap: 16px;
  width: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 22px 50px rgba(23, 33, 49, .06);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.customer-card:hover {
  border-color: rgba(14, 149, 217, .45);
}

.customer-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.customer-card p {
  margin: 0;
  color: var(--muted);
}

.customer-card dl,
.customer-summary dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.customer-card dl {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.customer-card dt,
.customer-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.customer-card dd,
.customer-summary dd {
  margin: 3px 0 0;
  font-weight: 800;
}

.customer-summary {
  display: grid;
  grid-template-columns: minmax(220px, 340px) minmax(0, 1fr);
  gap: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 22px 50px rgba(23, 33, 49, .06);
}

.customer-summary p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.customer-summary h2 {
  margin: 0;
  font-size: 30px;
}

.customer-summary dl {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.customer-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 18px 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.customer-tabs button {
  border: 0;
  border-radius: 6px;
  padding: 12px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.customer-tabs button.active {
  background: var(--blue-950);
  color: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 18px;
  border-bottom: 1px solid #e7edf4;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e8f6ff;
  color: var(--blue-700);
  font-weight: 800;
  font-size: 12px;
}

.slide-admin-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.slide-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.slide-admin-row strong,
.slide-admin-row span {
  display: block;
}

.slide-admin-row span {
  margin-top: 4px;
  color: var(--muted);
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .main {
    height: auto;
    overflow: visible;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .screen-overview-toolbar {
    display: grid;
  }

  .search-field {
    min-width: 0;
    width: 100%;
  }

  .customer-summary,
  .customer-summary dl,
  .customer-tabs {
    grid-template-columns: 1fr;
  }

  .customer-card dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
