:root {
  --blue: #0756b8;
  --blue-dark: #073d80;
  --green: #247a52;
  --red: #b42318;
  --ink: #172033;
  --muted: #677085;
  --line: #dfe4ec;
  --surface: #ffffff;
  --background: #f4f6f9;
  --shadow: 0 16px 45px rgba(21, 40, 72, .12);
}

* { box-sizing: border-box; }

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

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  padding: 40px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 20px;
  border-radius: 12px;
  background: var(--blue);
  color: white;
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }
.muted { color: var(--muted); }

.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label { font-size: .88rem; font-weight: 700; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
}
.field textarea { min-height: 105px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 3px solid rgba(7, 86, 184, .14);
  border-color: var(--blue);
}

.button {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  background: var(--blue);
  color: white;
  font-weight: 750;
}
.button:hover { background: var(--blue-dark); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button--quiet { background: #e9eef6; color: var(--ink); }
.button--quiet:hover { background: #dde5f0; }
.button--danger { background: #fff0ee; color: var(--red); }
.button--danger:hover { background: #ffe2dd; }
.button--full { width: 100%; }

.error-message { color: var(--red); font-size: .9rem; min-height: 1.3em; }
.success-message { color: var(--green); font-size: .9rem; min-height: 1.3em; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px clamp(20px, 5vw, 70px);
  background: var(--blue);
  color: white;
}
.app-header strong { display: block; font-size: 1.08rem; }
.app-header small { opacity: .8; }
.app-header .button--quiet { background: rgba(255,255,255,.15); color: white; }
.user-area { display: flex; align-items: center; gap: 12px; }
.user-copy { min-width: 0; }
.user-copy strong, .user-copy small { display: block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: .92rem; }
.user-copy small { font-size: .76rem; }
.user-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,.65);
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  color: white;
  font-weight: 800;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.app-main { width: min(1180px, calc(100% - 40px)); margin: 38px auto 70px; }
.system-status {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 28px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  box-shadow: 0 10px 30px rgba(15, 42, 78, .07);
}
.system-status h2 { margin: 4px 0; font-size: 1.25rem; }
.status-eyebrow { margin: 0; color: #55708f; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.status-items { display: grid; gap: 7px; min-width: 260px; font-size: .9rem; }
.analytics-panel { margin-bottom: 32px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 10px 30px rgba(15, 42, 78, .07); }
.analytics-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.analytics-heading h2 { margin: 4px 0; }
.demo-badge { padding: 7px 11px; border-radius: 999px; background: #fff3cd; color: #704f00; font-size: .78rem; font-weight: 800; }
.demo-badge.is-live { background: #e4f5eb; color: var(--green); }
.analytics-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.analytics-metrics article { display: grid; gap: 5px; padding: 18px; border-radius: 14px; background: #f5f8fc; }
.analytics-metrics small, .analytics-metrics span { color: var(--muted); font-size: .76rem; }
.analytics-metrics strong { font-size: 1.65rem; color: var(--blue); }
.analytics-details { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px; margin-top: 26px; }
.analytics-details h3 { margin-bottom: 14px; font-size: .95rem; }
.analytics-bars { display: flex; align-items: end; gap: 10px; height: 150px; padding-top: 10px; }
.analytics-bar { display: grid; grid-template-rows: 1fr auto; align-items: end; gap: 7px; width: 100%; height: 100%; text-align: center; }
.analytics-bar span { display: block; min-height: 8px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #3980d8, var(--blue)); }
.analytics-bar small { color: var(--muted); }
.analytics-pages { display: grid; gap: 10px; }
.analytics-pages div { display: flex; justify-content: space-between; gap: 15px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.privacy-note { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.audit-panel { margin-bottom: 32px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: 0 10px 30px rgba(15, 42, 78, .07); }
.audit-list { display: grid; gap: 10px; }
.audit-entry { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 1fr) minmax(190px, 1fr); gap: 16px; align-items: center; padding: 14px 16px; border-radius: 12px; background: #f5f8fc; }
.audit-entry strong, .audit-entry span, .audit-entry small { overflow-wrap: anywhere; }
.audit-entry small { color: var(--muted); }
.audit-result--failed { color: #a4262c; }
.toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 24px; }
.toolbar h1 { margin-bottom: 6px; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.tab {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-weight: 750;
}
.tab.is-active { border-color: var(--blue); background: var(--blue); color: white; }

.content-list { display: grid; gap: 12px; }
.content-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}
.content-card--asset { grid-template-columns: 92px 1fr auto; }
.asset-thumbnail { display: grid; width: 92px; height: 72px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #eef3f9; color: var(--blue); text-decoration: none; font-size: .78rem; font-weight: 850; }
.asset-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.media-guide { margin: -6px 0 20px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.media-guide-frame { width: min(360px, 100%); aspect-ratio: 16 / 9; overflow: hidden; border-radius: 9px; background: #e8edf4; }
.media-guide--team .media-guide-frame { width: min(240px, 100%); aspect-ratio: 4 / 5; }
.media-guide-frame img { width: 100%; height: 100%; display: block; object-fit: cover; }
.media-guide-message { margin: 10px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.media-guide-message--ok { color: var(--green); font-weight: 700; }
.media-guide-message--warning { color: #8a5800; font-weight: 700; }
.content-card h3 { margin-bottom: 7px; }
.content-card p { margin-bottom: 0; color: var(--muted); }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge { padding: 5px 9px; border-radius: 999px; background: #eef1f5; font-size: .78rem; font-weight: 750; }
.badge--published { background: #e4f5eb; color: var(--green); }
.empty-state { padding: 55px 25px; text-align: center; border: 1px dashed #bdc6d4; border-radius: 16px; color: var(--muted); }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 25px;
  background: rgba(13, 24, 44, .56);
}
.editor-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 50px);
  overflow: auto;
  padding: 30px;
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow);
}
.editor-header, .editor-actions { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.editor-header { margin-bottom: 25px; }
.editor-actions { margin-top: 24px; }
.editor-actions-main { display: flex; gap: 10px; }
.close-button { border: 0; background: transparent; font-size: 1.8rem; color: var(--muted); }
.checkbox-field { display: flex; align-items: center; gap: 10px; margin: 15px 0; }
.checkbox-field input { width: 18px; height: 18px; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.preview-backdrop { z-index: 20; }
.preview-card {
  width: min(920px, 100%);
  max-height: calc(100vh - 50px);
  overflow: auto;
  border-radius: 18px;
  background: white;
  box-shadow: var(--shadow);
}
.preview-toolbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 18px;
  background: #fff3cd;
  color: #704f00;
  font-size: .87rem;
  font-weight: 800;
}
.preview-toolbar .close-button { color: #704f00; }
.preview-image { width: 100%; max-height: 460px; object-fit: cover; display: block; }
.preview-image--portrait {
  width: min(360px, calc(100% - 44px));
  aspect-ratio: 4 / 5;
  margin: 34px auto 0;
  border-radius: 14px;
  object-fit: cover;
}
.preview-content { padding: clamp(28px, 6vw, 70px); }
.preview-content h1 { max-width: 760px; margin-bottom: 20px; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.06; }
.preview-date { color: var(--blue); font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.preview-snippet { max-width: 700px; margin-bottom: 30px; color: #39445a; font-size: 1.25rem; line-height: 1.55; }
.preview-body { max-width: 700px; color: #30394c; font-size: 1.05rem; line-height: 1.75; white-space: pre-line; }

@media (max-width: 680px) {
  .system-status { align-items: flex-start; flex-direction: column; }
  .status-items { min-width: 0; }
  .analytics-metrics { grid-template-columns: 1fr 1fr; }
  .analytics-details { grid-template-columns: 1fr; }
  .audit-entry { grid-template-columns: 1fr; gap: 5px; }
  .login-card { padding: 28px 22px; }
  .toolbar, .content-card, .editor-actions { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
  .toolbar-actions { flex-direction: column; }
  .content-card { display: grid; }
  .content-card--asset { grid-template-columns: 76px 1fr; }
  .content-card--asset .button { grid-column: 1 / -1; }
  .asset-thumbnail { width: 76px; height: 64px; }
  .two-columns { grid-template-columns: 1fr; gap: 0; }
  .editor-actions-main { flex-direction: column; }
  .user-copy { display: none; }
  .preview-content { padding: 28px 22px 40px; }
}
