:root {
  --brand-teal: #076469;
  --brand-teal-deep: #03484c;
  --brand-teal-soft: #dceeed;
  --brand-coral: #ce614b;
  --brand-coral-deep: #a74635;
  --brand-coral-soft: #f8e4dd;
  --brand-ivory: #fefaf2;
  --paper: #fffdf8;
  --ink: #183a3b;
  --muted: #647778;
  --gold: #cf9d49;
  --danger: #a33d3d;
  --line: #d7e1dc;
  --shadow: 0 18px 48px rgba(3, 72, 76, .11);
  color: var(--ink);
  background: var(--brand-ivory);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 4% 0%, rgba(7, 100, 105, .13) 0, transparent 30rem),
    radial-gradient(circle at 100% 100%, rgba(206, 97, 75, .10) 0, transparent 34rem),
    var(--brand-ivory);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand-teal); font-weight: 700; }
a:hover { color: var(--brand-coral-deep); }

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  color: white;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, .12), transparent 18rem),
    linear-gradient(165deg, var(--brand-teal) 0%, var(--brand-teal-deep) 78%);
  box-shadow: 10px 0 34px rgba(3, 72, 76, .10);
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  margin: 0 8px 28px;
}

.brand small {
  color: #d4ebe8;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.brand-lockup {
  position: relative;
  overflow: hidden;
  background: var(--brand-ivory);
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0, 31, 33, .16);
}

.brand-lockup img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 50%;
}

.sidebar-lockup { width: 180px; height: 112px; }
.login-lockup { width: 220px; height: 138px; margin: 0 auto 18px; }

.eyebrow {
  color: var(--brand-coral-deep);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.nav { display: grid; gap: 7px; }
.nav button {
  position: relative;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  color: #d2e7e5;
  background: transparent;
  text-align: left;
  font-weight: 650;
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.nav button:hover { background: rgba(255, 255, 255, .11); color: white; transform: translateX(2px); }
.nav button.active {
  color: var(--brand-teal-deep);
  background: var(--brand-ivory);
  box-shadow: 0 7px 20px rgba(0, 34, 36, .15);
}
.nav button.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 5px 5px 0;
  background: var(--brand-coral);
}

.sidebar-foot {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 24px;
  color: #bddbd8;
  font-size: .79rem;
  line-height: 1.5;
}

.main { min-width: 0; padding: 32px clamp(20px, 4vw, 58px) 48px; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}
.topbar h1 {
  margin: 0;
  color: var(--brand-teal-deep);
  font: 800 clamp(1.6rem, 3vw, 2.3rem)/1.08 ui-rounded, "Arial Rounded MT Bold", Inter, sans-serif;
  letter-spacing: -.025em;
}
.topbar h1::after {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  margin-top: 11px;
  border-radius: 99px;
  background: var(--brand-coral);
}
.topbar p { margin: 9px 0 0; color: var(--muted); }

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 15px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 253, 248, .88);
  box-shadow: 0 8px 24px rgba(3, 72, 76, .07);
}
.user-pill span { color: var(--muted); font-size: .82rem; }

.grid { display: grid; gap: 18px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; }
.grid.two { grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); }

