:root {
  --ink: #25242a;
  --muted: #716d78;
  --paper: #f5f3ee;
  --card: #fffefa;
  --line: #dedbd3;
  --purple: #6453c7;
  --purple-dark: #4b3aa8;
  --purple-pale: #eeeafd;
  --mint: #b9eed7;
  --amber: #f4c768;
  --rose: #e38179;
  --green: #24765c;
  --shadow: 0 20px 55px rgba(35, 30, 55, .09);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; letter-spacing: -.035em; }
a { color: var(--purple-dark); }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(400px, .85fr); }
.auth-story { display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: clamp(34px, 5vw, 74px); color: #fff; background:
  radial-gradient(circle at 18% 17%, rgba(185, 238, 215, .23), transparent 25%),
  radial-gradient(circle at 80% 80%, rgba(244, 199, 104, .22), transparent 28%),
  linear-gradient(145deg, #29234d 0%, #5a48b8 62%, #6e5bca 100%); position: relative; overflow: hidden; }
.auth-story::after { content: ""; position: absolute; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; right: -100px; top: 22%; box-shadow: 0 0 0 48px rgba(255,255,255,.04), 0 0 0 96px rgba(255,255,255,.03); }
.brand { display: flex; align-items: center; gap: 11px; font: 800 21px ui-rounded, "SF Pro Rounded", sans-serif; letter-spacing: -.04em; }
.brand-light { color: #fff; position: relative; z-index: 1; }
.brand-mark { display: inline-grid; place-items: center; width: 35px; height: 35px; border-radius: 10px 10px 10px 3px; color: #fff; background: var(--purple); font-size: 17px; }
.brand-light .brand-mark { color: #4b3aa8; background: var(--mint); }
.auth-copy { max-width: 690px; position: relative; z-index: 1; }
.auth-copy h1 { max-width: 650px; font-size: clamp(44px, 5.5vw, 76px); line-height: 1.01; margin-bottom: 26px; }
.auth-copy > p:last-child { max-width: 590px; color: rgba(255,255,255,.78); font-size: 19px; line-height: 1.6; }
.eyebrow { margin: 0 0 10px; color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow.ink { color: var(--purple); }
.auth-proof { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 1; }
.auth-proof span { padding: 8px 12px; border: 1px solid rgba(255,255,255,.23); border-radius: 999px; color: rgba(255,255,255,.85); font-size: 12px; }
.auth-panel { display: grid; place-items: center; padding: 40px; background: #ebe8e1; }
.auth-card { width: min(460px, 100%); padding: 38px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 30px; margin-bottom: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 36px; padding: 4px; background: #efede8; border-radius: 10px; }
.segmented button { padding: 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.stack { display: grid; gap: 19px; }
.stack label, .field { display: grid; gap: 7px; color: #403d46; font-size: 13px; font-weight: 700; }
.stack small, .field small { color: var(--muted); font-weight: 400; }
input, select, textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #cbc7ce; border-radius: 8px; outline: 0; background: #fff; color: var(--ink); }
textarea { min-height: 120px; resize: vertical; font-family: inherit; }
textarea.code { min-height: 260px; font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(100, 83, 199, .12); }
.form-error { margin: 0; padding: 10px 12px; color: #982c27; background: #fff0ef; border-radius: 7px; font-size: 13px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 41px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 750; font-size: 13px; text-decoration: none; }
.button:hover { border-color: #b8b3bf; transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--purple); border-color: var(--purple); }
.button.primary:hover { background: var(--purple-dark); }
.button.danger { color: #9b2e28; background: #fff2f1; border-color: #f0c1bd; }
.button.small { min-height: 32px; padding: 6px 10px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 34px; padding: 26px 18px 18px; border-right: 1px solid var(--line); background: #ebe8e1; }
.sidebar .brand { padding: 0 9px; }
.sidebar nav { display: grid; gap: 3px; }
.sidebar nav button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 11px; border: 0; border-radius: 8px; background: transparent; color: #615d67; cursor: pointer; text-align: left; font-size: 13px; font-weight: 650; }
.sidebar nav button span { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #cec9d1; border-radius: 7px; font-size: 10px; font-weight: 800; }
.sidebar nav button:hover { background: rgba(255,255,255,.55); color: var(--ink); }
.sidebar nav button.active { background: #fff; color: var(--purple-dark); box-shadow: 0 4px 15px rgba(32,27,45,.06); }
.sidebar nav button.active span { color: #fff; border-color: var(--purple); background: var(--purple); }
.sidebar-foot { display: grid; grid-template-columns: 35px 1fr 30px; align-items: center; gap: 9px; margin-top: auto; padding: 12px 9px 0; border-top: 1px solid var(--line); }
.sidebar-foot strong, .sidebar-foot small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot strong { font-size: 12px; }.sidebar-foot small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 50%; color: var(--purple-dark); background: var(--mint); font-size: 12px; font-weight: 800; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.icon-button:hover { background: #fff; color: var(--ink); }

main { min-width: 0; }
.topbar { min-height: 110px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px clamp(24px, 4.5vw, 64px); border-bottom: 1px solid var(--line); background: rgba(245,243,238,.93); backdrop-filter: blur(16px); }
.topbar h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); }
.top-actions { display: flex; align-items: center; gap: 9px; }
.mobile-menu { display: none; }
.page { padding: 34px clamp(24px, 4.5vw, 64px) 80px; }
.notice { margin: 24px clamp(24px, 4.5vw, 64px) 0; padding: 13px 16px; border: 1px solid #e8c88f; border-radius: 9px; color: #6c4a16; background: #fff8e8; font-size: 13px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { min-height: 145px; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--card); }
.metric p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric strong { font: 700 36px ui-rounded, "SF Pro Rounded", sans-serif; letter-spacing: -.05em; }
.metric small { color: var(--muted); font-size: 11px; }
.metric.tint { background: var(--purple-pale); border-color: #d8d0fa; }
.layout-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: var(--card); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 17px; }
.panel-body { padding: 20px; }
.quick-list { display: grid; gap: 10px; }
.quick-action { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; text-align: left; }
.quick-action:hover { border-color: #bcb5d6; box-shadow: 0 5px 15px rgba(30,25,45,.05); }
.quick-action .bubble { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; color: var(--purple-dark); background: var(--purple-pale); font-weight: 800; }
.quick-action strong, .quick-action small { display: block; }.quick-action strong { font-size: 13px; }.quick-action small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.progress { height: 7px; overflow: hidden; border-radius: 999px; background: #e8e4eb; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--purple); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters input, .filters select { min-height: 38px; width: auto; min-width: 160px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 14px; color: var(--muted); background: #f0eee9; text-align: left; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td { padding: 14px; border-top: 1px solid #e6e2dc; vertical-align: middle; }
tbody tr:hover { background: #fdfcf8; }
.cell-title { font-weight: 750; }.cell-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.tag, .status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: capitalize; }
.tag { margin: 2px; color: var(--purple-dark); background: var(--purple-pale); }
.status { color: #5e5964; background: #ece9ec; }
.status.subscribed, .status.sent, .status.active, .status.published, .status.approved { color: #1b684e; background: #daf3e8; }
.status.scheduled, .status.pending, .status.sending { color: #725117; background: #fff0c8; }
.status.unsubscribed, .status.failed, .status.cancelled, .status.suspended { color: #8d2e29; background: #fde2df; }
.row-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.empty { padding: 52px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font: 700 17px ui-rounded, "SF Pro Rounded", sans-serif; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.content-card { display: flex; flex-direction: column; min-height: 190px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.content-card h3 { margin: 13px 0 6px; font-size: 17px; }.content-card p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.content-card .row-actions { margin-top: auto; padding-top: 14px; }
.card-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px; color: var(--purple-dark); background: var(--purple-pale); font-weight: 800; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 12px; font-weight: 500; }
.checkbox input { width: auto; min-height: 0; margin-top: 3px; }
.help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.modal { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px; background: var(--card); box-shadow: 0 35px 100px rgba(20,15,35,.28); overflow: auto; }
.modal::backdrop { background: rgba(30,26,41,.58); backdrop-filter: blur(3px); }
.modal-close { position: absolute; right: 15px; top: 13px; z-index: 2; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #efede8; cursor: pointer; font-size: 22px; }
.modal-content { padding: 30px; }
.modal-content h2 { margin-bottom: 5px; font-size: 26px; }.modal-content > p { color: var(--muted); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 380px; padding: 13px 16px; color: #fff; background: #2d2935; border-radius: 9px; box-shadow: var(--shadow); font-size: 13px; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.report-card { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }.report-card strong { display: block; margin: 7px 0 2px; font: 700 30px ui-rounded, "SF Pro Rounded", sans-serif; }.report-card small { color: var(--muted); }
.bar-chart { display: flex; align-items: end; gap: 5px; height: 150px; padding-top: 18px; }.bar-chart span { flex: 1; min-width: 4px; border-radius: 4px 4px 0 0; background: var(--purple); opacity: .75; }
.callout { padding: 15px; border: 1px solid #d7d0f5; border-radius: 10px; color: #514592; background: var(--purple-pale); font-size: 12px; line-height: 1.55; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-copy h1 { font-size: 52px; }
}
@media (max-width: 820px) {
  .auth-shell { grid-template-columns: 1fr; }.auth-story { min-height: 48vh; }.auth-panel { padding: 28px 18px; }
  .app-shell { grid-template-columns: 1fr; }.sidebar { position: fixed; z-index: 12; width: 244px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); }.sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; }
  .topbar { justify-content: flex-start; }.top-actions { margin-left: auto; }
  .layout-grid { grid-template-columns: 1fr; }.report-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .auth-story { padding: 30px 24px; }.auth-copy h1 { font-size: 40px; }.auth-proof { display: none; }.auth-card { padding: 24px; }
  .topbar { min-height: 92px; padding: 20px 18px; }.topbar h1 { font-size: 25px; }.top-actions .button:not(.primary) { display: none; }
  .page { padding: 24px 18px 60px; }.metric-grid, .card-grid, .report-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }.form-grid .full { grid-column: auto; }.modal-content { padding: 26px 20px; }
}
