/* ============ Design tokens ============ */
:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #f1f2ee;
  --surface-3: #e9eae5;
  --ink: #14181f;
  --ink-2: #3a4150;
  --ink-3: #5a6170;
  --muted: #6b7280;
  --line: #e5e6e1;
  --line-strong: #cdcec8;

  --accent: #1e3a5f;
  --accent-hover: #15294a;
  --accent-soft: #e8eef6;
  --accent-strong: #122847;
  --pro: #b8732a;
  --pro-soft: #f6ebd9;
  --success: #2d6a4f;
  --success-soft: #e6f4ec;
  --danger: #b3261e;
  --danger-soft: #fdecec;
  --warn: #b78104;
  --warn-soft: #fdf3d6;

  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(20,24,31,.05);
  --shadow: 0 8px 24px rgba(20,24,31,.06);
  --shadow-lg: 0 24px 48px rgba(20,24,31,.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -0.01em; font-weight: 600; }
h1 { font-size: clamp(1.875rem, 3.5vw, 2.5rem); letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.muted-light { color: rgba(255,255,255,.7); }

/* ============ AUTH SCREEN ============ */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 5fr 6fr;
}
.auth-side {
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  padding: 2.5rem;
  position: relative;
  overflow: hidden;
}
.auth-side::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,.06) 0%, transparent 60%);
}
.auth-side-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: calc(100vh - 5rem);
  max-width: 460px;
  margin-left: auto;
}
.logo-light { color: white; margin-bottom: auto; }
.auth-side-content { margin: 4rem 0; }
.auth-side h1 { color: white; font-size: 2.5rem; margin-bottom: 1.25rem; }
.auth-side > .auth-side-inner > .auth-side-content > p {
  font-size: 1.0625rem;
  color: rgba(255,255,255,.85);
  margin-bottom: 2rem;
  max-width: 36em;
}
.auth-features {
  list-style: none;
  padding: 0;
  margin: 0;
}
.auth-features li {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .625rem 0;
  font-size: .9375rem;
  color: rgba(255,255,255,.92);
}
.check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: rgba(255,255,255,.15);
  color: white;
  border-radius: 4px;
  font-weight: 600;
  font-size: .8125rem;
}
.auth-side-footer { font-size: .8125rem; }

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  background: var(--surface);
}
.auth-form {
  width: 100%;
  max-width: 420px;
}
.auth-form h2 { font-size: 1.625rem; margin-bottom: .5rem; }
.auth-form > .muted { margin-bottom: 2rem; font-size: .9375rem; }
.auth-tip { margin-top: 1.5rem; font-size: .8125rem; text-align: center; }

@media (max-width: 920px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-side { padding: 2rem 1.5rem; }
  .auth-side-inner { min-height: auto; max-width: none; }
  .auth-side-content { margin: 2rem 0; }
  .auth-side h1 { font-size: 1.875rem; }
  .auth-form-wrap { padding: 2rem 1.5rem; }
}

