/* ==========================================================================
   УправЛуч — Design System
   Единая дизайн-система по мотивам Meta-commerce (DESIGN.md)
   База: Bootstrap 5.3 + Font Awesome 4.7
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Brand & accent */
  --ds-primary: #0064e0;          /* cobalt — только покупка/тариф/оплата */
  --ds-primary-deep: #0457cb;
  --ds-primary-soft: #0091ff;
  --ds-on-primary: #ffffff;
  --ds-ink-button: #000000;
  --ds-on-ink: #ffffff;
  --ds-fb-blue: #1876f2;          /* focus / selected control */
  --ds-meta-link: #385898;

  /* Semantic */
  --ds-success: #31a24c;
  --ds-attention: #f2a918;
  --ds-warning: #f7b928;
  --ds-critical: #e41e3f;
  --ds-critical-strong: #f0284a;

  /* Surface */
  --ds-canvas: #ffffff;
  --ds-surface-soft: #f1f4f7;

  /* Text */
  --ds-ink-deep: #0a1317;
  --ds-ink: #1c1e21;
  --ds-charcoal: #444950;
  --ds-slate: #4b4c4f;
  --ds-steel: #5d6c7b;
  --ds-stone: #8595a4;
  --ds-disabled: #bcc0c4;

  /* Lines */
  --ds-hairline: #ced0d4;
  --ds-hairline-soft: #dee3e9;

  /* Radius */
  --ds-r-xs: 2px;
  --ds-r-sm: 4px;
  --ds-r-md: 6px;
  --ds-r-lg: 8px;
  --ds-r-xl: 16px;
  --ds-r-xxl: 24px;
  --ds-r-xxxl: 32px;
  --ds-r-feature: 40px;
  --ds-r-full: 100px;
  --ds-r-circle: 9999px;

  /* Spacing */
  --ds-sp-xxs: 4px;
  --ds-sp-xs: 8px;
  --ds-sp-sm: 10px;
  --ds-sp-md: 12px;
  --ds-sp-base: 16px;
  --ds-sp-lg: 20px;
  --ds-sp-xl: 24px;
  --ds-sp-xxl: 32px;
  --ds-sp-xxxl: 40px;
  --ds-sp-section-sm: 48px;
  --ds-sp-section: 64px;
  --ds-sp-section-lg: 80px;
  --ds-sp-hero: 120px;

  /* Type */
  --ds-font: "Montserrat", "Helvetica Neue", Helvetica, Arial, "Noto Sans", sans-serif;

  /* Motion */
  --ds-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ds-dur-fast: 150ms;
  --ds-dur: 250ms;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--ds-font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: -0.16px;
  color: var(--ds-ink);
  background: var(--ds-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ds-ink-deep); text-decoration: none; transition: color var(--ds-dur-fast) var(--ds-ease); }
a:hover { color: var(--ds-ink); }

img { max-width: 100%; height: auto; }

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--ds-font);
  font-weight: 500;
  color: var(--ds-ink-deep);
  letter-spacing: -0.02em;
  margin: 0 0 var(--ds-sp-base);
}

h1, .h1 { font-size: 36px; line-height: 1.28; font-weight: 500; }
h2, .h2 { font-size: 28px; line-height: 1.21; font-weight: 500; }
h3, .h3 { font-size: 24px; line-height: 1.25; font-weight: 500; }
h4, .h4 { font-size: 18px; line-height: 1.44; font-weight: 700; letter-spacing: 0; }
h5, .h5 { font-size: 16px; line-height: 1.5; font-weight: 700; letter-spacing: -0.16px; }
h6, .h6 { font-size: 14px; line-height: 1.43; font-weight: 700; letter-spacing: -0.14px; }

p { margin: 0 0 var(--ds-sp-base); }

.text-muted { color: var(--ds-stone) !important; }
.text-steel { color: var(--ds-steel) !important; }
.text-slate { color: var(--ds-slate) !important; }
.text-charcoal { color: var(--ds-charcoal) !important; }
.text-ink { color: var(--ds-ink) !important; }
.text-ink-deep { color: var(--ds-ink-deep) !important; }
.text-cobalt { color: var(--ds-primary) !important; }

