:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9e0e7;
  --brand: #0e95d9;
  --brand-dark: #0877b2;
  --brand-navy: #073a5c;
  --brand-navy-deep: #052b46;
  --brand-soft: #e8f6fd;
  --accent: #efb84a;
  --danger: #bd3b42;
  --shadow: 0 14px 40px rgba(20, 32, 45, .10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body.is-authenticated .auth-page {
  display: none;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(14, 149, 217, .16), rgba(239, 184, 74, .11)),
    var(--bg);
}

.login-panel {
  position: relative;
  width: min(100%, 420px);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(17, 24, 39, .12);
}

.login-language-switcher {
  position: absolute;
  top: 14px;
  right: 16px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.login-language-switcher a {
  color: var(--muted);
  line-height: 1;
  text-decoration: none;
}

.login-language-switcher a.is-active {
  color: var(--brand);
}

.login-language-switcher a + a::before {
  content: "|";
  display: inline-block;
  margin: 0 5px;
  color: #a9b2c0;
}

.login-panel__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 16px 0 28px;
  text-align: center;
}

.login-panel__brand img {
  display: block;
  width: min(100%, 258px);
  height: auto;
}

.login-panel h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.login-panel p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
}

.oauth-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.oauth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.oauth-button:hover {
  border-color: var(--brand);
  background: #f8fbfa;
}

.oauth-button__icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 4px;
  background: #eef2f6;
  color: var(--brand);
  font-size: 13px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  font-size: 13px;
  font-weight: 750;
}

.login-form input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.login-form input:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(14, 149, 217, .14);
}

.login-submit {
  width: 100%;
  margin-top: 8px;
}

.alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #f1b9a7;
  border-radius: 6px;
  background: #fff1ed;
  color: #9f341c;
  font-size: 14px;
}

.auth-link {
  margin: 14px 0 0;
  font-size: 14px;
  text-align: center;
}

.auth-link a {
  color: var(--brand);
  font-weight: 750;
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--brand-navy-deep), var(--brand-navy));
  color: #f7fbfc;
  padding: 24px 16px;
}

.brand {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin-bottom: 28px;
}

.brand img {
  display: block;
  width: 164px;
  height: auto;
  filter: brightness(0) invert(1);
}

.nav {
  display: grid;
  gap: 6px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #c7dfef;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(14, 149, 217, .22);
  color: #fff;
}

.main {
  min-width: 0;
  padding: 28px;
}

.page-header,
.toolbar,
.panel-header,
.editor-bar,
.dialog-header,
.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  margin: -4px 0 24px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(20, 32, 45, .06);
}

.page-header {
  margin-bottom: 22px;
}

.topbar-brand-context {
  display: grid;
  gap: 2px;
}

.topbar-product {
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
}

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

.account-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-language-switcher {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c7dfef;
  font-size: 12px;
  font-weight: 850;
}

.sidebar-language-switcher a {
  color: #c7dfef;
  text-decoration: none;
}

.sidebar-language-switcher a.is-active {
  color: #fff;
}

.sidebar-language-switcher a + a::before {
  content: "|";
  display: inline-block;
  margin: 0 5px;
  color: rgba(255, 255, 255, .36);
}

.account-menu {
  position: relative;
}

.account-menu__trigger {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-navy);
}

.account-menu__trigger svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-menu__trigger:hover,
.account-menu__trigger[aria-expanded="true"] {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.account-menu__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(17, 24, 39, .18);
}

.account-menu__dropdown[hidden] {
  display: none;
}

.account-menu__item {
  width: 100%;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  padding: 0 10px;
  white-space: nowrap;
}

.account-menu__item:hover {
  background: var(--brand-soft);
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 31px;
}

h2 {
  font-size: 18px;
}

.primary-button,
.secondary-button,
.icon-button,
.tool-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
}

.primary-button {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  padding: 0 16px;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brand-dark);
}

.secondary-button {
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
}

.icon-button {
  width: 40px;
  background: #fff;
  color: var(--ink);
  font-size: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar {
  margin-bottom: 18px;
}

.toolbar .search-field {
  margin-left: auto;
}

.segmented {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 8px 13px;
}

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

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 290px;
  height: 42px;
  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-fit, minmax(320px, 1fr));
  gap: 18px;
}

.screen-card,
.preview-panel,
.playlist-panel,
.tool-panel,
.properties-panel,
.placeholder-view {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.screen-card {
  padding: 18px;
  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: center;
  justify-content: space-between;
  gap: 10px;
}

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

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

.status-pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 750;
}

.status-pill.offline {
  background: #fbe8ea;
  color: var(--danger);
}

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

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

.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;
}

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

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

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

.screen-settings-form {
  margin-top: 16px;
}

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

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

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

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