/* ============ Form fields ============ */
.field {
  display: block;
  margin-bottom: 1rem;
}
.field span.label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.field > span {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: .375rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: .75rem .875rem;
  font: inherit;
  font-size: .9375rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder { color: #9aa1ad; }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  font-size: .8125rem;
  color: var(--ink-2);
  margin-bottom: 1.25rem;
  cursor: pointer;
}
.checkbox input { margin-top: .15rem; flex-shrink: 0; }

.form-error {
  margin-top: .75rem;
  padding: .625rem .75rem;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius);
  font-size: .875rem;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .625rem 1.125rem;
  font: inherit;
  font-size: .9375rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, color .15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn-secondary:hover { background: var(--surface-2); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--danger-soft); border-color: #f3c5c1; text-decoration: none; }
.btn-block { width: 100%; }
.btn-lg { padding: .8125rem 1.5rem; font-size: 1rem; }
.btn-sm { padding: .5rem .875rem; font-size: .875rem; }

/* ============ Sidebar layout ============ */
.app-screen {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.logo {
  display: flex;
  align-items: center;
  gap: .625rem;
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  padding: 0 1.5rem;
  margin-bottom: 2rem;
}
.logo:hover { text-decoration: none; }
.logo svg { color: var(--accent); flex-shrink: 0; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 .75rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .75rem;
  border-radius: var(--radius);
  color: var(--ink-2);
  font-size: .9375rem;
  font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.nav-item svg { flex-shrink: 0; opacity: .85; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--line);
}
.user-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem;
  border-radius: var(--radius);
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: .9375rem;
  flex-shrink: 0;
}
.user-meta { flex-grow: 1; min-width: 0; }
.user-name {
  font-size: .875rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-status {
  font-size: .75rem;
  color: var(--muted);
}

/* Mobile header */
.mobile-header {
  display: none;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.mobile-menu-btn {
  background: none;
  border: none;
  padding: .375rem;
  cursor: pointer;
  color: var(--ink);
  border-radius: var(--radius);
}
.mobile-menu-btn:hover { background: var(--surface-2); }
.mobile-header .logo { padding: 0; margin: 0; }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,24,31,.4);
  z-index: 80;
}
.sidebar-backdrop.open { display: block; }

@media (max-width: 920px) {
  .app-screen { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { display: flex; }
}

/* ============ Main content ============ */
.main {
  padding: 2.5rem 2.5rem 4rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 920px) {
  .main { padding: 1.75rem 1.25rem 3rem; }
}

/* Page header */
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: 1.875rem; margin-bottom: .25rem; }
.page-head .muted { margin: 0; font-size: .9375rem; }
.page-head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Section labels */
.section-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  margin: 2.5rem 0 1.25rem;
}
.section-title:first-child { margin-top: 0; }

/* ============ Badges ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-family: var(--font-mono);
  font-size: .6875rem;
  font-weight: 500;
  padding: .25rem .5rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.badge-free { background: var(--accent-soft); color: var(--accent); }
.badge-pro { background: var(--pro-soft); color: var(--pro); }
.badge-active { background: var(--success-soft); color: var(--success); }
.badge-inactive { background: var(--surface-2); color: var(--muted); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }

/* ============ Cards ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.375rem;
  min-width: 0;          /* важно в grid: позволяет колонке сжиматься */
  overflow: hidden;
}
.stat-label {
  font-size: .8125rem;
  color: var(--muted);
  margin-bottom: .5rem;
}
.stat-value {
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-family: var(--font-mono);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-value.text {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: 0;
}
.stat-sub {
  font-size: .8125rem;
  color: var(--muted);
  margin-top: .375rem;
}

/* Plan banner on overview */
.plan-banner {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.plan-banner.free {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.plan-banner h3 { color: inherit; font-size: 1.25rem; margin-bottom: .25rem; }
.plan-banner p { margin: 0; opacity: .85; font-size: .9375rem; }
.plan-banner.free p { color: var(--muted); opacity: 1; }
.plan-banner .btn-primary {
  background: white;
  color: var(--accent);
  border-color: white;
}
.plan-banner .btn-primary:hover { background: var(--surface-2); }
.plan-banner.free .btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.plan-banner.free .btn-primary:hover { background: var(--accent-hover); }

/* Calc cards */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.calc-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.375rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  position: relative;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.calc-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
}
.calc-card.locked { cursor: not-allowed; }
.calc-card.locked:hover { transform: none; box-shadow: none; border-color: var(--line); }
.calc-card.locked .calc-card-icon { opacity: .35; }

.calc-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  gap: .75rem;
}
.calc-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--accent);
  border-radius: var(--radius);
  flex-shrink: 0;
}
.calc-card.locked .calc-card-icon { color: var(--muted); }

.calc-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .375rem;
  color: var(--ink);
  line-height: 1.3;
}
.calc-card p {
  font-size: .875rem;
  color: var(--muted);
  margin: 0;
  flex-grow: 1;
}
.calc-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: .875rem;
  border-top: 1px solid var(--line);
  font-size: .8125rem;
  color: var(--ink-3);
}