/* Bootstrap semantic text utilities → design tokens */
.text-primary { color: var(--ds-ink-deep) !important; }
.text-success { color: var(--ds-success) !important; }
.text-danger { color: var(--ds-critical) !important; }
.text-warning { color: var(--ds-attention) !important; }
.text-info { color: var(--ds-fb-blue) !important; }
.text-secondary { color: var(--ds-steel) !important; }
.text-light { color: var(--ds-stone) !important; }

/* Display scale utilities */
.ds-display { font-size: 64px; line-height: 1.16; font-weight: 500; letter-spacing: -0.03em; }
.ds-display-lg { font-size: 48px; line-height: 1.17; font-weight: 500; letter-spacing: -0.02em; }
.ds-heading-lg { font-size: 36px; line-height: 1.28; font-weight: 500; letter-spacing: -0.02em; }
.ds-heading-md { font-size: 28px; line-height: 1.21; font-weight: 300; letter-spacing: -0.01em; }
.ds-heading-sm { font-size: 24px; line-height: 1.25; font-weight: 500; letter-spacing: -0.01em; }
.ds-subtitle-lg { font-size: 18px; line-height: 1.44; font-weight: 700; }
.ds-subtitle { font-size: 18px; line-height: 1.44; font-weight: 400; }
.ds-body { font-size: 16px; line-height: 1.5; font-weight: 400; letter-spacing: -0.16px; }
.ds-body-bold { font-size: 16px; line-height: 1.5; font-weight: 700; letter-spacing: -0.16px; }
.ds-body-sm { font-size: 14px; line-height: 1.43; font-weight: 400; letter-spacing: -0.14px; }
.ds-body-sm-bold { font-size: 14px; line-height: 1.43; font-weight: 700; letter-spacing: -0.14px; }
.ds-caption { font-size: 12px; line-height: 1.33; font-weight: 400; }
.ds-caption-bold { font-size: 12px; line-height: 1.33; font-weight: 700; }

@media (max-width: 767px) {
  .ds-display { font-size: 36px; }
  .ds-display-lg { font-size: 28px; }
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.ds-container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.ds-main {
  display: block;
  min-height: calc(100vh - 64px);
}

.ds-section { padding-top: var(--ds-sp-section); padding-bottom: var(--ds-sp-section); }
.ds-section-lg { padding-top: var(--ds-sp-section-lg); padding-bottom: var(--ds-sp-section-lg); }
.ds-section-sm { padding-top: var(--ds-sp-section-sm); padding-bottom: var(--ds-sp-section-sm); }

/* App shell: topbar + (sidebar | content) */
.ds-layout {
  display: block;
  min-height: calc(100vh - 64px);
}

/* Logged-in app pages get the sidebar flex shell */
.app .ds-layout {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 64px);
}

.ds-content {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--ds-surface-soft);
  padding: 32px;
}

@media (max-width: 991px) {
  .ds-content { padding: 20px; }
}

/* --------------------------------------------------------------------------
   5. Top bar / header
   -------------------------------------------------------------------------- */
.ds-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--ds-canvas);
  border-bottom: 1px solid var(--ds-hairline-soft);
  height: 64px;
}

.ds-topbar__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.ds-brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--ds-font);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ds-ink-deep);
  white-space: nowrap;
}
.ds-brand:hover { color: var(--ds-ink-deep); }
.ds-brand img { height: 28px; width: auto; margin-right: 10px; }

.ds-topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
}

.ds-topnav__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--ds-r-full);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.14px;
  color: var(--ds-ink);
  border: 1px solid transparent;
}
.ds-topnav__link:hover { background: var(--ds-surface-soft); color: var(--ds-ink-deep); }
.ds-topnav__link.is-active {
  background: var(--ds-ink-deep);
  color: var(--ds-canvas);
  border-color: var(--ds-ink-deep);
}

.ds-topbar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.ds-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--ds-r-circle);
  border: 1px solid var(--ds-hairline-soft);
  background: var(--ds-canvas);
  color: var(--ds-ink);
  font-size: 16px;
  transition: all var(--ds-dur-fast) var(--ds-ease);
}
.ds-icon-btn:hover { border-color: var(--ds-hairline); color: var(--ds-ink-deep); }

.ds-burger {
  display: none;
  border: 0;
  background: transparent;
  font-size: 22px;
  color: var(--ds-ink-deep);
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}