.module-price {
  color: var(--brand-dark);
  font-weight: 850;
}

.module-summary {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-soft);
  padding: 12px;
}

.module-summary span {
  color: var(--muted);
}

.live-preview {
  position: relative;
  display: grid;
  align-content: center;
  aspect-ratio: 16 / 9;
  margin: 18px 0;
  padding: 48px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  overflow: hidden;
}

.live-preview.is-playing {
  display: block;
  padding: 0;
}

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

.live-preview.is-app-preview .screen-play-button,
.live-preview.is-app-preview .screen-stop-button {
  display: none;
}

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

.preview-clock {
  position: absolute;
  top: 24px;
  right: 28px;
  color: #cbd5e1;
  font-size: 28px;
  font-weight: 750;
}

.preview-title {
  max-width: 720px;
  font-size: clamp(28px, 5vw, 68px);
  font-weight: 800;
}

.preview-subtitle {
  margin-top: 16px;
  color: #e6edf5;
  font-size: 24px;
}

.screen-play-button,
.screen-stop-button {
  position: absolute;
  right: 28px;
  bottom: 24px;
  z-index: 2;
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 26px;
  box-shadow: 0 16px 36px rgba(14, 149, 217, .35);
}

.screen-play-button:hover,
.screen-stop-button:hover {
  background: var(--brand-dark);
}

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

.screen-playback-element {
  position: absolute;
  border-radius: 6px;
  animation: playbackEnter 520ms ease both;
}

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

.live-preview[data-transition="slide-up"] .screen-playback-element {
  animation-name: playbackSlideUp;
}

.live-preview[data-transition="slide-left"] .screen-playback-element {
  animation-name: playbackSlideLeft;
}

.live-preview[data-transition="zoom"] .screen-playback-element {
  animation-name: playbackZoom;
}

.screen-playback-element.element-text {
  min-width: 120px;
  min-height: 44px;
}

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

.live-preview.is-playing .screen-playback-progress {
  opacity: 1;
}

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

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

.metric-row {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

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

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

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

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

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

.slide-row {
  text-align: left;
}

.slide-row.is-playing {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(14, 149, 217, .12);
}

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

.slide-row-action {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
  padding: 0 10px;
}

.slide-row-action:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

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

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

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

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

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

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

.panel-block h2 {
  margin-bottom: 12px;
}

.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-toggle span:last-child {
  color: var(--muted);
  transition: transform .16s ease;
}

.panel-toggle[aria-expanded="false"] span:last-child {
  transform: rotate(-90deg);
}

.panel-collapse[hidden] {
  display: none;
}

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

.tool-button {
  width: 100%;
  margin-bottom: 8px;
  background: #fff;
  text-align: left;
  padding: 0 12px;
  cursor: grab;
}

.tool-button:active {
  cursor: grabbing;
}

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

.editor-bar {
  height: 58px;
  margin-bottom: 14px;
}

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

.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);
}

.editor-actions {
  display: flex;
  gap: 10px;
}

.canvas-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 188px);
  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);
  aspect-ratio: 16 / 9;
  background: #111827;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(18, 28, 39, .24);
  overflow: hidden;
}

.slide-canvas.is-drop-target {
  outline: 3px solid rgba(14, 149, 217, .45);
  outline-offset: 6px;
}

