:root {
  --ink: #171918;
  --muted: #6f7471;
  --faint: #939895;
  --line: #dfe2df;
  --line-strong: #c8cdc9;
  --surface: #f8f8f5;
  --surface-2: #f1f2ef;
  --soft: #f1f2ef;
  --panel: #fcfcfa;
  --page: #f5f5f1;
  --green: #15946d;
  --green-bright: #66d9ad;
  --green-soft: #e3f4ec;
  --red: #c84843;
  --red-soft: #fae9e7;
  --warm: #f4f1e8;
  --control-track: #dfe2df;
  color-scheme: light;
}

html[data-theme="dark"] {
  --ink: #f0f1ed;
  --muted: #a0a6a2;
  --faint: #747b77;
  --line: #303633;
  --line-strong: #464d49;
  --surface: #151918;
  --surface-2: #1a1f1d;
  --soft: #1a1f1d;
  --panel: #111513;
  --page: #0e1211;
  --green: #6fe2b6;
  --green-bright: #78e6bb;
  --green-soft: #173229;
  --red: #ff7771;
  --red-soft: #3a2221;
  --warm: #26251f;
  --control-track: #323836;
  color-scheme: dark;
}

html, body { background: var(--page); color: var(--ink); }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { color: var(--ink); }

header {
  height: 70px;
  padding: 0 24px 0 28px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--page) 94%, transparent);
  backdrop-filter: blur(16px);
}
header > .brand { display: flex; }
.brand { gap: 8px; letter-spacing: -.035em; }
.brand b { font-size: 20px; font-weight: 800; }
.brand span { color: var(--faint); font-weight: 650; }
.actions { align-items: center; gap: 8px; margin-left: auto; }
.actions .btn { min-height: 38px; }
.icon-btn { width: 38px; padding: 0; display: grid; place-items: center; }
.system-state { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; color: var(--muted); font-size: 12px; }
.system-state i, .profile-access i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 13%, transparent); }
.system-state.problem i { background: var(--red); }
.user-trigger { height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 11px 0 5px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.user-trigger > span { width: 28px; height: 28px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); font-size: 10px; font-weight: 800; }
.user-trigger b { max-width: 160px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }

aside {
  z-index: 10;
  top: 70px;
  width: 220px;
  padding: 0 16px 18px;
  border-color: var(--line);
  background: var(--surface);
}
.aside-brand { display: none; }
.eyebrow { padding: 0 12px 10px; color: var(--faint); }
nav { gap: 2px; }
nav button { min-height: 43px; border-radius: 0; padding: 10px 12px; color: var(--muted); position: relative; }
nav button:hover { background: var(--surface-2); color: var(--ink); }
nav button.active { background: var(--green-soft); color: var(--green); }
nav button.active::before { content: ""; position: absolute; left: -16px; top: 0; bottom: 0; width: 3px; background: var(--green); }
nav i { font-size: 16px; }
.bottom { border-top: 1px solid var(--line); padding-top: 11px; }
.bottom .backend-state { pointer-events: none; }
.bottom .backend-state i { color: var(--green); font-size: 10px; }
.aside-foot { padding: 15px 12px 0; color: var(--faint); font-size: 9px; letter-spacing: .11em; text-transform: uppercase; }

main { margin-left: 220px; padding: 96px 28px 40px; }
.content { max-width: 1420px; }
.notice { display: none; }
.page-head { margin: 0 0 27px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-size: 30px; font-weight: 760; }
.page-head p { color: var(--muted); }
.section-kicker { display: block; margin-bottom: 8px; color: var(--green); font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }

.btn { border-radius: 0; border-color: var(--line-strong); background: var(--panel); }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--page); }
.field, .form input, .form select, .form textarea, .wizard-field input, .wizard-field select, .wizard-field textarea,
.mailing-grid input, .mailing-grid select, .mailing-grid textarea, .warmup-settings select, .warmup-settings textarea, .time-window input {
  border-radius: 0 !important;
  border-color: var(--line-strong) !important;
  background: var(--panel) !important;
}
.card { border-radius: 0; border-color: var(--line); background: var(--panel); }
th, td { border-color: var(--line); }
th { color: var(--faint); text-transform: uppercase; letter-spacing: .065em; font-size: 10px; }
pre { background: var(--surface); color: var(--ink); }
footer { border-color: var(--line); color: var(--faint); }