@media (max-width: 991px) {
  .ds-burger { display: inline-flex; }
  .ds-topnav {
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: var(--ds-canvas);
    border-bottom: 1px solid var(--ds-hairline-soft);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px 16px;
    display: none;
  }
  .ds-topnav.is-open { display: flex; }
  .ds-topnav__link { border-radius: var(--ds-r-lg); padding: 12px 16px; }
}

/* --------------------------------------------------------------------------
   6. Sidebar (app)
   -------------------------------------------------------------------------- */
.ds-sidebar {
  flex: 0 0 264px;
  width: 264px;
  background: var(--ds-canvas);
  border-right: 1px solid var(--ds-hairline-soft);
  padding: 20px 12px;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.ds-sidebar__title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ds-stone);
  padding: 8px 12px 12px;
}

.ds-sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--ds-r-lg);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.14px;
  color: var(--ds-charcoal);
  margin-bottom: 2px;
  transition: all var(--ds-dur-fast) var(--ds-ease);
}
.ds-sidebar__link i { width: 18px; text-align: center; color: var(--ds-steel); }
.ds-sidebar__link:hover { background: var(--ds-surface-soft); color: var(--ds-ink-deep); }
.ds-sidebar__link.is-active {
  background: var(--ds-ink-deep);
  color: var(--ds-canvas);
}
.ds-sidebar__link.is-active i { color: var(--ds-canvas); }

.ds-sidebar__note {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--ds-r-lg);
  background: var(--ds-surface-soft);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ds-charcoal);
}

@media (max-width: 991px) {
  .ds-sidebar {
    position: fixed;
    top: 64px; left: 0; bottom: 0;
    z-index: 1029;
    transform: translateX(-100%);
    transition: transform var(--ds-dur) var(--ds-ease);
    box-shadow: 0 8px 30px rgba(10, 19, 23, 0.12);
  }
  .ds-sidebar.is-open { transform: translateX(0); }
}

/* --------------------------------------------------------------------------
   7. Footer
   -------------------------------------------------------------------------- */
.ds-footer {
  background: var(--ds-canvas);
  border-top: 1px solid var(--ds-hairline-soft);
  padding: 48px 0 24px;
  color: var(--ds-steel);
  font-size: 14px;
  letter-spacing: -0.14px;
}

.ds-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}

.ds-footer h6 {
  font-size: 14px;
  font-weight: 700;
  color: var(--ds-ink);
  margin-bottom: 16px;
}

.ds-footer__link {
  display: block;
  padding: 4px 0;
  color: var(--ds-steel);
}
.ds-footer__link:hover { color: var(--ds-ink-deep); }

.ds-footer__bottom {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--ds-hairline-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: var(--ds-stone);
}
.ds-footer__bottom a { color: var(--ds-stone); }
.ds-footer__bottom a:hover { color: var(--ds-ink-deep); }

@media (max-width: 767px) {
  .ds-footer__grid { grid-template-columns: 1fr; gap: 24px; }
}

/* --------------------------------------------------------------------------
   8. Buttons (pill signature)
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--ds-r-full);
  font-family: var(--ds-font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.14px;
  line-height: 1.43;
  padding: 12px 28px;
  border: 1px solid transparent;
  transition: all var(--ds-dur-fast) var(--ds-ease);
  white-space: nowrap;
}
.btn:focus { box-shadow: 0 0 0 3px rgba(24, 118, 242, 0.25); outline: 0; }

/* Primary = black ink (marketing & main app actions) */
.btn-primary {
  background: var(--ds-ink-button);
  color: var(--ds-on-ink);
  border-color: var(--ds-ink-button);
}
.btn-primary:hover, .btn-primary:focus { background: var(--ds-charcoal); border-color: var(--ds-charcoal); color: var(--ds-on-ink); }
.btn-primary:active { background: var(--ds-charcoal); }

/* Buy CTA = cobalt (тарифы / оплата / регистрация) */
.btn-cta {
  background: var(--ds-primary);
  color: var(--ds-on-primary);
  border-color: var(--ds-primary);
}
.btn-cta:hover, .btn-cta:focus { background: var(--ds-primary-deep); border-color: var(--ds-primary-deep); color: var(--ds-on-primary); }
.btn-cta:active { background: var(--ds-primary-deep); }

/* Secondary = outlined */
.btn-secondary {
  background: transparent;
  color: var(--ds-ink-deep);
  border: 2px solid var(--ds-ink-deep);
  padding: 11px 27px;
}
.btn-secondary:hover, .btn-secondary:focus { background: var(--ds-ink-deep); color: var(--ds-canvas); }

