:root {
  --bg: #f3f6f9;
  --panel: #ffffff;
  --panel-2: #f0f4f8;
  --line: #dce3ea;
  --text: #1a2433;
  --muted: #66738499;
  --muted-solid: #607082;
  --brand: #0097e0;        /* Daikin blue */
  --brand-2: #007cc2;      /* darker for hover/contrast on white */
  --danger: #d23b4a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 40, 70, 0.08), 0 1px 2px rgba(20, 40, 70, 0.04);
  --shadow-lg: 0 12px 40px rgba(20, 40, 70, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted-solid); }
.error { color: var(--danger); }

/* Buttons */
.btn {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow);
}
.btn:hover { background: var(--brand-2); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--text); box-shadow: none; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-danger { background: #fff; border: 1px solid var(--danger); color: var(--danger); box-shadow: none; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--bg); }
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}
.login-card .login-logo { height: 42px; align-self: flex-start; margin-bottom: 8px; display: block; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card input { padding: 11px 12px; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 14px; }
.brand img { height: 34px; display: block; }
.brand .divider { width: 1px; height: 26px; background: var(--line); }
.brand span { color: var(--text); font-weight: 700; }
.tabs { display: flex; gap: 6px; margin-left: 8px; }
.tab {
  background: transparent;
  border: 0;
  color: var(--muted-solid);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: #fff; background: var(--brand); }

main { padding: 24px; max-width: 1100px; margin: 0 auto; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h2 { margin: 0; font-size: 18px; }

/* Inputs */
input, select, textarea {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
textarea { min-height: 90px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; margin-bottom: 5px; color: var(--muted-solid); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; }
.checks label { display: flex; align-items: center; gap: 7px; color: var(--text); }
.checks input { width: auto; }

/* Content placement chooser (step 1) */
.chooser-lead { margin-top: -6px; margin-bottom: 18px; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.type-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  width: 100%; text-align: left; padding: 18px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s, transform .12s;
}
.type-card:hover { border-color: var(--brand); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.type-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.type-card.is-current { border-color: var(--brand); background: var(--panel-2); }
.type-ico { font-size: 26px; line-height: 1; }
.type-name { font-weight: 700; color: var(--text); font-size: 15px; }
.type-blurb { color: var(--muted-solid); font-size: 12.5px; line-height: 1.4; }

/* Chosen-placement header inside the detail step (step 2) */
.type-chosen { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.type-chosen .type-ico { font-size: 22px; }
.type-chosen-txt { display: flex; flex-direction: column; line-height: 1.25; }
.type-chosen-txt strong { color: var(--text); }
.type-chosen-txt small { color: var(--muted-solid); font-size: 12px; }
.type-chosen .btn { margin-left: auto; flex: none; }

/* Segmented control (Media: None / Image / Video) */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button { border: 0; border-left: 1px solid var(--line); background: #fff; color: var(--muted-solid); padding: 8px 18px; font: inherit; font-weight: 600; cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button.is-on { background: var(--brand); color: #fff; }
.seg button:not(.is-on):hover { background: var(--panel-2); color: var(--text); }

/* Progressive-disclosure groups (revealed by the media picker / optional toggles).
   Hiding is handled by the global .hidden rule; this just styles the revealed state. */
.cond-group { padding-left: 12px; border-left: 2px solid var(--line); margin: 4px 0 14px; }
.opt { margin-bottom: 14px; }
.opt-toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; margin-bottom: 8px; }
.opt-toggle input { width: auto; }

/* Topbar user actions — pushed to the right, two compact controls */
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* Account menu (avatar + name → dropdown) */
.user-wrap { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; }
.user-btn:hover { background: var(--panel-2); }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.user-meta { display: flex; flex-direction: column; line-height: 1.15; text-align: left; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--muted-solid); text-transform: capitalize; }
.caret { color: var(--muted-solid); font-size: 11px; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 1000; padding: 6px; }
.menu-item { display: block; width: 100%; text-align: left; background: transparent; border: 0; padding: 9px 10px; border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; }
.menu-item:hover { background: var(--panel-2); }
.menu-item--danger { color: var(--danger); }
.menu-item--danger:hover { background: #fdecee; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* Admin Panel — users */
.nu-form { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.nu-form input, .nu-form select { width: auto; flex: 1; min-width: 140px; }
.nu-form .btn { flex: none; }
.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.user-row .u-role { width: auto; flex: none; }
.user-row .grow { min-width: 0; }
.user-email { font-weight: 600; color: var(--text); word-break: break-all; }
.tempbox { border: 1px solid var(--brand); background: #eaf6fd; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.tempbox--err { border-color: var(--danger); background: #fdecee; color: var(--danger); }
.tempbox .temp-line { margin: 6px 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.temp-pw { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; font-weight: 700; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; letter-spacing: .04em; }

/* Single content-state chip: a colored dot + label (no heavy filled badge) */
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-solid); flex: none; }
.state.st-live .dot { background: #1b7a3d; }
.state.st-scheduled .dot { background: #d18a1a; }
.state.st-pending .dot { background: #d18a1a; }
.state.st-expired .dot { background: var(--danger); }
.state.st-draft .dot { background: #9aa6b2; }
.state.st-off .dot { background: #9aa6b2; }
.state.st-off, .state.st-draft { color: var(--muted-solid); }
.card--flash { animation: flash 1.5s ease; }
@keyframes flash { 0%, 100% { box-shadow: var(--shadow); } 30% { box-shadow: 0 0 0 3px var(--brand); } }

/* Bell / notifications */
.bell-wrap { position: relative; }
.bell-btn { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 16px; cursor: pointer; line-height: 1; }
.bell-btn:hover { background: var(--panel-2); }
.bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.bell-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; max-width: 90vw; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 1000; overflow: hidden; }
.bell-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.bell-list { max-height: 360px; overflow-y: auto; }
.notif { padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--panel-2); }
.notif--unread { background: #eaf6fd; }
.notif--unread:hover { background: #ddeffb; }
.notif-msg { font-size: 13px; color: var(--text); }
.notif-time { font-size: 11px; color: var(--muted-solid); margin-top: 3px; }
.notif-empty { padding: 16px 12px; font-size: 13px; }

/* Admin Panel sections + workflow editor */
.ap-section { margin-bottom: 6px; }
.ap-h { margin: 0 0 4px; font-size: 15px; }
.wf-steps { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wf-step { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.wf-num { width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.wf-empty { list-style: none; padding: 8px 0; }
.wf-add { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.wf-add select { width: auto; flex: none; min-width: 180px; }
.wf-add .grow { flex: 1; }

/* Analytics */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: var(--panel-2); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 12px; color: var(--muted-solid); }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); margin-top: 2px; }
.stat-value.accent { color: var(--brand); }
.an-table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.an-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.an-table th { text-align: left; font-weight: 600; color: var(--muted-solid); background: var(--panel-2); padding: 10px 14px; font-size: 12px; }
.an-table td { padding: 11px 14px; border-top: 1px solid var(--line); color: var(--text); }
.an-table .num { text-align: right; white-space: nowrap; }
.an-table .strong { font-weight: 700; color: #1b7a3d; }
.an-table .muted { color: var(--muted-solid); }

/* Filter bar */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters .flt-search { flex: 1; min-width: 200px; }
.filters select { width: auto; min-width: 130px; }
.filters .flt-arch { display: flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--text); font-size: 13px; }
.filters .flt-arch input { width: auto; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pager .pg-info { color: var(--muted-solid); font-size: 13px; }
.pager button[disabled] { opacity: .45; cursor: default; }

/* List rows */
.list { display: flex; flex-direction: column; gap: 10px; }
.card--archived { opacity: .72; background: var(--panel-2); }
.badge.archived-b { color: #5f6b7a; background: #e7ecf1; border-color: #d3dbe3; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.card .grow { flex: 1; min-width: 0; }
.card h3 { margin: 0 0 3px; font-size: 15px; }
.card .meta { color: var(--muted-solid); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.badge.modal { color: #1565c0; border-color: #bcd6f5; background: #eaf2fd; }
.badge.banner { color: #9a5b00; border-color: #f0d9ad; background: #fdf3e2; }
.badge.notification { color: #1b7a3d; border-color: #b7e3c5; background: #e8f7ee; }
.badge.pdf { color: #b3164b; border-color: #f3bcd0; background: #fcebf1; }
.badge.newsletter { color: #6a3fb0; border-color: #d8c8f2; background: #f2ecfc; }
.badge.live { color: #fff; background: var(--brand); border-color: var(--brand); }
.badge.off { color: var(--muted-solid); }
.badge.scheduled { color: #9a5b00; border-color: #e6b86a; background: #fdf3e2; }
.badge.expired { color: var(--danger); border-color: #f0b3ba; background: #fcebed; }

/* Toggle */
.switch { position: relative; width: 40px; height: 22px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #cbd5e0; border-radius: 999px; transition: .15s; cursor: pointer; }
.switch .slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Assets */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.asset {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.asset .thumb { height: 110px; background: var(--panel-2); display: grid; place-items: center; overflow: hidden; }
.asset .thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset .thumb { position: relative; }
.asset .thumb video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.asset .thumb .play-badge { position: absolute; inset: 0; margin: auto; width: 40px; height: 40px; display: grid; place-items: center; background: rgba(0,0,0,.5); color: #fff; border-radius: 999px; font-size: 16px; pointer-events: none; }
.asset .thumb .ext { font-size: 26px; font-weight: 800; color: var(--muted-solid); }
.asset .info { padding: 8px 10px; font-size: 12px; }
.asset .info .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset .actions { display: flex; gap: 6px; padding: 0 10px 10px; }

/* Modal (admin) */
.overlay { position: fixed; inset: 0; background: rgba(20, 40, 70, .45); display: grid; place-items: center; padding: 20px; z-index: 50; }
.dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.dialog h2 { margin: 0 0 16px; }
.dialog .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.dialog .foot .spacer { flex: 1; }
.dialog hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.dialog--wide { max-width: 960px; }

/* Field hint text (size/format guidance) */
.hint { display: block; margin-top: 5px; color: var(--muted-solid); font-size: 11px; line-height: 1.4; }

/* Hotspot editor */
.hs { margin-bottom: 14px; }
.hs-cap { color: var(--muted-solid); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.hs-stage { position: relative; display: block; width: 100%; margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); }
.hs-img { display: block; width: 100%; }
.hs-overlay { position: absolute; inset: 0; cursor: crosshair; }
.hs-box { position: absolute; background: rgba(0,151,224,.22); border: 2px solid var(--brand); border-radius: 4px; box-sizing: border-box; }
.hs-temp { background: rgba(0,151,224,.12); border-style: dashed; }
.hs-num { position: absolute; top: -1px; left: -1px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 4px 0 6px 0; }
.hs-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.hs-row { display: flex; align-items: center; gap: 10px; }
.hs-row .hs-num { position: static; border-radius: 6px; padding: 3px 9px; flex: none; }
.hs-row .hs-url { flex: 1; }

/* Editor two-column layout: form + live preview */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.editor-form { min-width: 0; }
.editor-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; }
.pv-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted-solid); }
.pv-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow); }
.pv-note { font-size: 11px; line-height: 1.45; color: var(--muted-solid); }
@media (max-width: 820px) {
  .editor-grid { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
}

/* Embed snippet */
.snippet {
  background: #eef3f8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #1f4e6b;
  word-break: break-all;
  white-space: pre-wrap;
}
.note { background: #eaf6fd; border-left: 3px solid var(--brand); padding: 9px 12px; border-radius: 6px; font-size: 12px; color: #2a5876; margin-bottom: 14px; }
.toast-stack { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--brand); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); }
.toast.err { border-left-color: var(--danger); }