/* ============ Plans page ============ */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.875rem 1.625rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.plan-card.featured {
  border-color: var(--accent);
  border-width: 2px;
  box-shadow: 0 12px 32px rgba(30, 58, 95, 0.08);
}
.plan-card-tag {
  position: absolute;
  top: -10px;
  left: 1.625rem;
  background: var(--accent);
  color: white;
  padding: .25rem .625rem;
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 4px;
}
.plan-name { font-size: 1.125rem; font-weight: 600; margin-bottom: .25rem; }
.plan-tagline { color: var(--muted); font-size: .875rem; margin-bottom: 1.5rem; }
.plan-price {
  font-family: var(--font-mono);
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1;
}
.plan-price-sub {
  font-size: .875rem;
  color: var(--muted);
  margin-top: .25rem;
  margin-bottom: 1.5rem;
}
.plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.75rem;
  flex-grow: 1;
}
.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  padding: .375rem 0;
  font-size: .9375rem;
  color: var(--ink-2);
}
.plan-features li::before {
  content: "✓";
  color: var(--success);
  font-weight: 600;
  flex-shrink: 0;
}
.plan-savings {
  display: inline-block;
  font-size: .75rem;
  font-weight: 500;
  color: var(--success);
  background: var(--success-soft);
  padding: .125rem .5rem;
  border-radius: 4px;
  margin-top: .5rem;
}

/* Add-on services */
.addon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.addon-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.375rem;
  display: flex;
  flex-direction: column;
}
.addon-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}
.addon-card h4 { font-size: 1rem; margin-bottom: .375rem; }
.addon-card p {
  font-size: .875rem;
  color: var(--muted);
  margin: 0;
  flex-grow: 1;
}
.addon-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.addon-price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

/* ============ History table ============ */
.history-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th, .table td {
  padding: .875rem 1.25rem;
  text-align: left;
  font-size: .9375rem;
  border-bottom: 1px solid var(--line);
}
.table th {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 500;
  background: var(--surface-2);
}
.table tr:last-child td { border-bottom: none; }
.table .col-amount { font-family: var(--font-mono); font-weight: 500; text-align: right; }
.table th.col-amount { text-align: right; }

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.empty-state .empty-icon {
  width: 48px;
  height: 48px;
  background: var(--surface-2);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  margin-bottom: 1rem;
}
.empty-state p { margin: 0 0 1rem; }

/* ============ Profile ============ */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}
.profile-card h3 { margin-bottom: 1.5rem; }
.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.profile-row:last-child { border-bottom: none; }
.profile-row-label { font-size: .8125rem; color: var(--muted); margin-bottom: .25rem; }
.profile-row-value { font-size: .9375rem; color: var(--ink); font-weight: 500; }

/* ============ Calc page (single calculator) ============ */
.calc-back {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-size: .875rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}
.calc-back:hover { color: var(--accent); text-decoration: none; }

.calc-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 920px) {
  .calc-page { grid-template-columns: 1fr; }
}
.calc-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}
.calc-panel h3 {
  font-size: .8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  margin-bottom: 1.25rem;
  font-weight: 600;
}
.calc-title-block { margin-bottom: 1.75rem; }
.calc-title-block h1 { font-size: 1.75rem; margin-bottom: .375rem; }
.calc-title-block p { color: var(--muted); margin: 0; max-width: 50em; }

.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .input-row { grid-template-columns: 1fr; } }

.result-row {
  display: flex;
  justify-content: space-between;
  padding: .75rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .9375rem;
}
.result-row:last-child { border-bottom: none; }
.result-row .label { color: var(--ink-2); }
.result-row .val {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink);
}
.result-row.highlight {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  border-bottom: none;
  font-weight: 500;
}
.result-row.highlight .val {
  font-size: 1.125rem;
  color: var(--accent);
}
.result-note {
  font-size: .8125rem;
  color: var(--muted);
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  line-height: 1.55;
}