/* Ghost = quiet outline */
.btn-ghost {
  background: transparent;
  color: var(--ds-ink-deep);
  border: 2px solid rgba(10, 19, 23, 0.12);
  padding: 9px 21px;
}
.btn-ghost:hover, .btn-ghost:focus { border-color: var(--ds-ink-deep); color: var(--ds-ink-deep); background: transparent; }

/* Outline variants */
.btn-outline-primary {
  background: transparent;
  color: var(--ds-ink-deep);
  border: 2px solid var(--ds-ink-deep);
  padding: 11px 27px;
}
.btn-outline-primary:hover, .btn-outline-primary:focus { background: var(--ds-ink-deep); color: var(--ds-canvas); }

.btn-outline-secondary {
  background: transparent;
  color: var(--ds-charcoal);
  border: 2px solid rgba(10, 19, 23, 0.12);
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus { border-color: var(--ds-charcoal); color: var(--ds-ink-deep); background: transparent; }

.btn-outline-danger {
  background: transparent;
  color: var(--ds-critical);
  border: 2px solid var(--ds-critical);
}
.btn-outline-danger:hover, .btn-outline-danger:focus { background: var(--ds-critical); color: #fff; }

/* Semantic pills */
.btn-success { background: var(--ds-success); border-color: var(--ds-success); color: #fff; }
.btn-success:hover, .btn-success:focus { background: #268b3e; border-color: #268b3e; color: #fff; }
.btn-danger { background: var(--ds-critical); border-color: var(--ds-critical); color: #fff; }
.btn-danger:hover, .btn-danger:focus { background: var(--ds-critical-strong); border-color: var(--ds-critical-strong); color: #fff; }
.btn-warning { background: var(--ds-warning); border-color: var(--ds-warning); color: var(--ds-ink-deep); }
.btn-warning:hover, .btn-warning:focus { background: var(--ds-attention); border-color: var(--ds-attention); color: var(--ds-ink-deep); }
.btn-info { background: var(--ds-surface-soft); border-color: var(--ds-hairline-soft); color: var(--ds-ink); }
.btn-info:hover, .btn-info:focus { background: var(--ds-hairline-soft); border-color: var(--ds-hairline); color: var(--ds-ink-deep); }
.btn-light { background: var(--ds-surface-soft); border-color: var(--ds-hairline-soft); color: var(--ds-ink); }
.btn-light:hover, .btn-light:focus { background: var(--ds-hairline-soft); color: var(--ds-ink-deep); }
.btn-dark { background: var(--ds-ink-deep); border-color: var(--ds-ink-deep); color: #fff; }
.btn-dark:hover, .btn-dark:focus { background: var(--ds-ink); border-color: var(--ds-ink); color: #fff; }
.btn-link { background: transparent; color: var(--ds-ink-deep); font-weight: 700; text-decoration: none; padding: 8px 12px; }
.btn-link:hover { color: var(--ds-primary-deep); }

.btn-sm { padding: 8px 18px; font-size: 13px; }
.btn-lg { padding: 14px 30px; font-size: 16px; }
.btn-sm.btn-secondary, .btn-sm.btn-outline-primary { padding: 7px 17px; }

/* Legacy neutral toggle (payment calendar view/period selectors) */
.btn-default {
  background: transparent;
  color: var(--ds-charcoal);
  border: 1px solid var(--ds-hairline);
}
.btn-default:hover, .btn-default:focus {
  background: var(--ds-surface-soft);
  color: var(--ds-ink-deep);
  border-color: var(--ds-hairline);
}

.btn:disabled, .btn.disabled {
  background: var(--ds-disabled);
  border-color: var(--ds-disabled);
  color: var(--ds-canvas);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   9. Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--ds-canvas);
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-xl);
  box-shadow: none;
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--ds-hairline-soft);
  padding: 18px 24px;
  border-radius: var(--ds-r-xl) var(--ds-r-xl) 0 0 !important;
}
.card-header h1, .card-header h2, .card-header h3,
.card-header h4, .card-header h5, .card-header h6 { margin-bottom: 0; }
.card-body { padding: 24px; }
.card-footer {
  background: transparent;
  border-top: 1px solid var(--ds-hairline-soft);
  padding: 16px 24px;
}

/* Showcase / photo cards */
.ds-card-photo { border: none; border-radius: var(--ds-r-xxxl); overflow: hidden; }
.ds-card-feature { border: 1px solid var(--ds-hairline-soft); border-radius: var(--ds-r-xxxl); padding: 32px; }
.ds-card-promo { background: var(--ds-ink-deep); color: var(--ds-canvas); border-radius: var(--ds-r-xxxl); padding: 64px; }
.ds-card-promo h1, .ds-card-promo h2, .ds-card-promo h3, .ds-card-promo h4,
.ds-card-promo h5, .ds-card-promo h6 { color: var(--ds-canvas); }
.ds-card-icon {
  background: var(--ds-canvas);
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-xl);
  padding: 24px;
}

/* --------------------------------------------------------------------------
   10. Forms
   -------------------------------------------------------------------------- */
.form-label, .col-form-label { font-size: 14px; font-weight: 600; color: var(--ds-ink); letter-spacing: -0.14px; }

.form-control, .form-select {
  min-height: 44px;
  border-radius: var(--ds-r-lg);
  border: 1px solid var(--ds-hairline);
  background: var(--ds-canvas);
  color: var(--ds-ink);
  font-family: var(--ds-font);
  font-size: 16px;
  letter-spacing: -0.16px;
  padding: 10px 12px;
  transition: border-color var(--ds-dur-fast) var(--ds-ease), box-shadow var(--ds-dur-fast) var(--ds-ease);
}
.form-control:focus, .form-select:focus {
  border: 2px solid var(--ds-fb-blue);
  box-shadow: none;
  outline: 0;
  padding: 9px 11px;
}
.form-control.is-invalid, .was-validated .form-control:invalid {
  border-color: var(--ds-critical-strong);
}
.form-control:disabled, .form-control[readonly] {
  background: var(--ds-surface-soft);
  color: var(--ds-disabled);
}

.form-check-input { border: 1px solid var(--ds-hairline); border-radius: var(--ds-r-sm); }
.form-check-input:checked { background-color: var(--ds-fb-blue); border-color: var(--ds-fb-blue); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(24, 118, 242, 0.2); border-color: var(--ds-fb-blue); }
.form-check-label { font-size: 14px; color: var(--ds-ink); letter-spacing: -0.14px; }

.input-group-text {
  background: var(--ds-surface-soft);
  border: 1px solid var(--ds-hairline);
  color: var(--ds-steel);
  font-size: 14px;
}

/* Search pill */
.ds-search {
  background: var(--ds-surface-soft);
  border-radius: var(--ds-r-full);
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  color: var(--ds-steel);
  border: 1px solid transparent;
  transition: all var(--ds-dur-fast) var(--ds-ease);
}
.ds-search input {
  border: 0; background: transparent; outline: none;
  font-size: 14px; color: var(--ds-ink); width: 100%;
}
.ds-search:focus-within { border-color: var(--ds-fb-blue); background: var(--ds-canvas); }

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */
.table { color: var(--ds-ink); border-color: var(--ds-hairline-soft); margin-bottom: 0; }
.table > :not(caption) > * > * {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ds-hairline-soft);
  vertical-align: middle;
}
.table thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ds-steel);
  border-bottom: 1px solid var(--ds-hairline-soft);
  background: var(--ds-surface-soft);
  white-space: nowrap;
}
.table tbody td { font-size: 14px; letter-spacing: -0.14px; }

/* Hover: только в приложении (body.app / body.admin) */
.app .table-hover tbody tr:hover td,
.admin .table-hover tbody tr:hover td { background: var(--ds-surface-soft); }

.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: #fafbfc; color: var(--ds-ink); }

/* Status badges (payment calendar) */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--ds-r-full);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.33;
  white-space: nowrap;
}
.status-planned { background: var(--ds-surface-soft); color: var(--ds-steel); }
.status-partially_completed { background: rgba(242, 169, 24, 0.18); color: #a06b00; }
.status-completed { background: rgba(49, 162, 76, 0.16); color: #1d7434; }
.status-cancelled { background: rgba(228, 30, 63, 0.12); color: var(--ds-critical); }

.negative-balance { color: var(--ds-critical); font-weight: 700; }
.warning-balance { color: var(--ds-attention); font-weight: 700; }
.positive-balance { color: var(--ds-success); font-weight: 700; }

/* --------------------------------------------------------------------------
   12. Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--ds-r-full);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.33;
  letter-spacing: 0;
}
.badge-success, .bg-success { background: var(--ds-success) !important; color: #fff !important; }
.badge-danger, .bg-danger { background: var(--ds-critical) !important; color: #fff !important; }
.badge-warning, .bg-warning { background: var(--ds-warning) !important; color: var(--ds-ink-deep) !important; }
.badge-info, .bg-info { background: var(--ds-fb-blue) !important; color: #fff !important; }
.badge-secondary, .bg-secondary { background: var(--ds-steel) !important; color: #fff !important; }
.badge-light, .bg-light { background: var(--ds-surface-soft) !important; color: var(--ds-ink) !important; }
.badge-dark, .bg-dark { background: var(--ds-ink-deep) !important; color: #fff !important; }
.badge-primary, .bg-primary { background: var(--ds-ink-button) !important; color: #fff !important; }

/* --------------------------------------------------------------------------
   13. Alerts
   -------------------------------------------------------------------------- */
.alert {
  border: none;
  border-radius: var(--ds-r-lg);
  padding: 16px 20px;
  font-size: 14px;
  letter-spacing: -0.14px;
}
.alert-success { background: rgba(49, 162, 76, 0.12); color: #1d7434; }
.alert-danger { background: rgba(228, 30, 63, 0.1); color: var(--ds-critical); }
.alert-warning { background: rgba(247, 185, 40, 0.16); color: #8a6400; }
.alert-info { background: rgba(24, 118, 242, 0.1); color: #0b57c4; }
.alert-secondary { background: var(--ds-surface-soft); color: var(--ds-ink); }
.alert .alert-heading { font-size: 16px; font-weight: 700; margin-bottom: 4px; }

/* --------------------------------------------------------------------------
   14. Nav pills / tabs
   -------------------------------------------------------------------------- */
.nav-pills .nav-link {
  border-radius: var(--ds-r-full);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.14px;
  color: var(--ds-ink);
  border: 1px solid var(--ds-hairline);
  background: var(--ds-canvas);
}
.nav-pills .nav-link:hover { background: var(--ds-surface-soft); color: var(--ds-ink-deep); }
.nav-pills .nav-link.active {
  background: var(--ds-ink-deep);
  color: var(--ds-canvas);
  border-color: var(--ds-ink-deep);
}

.nav-tabs { border-bottom: 1px solid var(--ds-hairline-soft); }
.nav-tabs .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ds-steel);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 0;
}
.nav-tabs .nav-link:hover { color: var(--ds-ink-deep); border-color: transparent; }
.nav-tabs .nav-link.active {
  color: var(--ds-ink-deep);
  background: transparent;
  border-bottom-color: var(--ds-ink-deep);
}

/* --------------------------------------------------------------------------
   15. Pagination
   -------------------------------------------------------------------------- */
.pagination { gap: 4px; }
.page-link {
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-full) !important;
  color: var(--ds-ink);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  margin: 0 2px;
  background: var(--ds-canvas);
}
.page-link:hover { background: var(--ds-surface-soft); color: var(--ds-ink-deep); border-color: var(--ds-hairline-soft); }
.page-item.active .page-link {
  background: var(--ds-ink-deep);
  border-color: var(--ds-ink-deep);
  color: var(--ds-canvas);
}
.page-item.disabled .page-link { color: var(--ds-disabled); background: var(--ds-surface-soft); }

/* --------------------------------------------------------------------------
   16. Misc utilities
   -------------------------------------------------------------------------- */
.list-group-item {
  border-color: var(--ds-hairline-soft);
  color: var(--ds-ink);
}
.list-group-item-action:hover { background: var(--ds-surface-soft); color: var(--ds-ink-deep); }
.list-group-item.active {
  background: var(--ds-ink-deep);
  border-color: var(--ds-ink-deep);
  color: var(--ds-canvas);
}

.progress { background: var(--ds-hairline-soft); border-radius: var(--ds-r-full); height: 6px; }
.progress-bar { border-radius: var(--ds-r-full); background: var(--ds-primary); }

.dropdown-menu {
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-lg);
  box-shadow: rgba(20, 22, 26, 0.12) 0 8px 24px 0;
}
.dropdown-item { font-size: 14px; color: var(--ds-ink); padding: 10px 16px; border-radius: var(--ds-r-sm); }
.dropdown-item:hover { background: var(--ds-surface-soft); color: var(--ds-ink-deep); }

hr { border-color: var(--ds-hairline-soft); opacity: 1; }

.breadcrumb { margin: 0 0 var(--ds-sp-base); }
.breadcrumb-item { font-size: 14px; color: var(--ds-steel); }
.breadcrumb-item a { color: var(--ds-steel); }
.breadcrumb-item.active { color: var(--ds-ink); }

.border-top { border-top: 1px solid var(--ds-hairline-soft) !important; }
.border-bottom { border-bottom: 1px solid var(--ds-hairline-soft) !important; }
.border { border: 1px solid var(--ds-hairline-soft) !important; }

/* Quick action / stat cards */
.ds-stat {
  background: var(--ds-canvas);
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-xl);
  padding: 24px;
}
.ds-stat__label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ds-steel); margin-bottom: 8px; }
.ds-stat__value { font-size: 28px; font-weight: 500; letter-spacing: -0.02em; color: var(--ds-ink-deep); line-height: 1.2; }
.ds-stat__hint { font-size: 13px; color: var(--ds-stone); margin-top: 6px; }