.card {
  position: relative;
  padding: 21px;
  border: 1px solid rgba(7, 100, 105, .14);
  border-radius: 20px;
  background: rgba(255, 253, 248, .94);
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 14px; color: var(--brand-teal-deep); }
.kpi { overflow: hidden; }
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--brand-teal);
}
.kpi:nth-child(even)::before { background: var(--brand-coral); }
.kpi .label { color: var(--muted); font-size: .84rem; }
.kpi .value {
  margin-top: 8px;
  color: var(--brand-teal-deep);
  font: 800 2rem/1.2 ui-rounded, "Arial Rounded MT Bold", Inter, sans-serif;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.button {
  border: 0;
  border-radius: 11px;
  padding: 10px 15px;
  color: white;
  background: var(--brand-teal);
  box-shadow: 0 7px 18px rgba(7, 100, 105, .18);
  font-weight: 800;
  transition: background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.button:hover { background: var(--brand-teal-deep); box-shadow: 0 9px 22px rgba(7, 100, 105, .23); transform: translateY(-1px); }
.button.secondary { color: var(--brand-teal-deep); background: white; border: 1px solid var(--line); box-shadow: none; }
.button.secondary:hover { border-color: var(--brand-teal); background: var(--brand-teal-soft); }
.button.coral { background: var(--brand-coral); box-shadow: 0 7px 18px rgba(206, 97, 75, .20); }
.button.coral:hover { background: var(--brand-coral-deep); }
.button.danger { background: var(--danger); }
.button.small { padding: 7px 10px; font-size: .82rem; }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button:focus-visible, .nav button:focus-visible, .icon-button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(206, 97, 75, .35);
  outline-offset: 2px;
}

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 15px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 12px 14px; border-bottom: 1px solid #edf1ed; text-align: left; vertical-align: top; }
th {
  color: var(--brand-teal-deep);
  background: #eff7f4;
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .065em;
  text-transform: uppercase;
}
td { font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffaf5; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 99px;
  color: var(--ink);
  background: #e7eeec;
  font-size: .73rem;
  font-weight: 850;
}
.badge.published, .badge.approved, .badge.ok { color: #0d5b43; background: #d9eee5; }
.badge.scheduled, .badge.in_review { color: #78550d; background: #fff0cc; }
.badge.failed, .badge.rejected, .badge.needs_attention { color: #842c2c; background: #f8deda; }
.badge.draft, .badge.viewer { color: #566; background: #e9ecef; }

.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--brand-teal-deep); font-size: .82rem; font-weight: 850; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #c7d6d1;
  border-radius: 11px;
  color: var(--ink);
  background: white;
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: #95b8b3; }
.field input[type="checkbox"] { width: auto; accent-color: var(--brand-teal); }
.field textarea { min-height: 140px; resize: vertical; }
.hint { color: var(--muted); font-size: .78rem; }

.preview { overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: white; }
.preview-head { display: flex; align-items: center; gap: 10px; padding: 14px; }
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, var(--brand-teal) 0 52%, var(--brand-coral) 52%);
  font-weight: 900;
}
.preview-copy { padding: 0 14px 14px; line-height: 1.5; white-space: pre-wrap; }
.preview img { display: block; width: 100%; max-height: 480px; object-fit: contain; background: #f5f3ee; }

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #b9d8d3;
  border-left: 4px solid var(--brand-teal);
  border-radius: 12px;
  color: var(--brand-teal-deep);
  background: #e8f4f1;
}
.notice.error { color: #842f2f; background: #fbe7e2; border-color: #edbfb5; border-left-color: var(--danger); }
.notice.warn { color: #714d0c; background: #fff2d8; border-color: #ead39b; border-left-color: var(--gold); }
.empty { padding: 35px; color: var(--muted); text-align: center; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px;
}
.login-card {
  position: relative;
  overflow: hidden;
  width: min(480px, 100%);
  padding: 36px;
  border: 1px solid rgba(7, 100, 105, .18);
  border-radius: 26px;
  background: rgba(255, 253, 248, .97);
  box-shadow: 0 26px 75px rgba(3, 72, 76, .16);
}
.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: linear-gradient(90deg, var(--brand-teal) 0 52%, var(--brand-coral) 52%);
}
.login-card .eyebrow { margin-top: 4px; text-align: center; }
.login-card h1 {
  margin: 10px 0 9px;
  color: var(--brand-teal-deep);
  font: 800 1.85rem/1.12 ui-rounded, "Arial Rounded MT Bold", Inter, sans-serif;
  text-align: center;
}
.login-card p { margin: 0 0 25px; color: var(--muted); text-align: center; }
.login-card form { display: grid; gap: 16px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 48, 51, .62);
  backdrop-filter: blur(3px);
}
.modal {
  overflow: auto;
  width: min(760px, 100%);
  max-height: 92vh;
  padding: 24px;
  border: 1px solid rgba(7, 100, 105, .15);
  border-radius: 21px;
  background: var(--paper);
  box-shadow: 0 26px 85px rgba(0, 0, 0, .28);
}
.modal.wide { width: min(1000px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; color: var(--brand-teal-deep); }
.icon-button { width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--brand-teal-deep); background: var(--brand-teal-soft); }

.calendar-list { display: grid; gap: 10px; }
.calendar-item {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 13px;
  border-left: 4px solid var(--brand-coral);
  border-radius: 10px;
  background: white;
}
.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.metric .value { margin: 8px 0; color: var(--brand-teal-deep); font: 800 1.55rem ui-rounded, "Arial Rounded MT Bold", Inter, sans-serif; }
.muted { color: var(--muted); }
.caption { max-width: 420px; white-space: pre-wrap; }
.live-image { width: 90px; height: 60px; border-radius: 8px; object-fit: cover; }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1050px) {
  .grid.kpis { grid-template-columns: repeat(2, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: relative; height: auto; padding: 14px; }
  .brand { flex-direction: row; align-items: center; margin: 0 4px 12px; }
  .sidebar-lockup { width: 126px; height: 78px; border-radius: 13px; }
  .nav { display: flex; overflow: auto; padding-bottom: 3px; }
  .nav button { white-space: nowrap; }
  .nav button:hover { transform: none; }
  .sidebar-foot { display: none; }
  .main { padding: 22px 14px 38px; }
  .topbar { align-items: flex-start; }
  .user-pill { align-items: flex-start; flex-direction: column; border-radius: 14px; }
  .grid.kpis, .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .calendar-item { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .login-card { padding: 30px 22px; }
  .login-lockup { width: 190px; height: 120px; }
}
