:root {
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
  color: #20232a;
  background: #f4f7fc;
  --primary: #409eff;
  --primary-dark: #227fe0;
  --primary-soft: #ecf5ff;
  --muted: #8b95a7;
  --border: #e4eaf2;
  --card: #fff;
  --dark: #252a34;
  --success: #35c78a;
  --warning: #f2a23a;
  --danger: #ef6262;
  --shadow: 0 12px 36px rgba(51, 83, 127, .09);
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f4f7fc; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(64, 158, 255, .3);
  outline-offset: 2px;
}

.login-view {
  position: relative;
  min-height: 100vh;
  padding: 28px clamp(28px, 7vw, 112px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: #fbfcfe;
  background-image:
    linear-gradient(rgba(28, 79, 224, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 79, 224, .05) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center -1px;
}
.login-view::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(180deg, #fbfcfe 0%, #fbfcfe 55%, rgba(251, 252, 254, 0) 100%), radial-gradient(ellipse 60% 45% at 100% 0%, rgba(255, 106, 0, .08), transparent);
  pointer-events: none;
}
.login-view > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: 14px; font-size: clamp(17px, 2vw, 20px); color: #10131a; }
.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 9px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.02em;
}
.brand-mark.small { width: 34px; height: 34px; border-radius: 8px; font-size: 13px; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; background: var(--orange); border-radius: 2px; }
.login-stage { width: 100%; display: grid; grid-template-columns: minmax(390px, 1fr) minmax(390px, 480px); align-items: center; gap: 6vw; }
.login-points { margin: 30px 0 0; padding: 0; list-style: none; display: grid; gap: 13px; }
.login-points li { display: flex; align-items: baseline; gap: 0; font-size: 13px; color: #33404f; }
.login-points .dot { transform: translateY(-1px); }
.login-card {
  position: relative;
  width: min(480px, 100%);
  padding: 40px 38px 36px;
  display: grid;
  gap: 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 10px;
  box-shadow: 0 20px 48px rgba(14, 23, 41, .08);
}
.login-card h1 { margin: -4px 0 0; color: #0b1220; font-size: 26px; letter-spacing: -.02em; }
.login-card .version {
  padding: 3px 7px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.login-card small { color: var(--muted); text-align: center; }
.login-footer { color: #64748b; font-size: 11px; text-align: center; }

.eyebrow { margin: 0; display: flex; align-items: center; color: var(--dark); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.eyebrow .dot { margin-right: 8px; }
.muted { color: var(--muted); }
label { display: grid; gap: 8px; color: #687486; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
input, select, textarea {
  width: 100%;
  min-height: 47px;
  padding: 11px 14px;
  color: #252a34;
  background: #fbfcfe;
  border: 1px solid #dfe5ed;
  border-radius: 5px;
  outline: 0;
  transition: .18s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px #409eff1f; background: #fff; }
.button { min-height: 42px; padding: 10px 18px; border: 0; border-radius: 5px; font-size: 13px; font-weight: 700; transition: .18s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .78; transform: none; }
.button.is-loading { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.button-spinner {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin .75s linear infinite;
}
@keyframes button-spin { to { transform: rotate(360deg); } }
.primary { color: #fff; background: var(--primary); box-shadow: 0 7px 16px #409eff35; }
.primary:hover { background: var(--primary-dark); }
.outline { color: var(--primary); background: #fff; border: 1px solid var(--primary); box-shadow: none; }
.full { width: 100%; }
.error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }

.topbar {
  height: 64px;
  padding: 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #20252e;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(53, 78, 112, .05);
}
.identity, .top-actions { display: flex; align-items: center; gap: 12px; }
.identity > span:last-child { display: grid; }
.identity small, .top-actions { color: var(--muted); font-size: 11px; }
.quiet { padding: 8px 12px; color: #687486; background: #f7f9fc; border: 1px solid var(--border); border-radius: 5px; }
.app { min-height: 100vh; }
.shell { min-height: calc(100vh - 64px); display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { padding: 24px 14px; display: flex; flex-direction: column; gap: 6px; background: #fff; border-right: 1px solid var(--border); }
.nav-label { margin: 16px 16px 5px; color: #a1a9b7; font-size: 9px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-label:first-child { margin-top: 0; }
.sidebar button { position: relative; padding: 13px 16px; color: #6f7a8d; background: transparent; border: 0; border-radius: 6px; text-align: left; font-size: 13px; font-weight: 650; }
.sidebar button:hover, .sidebar button.active { color: var(--primary); background: var(--primary-soft); }
.sidebar button.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; background: var(--primary); border-radius: 0 3px 3px 0; }
.sidebar-footer { margin-top: auto; padding: 12px 16px; color: var(--muted); font-size: 10px; }
.platform-footer { margin-left: 224px; padding: 18px 30px; color: #667185; background: #fff; border-top: 1px solid var(--border); font-size: 12px; text-align: center; }
.status-dot { width: 7px; height: 7px; display: inline-block; margin-right: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px #35c78a16; }
.workspace { width: min(1280px, 100%); margin: 0 auto; padding: 32px 30px 64px; outline: 0; }
.page-heading { margin-bottom: 24px; display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.page-heading h1 { margin: 6px 0; color: #242932; font-size: 27px; letter-spacing: -.02em; }
.page-heading p { margin: 0; }
.heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.setup-panel {
  margin-bottom: 20px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.5fr) auto;
  align-items: center;
  gap: 18px;
  background: linear-gradient(135deg, #f7fbff, #fff);
  border: 1px solid #cfe5fb;
  border-radius: 9px;
  box-shadow: var(--shadow);
}
.setup-panel h2 { margin: 5px 0; font-size: 16px; }
.setup-panel p { margin: 0; color: var(--muted); font-size: 11px; }
.server-url { display: flex; align-items: center; gap: 10px; }
.server-url code { flex: 1; padding: 12px; overflow: auto; color: #245c8f; background: #edf6ff; border-radius: 5px; font-size: 11px; white-space: nowrap; }
.testing-panel { border-color: #f0d59f; background: linear-gradient(135deg, #fffdf8, #fff8e9); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.fleet-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.metric { position: relative; min-height: 100px; padding: 16px; background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); overflow: hidden; }
.metric::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--primary); }
.metric.warning::before { background: var(--warning); }
.metric.success::before { background: var(--success); }
.metric.danger::before { background: var(--danger); }
.metric span { color: var(--muted); font-size: 10px; font-weight: 800; }
.metric strong { display: block; margin: 8px 0 4px; color: #292e38; font-size: 22px; }
.metric small { color: var(--muted); }
.card { background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); overflow: hidden; }
.card-header { min-height: 70px; padding: 16px 21px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.card-header h2 { margin: 0; font-size: 16px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 10px 14px; color: #7f8999; background: #f8fafd; border-bottom: 1px solid var(--border); font-size: 10px; text-align: left; }
td { padding: 11px 14px; border-top: 1px solid #edf0f5; }
tr:hover td { background: #fafcff; }
.badge { display: inline-block; padding: 5px 9px; color: var(--primary); background: var(--primary-soft); border-radius: 4px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.badge.active, .badge.published, .badge.approved { color: #279668; background: #eaf9f3; }
.badge.pending, .badge.review { color: #ad6a10; background: #fff6e9; }
.badge.suspended, .badge.offline { color: #c34141; background: #fff0f0; }
.empty { padding: 52px 24px; color: var(--muted); text-align: center; }

dialog { width: min(650px, calc(100vw - 32px)); max-height: min(90vh, 860px); padding: 0; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 24px 80px #22354d38; overflow: hidden; }
.media-preview-dialog { width: min(1040px, calc(100vw - 32px)); }
.campaign-config-dialog { width: min(1080px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(34, 46, 65, .46); backdrop-filter: blur(2px); }
dialog form { max-height: min(90vh, 860px); display: flex; flex-direction: column; }
dialog header, dialog footer { padding: 18px 21px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
dialog footer { justify-content: flex-end; gap: 9px; border-top: 1px solid var(--border); border-bottom: 0; }
.close { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); background: transparent; border: 0; border-radius: 6px; font-size: 25px; }
.close:hover { color: var(--danger); background: #fff1f1; }
.modal-body { min-height: 0; padding: 22px; display: grid; gap: 15px; overflow: auto; }
.modal-body .two { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 380px; padding: 13px 17px; color: #fff; background: #303746; border-radius: 6px; box-shadow: 0 12px 30px #26344738; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toolbar { display: flex; gap: 8px; }
.action { color: var(--primary); background: transparent; border: 0; font-weight: 700; font-size: 11px; }
.danger-text { color: var(--danger); }
.warning-text { color: #b46b09 !important; }
.device-fleet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.device-card { min-width: 0; padding: 20px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.device-card > header { display: flex; justify-content: space-between; gap: 16px; }
.device-card h2 { margin: 9px 0 4px; color: #242932; font-size: 17px; }
.device-card p { margin: 0; color: var(--muted); font-size: 11px; }
.online-state { height: fit-content; padding: 6px 9px; color: #a24444; background: #fff0f0; border-radius: 4px; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.online-state.online { color: #25865e; background: #eaf9f3; }
.device-facts { margin: 18px 0 14px; padding: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; background: #f8fafd; border-radius: 7px; }
.device-facts div, .download-status div { min-width: 0; display: grid; gap: 5px; }
.device-facts span, .download-status span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.device-facts strong { overflow: hidden; color: #414955; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.download-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.download-status div { padding: 11px; border: 1px solid var(--border); border-radius: 6px; }
.download-status strong { font-size: 20px; }
.progress-block { margin-top: 14px; }
.progress-block div { margin-bottom: 7px; display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.progress-block progress { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 8px; accent-color: var(--primary); }
.device-error { margin-top: 13px !important; padding: 10px; color: #b03f3f !important; background: #fff3f3; border-radius: 5px; }
.app-update-device-status { margin-top: 13px; padding: 12px; display: grid; gap: 7px; background: #f3f8ff; border: 1px solid #d9eaff; border-radius: 7px; }
.app-update-device-status > div { display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }
.app-update-device-status span, .app-update-device-status small { color: var(--muted); }
.app-update-device-status progress { width: 100%; accent-color: var(--primary); }
.verification-code { display: inline-block; padding: 8px 12px; color: #1a5b95; background: #eaf5ff; border: 1px solid #badfff; border-radius: 6px; font-size: 20px; font-weight: 900; letter-spacing: .14em; }
.release-safety { margin-bottom: 18px; color: #7a5315; background: #fff9e9; border-color: #f0dda7; }
.release-safety p { margin: 7px 0 0; }
.device-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.device-actions .button { min-height: 36px; padding: 8px 13px; font-size: 11px; }
.inline-select { min-width: 170px; margin: 0; color: var(--muted); font-size: 9px; }
.inline-select select { min-height: 36px; padding: 7px 9px; font-size: 10px; }
.screen-inventory, .sync-screen-list, .sync-media-list { display: grid; gap: 10px; }
.screen-card { padding: 12px; display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; border: 1px solid var(--border); border-radius: 7px; }
.screen-card.offline { opacity: .62; }
.screen-card > div:last-child { display: grid; gap: 4px; }
.screen-card small { color: var(--muted); }
.screen-shape.square { aspect-ratio: 1; }
.sync-set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.sync-set-card { height: fit-content; }
.sync-screen-row { padding: 10px; display: grid; grid-template-columns: minmax(240px, 1fr) 70px 70px 70px; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: 7px; }
.sync-media-row { padding: 10px; display: grid; grid-template-columns: minmax(210px, 1fr) minmax(180px, 1fr) 90px 110px; gap: 8px; align-items: end; border: 1px solid var(--border); border-radius: 7px; }
.sync-media-row label { margin: 0; }
.sync-media-row .check-label { align-self: center; }
.media-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.media-library-section { margin-bottom: 20px; background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); overflow: hidden; }
.media-library-section.portrait { border-top: 3px solid #9a69e8; }
.media-library-section.landscape { border-top: 3px solid #409eff; }
.media-library-section.any { border-top: 3px solid var(--warning); }
.media-library-section .media-grid { padding: 16px; }
.platform-idle-panel { margin-bottom: 20px; border-top: 3px solid var(--primary); }
.platform-idle-panel .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 16px; }
.platform-idle-card .media-preview strong { opacity: 1; transform: none; }
.platform-idle-card .media-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.media-card { padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.media-card.archived { opacity: .62; background: #f7f8fa; }
.media-preview { width: calc(100% + 24px); height: 128px; margin: -12px -12px 11px; padding: 18px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--primary); background: linear-gradient(145deg, #edf6ff, #f7fbff); border: 0; border-radius: 8px 8px 0 0; font-weight: 900; }
.media-preview.portrait { background: linear-gradient(145deg, #f5efff, #fbf9ff); color: #8056c8; }
.media-preview strong { font-size: 11px; font-weight: 700; opacity: 0; transform: translateY(4px); transition: .18s; }
.media-preview:hover strong, .media-preview:focus-visible strong { opacity: 1; transform: none; }
.media-library-preview { position: relative; overflow: hidden; isolation: isolate; }
.media-library-thumbnail { position: absolute; z-index: -1; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(1.4px) saturate(.86) brightness(.78); transform: scale(1.035); transition: filter .2s, transform .2s; }
.media-library-preview.thumbnail-ready { color: #fff; background: #253b55; text-shadow: 0 1px 6px #000; }
.media-library-preview.thumbnail-ready:hover .media-library-thumbnail, .media-library-preview.thumbnail-ready:focus-visible .media-library-thumbnail { filter: blur(0) saturate(1) brightness(.64); transform: scale(1); }
.media-library-preview-label { position: relative; z-index: 1; padding: 4px 7px; background: #15283bb8; border-radius: 4px; }
.media-library-preview.is-video { background: linear-gradient(145deg, #53687f, #24374b); color: #fff; }
.media-library-preview.is-video::before { content: ""; position: absolute; inset: 0; opacity: .2; background: repeating-linear-gradient(90deg, transparent 0 18px, #fff 18px 20px); }
.media-library-preview.thumbnail-error { color: #687486; background: #edf1f5; text-shadow: none; }
.media-card h3 { margin: 0 0 6px; font-size: 13px; }
.media-card p { margin: 2px 0; color: var(--muted); font-size: 10px; }
.media-actions { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.media-actions .button { width: 100%; min-height: 34px; padding: 7px 10px; font-size: 11px; }
.media-viewer { display: block; max-width: 100%; max-height: 100%; object-fit: contain; background: #111; border-radius: 7px; }
.media-preview-stage { height: min(62vh, 480px); padding: 18px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: #11151d; border-radius: 9px; }
.media-preview-stage.portrait .media-viewer { max-width: min(430px, 100%); }
.preview-facts { margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.preview-facts div { min-width: 0; padding: 12px; background: #f7f9fc; border: 1px solid var(--border); border-radius: 7px; }
.preview-facts dt { margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.preview-facts dd { margin: 0; overflow-wrap: anywhere; color: #38404c; font-size: 12px; font-weight: 700; }
.preview-help { margin: 0; color: var(--muted); font-size: 12px; }
.preview-actions { display: flex; justify-content: flex-end; }
.preview-actions .button { min-height: 36px; padding: 7px 14px; font-size: 11px; }
.preview-loading, .preview-error { min-height: 360px; padding: 48px; display: grid; place-items: center; align-content: center; gap: 12px; text-align: center; }
.preview-loading p, .preview-error p { margin: 0; color: var(--muted); }
.preview-spinner { width: 42px; height: 42px; border: 4px solid #dceeff; border-top-color: var(--primary); border-radius: 50%; animation: button-spin .8s linear infinite; }
.upload-selection { padding: 13px; background: #f7f9fc; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; }
.upload-selection ul { max-height: 180px; margin: 10px 0 0; padding: 0; overflow: auto; list-style: none; }
.upload-selection li { padding: 7px 0; display: grid; gap: 2px; border-top: 1px solid var(--border); color: #3d4654; }
.upload-selection li small { color: var(--muted); }
.upload-progress { padding: 13px; background: var(--primary-soft); border-radius: 7px; }
.upload-progress div { margin-bottom: 8px; display: flex; justify-content: space-between; font-size: 12px; }
.upload-progress progress { width: 100%; accent-color: var(--primary); }
.danger-zone { padding: 13px; color: #9c3434; background: #fff5f5; border: 1px solid #ffd6d6; border-radius: 6px; }
.danger-zone p { margin: 5px 0 11px; font-size: 11px; }
.button.danger { color: #fff; background: var(--danger); }
.assignment-list { display: grid; gap: 8px; max-height: 310px; overflow: auto; scrollbar-gutter: stable; }
.campaign-media-section { min-width: 0; display: grid; gap: 9px; }
.campaign-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.campaign-section-heading strong { color: #343b47; font-size: 13px; }
.campaign-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.campaign-section-heading > span { flex: 0 0 auto; padding: 5px 9px; color: var(--primary-dark); background: var(--primary-soft); border-radius: 999px; font-size: 10px; font-weight: 800; }
.assignment-scroll-hint { padding: 7px 10px; display: flex; align-items: center; justify-content: space-between; color: #5e7188; background: linear-gradient(90deg, #f4f9ff, #eef6ff); border: 1px solid #d7eaff; border-radius: 6px; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.campaign-media-list { height: clamp(250px, 42vh, 440px); max-height: none; padding: 2px 9px 10px 2px; overscroll-behavior: contain; border-bottom: 1px solid var(--border); }
.campaign-media-list::-webkit-scrollbar { width: 12px; }
.campaign-media-list::-webkit-scrollbar-track { background: #edf2f8; border-radius: 8px; }
.campaign-media-list::-webkit-scrollbar-thumb { background: #9facc0; border: 3px solid #edf2f8; border-radius: 8px; }
.assignment-row {
  min-width: 0;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: minmax(300px, 1.7fr) minmax(145px, .8fr) 88px 105px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.assignment-row:has([data-use-media]:checked), .assignment-row.is-selected { border-color: #409eff; background: #f4faff; box-shadow: 0 0 0 2px #409eff22; }
.assignment-row input, .assignment-row select { min-height: 38px; padding: 7px 9px; font-size: 11px; }
.campaign-media-choice { position: relative; min-width: 0; display: grid; grid-template-columns: 32px 92px minmax(0, 1fr); align-items: center; gap: 10px; color: #404754; text-transform: none; letter-spacing: 0; cursor: pointer; }
.campaign-media-checkbox { position: absolute; width: 1px !important; height: 1px; min-height: 1px !important; margin: 0; padding: 0 !important; opacity: 0; pointer-events: none; }
.campaign-media-toggle { width: 28px; height: 28px; display: grid; place-items: center; color: transparent; background: #fff; border: 2px solid #a8b4c5; border-radius: 6px; box-shadow: inset 0 0 0 2px #fff; transition: background .16s, border-color .16s, box-shadow .16s, transform .16s; }
.campaign-media-toggle span { font-size: 17px; font-weight: 900; line-height: 1; }
.campaign-media-checkbox:checked + .campaign-media-toggle { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: inset 0 0 0 2px var(--primary); }
.campaign-media-checkbox:focus-visible + .campaign-media-toggle { outline: 3px solid rgba(64, 158, 255, .32); outline-offset: 2px; }
.campaign-media-choice:hover .campaign-media-toggle { border-color: var(--primary); transform: scale(1.04); }
.campaign-media-thumb { position: relative; width: 92px; height: 58px; display: grid; place-items: center; overflow: hidden; color: #fff; background: linear-gradient(145deg, #587493, #263d59); border: 1px solid #d5deea; border-radius: 6px; }
.campaign-media-thumb.portrait { background: linear-gradient(145deg, #925f7f, #4d2c48); }
.campaign-media-thumb img { width: 100%; height: 100%; object-fit: cover; filter: blur(1.2px) saturate(.82); transform: scale(1.04); transition: filter .18s, transform .18s; }
.campaign-media-choice:hover .campaign-media-thumb img, .campaign-media-choice:focus-within .campaign-media-thumb img { filter: blur(0) saturate(1); transform: scale(1); }
.campaign-media-thumb.is-video::before { content: ""; position: absolute; inset: 0; opacity: .34; background: repeating-linear-gradient(90deg, transparent 0 12px, #fff 12px 13px); }
.campaign-media-thumb-state { position: relative; z-index: 1; padding: 3px 5px; color: #fff; background: #182a3da8; border-radius: 4px; font-size: 9px; font-weight: 800; text-align: center; }
.campaign-media-thumb.is-video .campaign-media-thumb-state { width: 30px; height: 30px; padding: 0 0 0 2px; display: grid; place-items: center; background: #ffffffd9; color: #294764; border-radius: 50%; font-size: 13px; }
.campaign-media-thumb.is-error { background: #758091; }
.campaign-media-identity { min-width: 0; display: grid; gap: 4px; }
.campaign-media-identity strong, .campaign-media-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.campaign-media-identity strong { color: #303744; font-size: 12px; }
.campaign-media-identity small { color: var(--muted); font-size: 10px; font-weight: 500; }
.campaign-media-selection-state { color: #778397 !important; font-weight: 750 !important; }
.assignment-row.is-selected .campaign-media-selection-state { color: var(--primary-dark) !important; }
.assignment-control { min-width: 0; gap: 4px; color: #8490a1; font-size: 9px; letter-spacing: .04em; }
.assignment-control input, .assignment-control select { min-width: 0; }
.check-label { display: flex; grid-template-columns: none; align-items: center; gap: 9px; color: #404754; text-transform: none; letter-spacing: 0; }
.check-label input { width: 17px; min-height: 17px; flex: 0 0 17px; }
.check-label span { display: grid; gap: 2px; }
.check-label small { color: var(--muted); font-weight: 500; }
fieldset { padding: 14px; border: 1px solid var(--border); border-radius: 6px; }
legend { padding: 0 7px; color: #737e90; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.screen-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.screen-plan { min-width: 0; }
.screen-shape { margin: 0 auto 12px; display: grid; place-items: center; align-content: center; color: #fff; background: linear-gradient(145deg, #2d8eea, #183e72); border: 5px solid #20252e; border-radius: 8px; box-shadow: 0 8px 18px #26344724; }
.screen-shape.landscape { width: 190px; height: 108px; }
.screen-shape.portrait { width: 94px; height: 150px; }
.screen-shape span { font-weight: 800; }
.screen-shape small { opacity: .75; }
.screen-plan ol { margin: 0; padding-left: 22px; }
.screen-plan li { padding: 5px 0; }
.screen-plan li small { display: block; color: var(--muted); }
.plain-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 6px; }
.plain-list li { padding: 9px 11px; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); font-size: 11px; }
.plain-list li:first-child { border-top: 0; }
.plain-list span { color: var(--muted); text-align: right; }

@media (max-width: 960px) {
  .login-stage { grid-template-columns: 1fr; }
  .login-card { margin: auto; }
  .metrics, .fleet-summary, .media-grid { grid-template-columns: 1fr 1fr; }
  .device-fleet { grid-template-columns: 1fr; }
  .sync-set-grid { grid-template-columns: 1fr; }
  .sync-screen-row, .sync-media-row { grid-template-columns: 1fr; }
  .screen-card { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 170px 1fr; }
  .platform-footer { margin-left: 170px; }
  .setup-panel { grid-template-columns: 1fr; }
  .assignment-row { grid-template-columns: 1fr 1fr; }
  .campaign-media-choice { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .platform-idle-panel .media-grid { grid-template-columns: 1fr; }
  .platform-idle-card .media-actions { grid-template-columns: 1fr; }
  .login-view { padding: 20px; }
  .login-brand { font-size: 17px; }
  .login-card { padding: 36px 24px; }
  .shell { display: block; }
  .topbar { height: 58px; padding: 0 14px; }
  .identity small { display: none; }
  .sidebar { position: sticky; top: 0; z-index: 2; padding: 10px; flex-direction: row; overflow: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar button { flex: 0 0 auto; padding: 10px 13px; }
  .sidebar button.active::before { left: 10px; right: 10px; top: auto; bottom: -10px; width: auto; height: 3px; }
  .nav-label { display: none; }
  .sidebar-footer, .top-actions span, #change-password, #recovery-email { display: none; }
  .platform-footer { margin-left: 0; padding: 16px; }
  .metrics, .fleet-summary, .media-grid { grid-template-columns: 1fr; }
  .workspace { padding: 24px 15px; }
  .page-heading { align-items: start; flex-direction: column; }
  .modal-body .two { grid-template-columns: 1fr; }
  .server-url, .plain-list li { align-items: stretch; flex-direction: column; }
  .choice-grid, .screen-plan-grid { grid-template-columns: 1fr; }
  .assignment-row { grid-template-columns: 1fr; }
  .campaign-media-choice { grid-template-columns: 32px 82px minmax(0, 1fr); }
  .campaign-media-thumb { width: 82px; height: 54px; }
  .campaign-media-list { height: min(390px, 48vh); }
  .heading-actions { width: 100%; justify-content: stretch; }
  .heading-actions .button { flex: 1; }
  .download-status { grid-template-columns: 1fr; }
  .device-facts { grid-template-columns: 1fr; }
  .preview-facts { grid-template-columns: 1fr 1fr; }
}

/* Tech Vision fleet-command redesign — 2026-08-13 */
:root {
  --primary: #1c4fe0;
  --primary-dark: #0f34a8;
  --primary-soft: #eaf0fe;
  --muted: #64748b;
  --border: #e1e6ee;
  --card: #fff;
  --dark: #0e1729;
  --success: #18875b;
  --warning: #c76a00;
  --danger: #c53b3b;
  --orange: #ff6a00;
  --accent-blue: #8cc6ff;
  --page: #f2f4f7;
  --shadow: 0 10px 28px rgba(13, 71, 161, .07);
}

body { color: var(--dark); background: var(--page); font-size: 14px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.app { min-height: 100vh; display: grid; grid-template-columns: 282px minmax(0, 1fr); background: var(--page); }
.app-main { min-width: 0; min-height: 100vh; display: grid; grid-template-rows: 72px 1fr auto; grid-column: 2; }
.sidebar { position: sticky; z-index: 4; top: 0; height: 100vh; padding: 0 16px 16px; display: flex; flex-direction: column; gap: 0; color: #fff; background: #082d62; border: 0; box-shadow: 8px 0 24px rgba(13, 71, 161, .08); }
.sidebar-brand { min-height: 88px; padding: 22px 14px 18px; display: grid; align-content: center; gap: 5px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand strong { max-width: 220px; font-size: 15px; line-height: 1.3; }
.sidebar-brand small { color: #a9c9ed; font-size: 10px; }
.sidebar-nav { padding-top: 12px; display: flex; flex-direction: column; gap: 3px; overflow: auto; scrollbar-width: thin; }
.sidebar-nav { scrollbar-width: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.nav-label { margin: 18px 13px 7px; color: #91b3db; font-size: 9px; letter-spacing: .14em; }
.sidebar-nav button { min-height: 44px; padding: 10px 13px; display: grid; grid-template-columns: 22px 1fr; align-items: center; gap: 10px; color: #d9e8fa; background: transparent; border: 0; border-radius: 7px; font-size: 13px; font-weight: 650; text-align: left; }
.sidebar-nav button i { color: #9cc9f8; font-size: 18px; }
.sidebar-nav button:hover { color: #fff; background: rgba(140,198,255,.12); }
.sidebar-nav button.active { color: #fff; background: #0d5eb8; box-shadow: inset 3px 0 0 var(--accent-blue); }
.sidebar-nav button.active i { color: #fff; }
.sidebar-nav button.active::before { display: none; }
.sidebar-footer { margin-top: auto; padding: 13px; display: flex; align-items: center; gap: 10px; color: #fff; background: rgba(140,198,255,.1); border: 1px solid rgba(140,198,255,.12); border-radius: 8px; font-size: 11px; }
.sidebar-footer > span:last-child { display: grid; gap: 2px; }
.sidebar-footer small { color: #a9c9ed; }
.status-dot { flex: 0 0 8px; }

.topbar { position: sticky; z-index: 3; top: 0; height: 72px; padding: 0 28px 0 36px; display: flex; align-items: center; justify-content: space-between; color: var(--dark); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); box-shadow: none; backdrop-filter: blur(14px); }
.identity { min-width: 250px; padding: 9px 12px; display: flex; justify-content: space-between; color: var(--dark); background: #f8fafc; border: 1px solid var(--border); border-radius: 7px; }
.identity > span { display: grid; gap: 2px; }
.identity strong { font-size: 13px; }
.identity small { color: var(--muted); font-size: 10px; }
.identity i { align-self: center; color: var(--primary); }
.top-actions { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.top-actions > span { margin-right: 6px; font-size: 12px; font-weight: 700; }
.quiet { min-height: 40px; padding: 8px 11px; display: inline-flex; align-items: center; gap: 7px; color: #496275; background: #fff; border-color: transparent; }
.quiet:hover { color: var(--primary-dark); background: var(--primary-soft); }
.quiet i { font-size: 16px; }

.workspace { width: min(1460px, 100%); margin: 0 auto; padding: 26px 32px 48px; }
.page-heading { margin-bottom: 20px; align-items: center; }
.page-heading .eyebrow { color: var(--primary); font-size: 10px; }
.page-heading h1 { margin: 6px 0 4px; color: #10233f; font-size: 23px; line-height: 1.2; }
.page-heading p.muted { max-width: 760px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.heading-actions { align-items: center; }
.button { min-height: 40px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 6px; font-size: 12px; }
.button.primary { background: var(--primary); box-shadow: 0 7px 16px rgba(25,118,210,.18); }
.button.primary:hover { background: var(--primary-dark); }
.button.outline { color: var(--primary-dark); border-color: #9fc8ef; }
.button.outline:hover { background: var(--primary-soft); }
.action { min-height: 36px; padding: 7px 8px; color: var(--primary); font-size: 12px; }

.command-status { margin-bottom: 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); }
.command-metric { min-width: 0; min-height: 92px; padding: 16px 20px; display: flex; align-items: center; gap: 13px; border-right: 1px solid var(--border); }
.command-metric:last-child { border-right: 0; }
.command-metric .metric-icon { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 50%; }
.command-metric.success .metric-icon { color: var(--success); background: #e8f7f0; }
.command-metric.attention .metric-icon { color: var(--orange); background: #fff0e7; }
.command-metric.warning .metric-icon { color: var(--warning); background: #fff4df; }
.command-metric i { font-size: 18px; }
.command-metric > span:last-child { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 8px; }
.command-metric strong { color: #101f33; font-size: 22px; }
.command-metric b { font-size: 12px; }
.command-metric small { grid-column: 2; color: var(--muted); font-size: 10px; }
.command-grid { margin-bottom: 18px; display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(300px, .9fr); gap: 18px; align-items: start; }
.command-panel { min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow); }
.card, .media-library-section { border-color: var(--border); border-radius: 9px; box-shadow: var(--shadow); }
.card-header { min-height: 56px; padding: 13px 18px; }
.card-header h2 { color: #172a43; font-size: 14px; }
.card-header small { display: block; margin-top: 3px; font-size: 11px; }
.count-dot { margin-left: 5px; padding: 2px 7px; color: #fff; background: var(--orange); border-radius: 999px; font-size: 10px; vertical-align: 2px; }
.operational-table table, .fleet-table table { font-size: 12px; }
.operational-table th, .fleet-table th { padding: 9px 14px; color: #607082; background: #f8fafc; font-size: 9px; letter-spacing: .05em; }
.operational-table td, .fleet-table td { padding: 10px 14px; vertical-align: middle; }
.operational-table td:first-child, .fleet-table td:first-child { border-left: 3px solid transparent; }
.operational-table tr.attention-pending td:first-child { border-left-color: var(--orange); }
.operational-table tr.attention-offline td:first-child { border-left-color: var(--danger); }
.operational-table tr.attention-active td:first-child { border-left-color: var(--success); }
.operational-table td > small, .operational-table td > strong, .fleet-table td > small, .fleet-table td > strong { display: block; }
.operational-table td > small, .fleet-table td > small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.status-label { display: inline-flex; align-items: center; gap: 6px; color: #516779; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.status-label i { color: #8d9baa; font-size: 8px; }
.status-label.active i { color: var(--success); }
.status-label.pending i, .status-label.warning i { color: var(--orange); }
.status-label.offline i { color: var(--danger); }
.table-action { min-height: 34px; padding: 6px 10px; color: var(--primary-dark); background: #fff; border: 1px solid #cddceb; box-shadow: none; font-size: 10px; }
.readiness-panel { padding-bottom: 16px; }
.readiness-list { padding: 0 18px; }
.readiness-row { padding: 14px 0; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.status-light { width: 8px; height: 8px; background: var(--orange); border-radius: 50%; }
.status-light.ready { background: var(--success); }
.readiness-row > span:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.readiness-row strong, .readiness-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readiness-row strong { color: #26394f; font-size: 12px; }
.readiness-row small { color: var(--muted); font-size: 10px; }
.readiness-result { color: var(--warning); font-size: 10px; font-weight: 800; }
.readiness-result.ready { color: var(--success); }
.readiness-panel > .button { width: calc(100% - 36px); margin: 18px 18px 0; }

.setup-panel { margin: 0; padding: 18px 20px; grid-template-columns: minmax(240px, 1.1fr) minmax(300px, 1.6fr) auto; background: #fff; border-color: var(--border); border-radius: 9px; box-shadow: var(--shadow); }
.setup-panel h2 { color: #20344d; }
.setup-panel p { line-height: 1.45; }
.server-url code { color: var(--primary-dark); background: #edf5fd; }
.fleet-summary.command-status .metric { min-height: 92px; padding: 16px 20px; border: 0; border-right: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.fleet-summary.command-status .metric:last-child { border-right: 0; }
.fleet-summary.command-status .metric::before { display: none; }
.fleet-register { margin-bottom: 18px; }
.fleet-table td:last-child { min-width: 230px; }
.fleet-table progress { width: 120px; height: 7px; accent-color: var(--primary); }
.row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.table-profile { width: auto; margin: 0; }
.table-profile select { width: 126px; min-height: 34px; padding: 5px 7px; font-size: 10px; }
.setup-disclosure { margin-top: 16px; }
.setup-disclosure summary { min-height: 48px; padding: 12px 16px; display: flex; align-items: center; gap: 8px; color: var(--primary-dark); background: #fff; border: 1px solid var(--border); border-radius: 7px; cursor: pointer; font-weight: 750; }
.setup-disclosure[open] summary { margin-bottom: 12px; }

table { font-size: 12px; }
th { color: #607082; background: #f8fafc; font-size: 9px; letter-spacing: .04em; }
td { line-height: 1.4; }
.badge { padding: 5px 8px; border-radius: 4px; letter-spacing: .04em; }
.empty.compact { padding: 28px 18px; }
.media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.media-card { box-shadow: none; }
.media-preview { height: 118px; }
.campaign-config-dialog { width: min(1180px, calc(100vw - 32px)); }
.campaign-media-list { height: clamp(320px, 48vh, 520px); }
dialog { border-radius: 10px; }
dialog header, dialog footer { background: #fff; }
.modal-body { font-size: 14px; }
label { font-size: 11px; }
input, select, textarea { font-size: 14px; }
.platform-footer { margin: 0; padding: 18px 36px; color: #667a8c; background: #fff; border-top: 1px solid var(--border); font-size: 11px; text-align: left; }
.platform-footer span { color: var(--primary-dark); }

.login-view { padding: 34px clamp(28px, 7vw, 110px); color: var(--dark); }
.login-brand span { display: grid; gap: 3px; }
.login-brand strong { color: var(--dark); font-size: 15px; }
.login-brand small { color: var(--muted); font-size: 10px; }
.login-stage { grid-template-columns: minmax(360px, 1fr) minmax(390px, 480px); }
.login-introduction { max-width: 620px; }
.login-introduction h2 { max-width: 560px; margin: 14px 0 16px; color: var(--dark); font-size: clamp(32px, 3.6vw, 48px); font-weight: 800; line-height: 1.08; letter-spacing: -.03em; }
.login-introduction h2 span { color: var(--primary); }
.login-introduction > p:last-of-type { max-width: 480px; color: var(--muted); font-size: 15px; line-height: 1.6; }

@media (max-width: 1320px) {
  .operational-table table { table-layout: fixed; }
  .operational-table th:nth-child(1) { width: 23%; }
  .operational-table th:nth-child(2) { width: 11%; }
  .operational-table th:nth-child(3) { width: 22%; }
  .operational-table th:nth-child(4) { width: 10%; }
  .operational-table th:nth-child(5) { width: 11%; }
  .operational-table th:nth-child(6) { width: 11%; }
  .operational-table th:nth-child(7) { width: 12%; }
  .operational-table td > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 1180px) {
  .app { grid-template-columns: 88px minmax(0, 1fr); }
  .app-main { grid-column: 2; }
  .sidebar { padding-inline: 10px; }
  .sidebar-brand strong { font-size: 0; }
  .sidebar-brand strong::after { content: "CMP"; font-size: 15px; }
  .sidebar-brand small, .sidebar-nav button span, .nav-label, .sidebar-footer > span:last-child { display: none; }
  .sidebar-nav button { grid-template-columns: 1fr; justify-items: center; }
  .sidebar-nav button i { font-size: 20px; }
  .command-status { grid-template-columns: 1fr 1fr; }
  .command-metric:nth-child(2) { border-right: 0; }
  .command-metric:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .command-grid { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: 1fr 1fr; }
  .top-actions .quiet span { display: none; }
  .operational-table table { table-layout: fixed; }
  .operational-table th:nth-child(1) { width: 23%; }
  .operational-table th:nth-child(2) { width: 11%; }
  .operational-table th:nth-child(3) { width: 22%; }
  .operational-table th:nth-child(4) { width: 10%; }
  .operational-table th:nth-child(5) { width: 11%; }
  .operational-table th:nth-child(6) { width: 11%; }
  .operational-table th:nth-child(7) { width: 12%; }
  .operational-table td > small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 760px) {
  .app { display: block; }
  .app-main { display: block; }
  .sidebar { position: sticky; height: auto; padding: 8px; flex-direction: row; overflow-x: auto; }
  .sidebar-brand, .sidebar-footer, .nav-label { display: none; }
  .sidebar-nav { padding: 0; flex-direction: row; overflow: visible; }
  .sidebar-nav button { min-width: 48px; padding: 10px; }
  .topbar { top: 60px; height: 62px; padding: 0 14px; }
  .identity { min-width: 0; flex: 1; }
  .top-actions > span, #recovery-email, #change-password { display: none; }
  .workspace { padding: 24px 15px 48px; }
  .page-heading { align-items: stretch; }
  .command-status { grid-template-columns: 1fr; }
  .command-metric { min-height: 94px; border-right: 0; border-bottom: 1px solid var(--border); }
  .command-metric:last-child { border-bottom: 0; }
  .command-grid { grid-template-columns: 1fr; }
  .setup-panel { grid-template-columns: 1fr; }
  .media-grid { grid-template-columns: 1fr; }
  .platform-footer { padding: 16px; }
  .login-stage { grid-template-columns: 1fr; }
  .login-introduction { display: none; }
}