/* Select2 alignment */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  min-height: 44px;
  border: 1px solid var(--ds-hairline) !important;
  border-radius: var(--ds-r-lg) !important;
  display: flex;
  align-items: center;
  padding: 4px 8px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--ds-ink);
  font-size: 15px;
  line-height: 34px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 42px; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
  border: 2px solid var(--ds-fb-blue) !important;
}
.select2-dropdown { border-color: var(--ds-hairline-soft); border-radius: var(--ds-r-lg); overflow: hidden; }
.select2-container--default .select2-results__option { font-size: 14px; padding: 8px 12px; }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--ds-surface-soft);
  color: var(--ds-ink-deep);
}

/* DataTables toolbar alignment */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--ds-hairline);
  border-radius: var(--ds-r-full);
  padding: 8px 16px;
  font-size: 14px;
  margin-left: 8px;
}
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--ds-hairline);
  border-radius: var(--ds-r-lg);
  padding: 6px 8px;
}

/* --------------------------------------------------------------------------
   17. Legacy compatibility
   -------------------------------------------------------------------------- */
.text-blue { color: var(--ds-fb-blue) !important; }

.loading-spinner {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83"></path></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
}

.cash-gap-row { background-color: rgba(228, 30, 63, 0.06) !important; }

.nav-selected {
  background: var(--ds-ink);
  color: #fff;
  padding: 5px 12px;
  display: inline-block;
  border-radius: var(--ds-r-full);
}

