:root {
  color-scheme: light;
  --ink: #0b1324;
  --muted: #5f6f84;
  --line: #dce3ed;
  --surface: #ffffff;
  --canvas: #f3f6fa;
  --nav: #0b1324;
  --nav-soft: #17233a;
  --accent: #1f56e0;
  --accent-soft: #eaf0ff;
  --success: #11845b;
  --warning: #b26a08;
  --danger: #bf3344;
  --shadow: 0 14px 40px rgba(11, 19, 36, .08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.boot-screen {
  min-height: 100vh; display: grid; place-content: center; justify-items: center;
  gap: 16px; color: var(--muted);
}
.brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: 15px; background: var(--accent); color: white;
  font-weight: 800; letter-spacing: -.04em;
}
.boot-line {
  width: 150px; height: 3px; border-radius: 9px;
  background: linear-gradient(90deg, var(--accent) 35%, #dbe4f3 35%);
  animation: pulse 1s ease-in-out infinite alternate;
}
@keyframes pulse { to { opacity: .45; transform: scaleX(.92); } }

.auth-page {
  min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr;
  background: var(--surface);
}
.auth-story {
  position: relative; overflow: hidden; padding: 56px clamp(32px, 6vw, 92px);
  display: flex; flex-direction: column; justify-content: space-between;
  color: white; background:
    radial-gradient(circle at 84% 14%, rgba(72, 116, 255, .55), transparent 28%),
    linear-gradient(145deg, #0b1324 0%, #14264c 54%, #173b79 100%);
}
.auth-story::after {
  content: ""; position: absolute; width: 440px; height: 440px;
  right: -220px; bottom: -170px; border: 1px solid rgba(255,255,255,.17);
  border-radius: 50%; box-shadow: 0 0 0 58px rgba(255,255,255,.035),
    0 0 0 118px rgba(255,255,255,.025);
}
.wordmark { display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 19px; }
.wordmark .brand-mark { background: white; color: var(--nav); }
.auth-copy { position: relative; z-index: 1; max-width: 620px; }
.eyebrow { margin: 0 0 12px; color: #4964a8; font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.auth-story .eyebrow { color: #b7c8ff; }
.auth-copy h1 { margin: 0 0 22px; font-size: clamp(42px, 5.3vw, 76px); line-height: .99; letter-spacing: -.055em; }
.auth-copy p { max-width: 520px; margin: 0; color: #c7d4ea; font-size: 18px; line-height: 1.65; }
.auth-proof { position: relative; z-index: 1; display: flex; gap: 28px; color: #b9c8e2; font-size: 13px; }
.auth-proof span::before { content: "●"; margin-right: 8px; color: #59dcac; }
.auth-panel { display: grid; place-items: center; padding: 36px; }
.auth-card { width: min(430px, 100%); }
.auth-card h2 { margin: 0; font-size: 32px; letter-spacing: -.035em; }
.auth-card > p { color: var(--muted); margin: 10px 0 28px; line-height: 1.6; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 26px; background: #edf1f7; border-radius: 12px; }
.tab { border: 0; padding: 10px; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; }
.tab.active { color: var(--ink); background: white; box-shadow: 0 2px 8px rgba(11,19,36,.08); }
.field { display: grid; gap: 8px; margin: 16px 0; }
.field label { font-size: 13px; font-weight: 750; }
.field input {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 14px; outline: 0; color: var(--ink); background: white;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field input[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(191, 51, 68, .09);
}
.field-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }
.password-guidance {
  display: grid; gap: 7px; padding: 12px 14px; border-radius: 11px;
  color: var(--muted); background: #f5f7fb; font-size: 12px; line-height: 1.45;
}
.password-guidance strong { color: var(--ink); }
.password-guidance span { font-size: 11px; }
.password-checklist { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.password-checklist li::first-letter { font-weight: 900; }
.password-checklist li.met { color: var(--success); }
.primary, .secondary, .ghost, .icon-button {
  border: 0; border-radius: 11px; font-weight: 750;
}
.primary { padding: 13px 18px; color: white; background: var(--accent); box-shadow: 0 7px 18px rgba(39,100,255,.2); }
.primary:hover { background: #1754ed; }
.primary:disabled { opacity: .55; cursor: wait; }
.auth-card .primary { width: 100%; margin-top: 8px; }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 252px; z-index: 5;
  display: flex; flex-direction: column; padding: 26px 18px;
  color: #d9e4f5; background: var(--nav);
}
.sidebar .wordmark { padding: 0 8px 26px; }
.sidebar .brand-mark { width: 40px; height: 40px; }
.nav-label { margin: 20px 12px 9px; color: #6f819e; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px;
  border: 0; border-radius: 10px; color: #aebcd2; background: transparent;
  text-align: left; font-weight: 650;
}
.nav-item.active { color: white; background: var(--nav-soft); }
.nav-dot { width: 8px; height: 8px; border: 2px solid currentColor; border-radius: 50%; }
.sidebar-footer { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid #26344b; }
.user-mini { display: flex; gap: 11px; align-items: center; min-width: 0; }
.avatar { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 12px; background: #263c66; color: white; font-weight: 800; }
.user-mini strong, .user-mini span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mini span { margin-top: 3px; color: #8191aa; font-size: 11px; }
.logout { margin-top: 14px; width: 100%; border: 1px solid #2c3b53; border-radius: 10px; padding: 9px; color: #aebcd2; background: transparent; }

.main { grid-column: 2; min-width: 0; }
.topbar {
  height: 78px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(22px, 4vw, 52px); border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.9); backdrop-filter: blur(12px);
}
.topbar-title { font-size: 15px; font-weight: 800; }
.org-select {
  min-width: 220px; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 36px 10px 12px; color: var(--ink); background: white;
}
.content { padding: 42px clamp(22px, 4vw, 52px) 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.page-heading h1 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--muted); }
.secondary { padding: 11px 16px; color: var(--accent); background: var(--accent-soft); }
.ghost { padding: 10px 14px; border: 1px solid var(--line); background: white; color: var(--ink); }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.analytics-kpis { grid-template-columns: repeat(4, 1fr); }
.period-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.period-tab { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: white; font-weight: 750; }
.period-tab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.analytics-breakdown { max-width: 720px; }
.privacy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.privacy-grid .privacy-deletion { grid-column: 1 / -1; }
.privacy-warning { margin: 0 0 18px; color: var(--muted); line-height: 1.6; }
.privacy-warning strong { color: var(--danger); }
.auth-consent { margin: 20px 0 8px; line-height: 1.45; }
.metric { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { display: block; margin-top: 5px; font-size: 25px; letter-spacing: -.03em; }
.business-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(315px, 1fr)); gap: 18px; }
.business-card {
  position: relative; overflow: hidden; border: 1px solid var(--line);
  border-radius: var(--radius); background: white; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.business-card:hover { transform: translateY(-2px); box-shadow: 0 18px 48px rgba(11,19,36,.12); }
.card-accent { height: 5px; background: linear-gradient(90deg, var(--accent), #7ca2ff); }
.card-body { padding: 23px; }
.card-kicker { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.business-card h2 { margin: 8px 0 5px; font-size: 22px; letter-spacing: -.025em; }
.business-meta { min-height: 42px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.status-list { display: grid; gap: 11px; margin: 22px 0; padding: 16px 0; border-block: 1px solid #edf0f5; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; font-size: 10px; font-weight: 850; letter-spacing: .05em; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: #08734f; background: #e9f8f2; }
.pill.warn { color: #874900; background: #fff5df; }
.pill.muted { color: #506178; background: #eef2f7; }
.card-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.card-actions button { white-space: nowrap; }

.empty, .error-panel {
  padding: 60px 28px; border: 1px dashed #c9d2df; border-radius: var(--radius);
  text-align: center; background: rgba(255,255,255,.65);
}
.empty-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 18px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.empty h2, .error-panel h2 { margin: 0 0 9px; }
.empty p, .error-panel p { max-width: 460px; margin: 0 auto 22px; color: var(--muted); line-height: 1.6; }
.skeleton { min-height: 290px; border-radius: var(--radius); background: linear-gradient(100deg,#e9edf3 30%,#f7f9fc 45%,#e9edf3 60%); background-size: 250% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position-x: -250%; } }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(5,11,24,.58); backdrop-filter: blur(5px); }
.modal { width: min(520px, 100%); max-height: 88vh; overflow: auto; padding: 26px; border-radius: 20px; background: white; box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.modal h2 { margin: 0; letter-spacing: -.03em; }
.icon-button { width: 34px; height: 34px; color: var(--muted); background: #eef2f7; }
.detail-table { display: grid; gap: 0; margin-top: 20px; }
.detail-row { display: grid; grid-template-columns: 150px 1fr; gap: 20px; padding: 13px 0; border-bottom: 1px solid #edf0f5; font-size: 13px; }
.detail-row span { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.toast {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 390px;
  padding: 13px 16px; border-radius: 12px; color: white; background: var(--nav);
  box-shadow: var(--shadow); opacity: 0; transform: translateY(12px);
  pointer-events: none; transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.editor-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.editor-header h1 { margin: 3px 0 10px; font-size: clamp(30px, 4vw, 44px); letter-spacing: -.045em; }
.back-link { min-height: 24px; padding: 2px 0; margin-bottom: 22px; border: 0; color: var(--accent); background: transparent; font-weight: 750; }
.editor-status { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.publish-actions { display: flex; gap: 10px; }
.editor-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 24px; align-items: start; }
.editor-column { display: grid; gap: 18px; }
.editor-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); }
.section-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 20px; }
.section-title h2 { margin: 0 0 5px; font-size: 20px; }
.section-title p { margin: 0; color: var(--muted); font-size: 13px; }
.save-state { color: var(--success); font-size: 12px; font-weight: 800; }
.field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; outline: 0; color: var(--ink); background: white; resize: vertical; }
.field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.block-list { display: grid; gap: 10px; }
.block-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid #e6ebf2; border-radius: 13px; }
.block-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-size: 11px; font-weight: 900; }
.block-copy { min-width: 0; }
.block-copy strong, .block-copy span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.block-copy span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.block-controls { display: flex; gap: 6px; align-items: center; }
.block-controls .icon-button:disabled { opacity: .3; cursor: default; }
.danger-button { padding: 9px 11px; border: 0; border-radius: 10px; color: var(--danger); background: #fff0f2; font-weight: 750; }
.compact-empty { display: grid; gap: 5px; padding: 28px 18px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); text-align: center; }
.permission-note { margin: 0; padding: 13px 16px; border-radius: 12px; color: #79580a; background: #fff5df; font-size: 13px; }
.preview-column { position: sticky; top: 22px; }
.public-access { margin-top: 18px; text-align: center; }
.public-access h2 { margin: 0 0 8px; font-size: 18px; }
.public-access p { overflow-wrap: anywhere; }
.public-access a { display: inline-block; min-height: 24px; padding-block: 2px; }
.public-access img { max-width: 100%; height: auto; padding: 8px; background: white; }
.preview-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 11px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.preview-label .ghost { padding: 7px 10px; font-size: 11px; letter-spacing: 0; text-transform: none; }
.phone-preview { min-height: 620px; padding: 35px 25px 24px; border: 9px solid var(--ink); border-radius: 38px; color: #f8fbff; background: linear-gradient(155deg,#132548,#08101f 65%); box-shadow: 0 24px 60px rgba(11,19,36,.2); }
.preview-frame { padding: 35px 10px 10px; overflow: hidden; }
.preview-iframe { display: block; width: 100%; min-height: 690px; border: 0; border-radius: 24px; background: white; }
.phone-speaker { width: 60px; height: 5px; margin: -19px auto 34px; border-radius: 8px; background: #4a5870; }
.preview-brand { color: #89a9ff; font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.phone-preview h2 { margin: 13px 0 8px; font-size: 28px; letter-spacing: -.04em; }
.phone-preview > p { margin: 0 0 24px; color: #aebdd5; font-size: 13px; line-height: 1.55; }
.preview-blocks { display: grid; gap: 9px; }
.preview-block { display: grid; gap: 4px; padding: 14px 15px; border: 1px solid #30405a; border-radius: 14px; background: rgba(255,255,255,.055); }
.preview-block small { color: #769dff; font-size: 9px; font-weight: 850; }
.preview-block strong { font-size: 13px; }
.preview-block span { overflow-wrap: anywhere; color: #b7c4d8; font-size: 11px; }
.preview-foot { margin-top: 25px; color: #667894; font-size: 10px; text-align: center; }
.check-field { display: flex; gap: 9px; align-items: center; margin-top: 18px; color: var(--muted); font-size: 13px; }
.mobile-tabs { display: none; }
.editor-loading { max-width: 720px; margin: 40px auto; text-align: center; color: var(--muted); }

@media (max-width: 850px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-story { min-height: 330px; padding: 34px 26px; }
  .auth-copy h1 { font-size: 42px; }
  .auth-proof { display: none; }
  .auth-panel { padding: 38px 24px; }
  .shell { display: block; }
  .sidebar { position: static; width: auto; height: auto; flex-direction: row; align-items: center; padding: 13px 18px; }
  .sidebar .wordmark { padding: 0; }
  .sidebar nav, .sidebar-footer .user-mini { display: none; }
  .sidebar-footer { margin: 0 0 0 auto; padding: 0; border: 0; }
  .logout { margin: 0; width: auto; }
  .main { grid-column: auto; }
  .topbar { height: auto; padding: 14px 20px; }
  .topbar-title { display: none; }
  .org-select { width: 100%; }
  .content { padding-top: 28px; }
  .summary-grid, .analytics-kpis, .privacy-grid { grid-template-columns: 1fr; }
  .privacy-grid .privacy-deletion { grid-column: auto; }
  .editor-layout { grid-template-columns: 1fr; }
  .preview-column { position: static; }
  .phone-preview { width: min(390px, 100%); margin: auto; }
}

@media (max-width: 560px) {
  .auth-story { min-height: 280px; }
  .auth-copy p { font-size: 15px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .business-grid { grid-template-columns: 1fr; }
  .card-actions { grid-template-columns: 1fr; }
  .detail-row { grid-template-columns: 1fr; gap: 4px; }
  .editor-header { align-items: stretch; flex-direction: column; }
  .publish-actions button { width: 100%; }
  .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 16px; border-radius: 12px; background: #e7ecf4; }
  .mobile-tabs button { padding: 10px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-weight: 750; }
  .mobile-tabs button.active { color: var(--ink); background: white; }
  .editor-layout [data-editor-panel="preview"] { display: none; }
  .editor-layout[data-mobile-tab="preview"] [data-editor-panel="preview"] { display: block; }
  .editor-layout[data-mobile-tab="preview"] [data-editor-panel="form"] { display: none; }
  .editor-card { padding: 18px; }
  .section-title { align-items: stretch; flex-direction: column; }
  .block-row { grid-template-columns: 42px minmax(0, 1fr); }
  .block-controls { grid-column: 1 / -1; }
  .phone-preview { min-height: 560px; }
}

.sections-editor { display: grid; gap: 18px; }
.section-subtitle { display: flex; justify-content: space-between; gap: 12px; align-items: end; padding-top: 6px; border-top: 1px solid var(--line); }
.section-subtitle strong { color: var(--ink); font-size: 14px; }
.section-subtitle span { color: var(--muted); font-size: 12px; text-align: right; }
.section-item-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr) 150px; gap: 10px; }
.section-item-row.action-row { grid-template-columns: 150px minmax(0,1fr) minmax(0,1.5fr); }
.section-item-row input, .section-item-row select { width: 100%; }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.legacy-blocks-card { border-style: dashed; }
@media (max-width: 700px) {
  .section-item-row, .section-item-row.action-row, .coordinate-grid { grid-template-columns: 1fr; }
  .section-subtitle { align-items: stretch; flex-direction: column; }
  .section-subtitle span { text-align: left; }
}

.media-library { overflow: hidden; }
.media-library-grid { display: grid; gap: 12px; }
.media-slot { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 13px; border: 1px solid #e6ebf2; border-radius: 14px; background: #fbfcfe; }
.media-visual { width: 92px; height: 72px; overflow: hidden; border-radius: 12px; background: #eef2f7; }
.media-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-placeholder { display: grid; width: 100%; height: 100%; place-items: center; color: #8c98aa; font-size: 26px; font-weight: 400; }
.media-slot-copy { min-width: 0; }
.media-slot-copy strong, .media-slot-copy span, .media-slot-copy small { display: block; }
.media-slot-copy span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.media-slot-copy small { margin-top: 7px; overflow: hidden; color: #7d8898; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.media-slot-control { display: flex; justify-content: flex-end; }
.media-upload-button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 9px 13px; border: 1px solid #cbd5e1; border-radius: 10px; color: var(--ink); background: white; font-size: 12px; font-weight: 800; cursor: pointer; }
.media-upload-button:hover { border-color: var(--accent); color: var(--accent); }
.media-upload-button.disabled { opacity: .45; cursor: default; pointer-events: none; }
.media-file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.media-library-note { margin-top: 14px; }
.media-history { grid-column: 1 / -1; border-top: 1px solid #e6ebf2; padding-top: 10px; }
.media-history summary { color: #526071; font-size: 12px; font-weight: 800; cursor: pointer; }
.media-history-list { display: grid; gap: 8px; margin-top: 10px; }
.media-history-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 9px 10px; border: 1px solid #e9edf3; border-radius: 10px; background: white; }
.media-history-copy { min-width: 0; }
.media-history-copy strong, .media-history-copy span, .media-history-copy small { display: block; }
.media-history-copy span { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.media-history-copy small { margin-top: 3px; color: #8a95a5; font-size: 10px; }
.media-history-actions { display: flex; gap: 8px; align-items: center; flex: 0 0 auto; }
.media-retention { display: grid; gap: 4px; margin-top: 14px; padding: 12px; border: 1px dashed #cbd5e1; border-radius: 12px; background: #f8fafc; color: #627084; font-size: 11px; }
.media-retention strong { color: var(--ink); font-size: 12px; }
.media-presentation { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(150px,1fr) repeat(3,minmax(110px,150px)) auto; gap: 10px; align-items: end; padding: 12px; border-top: 1px solid #e6ebf2; background: #f8fafc; border-radius: 10px; }
.media-presentation-head { min-width: 0; align-self: center; }
.media-presentation-head strong, .media-presentation-head span { display: block; }
.media-presentation-head span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.media-presentation label { display: grid; gap: 5px; color: #526071; font-size: 10px; font-weight: 800; }
.media-presentation select { min-height: 34px; padding: 6px 8px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; color: var(--ink); }
.media-presentation input[type="range"] { width: 100%; accent-color: var(--accent); }
.media-presentation output { color: var(--muted); font-weight: 700; }
.media-presentation-save { min-height: 36px; white-space: nowrap; }
@media (max-width: 860px) {
  .media-presentation { grid-template-columns: 1fr 1fr; }
  .media-presentation-head, .media-presentation-save { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .media-slot { grid-template-columns: 72px minmax(0, 1fr); }
  .media-visual { width: 72px; height: 62px; }
  .media-slot-control { grid-column: 1 / -1; justify-content: stretch; }
  .media-slot-control > * { width: 100%; }
}

/* INCOM-UI-STRUCTURE-001 */
:where(button, input, textarea, select, a):focus-visible {
  outline: 3px solid rgba(39, 100, 255, .35);
  outline-offset: 2px;
}
.sidebar-head, .topbar-leading {
  display: flex;
  align-items: center;
}
.sidebar-head { justify-content: space-between; gap: 12px; }
.sidebar-close, .mobile-nav-toggle {
  display: none;
  border: 0;
  color: inherit;
  background: transparent;
}
.mobile-nav-backdrop[hidden] { display: none; }
.topbar-leading { gap: 12px; min-width: 0; }
.card-actions.single-action { grid-template-columns: 1fr; }
.card-actions.single-action .primary { width: 100%; }
.organization-grid, .settings-grid, .workspace-overview-grid {
  display: grid;
  gap: 18px;
}
.organization-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.settings-grid, .workspace-overview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.workspace-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}
.workspace-card.current { border-color: #a9bfff; }
.workspace-card h2 { margin: 3px 0 0; font-size: 21px; }
.workspace-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.workspace-card button { justify-self: start; }
.organization-card { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.workspace-heading { margin-bottom: 24px; }
.workspace-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.workspace-title-row h1 {
  margin: 2px 0 8px;
  font-size: clamp(30px, 4vw, 46px);
  letter-spacing: -.045em;
}
.workspace-title-row p { margin: 0; color: var(--muted); }
.workspace-statuses { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.workspace-tabs {
  display: flex;
  gap: 8px;
  margin-top: 24px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.workspace-tab {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: white;
  font-weight: 750;
}
.workspace-tab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.workspace-detail-card { max-width: 880px; }
.workspace-empty { max-width: 880px; }
.subpage-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 20px;
}
.subpage-heading h2 { margin: 0 0 5px; font-size: 24px; letter-spacing: -.025em; }
.subpage-heading p { margin: 0; color: var(--muted); }
.audit-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}
.audit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid #edf0f5;
}
.audit-row:last-child { border-bottom: 0; }
.audit-main strong, .audit-main span { display: block; }
.audit-main span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.audit-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
@media (max-width: 850px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(320px, 86vw);
    height: 100dvh;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 20px 16px;
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: 20px 0 60px rgba(5, 11, 24, .26);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .wordmark { padding: 0; }
  .sidebar nav { display: block; }
  .sidebar-footer { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid #26344b; }
  .sidebar-footer .user-mini { display: flex; }
  .logout { margin-top: 14px; width: 100%; }
  .sidebar-close {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #17233a;
    font-size: 24px;
  }
  .mobile-nav-toggle {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: white;
    font-size: 20px;
  }
  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(5, 11, 24, .52);
    backdrop-filter: blur(2px);
  }
  .topbar { min-height: 68px; height: auto; padding: 12px 18px; gap: 14px; }
  .topbar-title { display: inline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .org-select { width: min(48vw, 330px); min-width: 0; }
  .workspace-title-row { align-items: stretch; flex-direction: column; }
  .workspace-statuses { justify-content: flex-start; }
  .settings-grid, .workspace-overview-grid { grid-template-columns: 1fr; }
  .organization-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { align-items: stretch; flex-wrap: wrap; }
  .topbar-leading { width: 100%; }
  .org-select { width: 100%; }
  .organization-card { grid-template-columns: 1fr; }
  .organization-card button { width: 100%; justify-self: stretch; }
  .workspace-tabs { margin-inline: -4px; padding-inline: 4px; }
  .subpage-heading { align-items: stretch; flex-direction: column; }
  .subpage-heading > button { width: 100%; }
  .audit-row { grid-template-columns: 1fr; gap: 10px; }
  .audit-meta { justify-content: space-between; }
}

/* INCOM-UI-PRESENCE-002 */
.presence-editor-nav {
  display: flex;
  gap: 8px;
  margin: 0 0 20px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f4f7fb;
}
.presence-editor-tab {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 780;
}
.presence-editor-tab.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 4px 14px rgba(16, 28, 48, .08);
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.template-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: white;
  text-align: left;
}
.template-card:hover { border-color: #b9c8e8; }
.template-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(39, 100, 255, .10);
}
.template-thumb {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  min-height: 118px;
  padding: 12px;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(145deg, #e9eef8, #f8fafc);
}
.template-thumb i {
  display: block;
  min-height: 28px;
  border-radius: 7px;
  background: white;
  box-shadow: 0 5px 16px rgba(31, 47, 72, .08);
}
.template-thumb i:first-child { grid-column: 1 / -1; min-height: 42px; }
.template-thumb-wide { grid-template-columns: repeat(3, 1fr); }
.template-thumb-wide i:first-child { grid-column: 1 / -1; }
.template-thumb-service-grid i:first-child { min-height: 48px; }
.template-thumb-service-grid i:not(:first-child) { min-height: 42px; }
.template-card-copy { display: grid; gap: 5px; }
.template-card-copy strong { font-size: 15px; }
.template-card-copy small,
.theme-card small { color: var(--muted); line-height: 1.4; }
.template-card-meta {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.design-theme-title { margin-top: 24px; }
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.theme-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: white;
  text-align: left;
}
.theme-card.selected { border-color: var(--accent); }
.theme-card > span:last-child { display: grid; gap: 4px; }
.theme-swatches { display: flex; gap: 6px; }
.theme-swatches i {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(17, 31, 50, .10);
  border-radius: 8px;
}
.design-actions,
.publish-primary-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.semantic-block-list { display: grid; gap: 10px; }
.semantic-block-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}
.semantic-block-row.is-hidden { opacity: .58; background: #f7f9fc; }
.semantic-block-order {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--muted);
  background: #eef2f7;
  font-weight: 800;
}
.semantic-block-copy { display: grid; gap: 4px; min-width: 0; }
.semantic-block-copy span { color: var(--muted); font-size: 12px; }
.semantic-block-controls { display: flex; align-items: center; gap: 7px; }
.publish-checklist {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}
.publish-checklist > div {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.4fr);
  gap: 16px;
  padding: 13px 15px;
  border-bottom: 1px solid #edf0f5;
}
.publish-checklist > div:last-child { border-bottom: 0; }
.publish-checklist span { color: var(--muted); }
.publish-checklist strong { text-align: right; }
.warning-note { color: #874900; background: #fff5df; padding: 10px 12px; border-radius: 10px; }
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.preview-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  color: #654500;
  background: #fff5df;
  font-size: 12px;
  line-height: 1.45;
}
@media (max-width: 1080px) {
  .template-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .presence-editor-nav { margin-inline: -2px; padding: 5px; }
  .template-grid, .theme-grid { grid-template-columns: 1fr; }
  .semantic-block-row { grid-template-columns: 34px minmax(0, 1fr); }
  .semantic-block-controls { grid-column: 1 / -1; justify-content: flex-end; }
  .publish-checklist > div { grid-template-columns: 1fr; gap: 4px; }
  .publish-checklist strong { text-align: left; }
  .design-actions, .publish-primary-actions { flex-direction: column; }
  .design-actions > *, .publish-primary-actions > * { width: 100%; }
}