.canvas-element {
  position: absolute;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.canvas-element.selected {
  border-color: var(--accent);
  outline: 2px solid rgba(239, 184, 74, .25);
}

.element-text {
  min-width: 120px;
  min-height: 44px;
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  padding: 4px 8px;
}

.element-image,
.element-video,
.element-shape,
.element-qr,
.element-product-card,
.element-price-card,
.element-weather,
.element-agenda,
.element-embed,
.element-table,
.element-rss,
.element-data-field {
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 750;
  padding: 8px;
  white-space: pre-line;
}

.element-image {
  background: linear-gradient(135deg, #0877b2, #7bc7ed);
}

.element-video {
  background: linear-gradient(135deg, #2e3141, #8d4356);
}

.element-shape {
  background: var(--accent);
  color: #1d2630;
}

.element-clock,
.element-countdown,
.element-logo,
.element-ticker {
  display: grid;
  align-items: center;
  color: #fff;
  font-weight: 850;
  padding: 4px 10px;
  white-space: pre-line;
}

.element-clock {
  font-size: 28px;
}

.element-qr {
  background:
    linear-gradient(90deg, #fff 50%, transparent 50%),
    linear-gradient(#fff 50%, transparent 50%),
    #17202a;
  background-size: 12px 12px;
  color: #17202a;
}

.element-ticker {
  background: rgba(14, 149, 217, .92);
  font-size: 20px;
  overflow: hidden;
}

.element-product-card,
.element-agenda,
.element-table,
.element-rss {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .28);
}

.element-price-card {
  background: #17202a;
  color: #efb84a;
  font-size: 26px;
}

.element-weather {
  background: linear-gradient(135deg, #0e95d9, #7bc7ed);
}

.element-embed,
.element-data-field {
  background: rgba(7, 58, 92, .88);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.element-icon {
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #efb84a;
  color: #17202a;
  font-size: 34px;
  font-weight: 900;
}

.element-divider {
  min-height: 4px;
  background: currentColor;
}

.element-logo {
  color: #fff;
  font-size: 26px;
}

.element-background-media {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(14, 149, 217, .55), rgba(239, 184, 74, .55));
  color: #fff;
  font-weight: 850;
}

.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 {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 850;
}

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

.element-list-empty {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.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;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 7px 9px;
}

.element-list-item:hover {
  background: var(--brand-soft);
}

.element-list-index {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #e6edf4;
  color: var(--brand-navy);
  font-size: 12px;
  font-weight: 850;
}

.element-list-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

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

.placeholder-view {
  padding: 22px;
}

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

.playback-dialog {
  width: min(1180px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .28);
}

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

.playback-header,
.playback-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.playback-stage-wrap {
  display: grid;
  place-items: center;
  margin: 18px 0 14px;
  padding: 22px;
  border-radius: 8px;
  background: #071d2f;
}

.playback-stage {
  position: relative;
  width: min(100%, 1040px);
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #111827;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

.playback-element {
  position: absolute;
  border-radius: 6px;
  animation: playbackEnter 520ms ease both;
}

.playback-element.element-text {
  min-width: 120px;
  min-height: 44px;
}

.playback-element:nth-child(2) {
  animation-delay: 120ms;
}

.playback-element:nth-child(3) {
  animation-delay: 220ms;
}

.playback-element:nth-child(4) {
  animation-delay: 320ms;
}

.playback-progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: #dbe7ef;
  overflow: hidden;
}

.playback-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

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

@keyframes playbackEnter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes playbackProgress {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

@keyframes playbackSlideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes playbackSlideLeft {
  from {
    opacity: 0;
    transform: translateX(34px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes playbackZoom {
  from {
    opacity: 0;
    transform: scale(.94);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.template-dialog::backdrop,
.save-template-dialog::backdrop,
.screen-dialog::backdrop,
.password-dialog::backdrop {
  background: rgba(16, 32, 42, .52);
}

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

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

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

.screen-form input:focus,
.screen-form select:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(14, 149, 217, .14);
}

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

.custom-size-fields[hidden] {
  display: none;
}

.orientation-field {
  display: inline-flex;
  gap: 6px;
  width: fit-content;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.orientation-field legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.orientation-field label {
  display: block;
  color: var(--muted);
}

.orientation-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.orientation-field span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border-radius: 6px;
  padding: 0 12px;
}

.orientation-field input:checked + span {
  background: var(--brand-navy);
  color: #fff;
}

.screen-format-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 14px;
  border: 1px dashed #bdc7d2;
  border-radius: 8px;
  background: #f8fbfd;
}

.screen-format-preview div {
  width: 120px;
  aspect-ratio: var(--screen-preview-ratio, 16 / 9);
  border-radius: 6px;
  background: linear-gradient(135deg, var(--brand-navy), var(--brand));
}

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

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

.form-message {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #a7e0c2;
  border-radius: 6px;
  background: #ecfdf3;
  color: #166534;
  font-size: 14px;
}

.form-message.is-error {
  border-color: #f1b9a7;
  background: #fff1ed;
  color: #9f341c;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

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

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

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

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

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

.template-empty {
  margin: 12px 0 0;
  color: var(--muted);
}

.template-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  text-align: left;
}

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

.template-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  margin-bottom: 10px;
  background: #111827;
  overflow: hidden;
}

.template-preview span {
  position: absolute;
  border-radius: 4px;
  background: currentColor;
  opacity: .95;
}

.template-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

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

.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);
}

.context-menu button[data-context-action="delete"] {
  color: var(--danger);
}

.context-menu button[data-context-action="delete"]:hover {
  background: #fff1ed;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }

  .brand {
    margin: 0;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    white-space: nowrap;
  }

  .detail-layout,
  .editor-shell {
    grid-template-columns: 1fr;
  }

  .tool-panel,
  .properties-panel {
    order: 2;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .page-header,
  .toolbar,
  .panel-header,
  .editor-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-actions {
    width: 100%;
  }

  .editor-actions button {
    flex: 1;
  }

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

  .toolbar .search-field {
    margin-left: 0;
  }

  .template-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .live-preview {
    padding: 26px;
  }
}