/* Clickable card tiles (e.g. category template picker) */
.template-card { cursor: pointer; }
.app .template-card:hover { border-color: var(--ds-ink-deep); }

/* FullCalendar + Chart canvas rounding alignment */
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 1.25em; }
.fc .fc-button-primary {
  background: var(--ds-ink-button);
  border-color: var(--ds-ink-button);
  border-radius: var(--ds-r-full) !important;
  font-size: 14px;
  font-weight: 700;
  text-transform: none;
}
.fc .fc-button-primary:hover { background: var(--ds-charcoal); border-color: var(--ds-charcoal); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--ds-primary); border-color: var(--ds-primary); }
.fc .fc-button { padding: 8px 14px; }

/* --------------------------------------------------------------------------
   18. Marketing components
   -------------------------------------------------------------------------- */
.ds-hero {
  position: relative;
  background-color: var(--ds-ink-deep);
  background-size: cover;
  background-position: center;
  color: var(--ds-canvas);
  padding: 120px 0;
  overflow: hidden;
}
.ds-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 19, 23, 0.55);
}
.ds-hero > .ds-container { position: relative; z-index: 1; }
.ds-hero h1, .ds-hero h2, .ds-hero h3 { color: var(--ds-canvas); }
.ds-hero .ds-hero__title {
  font-size: 64px;
  line-height: 1.16;
  font-weight: 500;
  letter-spacing: -0.03em;
  max-width: 720px;
}
.ds-hero .ds-hero__lead {
  font-size: 18px;
  line-height: 1.44;
  color: rgba(255, 255, 255, 0.85);
  max-width: 620px;
  margin: 24px 0 32px;
}
.ds-hero__badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.16);
  border-radius: var(--ds-r-full);
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 20px;
}
@media (max-width: 767px) {
  .ds-hero { padding: 64px 0; }
  .ds-hero .ds-hero__title { font-size: 36px; }
}

