:root {
  color-scheme: light;
  --bg: #f4f6f4;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --ink: #19221e;
  --muted: #68736d;
  --line: #dde4df;
  --line-strong: #cbd5cf;
  --accent: #167654;
  --accent-dark: #0f6043;
  --accent-soft: #e9f5ef;
  --blue: #315f88;
  --danger: #a44034;
  --danger-soft: #fff0ed;
  --warning: #795b13;
  --warning-soft: #fff7df;
  --shadow: 0 14px 40px rgba(31, 53, 43, 0.07);
  --shadow-hover: 0 18px 46px rgba(31, 53, 43, 0.11);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --ease: 180ms cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", "Noto Sans", "Helvetica Neue", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select { font: inherit; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
  transition: transform var(--ease);
}
.skip-link:focus { transform: translateY(0); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(22, 118, 84, .34);
  outline-offset: 3px;
}

.app-shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 18px 20px;
  border-right: 1px solid var(--line);
  background: rgba(251, 252, 251, .94);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 11px; margin: 0 6px 34px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { letter-spacing: -.01em; }
.brand-copy small { color: var(--muted); font-size: 12px; }

.nav { display: grid; gap: 5px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: #3a4540;
  font-weight: 600;
  transition: color var(--ease), background var(--ease), transform var(--ease);
}
.nav a span { width: 20px; color: var(--muted); text-align: center; font-size: 18px; }
.nav a:hover { background: #f0f4f1; color: var(--ink); text-decoration: none; transform: translateX(2px); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-dark); }
.nav a[aria-current="page"] span { color: var(--accent); }

.logout-form { margin-top: auto; padding: 18px 7px 0; border-top: 1px solid var(--line); }
.link-button { display: grid; gap: 1px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; text-align: left; }
.link-button:hover { color: var(--ink); }
.link-button small { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.logout-icon { display: none; }

.content { min-width: 0; padding: 36px clamp(22px, 4vw, 54px) 64px; }
.content-inner { width: min(1180px, 100%); margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 4vw, 40px); line-height: 1.1; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: 17px; line-height: 1.3; }
.page-intro { max-width: 660px; margin: 0; color: var(--muted); font-size: 16px; }
.muted, .hint, .empty { color: var(--muted); }
.empty { margin-bottom: 0; }

.panel {
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head p { margin: 3px 0 0; font-size: 13px; }

.button, button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease), background var(--ease);
}
.button:hover, button.button:hover { border-color: #aebbb4; box-shadow: 0 6px 18px rgba(28, 48, 39, .09); text-decoration: none; transform: translateY(-1px); }
.button:active, button.button:active { transform: translateY(0); }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.button.quiet { background: var(--panel-soft); }
.button.danger { border-color: #e5b5ad; color: var(--danger); }
.button.wide { width: 100%; }
button:disabled, .button:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.notice strong { font-weight: 750; }
.notice.warning { border-color: #ead79d; background: var(--warning-soft); color: #5f4c19; }
.notice.error { border-color: #edbdb5; background: var(--danger-soft); color: #773128; }
.notice.success { border-color: #b9dcca; background: var(--accent-soft); color: #155c42; }
.action-notice { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.action-notice div { display: grid; gap: 2px; }
.action-notice span { font-size: 13px; }

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 27px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.status.sent { border-color: #b8d9c7; background: var(--accent-soft); color: var(--accent-dark); }
.status.error, .status.failed, .status.unknown, .status.delivering { border-color: #e8bbb2; background: var(--danger-soft); color: var(--danger); }
.status.warning, .status.queued, .status.retry, .status.missed, .status.cancelled { border-color: #e5d39d; background: var(--warning-soft); color: var(--warning); }
.status.running { border-color: #bfd1e0; background: #eef5fa; color: var(--blue); }

.empty-state { padding: 42px; text-align: center; }
.empty-state > p { max-width: 560px; margin: 8px auto 26px; color: var(--muted); }
.empty-state-icon { display: grid; width: 54px; height: 54px; margin: 0 auto 18px; place-items: center; border-radius: 17px; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.empty-state.compact { padding: 28px; box-shadow: none; }
.setup-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 760px; margin: 0 auto 28px; padding: 0; list-style: none; text-align: left; }
.setup-steps li { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-soft); }
.setup-steps li > span { display: grid; flex: 0 0 auto; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: #e8edea; color: var(--muted); font-weight: 800; font-size: 12px; }
.setup-steps li.done > span { background: var(--accent); color: #fff; }
.setup-steps strong, .setup-steps small { display: block; }
.setup-steps small { color: var(--muted); font-size: 11px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(290px, .8fr); gap: 20px; align-items: start; }
.clients-panel { padding: 0; overflow: hidden; }
.clients-panel > .panel-head { padding: 22px 22px 0; }
.client-cards { display: grid; }
.client-card { padding: 20px 22px; border-top: 1px solid var(--line); transition: background var(--ease); }
.client-card:hover { background: #fbfcfb; }
.client-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.client-card h3 { margin: 0 0 8px; }
.next-action { display: flex; gap: 10px; margin-top: 16px; padding: 11px 12px; border-radius: 12px; background: var(--warning-soft); color: #604d1a; }
.next-action > span { font-weight: 800; }
.next-action strong, .next-action small { display: block; }
.next-action small { margin-top: 1px; opacity: .86; }
.client-summary { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(180px, 1.3fr); gap: 16px; margin-top: 17px; }
.client-summary div { min-width: 0; }
.client-summary span, .client-summary strong, .client-summary small { display: block; }
.client-summary span { margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.client-summary strong { overflow-wrap: anywhere; font-size: 13px; }
.client-summary small { margin-top: 2px; color: var(--muted); }
.side-stack { min-width: 0; }
.compact-panel { padding: 20px; }
.run-list { display: grid; gap: 15px; }
.run-row { display: grid; grid-template-columns: 9px 1fr; gap: 11px; align-items: center; }
.run-row strong, .run-row small { display: block; }
.run-row small { color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #aeb9b3; }
.status-dot.sent { background: var(--accent); }
.status-dot.error, .status-dot.failed, .status-dot.unknown { background: var(--danger); }
.status-dot.running, .status-dot.delivering { background: var(--blue); }
.status-dot.queued, .status-dot.retry, .status-dot.warning { background: #bf8d13; }

.system-details { margin-top: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.58); }
.system-details > summary, .feature-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-radius: inherit;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}
.system-details > summary::-webkit-details-marker, .settings-section > summary::-webkit-details-marker, .feature-panel > summary::-webkit-details-marker, .nested-details > summary::-webkit-details-marker { display: none; }
.system-summary-state { color: var(--muted); font-size: 12px; }
.system-summary-state.ok { color: var(--accent); }
.system-summary-state.bad { color: var(--danger); }
.system-details-body { padding: 0 18px 18px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; }
.facts div { padding: 11px 12px; border-radius: 11px; background: var(--panel-soft); }
.facts dt { color: var(--muted); font-size: 11px; }
.facts dd { margin: 2px 0 0; font-weight: 700; }

.readiness-strip { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid; border-radius: var(--radius); }
.readiness-strip.ready { border-color: #b8dac7; background: var(--accent-soft); }
.readiness-strip.attention { border-color: #e4d39e; background: var(--warning-soft); }
.readiness-icon { display: grid; flex: 0 0 auto; width: 30px; height: 30px; place-items: center; border-radius: 50%; background: #fff; font-weight: 800; }
.readiness-strip strong, .readiness-strip span { display: block; }
.readiness-strip div > span { color: var(--muted); font-size: 13px; }

.settings-form { display: grid; gap: 12px; }
.settings-section { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow); overflow: clip; }
.settings-section > summary {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 20px;
  gap: 13px;
  align-items: center;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  transition: background var(--ease);
}
.settings-section > summary:hover { background: var(--panel-soft); }
.settings-section > summary strong, .settings-section > summary small { display: block; }
.settings-section > summary small { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.section-number { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.section-chevron { width: 9px; height: 9px; border-right: 2px solid #8c9791; border-bottom: 2px solid #8c9791; transform: rotate(45deg); transition: transform var(--ease); }
.settings-section[open] > summary .section-chevron, .feature-panel[open] > summary .section-chevron { transform: rotate(225deg); }
.settings-section-body { display: grid; gap: 18px; padding: 4px 20px 22px 67px; border-top: 1px solid transparent; }
.settings-section[open] .settings-section-body { animation: reveal var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.form, .connection-form { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 16px; }
label { display: grid; align-content: start; gap: 7px; min-width: 0; }
label > span { color: #53605a; font-size: 13px; font-weight: 650; }
.optional { color: var(--muted); font-size: 11px; font-weight: 400; }
input, select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
input:hover, select:hover { border-color: #b6c3bc; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(22,118,84,.1); outline: 0; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
.field-help, .hint { color: var(--muted); font-size: 12px; line-height: 1.45; }
.field-error { color: var(--danger); font-size: 12px; font-weight: 700; }
.is-hidden { display: none !important; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.switch-row > span strong, .switch-row > span small { display: block; }
.switch-row > span { color: var(--ink); }
.switch-row > span small { margin-top: 2px; color: var(--muted); font-weight: 400; }
.switch-row input[role="switch"] { position: relative; flex: 0 0 auto; width: 42px; min-height: 24px; height: 24px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: #cbd3cf; appearance: none; cursor: pointer; transition: background var(--ease); }
.switch-row input[role="switch"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.16); transition: transform var(--ease); }
.switch-row input[role="switch"]:checked { background: var(--accent); }
.switch-row input[role="switch"]:checked::after { transform: translateX(18px); }
.switch-row.disabled { opacity: .58; }

.confirmation-check { display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px; border: 1px solid #e3d39d; border-radius: 12px; background: var(--warning-soft); }
.confirmation-check input, label.check input { flex: 0 0 auto; width: auto; min-height: 0; margin-top: 3px; }
.confirmation-check span strong, .confirmation-check span small { display: block; }
.confirmation-check span small { margin-top: 2px; color: var(--muted); font-weight: 400; }

.nested-details { border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.nested-details > summary { display: flex; justify-content: space-between; gap: 12px; padding: 13px 14px; cursor: pointer; list-style: none; font-weight: 700; }
.nested-details > summary span { color: var(--muted); font-size: 11px; font-weight: 500; }
.nested-details-body { padding: 4px 14px 15px; }
.schedule-fields.schedule-disabled { opacity: .58; }
.schedule-fields.schedule-disabled input, .schedule-fields.schedule-disabled select { background: #f7f8f7; }
.soft-callout { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: #315d4c; font-size: 13px; }

.save-bar { position: sticky; z-index: 5; bottom: 12px; display: flex; align-items: center; justify-content: flex-end; gap: 18px; margin: 4px 0 26px; padding: 12px 14px; border: 1px solid rgba(205,216,210,.88); border-radius: 15px; background: rgba(255,255,255,.92); box-shadow: 0 12px 32px rgba(25,44,35,.13); backdrop-filter: blur(12px); }
.save-bar .muted { margin-right: auto; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.workflow-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.action-card { display: grid; grid-template-columns: 42px 1fr; gap: 15px; align-content: start; }
.action-card > form, .action-card > .notice { grid-column: 1 / -1; }
.action-card-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 13px; background: #edf1ef; color: var(--muted); font-weight: 800; }
.action-card.required .action-card-icon { background: var(--warning-soft); color: var(--warning); }
.action-card.complete .action-card-icon { background: var(--accent-soft); color: var(--accent); }
.action-card h2 { margin-bottom: 4px; }
.action-card p { margin-bottom: 0; color: var(--muted); }
.period-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.period-form .button { grid-column: 1 / -1; }
.period-hint { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border-radius: 11px; background: var(--panel-soft); color: var(--muted); font-size: 12px; }

.feature-panel { padding: 0; overflow: clip; }
.feature-panel > summary strong, .feature-panel > summary small { display: block; }
.feature-panel > summary small { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
.feature-panel-body { padding: 0 20px 20px; }
.show-add-form { display: grid; grid-template-columns: 1.3fr 1fr 1fr 100px auto; gap: 10px; align-items: end; padding: 15px; border-radius: 14px; background: var(--panel-soft); }
.show-list { display: grid; margin-top: 18px; }
.show-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 4px; border-top: 1px solid var(--line); }
.show-row strong, .show-row small { display: block; }
.show-row small { color: var(--muted); }
.delete-confirmation { position: relative; }
.delete-confirmation > summary { color: var(--danger); cursor: pointer; list-style: none; font-size: 13px; }
.delete-confirmation[open] { min-width: 220px; padding: 12px; border: 1px solid #ebc2ba; border-radius: 12px; background: var(--danger-soft); }
.delete-confirmation .check { display: flex; gap: 8px; margin: 8px 0 10px; }

.connection-card { max-width: 800px; }
.connection-head { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.connection-head h2, .connection-head p { margin: 0; }
.connection-head p { margin-top: 3px; color: var(--muted); }
.service-mark { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 14px; font-size: 18px; font-weight: 900; }
.service-mark.pachca { background: #252e2a; color: #fff; }
.service-mark.yandex { background: #ffecec; color: #d92121; }
.connection-form { margin-top: 20px; }
.help-details { width: fit-content; color: var(--muted); font-size: 13px; }
.help-details summary { color: var(--accent-dark); cursor: pointer; font-weight: 700; }
.help-details p { max-width: 620px; margin: 8px 0 0; }
.info-card { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 14px; max-width: 800px; box-shadow: none; }
.info-card h2, .info-card p { margin: 0; }
.info-card p { margin-top: 3px; color: var(--muted); }

.runs-panel { padding: 0; overflow: clip; }
.runs-panel > .panel-head { padding: 22px 22px 0; }
.runs-list { display: grid; }
.run-card { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 20px; padding: 20px 22px; border-top: 1px solid var(--line); }
.run-status { display: grid; align-content: start; justify-items: start; gap: 6px; }
.run-status small { color: var(--muted); }
.run-main h3 { margin: 0; }
.run-main > div:first-child p { margin: 2px 0 13px; color: var(--muted); }
.run-meta { display: flex; flex-wrap: wrap; gap: 9px 22px; }
.run-meta span { font-weight: 650; font-size: 13px; }
.run-meta small { display: block; color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; }
.run-plan { margin: 8px 0 0; font-size: 12px; }
.inline-link { display: inline-block; margin-top: 12px; font-weight: 700; }
.safe-error { margin-top: 13px; padding: 10px 12px; border-radius: 11px; background: var(--danger-soft); color: #773128; font-size: 13px; }
.operator-action { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.operator-action.attention-action { border-color: #e5d39c; background: var(--warning-soft); }
.operator-action.danger-action { border-color: #ebc2ba; background: var(--danger-soft); }
.operator-action.danger-action > summary { color: var(--danger); }
.operator-action > summary { padding: 11px 13px; cursor: pointer; color: var(--accent-dark); font-weight: 750; }
.operator-action form { display: grid; gap: 9px; padding: 0 13px 13px; }
.operator-action form p { margin: 0; color: var(--muted); font-size: 13px; }
.operator-action > p { margin: 0; padding: 0 13px 13px; color: var(--muted); font-size: 13px; }
.operator-action .inline-operation-error { margin: 0 13px 12px; }
.run-card:target { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 3px; }
.operator-action form label { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
.operator-action input[type="radio"], .operator-action input[type="checkbox"] { width: auto; min-height: 0; margin-top: 3px; }
.danger-zone { margin-top: 20px; border-color: #ebc2ba; }
.danger-zone > summary { color: var(--danger); }
.danger-form { display: grid; gap: 12px; max-width: 620px; margin-top: 14px; }
.danger-form .check { display: flex; align-items: flex-start; gap: 9px; }
.danger-form .check input { width: auto; min-height: 0; margin-top: 3px; }
.resolution-note { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.pagination { text-align: center; }

.preview-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 20px; align-items: start; }
.preview-message { min-width: 0; }
.message-preview { margin: 0; padding: 16px; border-radius: 14px; background: #f5f7f6; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; line-height: 1.65; }
.preview-side { position: sticky; top: 24px; }
.preview-facts { display: grid; gap: 13px; margin: 18px 0; }
.preview-facts div { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.preview-facts dt { color: var(--muted); font-size: 11px; }
.preview-facts dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.preview-facts small { display: block; color: var(--muted); font-weight: 400; }
.send-confirm { display: grid; gap: 8px; }
.send-confirm small { color: var(--muted); text-align: center; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); }
.login-card .brand { margin: 0 0 24px; }
.form-error-card { width: min(600px, 100%); margin: 10vh auto; }

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 20; top: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; width: 100%; height: auto; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 0; }
  .brand-copy { display: none; }
  .nav { display: flex; justify-content: center; overflow-x: auto; }
  .nav a { flex: 0 0 auto; min-height: 40px; padding: 0 10px; font-size: 13px; }
  .nav a:hover { transform: none; }
  .logout-form { margin: 0; padding: 0 0 0 12px; border: 0; }
  .logout-form small { display: none; }
  .content { padding-top: 28px; }
  .dashboard-grid, .preview-layout { grid-template-columns: 1fr; }
  .preview-side { position: static; }
  .show-add-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .show-add-form .button { align-self: end; }
}

@media (max-width: 720px) {
  .sidebar { grid-template-columns: minmax(0, 1fr) auto; gap: 5px; padding: 8px 10px 6px; }
  .brand { display: none; }
  .nav { justify-content: flex-start; }
  .nav a { display: grid; grid-template-columns: 1fr; gap: 0; min-width: 67px; padding: 4px 6px; text-align: center; font-size: 10px; }
  .nav a span { width: auto; font-size: 17px; }
  .logout-form { display: block; padding: 0; }
  .logout-form .link-button { display: grid; min-width: 50px; min-height: 44px; place-items: center; gap: 0; padding: 4px; border-radius: 10px; font-size: 10px; text-align: center; }
  .logout-form .link-button:hover { background: #f0f4f1; }
  .logout-form .logout-icon { display: block; font-size: 17px; line-height: 1; }
  .logout-form small { display: none; }
  .content { padding: 22px 14px 48px; }
  .page-head { display: grid; margin-bottom: 20px; }
  .page-head .button { width: 100%; }
  .page-intro { font-size: 14px; }
  h1 { font-size: 29px; }
  .panel { padding: 17px; border-radius: 18px; }
  .action-notice { display: grid; }
  .action-notice .button { width: 100%; }
  .setup-steps, .form-grid, .workflow-grid { grid-template-columns: 1fr; }
  .empty-state { padding: 28px 18px; }
  .client-card { padding: 18px; }
  .client-card-head { display: grid; }
  .client-card-head .button { width: 100%; }
  .client-summary { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .settings-section > summary { grid-template-columns: 32px minmax(0, 1fr) 16px; padding: 16px; }
  .settings-section-body { padding: 4px 16px 18px; }
  .save-bar { bottom: 7px; display: grid; padding: 10px; }
  .save-bar .muted { display: none; }
  .save-bar .button { width: 100%; }
  .period-form { grid-template-columns: 1fr; }
  .show-add-form { grid-template-columns: 1fr; }
  .show-row { align-items: flex-start; }
  .connection-head, .info-card { grid-template-columns: 44px 1fr; }
  .connection-head .status, .info-card .button { grid-column: 1 / -1; width: 100%; }
  .run-card { grid-template-columns: 1fr; gap: 12px; padding: 18px; }
  .run-status { display: flex; align-items: center; justify-content: space-between; }
}

@media (max-width: 390px) {
  .nav a { min-width: 70px; }
  .facts { grid-template-columns: 1fr; }
  .switch-row { align-items: flex-start; }
  .section-number { display: none; }
  .settings-section > summary { grid-template-columns: minmax(0, 1fr) 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
