/* ─── Design tokens ─── */
:root {
  --brand:        #2563eb;
  --brand-dark:   #1d4ed8;
  --brand-light:  #eff6ff;
  --nav-bg:       #0f172a;
  --nav-text:     #cbd5e1;
  --nav-hover:    #ffffff;
  --nav-active:   #2563eb;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --border:       #e2e8f0;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --danger:       #ef4444;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 3px 0 rgba(0,0,0,.08), 0 1px 2px -1px rgba(0,0,0,.06);
  --shadow:       0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.12);
  --nav-w:        220px;
}

/* ─── Reset / base ─── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
}

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

/* ─── Shell layout ─── */
.dcs-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Side nav ─── */
.dcs-nav {
  width: var(--nav-w);
  background: var(--nav-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.dcs-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
}
.dcs-nav-brand-icon {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff;
  flex-shrink: 0;
}
.dcs-nav-brand-name {
  font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -.3px;
}

.dcs-nav-section {
  padding: 16px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #475569;
}

.dcs-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: 6px;
  color: var(--nav-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.dcs-nav-link:hover { background: rgba(255,255,255,.07); color: var(--nav-hover); text-decoration: none; }
.dcs-nav-link.active { background: var(--brand); color: #fff; }
.dcs-nav-link svg { opacity: .75; flex-shrink: 0; }
.dcs-nav-link.active svg { opacity: 1; }

.dcs-nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}
.dcs-nav-link.active .dcs-nav-badge {
  background: #fff;
  color: #dc2626;
}
.dcs-nav-badge-warn {
  background: #f59e0b;
}
.dcs-nav-link.active .dcs-nav-badge-warn {
  background: #fff;
  color: #d97706;
}

.dcs-nav-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px;
}
.dcs-nav-footer .dcs-nav-link { color: #94a3b8; font-size: 13px; }
.dcs-nav-footer form button {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 1px 0;
  border-radius: 6px; color: #94a3b8;
  font-size: 13px; font-weight: 500; width: 100%;
  transition: background .15s, color .15s;
}
.dcs-nav-footer form button:hover { background: rgba(255,255,255,.07); color: #fff; }

/* ─── Main content area ─── */
.dcs-main {
  margin-left: var(--nav-w);
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.dcs-topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 12px;
  position: sticky; top: 0; z-index: 50;
}
.dcs-topbar-title {
  font-size: 15px; font-weight: 600; color: var(--text);
  flex: 1;
}
.billing-db-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  user-select: none;
}
.billing-db-badge--local {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}
.billing-db-badge--azure {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.dcs-topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted);
}
.dcs-topbar-avatar {
  width: 30px; height: 30px;
  background: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}

.dcs-content {
  padding: 28px;
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* Wide tables scroll inside the card, not the whole page */
.table-scroll-x {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* ─── Page header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 {
  font-size: 20px; font-weight: 700; margin: 0;
}

/* ─── Cards ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin: 0 0 16px;
}

/* ─── Buttons (global — use .btn on all pages) ─── */
.btn,
button.btn,
a.btn,
input[type="submit"].btn,
input[type="button"].btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 500; line-height: 1.25;
  padding: 7px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  text-decoration: none; white-space: nowrap;
  font-family: inherit;
  box-sizing: border-box;
}
.btn:disabled,
.btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: none; }

/* Primary — main actions */
.btn-primary,
.cdr-apply-btn,
.import-btn-1voice,
.btn-generate {
  background: var(--brand); color: #fff; border-color: var(--brand);
}
.btn-primary:hover,
.cdr-apply-btn:hover,
.import-btn-1voice:hover,
.btn-generate:hover:not(:disabled) {
  background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; text-decoration: none;
}
.btn-generate:disabled { opacity: .55; cursor: not-allowed; }

/* Secondary — cancel, filter, close, outline */
.btn-secondary,
.btn-outline-secondary,
.cdr-clear-btn,
.btn-filter,
.btn-icon-link {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn-secondary:hover,
.btn-outline-secondary:hover,
.cdr-clear-btn:hover,
.btn-filter:hover,
.btn-icon-link:hover {
  background: var(--surface-2); border-color: #cbd5e1; color: var(--text); text-decoration: none;
}

/* Outline primary = same as secondary (one neutral + one primary palette) */
.btn-outline-primary {
  background: var(--brand-light); color: var(--brand); border-color: #93c5fd;
}
.btn-outline-primary:hover {
  background: #dbeafe; color: var(--brand-dark); border-color: var(--brand); text-decoration: none;
}

/* Danger */
.btn-danger,
.btn-outline-danger {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn-danger:hover,
.btn-outline-danger:hover {
  background: #dc2626; border-color: #dc2626; color: #fff; text-decoration: none;
}

/* Success */
.btn-success,
.btn-outline-success {
  background: var(--success); color: #fff; border-color: var(--success);
}
.btn-success:hover,
.btn-outline-success:hover {
  background: #16a34a; border-color: #16a34a; color: #fff; text-decoration: none;
}

/* Warning / info — mapped to secondary + primary tints for consistency */
.btn-warning {
  background: var(--surface); color: #b45309; border-color: #fde68a;
}
.btn-warning:hover { background: #fffbeb; border-color: #fcd34d; color: #92400e; text-decoration: none; }
.btn-info,
.btn-outline-info {
  background: var(--brand-light); color: var(--brand); border-color: #bfdbfe;
}
.btn-info:hover,
.btn-outline-info:hover {
  background: #dbeafe; color: var(--brand-dark); border-color: var(--brand); text-decoration: none;
}

/* Ghost / link */
.btn-ghost {
  background: transparent; color: var(--text-muted); border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn-link {
  background: none; border: none; color: var(--brand); padding: 0; font-size: 13px;
  cursor: pointer; text-decoration: none; display: inline;
}
.btn-link:hover { color: var(--brand-dark); text-decoration: underline; }

.btn-sm,
.btn.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xs {
  padding: 3px 8px; font-size: 11px; border-radius: 5px;
}

/* CDR pagination */
.cdr-pg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px; padding: 0 8px;
  border-radius: 6px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none; transition: all .15s;
}
.cdr-pg-btn:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.cdr-pg-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Invoice list icon actions */
.act-btn {
  width: 30px; height: 30px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .9rem; cursor: pointer; border: 1px solid var(--border);
  transition: all .15s; background: var(--surface); color: var(--text-muted);
  text-decoration: none; padding: 0;
}
.act-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.act-view  { color: var(--brand); border-color: #bfdbfe; background: var(--brand-light); }
.act-view:hover  { background: #dbeafe; color: var(--brand-dark); }
.act-send  { color: var(--brand); border-color: #bfdbfe; background: var(--brand-light); }
.act-send:hover  { background: #dbeafe; }
.act-paid  { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.act-paid:hover  { background: #dcfce7; }
.act-void  { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.act-void:hover  { background: #fee2e2; }
.act-check { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.act-check:hover { background: #fef3c7; }

/* Billing subscription table icon buttons */
.inv-add-btn,
.inv-edit-btn,
.inv-detail-btn,
.inv-del-btn,
.inv-move-btn,
.inv-expand-btn,
.inv-card-expand-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; flex-shrink: 0; transition: all .15s;
  font-size: 12px; line-height: 1;
}
.inv-add-btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.inv-add-btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.inv-edit-btn,
.inv-detail-btn { background: var(--brand-light); border-color: #bfdbfe; color: var(--brand); }
.inv-edit-btn:hover,
.inv-detail-btn:hover { background: #dbeafe; color: var(--brand-dark); }
.inv-del-btn { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.inv-del-btn:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.inv-move-btn,
.inv-expand-btn,
.inv-card-expand-btn { background: var(--surface); color: var(--text-muted); }
.inv-move-btn:hover:not(:disabled),
.inv-expand-btn:hover,
.inv-card-expand-btn:hover { background: var(--surface-2); color: var(--text); }
.inv-move-btn:disabled { opacity: .35; cursor: default; }

/* ─── Tables ─── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
  max-width: 100%;
  min-width: 0;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  background: var(--surface-2);
  padding: 10px 14px;
  font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:hover td { border-bottom-color: var(--border); }
.table .actions { display: flex; align-items: center; gap: 6px; }

/* ─── Forms ─── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12.5px; font-weight: 500; color: var(--text); }
.form-control {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13.5px; color: var(--text); background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control::placeholder { color: #94a3b8; }
.form-check-input { accent-color: var(--brand); }

/* ─── Alerts / status ─── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; }
.text-danger { color: var(--danger); font-size: 12px; }

/* ─── Badges ─── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 600; }
.badge-blue    { background: var(--brand-light); color: var(--brand); }
.badge-green   { background: #f0fdf4; color: #16a34a; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* ─── Divider ─── */
.section-divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ─── Login page (no nav) ─── */
body.login-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-wrap {
  width: 100%; max-width: 400px; padding: 16px;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}
.login-logo {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px;
}
.login-logo-icon {
  width: 40px; height: 40px;
  background: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
}
.login-logo-name { font-size: 20px; font-weight: 800; color: var(--text); }
.login-card h1 { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.login-card .sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.login-card .form-label { font-size: 13px; font-weight: 500; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }

/* ─── Validation styles ─── */
.validation-summary-errors ul { margin: 0; padding-left: 16px; }
.validation-summary-errors    { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.validation-summary-errors:empty { display: none; }
.validation-summary-valid      { display: none; }
.bl-field .text-danger { display: block; margin-top: 4px; }
.form-control.input-validation-error { border-color: var(--danger); }

/* ─── Modals ─── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 440px;
  padding: 24px;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 16px; color: var(--text-muted);
  line-height: 1; padding: 2px 6px; border-radius: 4px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* ─── Billing CDR alerts (layout partial) ─── */
.billing-cdr-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  color: #92400e;
  font-size: 13px;
}
.billing-cdr-alert > .bi {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.billing-cdr-alert-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.billing-cdr-alert-body strong {
  color: #78350f;
  font-weight: 600;
}
.billing-cdr-alert-link,
button.billing-cdr-alert-link {
  flex-shrink: 0;
  align-self: center;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: var(--brand);
  color: #fff !important;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
}
.billing-cdr-alert-link:hover,
button.billing-cdr-alert-link:hover {
  background: var(--brand-dark);
}

/* ─── Billing toolbar (CDR + 1Voice Credit) ─── */
.billing-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.billing-toolbar-main { flex: 1 1 200px; min-width: 0; }
.billing-toolbar-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a202c;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.billing-toolbar-sub { font-size: 13px; font-weight: 400; color: #718096; }
.billing-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.billing-toolbar-meta {
  font-size: 12px;
  color: #475569;
  line-height: 1.55;
  text-align: right;
  flex: 0 1 360px;
  min-width: 0;
  max-width: 100%;
}
.billing-toolbar-meta-row { margin-bottom: 2px; }
.billing-toolbar-meta-row strong { color: #334155; font-weight: 600; }
.billing-toolbar-last-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
  display: block;
  margin-bottom: 2px;
}
.billing-toolbar-last { font-size: 13px; font-weight: 600; color: #0f172a; }
.billing-toolbar-hint { font-size: 11px; color: #64748b; margin-top: 6px; line-height: 1.4; }

/* ─── Stock toolbar (Index + Inquiry) ─── */
.stock-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  max-width: 100%;
  min-width: 0;
}
.stock-toolbar-left,
.stock-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.stock-toolbar-right {
  border-left: 1px solid var(--border);
  padding-left: 10px;
}
.inq-filter-panel {
  padding: 14px 16px 10px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  max-width: 100%;
  min-width: 0;
}
.inq-filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 10px;
  max-width: 100%;
}
.inq-filter-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1 1 140px;
  max-width: 220px;
}
.inq-filter-field label {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.inq-filter-check { justify-content: flex-end; }
.inq-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── Rate table import upload progress ─── */
.rate-import-track {
  margin-top: 10px;
  max-width: 460px;
  display: none;
}
.rate-import-track-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.rate-import-track-outer {
  position: relative;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.rate-import-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transition: width 0.12s ease-out;
}
.rate-import-stripes {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: repeating-linear-gradient(
    -45deg,
    #667eea,
    #667eea 7px,
    #8d96f2 7px,
    #8d96f2 14px
  );
  background-size: 28px 8px;
  animation: rate-import-stripes-shift 0.65s linear infinite;
}
@keyframes rate-import-stripes-shift {
  from { background-position-x: 0; }
  to   { background-position-x: 28px; }
}

/* Billing > Rates: shared modal overlay */
.rate-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.rate-modal-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  overflow-y: auto;
}
.rate-modal-hdr {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.rate-modal-hdr strong { font-size: 15px; }
.rate-modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #718096;
  line-height: 1;
}

/* Billing > Rates: fixed dock so Save all rates stays visible on long tables */
.rate-lines-form-wrap {
  padding-bottom: 76px;
}
.rates-save-dock {
  position: fixed;
  bottom: 0;
  left: var(--nav-w);
  right: 0;
  z-index: 49;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 12px 28px calc(12px + env(safe-area-inset-bottom, 0));
  background: rgba(248, 250, 252, 0.94);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(8px);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .dcs-nav { display: none; }
  .dcs-main { margin-left: 0; }
  .dcs-content { padding: 16px; }
  .rates-save-dock {
    left: 0;
    padding-left: 16px;
    padding-right: 16px;
  }
  .form-grid { grid-template-columns: 1fr; }
  .stock-toolbar { flex-direction: column; align-items: flex-start; }
  .stock-toolbar-right {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 8px;
    width: 100%;
  }
  .inq-filter-field { max-width: 100%; flex-basis: 100%; }
  .billing-toolbar-meta { text-align: left; flex-basis: 100%; }
}

/* ─── Form submit busy state (Saving…) ─── */
.dcs-form-busy {
  cursor: wait;
}
.dcs-btn-saving {
  cursor: wait !important;
  opacity: 0.88;
  pointer-events: none;
}
.dcs-btn-spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: dcs-btn-spin 0.65s linear infinite;
  vertical-align: -0.12em;
}
@keyframes dcs-btn-spin {
  to { transform: rotate(360deg); }
}