.ds-feature {
  background: var(--ds-canvas);
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-xl);
  padding: 32px;
  height: 100%;
}
.ds-feature__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--ds-r-circle);
  background: var(--ds-surface-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--ds-ink-deep);
  margin-bottom: 20px;
}
.ds-feature h4 { margin-bottom: 8px; }
.ds-feature p { color: var(--ds-charcoal); font-size: 14px; line-height: 1.5; margin-bottom: 0; }

.ds-step { text-align: center; padding: 24px; }
.ds-step__num {
  width: 48px;
  height: 48px;
  border-radius: var(--ds-r-circle);
  background: var(--ds-ink-deep);
  color: var(--ds-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  margin: 0 auto 20px;
}

.ds-testimonial {
  background: var(--ds-canvas);
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-xl);
  padding: 32px;
  height: 100%;
}
.ds-testimonial .ds-testimonial__stars { color: var(--ds-warning); margin-bottom: 16px; }
.ds-testimonial .ds-testimonial__quote { color: var(--ds-ink); font-size: 16px; line-height: 1.5; }
.ds-testimonial__avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--ds-r-circle);
  background: var(--ds-surface-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-steel);
  font-weight: 700;
}

.ds-pricing {
  background: var(--ds-canvas);
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-xxl);
  padding: 40px;
}
.ds-pricing__price { font-size: 48px; font-weight: 500; letter-spacing: -0.02em; color: var(--ds-ink-deep); line-height: 1.1; }