/* ============ Modal ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20,24,31,.55);
  backdrop-filter: blur(2px);
}
.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.75rem;
  color: var(--muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  line-height: 1;
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-card h2 { margin-bottom: .25rem; }

.order-summary {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--surface-2);
  border-radius: var(--radius);
}
.order-row {
  display: flex;
  justify-content: space-between;
  padding: .375rem 0;
  font-size: .9375rem;
}
.order-row span { color: var(--muted); }
.order-row strong { font-weight: 500; color: var(--ink); }
.order-total {
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--line);
  font-size: 1rem;
}
.order-total .price {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 600;
}
.payment-note {
  font-size: .8125rem;
  color: var(--muted);
  margin-top: 1rem;
  text-align: center;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: .875rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  font-size: .9375rem;
  animation: slideUp .3s ease;
  max-width: calc(100vw - 2rem);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .plans-grid { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 1.5rem; }
  .modal-card { padding: 1.75rem; }
  .table th, .table td { padding: .75rem .875rem; font-size: .875rem; }
  .table .col-hide-sm { display: none; }
  .profile-row { flex-direction: column; align-items: flex-start; gap: .375rem; }
  .stat-card { padding: 1rem 1.125rem; }
  .stat-value { font-size: 1.375rem; }
}

/* ---------- Tabs on auth screen ---------- */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.auth-tab {
  flex: 1;
  background: none;
  border: 0;
  padding: 12px 0;
  font: inherit;
  font-size: 15px;
  color: var(--ink-muted, #6b7280);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.auth-tab:hover { color: var(--ink, #111827); }
.auth-tab.is-active {
  color: var(--accent, #1e3a5f);
  border-bottom-color: var(--accent, #1e3a5f);
  font-weight: 600;
}

/* ============ Training banner & service-instructions ============ */
.training-banner {
  margin-top: 2.5rem;
  padding: 1.75rem 2rem;
  background: var(--surface-2, #f4f6fa);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius-lg, 12px);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.training-banner__text { flex: 1 1 320px; min-width: 0; }
.training-banner__text h3 {
  margin: 0 0 .35rem;
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink, #111827);
}
.training-banner__text p {
  margin: 0;
  color: var(--ink-muted, #4b5563);
  font-size: .95rem;
}
.training-banner .btn { white-space: nowrap; }

@media (max-width: 640px) {
  .training-banner { padding: 1.25rem; gap: 1rem; }
  .training-banner .btn { width: 100%; text-align: center; }
}

.addon-note {
  margin-top: .35rem;
  font-size: .85rem;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: .5rem;
  color: var(--accent, #1e3a5f);
  cursor: pointer;
  font-size: .85rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--accent-hover, #142847); }

.howto-list {
  margin: 1rem 0 1.25rem;
  padding-left: 1.25rem;
  line-height: 1.55;
}
.howto-list li { margin-bottom: .5rem; }
.howto-list ul {
  margin: .35rem 0 .25rem;
  padding-left: 1.1rem;
  list-style: disc;
  color: var(--ink-muted, #4b5563);
}
.howto-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  background: var(--surface-2, #f4f6fa);
  padding: .05rem .35rem;
  border-radius: 4px;
}

.modal-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}
.modal-actions .btn { flex: 0 1 auto; }
@media (max-width: 480px) {
  .modal-actions .btn { flex: 1 1 100%; text-align: center; }
}

/* Если осталась одна доп. услуга — не растягиваем её на всю ширину */
.addons-grid .addon-card:only-child {
  max-width: 480px;
  justify-self: start;
}
.addons-grid:has(.addon-card:only-child) {
  grid-template-columns: minmax(280px, 480px);
  justify-content: start;
}

/* ============ ПОДКЛЮЧАЕМЫЕ КАЛЬКУЛЯТОРЫ (внешние папки) ============ */
.ext-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin: 0 0 2rem;
}
.ext-calc-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--border, #e6eaf2);
  border-radius: 12px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.ext-calc-card:hover {
  box-shadow: 0 6px 20px rgba(30, 58, 95, 0.08);
  transform: translateY(-2px);
}
.ext-calc-card.is-locked { opacity: 0.85; }
.ext-calc-head {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ext-calc-head .badge { align-self: flex-start; }
.ext-calc-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e3a5f;
  line-height: 1.3;
}
.ext-calc-card p { margin: 0; flex: 1; font-size: 0.92rem; line-height: 1.45; }
.ext-calc-card .btn-block { margin-top: auto; }

/* ============ БЫСТРЫЙ СТАРТ (карточки на «Обзоре») ============ */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 0 0 2rem;
}
.quick-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.375rem;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e6eaf2);
  border-radius: var(--radius-lg, 12px);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
  min-width: 0;
}
.quick-card:hover {
  box-shadow: 0 6px 20px rgba(30, 58, 95, 0.08);
  transform: translateY(-2px);
  border-color: var(--accent, #1e3a5f);
}
.quick-card .quick-icon {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.quick-card strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink, #1e3a5f);
}
.quick-card span {
  font-size: 0.875rem;
  color: var(--muted, #6b7a90);
}