/* Dashboard */
#page-home { border: 1px solid var(--line); background: var(--panel); }
.dashboard-masthead { min-height: 112px; padding: 22px 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dashboard-masthead > div { display: flex; align-items: baseline; gap: 18px; letter-spacing: -.065em; }
.dashboard-masthead b { font-size: clamp(38px, 5vw, 70px); line-height: .9; font-weight: 850; }
.dashboard-masthead span { color: var(--faint); font-size: clamp(28px, 4vw, 58px); line-height: .9; font-weight: 350; }
.dashboard-masthead small { color: var(--faint); font-size: 9px; line-height: 1.6; font-weight: 700; letter-spacing: .14em; }
.metrics { grid-template-columns: repeat(4, 1fr); gap: 0; margin: 0; border-bottom: 1px solid var(--line); }
.metrics article { min-height: 104px; padding: 22px 28px; border: 0; border-right: 1px solid var(--line); border-radius: 0; }
.metrics article:last-child { border-right: 0; }
.metrics strong { font-size: 35px; font-weight: 780; }
.metrics span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; border-bottom: 1px solid var(--line); }
.operations-panel { min-width: 0; padding: 0 28px 22px; }
.control-panel, .profile-settings { position: static; width: auto; inset: auto; padding: 0; border: 0; display: block; background: transparent; }
.control-panel { border-left: 1px solid var(--line); padding: 0 24px 22px; }
.panel-head { height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head button { border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.panel-head small { color: var(--faint); font-size: 10px; }
.operation-head, .operation-row { display: grid; grid-template-columns: 75px 130px minmax(0, 1fr) 120px; align-items: center; gap: 12px; }
.operation-head { height: 42px; color: var(--faint); font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.operation-row { min-height: 48px; border-bottom: 1px solid var(--line); font-size: 12px; }
.operation-row:last-child { border-bottom: 0; }
.operation-row .op-type, .operation-row time { color: var(--muted); }
.operation-row .op-description { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operation-row .op-status { display: flex; align-items: center; gap: 7px; font-size: 11px; }
.operation-row .op-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.operation-row.failed .op-status { color: var(--red); }
.operation-row.failed .op-status i { background: var(--red); }
.operation-empty { padding: 34px 0; color: var(--muted); }
.control-status { display: grid; gap: 10px; padding: 19px 0; border-bottom: 1px solid var(--line); }
.control-status > span, .control-limits h3 { color: var(--faint); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.control-status b { display: flex; align-items: center; gap: 10px; color: var(--green); }
.control-status b i { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.control-bars { padding: 8px 0 17px; border-bottom: 1px solid var(--line); }
.control-bars label { display: grid; gap: 8px; margin-top: 14px; }
.control-bars label > span { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.control-bars label b { color: var(--ink); }
.control-bars label > i { height: 4px; background: var(--control-track); overflow: hidden; }
.control-bars label em { display: block; width: 0; height: 100%; background: var(--green); transition: width .25s ease; }
.control-limits { padding-top: 17px; }
.control-limits h3 { margin: 0 0 8px; }
.control-limits > div { display: flex; justify-content: space-between; padding: 7px 0; color: var(--muted); font-size: 11px; }
.control-limits b { color: var(--ink); }
.warmup-plan { padding: 0 28px 22px; }
.home-warmup-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.home-warmup-day { min-height: 104px; padding: 14px 16px; border-right: 1px solid var(--line); }
.home-warmup-day:last-child { border-right: 0; }
.home-warmup-day b, .home-warmup-day span { display: block; }
.home-warmup-day small { color: var(--muted); }
.home-warmup-day span { margin-top: 15px; color: var(--green); font-size: 11px; }

/* Personal cabinet */
.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; border: 1px solid var(--line); background: var(--panel); }
.profile-main { border-right: 1px solid var(--line); }
.profile-identity { min-height: 154px; display: flex; align-items: center; gap: 22px; padding: 28px; border-bottom: 1px solid var(--line); }
.profile-avatar { width: 74px; height: 74px; display: grid; place-items: center; flex: 0 0 auto; background: var(--green-soft); color: var(--green); font-size: 20px; font-weight: 800; }
.profile-identity h2 { margin: 0 0 4px; font-size: 21px; }
.profile-identity p { margin: 0 0 12px; color: var(--muted); }
.profile-access { display: inline-flex; align-items: center; gap: 8px; color: var(--green); font-size: 11px; font-weight: 700; }
.profile-section { padding: 25px 28px; border-bottom: 1px solid var(--line); }
.profile-section:last-child { border-bottom: 0; }
.profile-section h3 { margin: 0 0 9px; font-size: 16px; }
.profile-section > p { margin: 0 0 18px; color: var(--muted); }
.profile-section dl { margin: 0; }
.profile-section dl > div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.profile-section dl > div:last-child { border-bottom: 0; }
.profile-section dt { color: var(--muted); }
.profile-section dd { margin: 0; font-weight: 700; }
.profile-settings .profile-section { border-bottom: 1px solid var(--line); }
.theme-choice { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line-strong); }
.theme-choice button { min-height: 38px; border: 0; border-right: 1px solid var(--line-strong); background: transparent; color: var(--muted); font-size: 11px; }
.theme-choice button:last-child { border-right: 0; }
.theme-choice button.active { background: var(--ink); color: var(--page); }
.danger-zone .btn { color: var(--red); }

/* Existing feature surfaces */
.warmup-info, .wizard-note, .spintax-help { border-radius: 0; background: var(--warm); }
.warmup-modes article, .warmup-program, .warmup-day, .mailing-program, .mailing-window-block, .time-window, .mode-list label, .account-group, .review-list article { border-radius: 0; border-color: var(--line); background: var(--panel); box-shadow: none; }

/* The legacy mailing form set a white background on this nested wrapper. */
.mailing-window-block .time-window { background: var(--panel); }

/* Keep the mailing personalization helper within the neutral surface palette. */
.spintax-help { border: 1px solid var(--line); background: var(--surface); }
.spintax-help code { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }

/* Remove labels and icons that repeat a nearby page title or action. */
aside > .eyebrow,
.aside-foot,
.dashboard-masthead small,
.section-kicker,
.profile-access,
.empty > div > i,
.bottom .backend-state { display: none; }

aside nav button { gap: 0; }
.warmup-progress, .mailing-progress { border-radius: 0; background: var(--control-track); }
.warmup-progress i, .mailing-progress i { border-radius: 0; background: var(--green); }
.modal, .login-card { border-radius: 0; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 24px 80px #0005; }
.login { background: var(--page); }
.login-card input { border-radius: 0; background: var(--panel); border-color: var(--line-strong); }
.login-card .brand { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.backdrop { background: #070a0980; backdrop-filter: blur(4px); }
.restriction, .warmup-program-status, .mailing-program-status { border-radius: 0; }

/* Legacy surfaces used --soft or hard-coded light status colours. Keep them
   within the same graphite stack when the interface is dark. */
.token { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.token .btn { background: var(--panel); color: var(--ink); }
.token .btn:hover { background: var(--surface); }
.quick button { background: var(--panel); border-color: var(--line); color: var(--ink); }
.quick button:hover { background: var(--surface-2); }
.restriction { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); }
html[data-theme="dark"] .restriction.clear { border-color: color-mix(in srgb, var(--green) 34%, var(--line)); background: var(--green-soft); color: var(--green); }
html[data-theme="dark"] .restriction.limited { border-color: #5d4a28; background: #2b2417; color: #e3b75f; }
html[data-theme="dark"] .restriction.blocked,
html[data-theme="dark"] .restriction.error { border-color: color-mix(in srgb, var(--red) 38%, var(--line)); background: var(--red-soft); color: var(--red); }
html[data-theme="dark"] .restriction.checking { border-color: #30496f; background: #172238; color: #91b7ff; }
html[data-theme="dark"] .mailing-warning { border-color: color-mix(in srgb, var(--red) 38%, var(--line)); background: var(--red-soft); color: var(--red); }

/* Mailing: the campaign body uses the same surface stack as the rest of the UI. */
.mailing-program-status {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
}
.mailing-program-status.running {
  border-color: #30496f;
  background: #172238;
  color: #91b7ff;
}
.mailing-program-status.paused {
  border-color: #5d4a28;
  background: #2b2417;
  color: #e3b75f;
}
.mailing-program-status.succeeded {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  background: var(--green-soft);
  color: var(--green);
}
.mailing-program-status.partial,
.mailing-program-status.failed {
  border-color: color-mix(in srgb, var(--red) 38%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}
.mailing-message,
.mailing-review-message {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--ink);
}
.mailing-message p { color: var(--ink); }
.mailing-chevron { color: var(--faint); }
.btn.danger { border-color: color-mix(in srgb, var(--red) 44%, var(--line)); }
.btn.danger:hover { background: var(--red-soft); }

/* Warmup: keep every state inside the graphite palette in dark mode. */
html[data-theme="dark"] .warmup-program-status {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
}
html[data-theme="dark"] .warmup-program-status.done {
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
  background: var(--green-soft);
  color: var(--green);
}
html[data-theme="dark"] .warmup-program-status.active {
  border-color: #30496f;
  background: #172238;
  color: #91b7ff;
}
html[data-theme="dark"] .warmup-program-status.paused {
  border-color: #454673;
  background: #222238;
  color: #aaaef0;
}
html[data-theme="dark"] .warmup-program-status.failed {
  border-color: color-mix(in srgb, var(--red) 38%, var(--line));
  background: var(--red-soft);
  color: var(--red);
}
html[data-theme="dark"] .warmup-day,
html[data-theme="dark"] .warmup-day.active,
html[data-theme="dark"] .warmup-day.done,
html[data-theme="dark"] .warmup-day.problem,
html[data-theme="dark"] .warmup-day[open] {
  background: var(--panel);
  box-shadow: none;
}
html[data-theme="dark"] .warmup-day.active {
  border-color: #42649a;
}
html[data-theme="dark"] .warmup-day.done {
  border-color: color-mix(in srgb, var(--green) 24%, var(--line));
}
html[data-theme="dark"] .warmup-day.problem {
  border-color: color-mix(in srgb, var(--red) 48%, var(--line));
}
html[data-theme="dark"] .warmup-day[open] {
  border-color: var(--line-strong);
}
html[data-theme="dark"] .warmup-day.problem[open] {
  border-color: color-mix(in srgb, var(--red) 54%, var(--line));
}
html[data-theme="dark"] .warmup-day summary,
html[data-theme="dark"] .warmup-day-details,
html[data-theme="dark"] .warmup-session-detail {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}
html[data-theme="dark"] .warmup-session-dot {
  background: #5c635f;
}
html[data-theme="dark"] .warmup-session-dot.done {
  background: var(--green);
}
html[data-theme="dark"] .warmup-session-dot.active {
  background: #6f9cf1;
  box-shadow: 0 0 0 3px #1b2940;
}
html[data-theme="dark"] .warmup-session-dot.paused {
  background: #8c91e3;
}
html[data-theme="dark"] .warmup-session-dot.failed,
html[data-theme="dark"] .warmup-session-dot.stopped {
  background: var(--red);
}
html[data-theme="dark"] .warmup-session-dot.skipped {
  background: var(--green);
}
html[data-theme="dark"] .warmup-session-index {
  background: var(--surface-2);
  color: var(--muted);
}
html[data-theme="dark"] .warmup-session-index.done {
  background: var(--green-soft);
  color: var(--green);
}
html[data-theme="dark"] .warmup-session-index.active {
  background: #1b2940;
  color: #91b7ff;
}
html[data-theme="dark"] .warmup-session-index.failed,
html[data-theme="dark"] .warmup-session-index.stopped,
html[data-theme="dark"] .warmup-session-index.skipped {
  background: var(--red-soft);
  color: var(--red);
}
html[data-theme="dark"] .warmup-action.done { color: var(--green); }
html[data-theme="dark"] .warmup-action.active { color: #91b7ff; }
html[data-theme="dark"] .warmup-detail-actions .btn {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}
html[data-theme="dark"] .warmup-detail-actions .btn:hover {
  background: #222825;
}

@media (max-width: 1100px) {
  .dashboard-masthead small, .system-state { display: none; }
  .home-grid { grid-template-columns: 1fr; }
  .control-panel { border-left: 0; border-top: 1px solid var(--line); }
  .home-warmup-days { overflow-x: auto; grid-template-columns: repeat(7, 150px); }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-main { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 850px) {
  header { height: 62px; padding: 0 12px; }
  .actions { width: 100%; justify-content: flex-end; }
  .actions #stopAll { margin-right: auto; font-size: 11px; }
  .user-trigger b { display: none; }
  aside { top: 62px; width: 66px; padding: 10px 8px; }
  .aside-brand, .aside-foot { display: none; }
  nav button.active::before { left: -8px; }
  main { margin-left: 66px; padding: 78px 10px 28px; }
  .dashboard-masthead { min-height: 84px; padding: 18px; }
  .dashboard-masthead > div { gap: 9px; }
  .dashboard-masthead b { font-size: 30px; }
  .dashboard-masthead span { font-size: 24px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metrics article:nth-child(2) { border-right: 0; }
  .metrics article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .metrics article { padding: 15px; min-height: 84px; }
  .operation-head, .operation-row { grid-template-columns: 54px 1fr 90px; }
  .operation-head span:nth-child(2), .operation-row .op-type { display: none; }
  .operations-panel, .warmup-plan { padding-left: 15px; padding-right: 15px; }
  .profile-identity, .profile-section { padding: 20px; }
  .profile-identity { align-items: flex-start; }
}

@media (max-width: 560px) {
  .dashboard-masthead span { display: none; }
  .operation-head, .operation-row { grid-template-columns: 48px 1fr; }
  .operation-head span:last-child, .operation-row .op-status { display: none; }
  .profile-identity { flex-direction: column; }
  .theme-choice { grid-template-columns: 1fr; }
  .theme-choice button { border-right: 0; border-bottom: 1px solid var(--line-strong); }
  .theme-choice button:last-child { border-bottom: 0; }
}

/* Mobile application shell */
@media (max-width: 700px) {
  html, body { min-width: 0; overflow-x: hidden; }
  body { padding-bottom: env(safe-area-inset-bottom); }

  header {
    height: 58px;
    padding: 0 10px 0 14px;
  }
  header > .brand { min-width: 0; }
  header > .brand b { font-size: 16px; white-space: nowrap; }
  header > .brand span { display: none; }
  .actions { gap: 4px; }
  .actions .btn,
  .user-trigger {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    justify-content: center;
  }
  .user-trigger > span { width: 26px; height: 26px; }
  .user-trigger b { display: none; }
  .actions #stopAll { font-size: 0; }
  .actions #stopAll::before { content: "■"; font-size: 11px; }

  aside {
    z-index: 30;
    top: auto;
    right: 0;
    bottom: 0;
    width: auto;
    height: calc(64px + env(safe-area-inset-bottom));
    padding: 0 4px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    border-right: 0;
    background: var(--surface);
    box-shadow: 0 -10px 24px #0003;
    isolation: isolate;
    overflow: hidden;
  }
  aside .aside-brand,
  aside .eyebrow,
  aside .bottom,
  aside .aside-foot { display: none; }
  main .control-panel,
  main .profile-settings {
    height: auto;
    overflow: visible;
    backdrop-filter: none;
  }
  aside #nav {
    display: flex;
    height: 64px;
    gap: 0;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    background: var(--surface);
  }
  aside #nav::-webkit-scrollbar { display: none; }
  aside #nav button {
    position: relative;
    display: flex;
    flex: 0 0 74px;
    min-width: 74px;
    min-height: 64px;
    height: 64px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 4px 6px;
    font-size: 9px;
    line-height: 1.1;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  aside #nav button span { display: block; max-width: 66px; overflow: hidden; text-overflow: ellipsis; }
  aside #nav button i { width: auto; font-size: 15px; line-height: 1; }
  aside #nav button em { display: block; position: absolute; top: 7px; right: 11px; margin: 0; font-size: 9px; }
  aside #nav button.active::before { top: auto; right: 6px; bottom: 0; left: 6px; width: auto; height: 3px; }

  main {
    margin-left: 0;
    min-height: 100dvh;
    padding: 76px 12px calc(112px + env(safe-area-inset-bottom));
  }
  .content { width: 100%; max-width: none; }
  .page-head {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 15px;
  }
  .page-head h1 { font-size: 27px; }
  .page-head p { font-size: 13px; line-height: 1.45; }
  .page-head > .btn { align-self: stretch; min-height: 42px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { min-width: 0; }
  .field { width: 100%; }
  .card { border-radius: 0; -webkit-overflow-scrolling: touch; }
  .card table { min-width: 640px; }
  th, td { padding: 12px; }

  #page-home { margin: 0 -12px; border-right: 0; border-left: 0; }
  .dashboard-masthead { min-height: 80px; padding: 18px 16px; }
  .dashboard-masthead > div { display: block; }
  .dashboard-masthead b { font-size: 31px; letter-spacing: -.06em; }
  .dashboard-masthead small { display: none; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics article { min-height: 82px; padding: 15px 16px; }
  .metrics article:nth-child(2) { border-right: 0; }
  .metrics article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .metrics strong { font-size: 28px; }
  .home-grid { grid-template-columns: 1fr; }
  .operations-panel,
  .warmup-plan { padding: 0 16px 18px; }
  .control-panel { padding: 0 16px 18px; }
  .operation-head,
  .operation-row { grid-template-columns: 50px minmax(0, 1fr) 84px; gap: 8px; }
  .operation-head span:nth-child(2),
  .operation-row .op-type { display: none; }
  .operation-row { min-height: 56px; }

  .warmup-info { align-items: flex-start; flex-direction: column; gap: 5px; margin-bottom: 12px; padding: 13px; }
  .warmup-modes { grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
  .warmup-modes article { padding: 13px; }
  .warmup-program { padding: 16px; }
  .warmup-program-head { align-items: flex-start; flex-direction: column; gap: 11px; }
  .warmup-program h2 { font-size: 20px; }
  .warmup-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
  .warmup-summary span { min-width: 0; }
  .warmup-timeline { margin-right: -5px; }
  .warmup-day { flex-basis: 144px; }
  .warmup-day[open] { flex-basis: min(286px, calc(100vw - 48px)); }
  .warmup-session-detail { grid-template-columns: 24px minmax(0, 1fr); }
  .warmup-detail-actions { grid-column: 2; justify-content: flex-start; }

  .mailing-program > summary {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px 38px 16px 16px;
  }
  .mailing-program h2 { font-size: 20px; overflow-wrap: anywhere; }
  .mailing-program-status { justify-self: start; }
  .mailing-chevron { right: 15px; }
  .mailing-progress { height: 6px; }
  .mailing-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 14px; }
  .mailing-details { padding: 15px; }
  .mailing-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
  .mailing-meta span { min-width: 0; overflow-wrap: anywhere; }
  .mailing-actions { display: grid; grid-column: 1 / -1; grid-template-columns: 1fr 1fr; width: 100%; margin: 2px 0 0; }
  .mailing-actions .btn:last-child { grid-column: 1 / -1; }
  .mailing-message,
  .mailing-review-message { padding: 13px; overflow-wrap: anywhere; }
  .mailing-message p { overflow-wrap: anywhere; }
  .mailing-table { margin: 0 -15px; padding: 0 15px; }
  .mailing-table table { min-width: 680px; }

  .profile-layout { margin: 0 -12px; border-right: 0; border-left: 0; }
  .profile-identity { align-items: flex-start; flex-direction: column; padding: 20px 16px; }
  .profile-section { padding: 20px 16px; }
  .profile-section dl > div { align-items: flex-start; flex-direction: column; gap: 3px; }

  .backdrop { align-items: flex-end; padding: 0; }
  .modal {
    width: 100%;
    max-height: calc(100dvh - 10px);
    padding: 18px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    box-shadow: 0 -18px 60px #0006;
  }
  .wizard-modal { display: flex; flex-direction: column; padding: 0; }
  .wizard-head { padding: 16px; }
  .wizard-steps { padding: 12px 16px; }
  .wizard-body { min-height: 0; max-height: none; flex: 1 1 auto; padding: 18px 16px; }
  .wizard-body h2 { font-size: 21px; }
  .wizard-footer { padding: 13px 16px; }
  .wizard-footer .btn { min-height: 40px; }
  .mailing-account-choice { gap: 12px; padding: 12px; }
  .mailing-account-limit { grid-template-columns: 1fr 72px; }
  .time-window { gap: 8px; padding: 14px; }
  .review-list article { padding-right: 16px; }
  .review-list button { position: static; justify-self: start; padding: 0; }
}

@media (max-width: 360px) {
  .actions #logout { display: none; }
  aside #nav button { flex-basis: 68px; min-width: 68px; }
  .mailing-meta { grid-template-columns: 1fr; }
  .mailing-actions { grid-template-columns: 1fr; }
  .mailing-actions .btn:last-child { grid-column: auto; }
}