.ds-nav-card {
  display: block;
  background: var(--ds-canvas);
  border: 1px solid var(--ds-hairline-soft);
  border-radius: var(--ds-r-xl);
  padding: 24px;
  height: 100%;
  text-align: center;
  color: var(--ds-ink);
}
.ds-nav-card:hover { border-color: var(--ds-ink-deep); color: var(--ds-ink-deep); }
.ds-nav-card i { font-size: 28px; color: var(--ds-ink-deep); margin-bottom: 12px; }
.ds-nav-card h6 { margin-bottom: 4px; }
.ds-nav-card small { color: var(--ds-stone); }

.ds-cta-band {
  background: var(--ds-ink-deep);
  color: var(--ds-canvas);
  padding: 80px 0;
  text-align: center;
}
.ds-cta-band h2, .ds-cta-band h3 { color: var(--ds-canvas); }

.ds-check-list { list-style: none; padding: 0; margin: 0; }
.ds-check-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  color: var(--ds-charcoal);
  font-size: 14px;
}
.ds-check-list li i { color: var(--ds-success); margin-top: 3px; }

/* Article body (raw HTML from DB: blog / help content) */
.article-content { font-size: 16px; line-height: 1.6; color: var(--ds-ink); }
.article-content h2, .article-content h3, .article-content h4 {
  color: var(--ds-ink-deep);
  margin: 1.5em 0 0.5em;
  font-weight: 500;
}
.article-content h2 { font-size: 24px; }
.article-content h3 { font-size: 20px; }
.article-content h4 { font-size: 18px; }
.article-content p { margin: 0 0 1em; }
.article-content ul, .article-content ol { margin: 0 0 1em 1.5em; padding: 0; }
.article-content li { margin: 0.25em 0; }
.article-content a { color: var(--ds-primary-deep); font-weight: 600; }
.article-content a:hover { color: var(--ds-primary); }
.article-content img { max-width: 100%; height: auto; border-radius: var(--ds-r-lg); margin: 1em 0; }
.article-content table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 14px; }
.article-content table th, .article-content table td {
  border: 1px solid var(--ds-hairline-soft);
  padding: 8px 12px;
  text-align: left;
}
.article-content table th { background: var(--ds-surface-soft); font-weight: 700; }
.article-content blockquote {
  margin: 1em 0;
  padding: 8px 20px;
  border-left: 3px solid var(--ds-hairline);
  color: var(--ds-charcoal);
}
.article-content code {
  background: var(--ds-surface-soft);
  border-radius: var(--ds-r-sm);
  padding: 2px 6px;
  font-size: 0.9em;
}
.article-content pre {
  background: var(--ds-ink-deep);
  color: #e6edf3;
  border-radius: var(--ds-r-lg);
  padding: 16px;
  overflow-x: auto;
}
.article-content pre code { background: transparent; color: inherit; padding: 0; }
