:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111f;
  color: #f6f8fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 0%, rgba(45, 125, 255, .17), transparent 32rem),
    #07111f;
}
button, input, select, textarea { font: inherit; }
main { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 80px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(32px, 5vw, 52px); letter-spacing: -.04em; }
h2 { margin-bottom: 0; font-size: 24px; }
h3 { margin: 0 0 5px; font-size: 18px; }
.eyebrow { margin-bottom: 9px; color: #5f9bff; font-size: 12px; font-weight: 800; letter-spacing: .17em; }
.muted { color: #9eb0c7; }
.error { margin: 12px 0; color: #ff9696; }
[hidden] { display: none !important; }

.login-card {
  width: min(480px, 100%);
  margin: 8vh auto 0;
  padding: 38px;
  border: 1px solid #1d3554;
  border-radius: 24px;
  background: rgba(13, 27, 46, .94);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .28);
}
.first-login-note { margin: 18px 0 0; font-size: 12px; }
form { display: grid; gap: 10px; }
label { color: #b9c7d8; font-size: 13px; font-weight: 700; }
.field-help { margin: -4px 0 2px; color: #758ca9; font-size: 11px; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #2b4464;
  border-radius: 10px;
  outline: none;
  background: #0a1728;
  color: #f6f8fb;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #438aff; box-shadow: 0 0 0 3px rgba(67, 138, 255, .16); }
button {
  min-height: 46px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: #2d7dff;
  color: white;
  font-weight: 800;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.secondary { border: 1px solid #36577e; background: #132945; }
button.ghost { background: transparent; color: #a8bdd7; }
button.danger { background: transparent; color: #ff9898; }
button.small { min-height: 34px; padding: 6px 10px; font-size: 12px; }

header, .section-heading, .header-actions, .item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header { margin-bottom: 26px; }
.header-actions { justify-content: flex-end; }
.pill, .status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #142c4b;
  color: #a9c8f7;
  font-size: 12px;
  font-weight: 800;
}
.status.online { background: rgba(42, 190, 120, .16); color: #69e4a8; }
.status.offline { background: rgba(255, 178, 82, .13); color: #ffc176; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.summary-grid article, .panel {
  border: 1px solid #1d3554;
  border-radius: 18px;
  background: rgba(13, 27, 46, .9);
}
.summary-grid article { padding: 21px; }
.summary-grid span { display: block; margin-bottom: 8px; color: #95a9c2; font-size: 13px; }
.summary-grid strong { font-size: 32px; }
.panel { padding: 24px; }
.section-heading { align-items: flex-start; margin-bottom: 20px; }
.section-heading > p { max-width: 540px; margin: 0; text-align: right; font-size: 13px; }

.display-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.display-card, .item-card {
  padding: 17px;
  border: 1px solid #243f61;
  border-radius: 13px;
  background: #0a192b;
}
.display-card .meta, .item-card .meta { margin: 7px 0 14px; color: #8fa5c0; font-size: 12px; }
.display-card footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.empty { padding: 28px; border: 1px dashed #2c4563; border-radius: 13px; color: #8ea3bd; text-align: center; }

.content-layout { display: grid; grid-template-columns: minmax(320px, 440px) 1fr; gap: 14px; margin-top: 14px; }
.templates-panel { margin-top: 14px; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.template-card { display: grid; align-content: start; gap: 10px; padding: 22px; overflow: hidden; border: 1px solid #29486d; border-radius: 16px; background: #0a192b; }
.template-card .muted { margin-bottom: 4px; font-size: 13px; line-height: 1.5; }
.template-icon { display: grid; width: 52px; height: 52px; place-items: center; border: 1px solid rgba(255,255,255,.13); border-radius: 15px; background: rgba(255,255,255,.08); font-size: 27px; }
.weather-template-card { background: radial-gradient(circle at 90% 0, rgba(255, 190, 73, .18), transparent 15rem), #0a192b; }
.notice-template-card { background: radial-gradient(circle at 90% 0, rgba(74, 133, 255, .2), transparent 15rem), #0a192b; }
.preview-panel { margin-top: 14px; }
.preview-controls { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 12px; margin-bottom: 18px; }
.preview-controls label { display: block; margin-bottom: 7px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.or { display: flex; align-items: center; gap: 10px; margin: 2px 0; color: #758ca9; font-size: 11px; }
.or::before, .or::after { content: ""; height: 1px; flex: 1; background: #263d59; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 7px 0; }
.check-row input, .days input { width: 18px; min-height: 18px; margin: 0; }
.days { display: flex; flex-wrap: wrap; gap: 7px; }
.days label { display: flex; align-items: center; gap: 5px; padding: 8px; border: 1px solid #263f60; border-radius: 8px; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.preview-label, .preview-title { display: block; }
.preview-label { color: #66a1ff; font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.preview-title { max-width: 250px; margin-top: 3px; overflow: hidden; color: #dbe8f8; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.preview-stage {
  position: relative;
  display: grid;
  width: min(720px, 100%);
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  place-items: center;
  overflow: hidden;
  border: 5px solid #263f60;
  border-radius: 12px;
  background: #02060c;
  box-shadow: inset 0 0 0 1px #000;
}
.preview-stage img, .preview-stage video, .preview-stage iframe { width: 100%; height: 100%; border: 0; object-fit: contain; }
.preview-stage iframe { background: white; }
.preview-empty { max-width: 280px; margin: 0; padding: 20px; color: #7187a2; text-align: center; }
.preview-audio { display: grid; width: min(86%, 340px); gap: 18px; color: #dbe8f8; text-align: center; }
.preview-audio audio { width: 100%; }
.item-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-bottom: 10px; }
.item-card .type { color: #66a1ff; font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.item-card .source { max-width: 620px; overflow: hidden; color: #758ca9; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.item-actions { align-self: center; justify-content: flex-end; }
#toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 13px 18px;
  border-radius: 10px;
  background: #eaf2ff;
  color: #0a182a;
  font-weight: 800;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}

@media (max-width: 850px) {
  main { width: min(100% - 24px, 680px); padding-top: 24px; }
  header, .section-heading { align-items: flex-start; flex-direction: column; }
  .header-actions { flex-wrap: wrap; justify-content: flex-start; }
  .section-heading > p { text-align: left; }
  .content-layout { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .item-card { grid-template-columns: 1fr; }
  .preview-controls { grid-template-columns: 1fr; }
  .template-grid { grid-template-columns: 1fr; }
}
