/* ==========================================================================
   Core — core.css
   Design tokens and base components shared by every site of the product:
   the admin panel, the user panel and the portal (decision D4,
   docs/decisions/2026-10-15-d4-shared-core-css.md). Each site loads this
   file first, then its own assets/css/app.css with section 19 only.
   Edit tokens and shared components here, never in a site's app.css.

   Sections
   01. Design tokens (light / dark)
   02. Base & typography
   03. Layout: app shell, sidebar, navbar, page
   04. Grid & spacing helpers
   05. Card, stat card
   06. Buttons
   07. Forms
   08. Badges, avatars, progress
   09. Tables & pagination
   10. Alerts, empty state, skeleton
   11. Tabs, dropdown, modal, tooltip
   12. Toast
   13. Auth pages
   14. Error pages
   15. Charts & activity list
   16. Vendor overrides: Select2, SweetAlert2, Flatpickr
   17. Utilities
   18. Responsive
   ========================================================================== */

/* 01. Design tokens ------------------------------------------------------ */
:root,
[data-theme="light"] {
  color-scheme: light;

  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-surface-muted: #f0f2f5;
  --color-surface-hover: #f3f4f7;
  --color-border: #e3e6eb;
  --color-border-strong: #cfd4dc;
  --color-text: #111827;
  --color-text-muted: #5b6474;
  --color-text-subtle: #656d7e;
  --color-text-inverse: #ffffff;

  --color-primary: #3550dc;
  --color-primary-hover: #2a43c4;
  --color-primary-soft: #ebeefd;
  --color-primary-text: #2b44c2;

  --color-success: #127a4b;
  --color-success-soft: #e5f4ec;
  --color-warning: #9a5806;
  --color-warning-soft: #fdf1dc;
  --color-danger: #c0352b;
  --color-danger-hover: #a52b22;
  --color-danger-soft: #fbe8e6;
  --color-info: #0b6aa2;
  --color-info-soft: #e3f1fa;

  --color-chart-1: #3550dc;
  --color-chart-2: #e07b2e;
  --color-chart-3: #1f9d6a;
  --color-chart-4: #8a4fd6;
  --color-chart-5: #c93c7a;
  --color-chart-grid: #eceef2;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 4px 16px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 16px 40px rgba(17, 24, 39, 0.16);
  --focus-ring: 0 0 0 3px rgba(53, 80, 220, 0.25);
  --overlay: rgba(15, 18, 26, 0.45);
}

[data-theme="dark"] {
  color-scheme: dark;

  --color-bg: #0c0e13;
  --color-surface: #14171e;
  --color-surface-muted: #1a1e27;
  --color-surface-hover: #1d2230;
  --color-border: #252a35;
  --color-border-strong: #343a48;
  --color-text: #e7e9ee;
  --color-text-muted: #a0a8b8;
  --color-text-subtle: #8a93a5;
  --color-text-inverse: #0c0e13;

  --color-primary: #7088ff;
  --color-primary-hover: #8a9dff;
  --color-primary-soft: #1d2445;
  --color-primary-text: #a9b8ff;

  --color-success: #4cc38a;
  --color-success-soft: #12291f;
  --color-warning: #e9a23b;
  --color-warning-soft: #2e2312;
  --color-danger: #f07167;
  --color-danger-hover: #f48b83;
  --color-danger-soft: #33191a;
  --color-info: #5bb5ec;
  --color-info-soft: #112634;

  --color-chart-1: #7088ff;
  --color-chart-2: #f0a05a;
  --color-chart-3: #4cc38a;
  --color-chart-4: #b48cf5;
  --color-chart-5: #ec7fb0;
  --color-chart-grid: #232835;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --focus-ring: 0 0 0 3px rgba(112, 136, 255, 0.35);
  --overlay: rgba(0, 0, 0, 0.6);
}

:root {
  --font-sans: "Geist Variable", "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono Variable", "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  --sidebar-width: 256px;
  --navbar-height: 64px;
  --content-max-width: 1440px;

  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
}

/* 02. Base & typography -------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

a {
  color: var(--color-primary-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img,
svg {
  display: block;
  max-width: 100%;
}

code,
kbd,
.font-mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

hr,
.divider {
  height: 1px;
  margin: 16px 0;
  border: 0;
  background: var(--color-border);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Hidden until a keyboard user tabs to it: jumps past the sidebar to the page. */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: 500;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

::selection {
  background: var(--color-primary-soft);
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

/* An icon inside running text (a hint, a footer note, a link) stays on the text line.
   In flex and grid containers the icon is a flex or grid item, so nothing changes there. */
svg.icon {
  display: inline-block;
  vertical-align: -0.15em;
}

/* 03. Layout ------------------------------------------------------------- */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  height: 100vh;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  z-index: 40;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--navbar-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--color-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-text);
  font-weight: 600;
  font-size: 15px;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
}

.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-caption {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

.nav-section + .nav-section {
  margin-top: 16px;
}

.nav-section-title {
  padding: 0 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-subtle);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.nav-link:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
  text-decoration: none;
}

.nav-link.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.nav-link-text {
  flex: 1;
}

.nav-badge {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: var(--color-danger-soft);
  color: var(--color-danger);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--color-border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-backdrop {
  display: none;
}

/* Main column */
.main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--navbar-height);
  padding: 0 24px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 30;
}

.navbar-toggle {
  display: none;
}

.navbar-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}

.navbar-search .form-control {
  padding-left: 38px;
  background: var(--color-surface-muted);
  border-color: transparent;
}

.navbar-search .form-control:focus {
  background: var(--color-surface);
  border-color: var(--color-primary);
}

.navbar-search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--color-text-subtle);
  pointer-events: none;
}

.navbar-search-shortcut {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.navbar-divider {
  width: 1px;
  height: 24px;
  margin: 0 8px;
  background: var(--color-border);
}

.user-menu-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  font: inherit;
  cursor: pointer;
}

.user-menu-button:hover {
  background: var(--color-surface-hover);
}

.user-menu-name {
  font-weight: 600;
  font-size: 13px;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.icon-button:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.icon-button-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--color-surface);
  border-radius: var(--radius-full);
  background: var(--color-danger);
}

/* Theme toggle: show the icon of the theme you would switch to.
   svg.theme-icon-light outranks the inline-block of svg.icon above. */
.theme-icon-light,
svg.theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-light {
  display: block;
}

[data-theme="dark"] .theme-icon-dark {
  display: none;
}

/* Page */
.page {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 24px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
}

.page-subtitle {
  margin-top: 4px;
  color: var(--color-text-muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  font-size: 13px;
  color: var(--color-text-muted);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  margin-right: 6px;
  color: var(--color-border-strong);
}

.breadcrumb a {
  color: var(--color-text-muted);
}

.page-footer {
  padding: 16px 24px 24px;
  color: var(--color-text-subtle);
  font-size: 12px;
  text-align: center;
}

/* 04. Grid & spacing ----------------------------------------------------- */
.grid {
  display: grid;
  gap: 16px;
}

.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.grid-main-aside {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

/* Each item keeps its own height instead of stretching to the tallest one */
.grid-align-start { align-items: start; }

.col-span-2 { grid-column: span 2; }
.col-span-full { grid-column: 1 / -1; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-sm { gap: 8px; }
.stack-lg { gap: 24px; }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cluster-between {
  justify-content: space-between;
}

.section {
  margin-bottom: 24px;
}

/* 05. Card --------------------------------------------------------------- */
.card {
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-subtitle {
  margin-top: 2px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.card-body {
  padding: 20px;
}

.card-body-flush {
  padding: 0;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
}

/* Stat card */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.stat-icon-success { background: var(--color-success-soft); color: var(--color-success); }
.stat-icon-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.stat-icon-danger { background: var(--color-danger-soft); color: var(--color-danger); }

.stat-value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
}

.stat-trend.is-up { color: var(--color-success); }
.stat-trend.is-down { color: var(--color-danger); }

/* 06. Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled,
.btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

[data-theme="dark"] .btn-primary {
  color: #0c0e13;
}

.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.btn-secondary:hover {
  background: var(--color-surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: var(--color-danger-hover);
}

[data-theme="dark"] .btn-danger {
  color: #0c0e13;
}

.btn-soft-danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.btn-sm {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
}

.btn-lg {
  min-height: 48px;
  padding: 12px 20px;
  font-size: 15px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 40px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 32px;
}

.btn.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-color: #ffffff #ffffff transparent transparent;
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

/* Light buttons need a dark spinner. */
.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after {
  border-color: var(--color-text) var(--color-text) transparent transparent;
}

.btn-group {
  display: inline-flex;
}

.btn-group > .btn {
  border-radius: 0;
}

.btn-group > .btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group > .btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.btn-group > .btn + .btn {
  margin-left: -1px;
}

.btn-group > .btn.is-active {
  background: var(--color-surface-muted);
  color: var(--color-text);
}

/* 07. Forms -------------------------------------------------------------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
}

.form-label-required::after {
  content: " *";
  color: var(--color-danger);
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* A badge beside the label must not make the row taller than a plain label (fields side by side line up). */
.form-label-row .badge {
  margin-block: -4px;
}

.form-control,
.form-select,
.form-textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-subtle);
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus,
.form-control:focus-visible,
.form-select:focus-visible,
.form-textarea:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.form-control:disabled,
.form-select:disabled {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

/* Read-only values stay selectable and focusable but must not look editable. */
.form-control[readonly] {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  cursor: default;
}

.form-control[readonly]:focus {
  border-color: var(--color-border-strong);
}

.form-select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a8394' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-textarea {
  min-height: 96px;
  resize: vertical;
}

.form-control-sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 13px;
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

.form-error {
  font-size: 12px;
  color: var(--color-danger);
}

.is-invalid,
.is-invalid:focus {
  border-color: var(--color-danger);
}

.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(192, 53, 43, 0.2);
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .form-control {
  padding-left: 38px;
}

.input-group-icon {
  position: absolute;
  left: 12px;
  color: var(--color-text-subtle);
  pointer-events: none;
}

.input-group-action {
  position: absolute;
  right: 4px;
}

.input-group-has-action .form-control {
  padding-right: 44px;
}

/* Checkbox & radio */
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  cursor: pointer;
  user-select: none;
}

.check-input {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.switch-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-border-strong);
  transition: background var(--transition-fast);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.switch-input:checked + .switch-track {
  background: var(--color-primary);
}

.switch-input:checked + .switch-track::after {
  transform: translateX(16px);
}

.switch-input:focus-visible + .switch-track {
  box-shadow: var(--focus-ring);
}

/* Form section (settings pages) */
.form-section {
  display: grid;
  grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--color-border);
}

.form-section:last-child {
  border-bottom: 0;
}

.form-section-title {
  font-size: 15px;
  font-weight: 600;
}

.form-section-text {
  margin-top: 4px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* In a card footer the actions sit beside the hint, centred by the footer. */
.card-footer > .form-actions { margin-top: 0; }

/* 08. Badges, avatars, progress ----------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
}

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

.badge-primary { background: var(--color-primary-soft); color: var(--color-primary-text); }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-info { background: var(--color-info-soft); color: var(--color-info); }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
  font-size: 13px;
  font-weight: 600;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-square { border-radius: var(--radius-md); }

.avatar-warm { background: var(--color-warning-soft); color: var(--color-warning); }
.avatar-green { background: var(--color-success-soft); color: var(--color-success); }

.media {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.media-body {
  min-width: 0;
}

/* Block so that a link title and a span text still sit on two lines */
.media-title {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-text {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--color-surface-muted);
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
}

.progress-bar-warning { background: var(--color-warning); }
.progress-bar-danger { background: var(--color-danger); }

/* Step classes for usage bars (App\Support\Progress::step rounds to tens) */
.progress-0 { width: 0; }
.progress-10 { width: 10%; }
.progress-20 { width: 20%; }
.progress-25 { width: 25%; }
.progress-30 { width: 30%; }
.progress-40 { width: 40%; }
.progress-50 { width: 50%; }
.progress-60 { width: 60%; }
.progress-70 { width: 70%; }
.progress-75 { width: 75%; }
.progress-80 { width: 80%; }
.progress-90 { width: 90%; }
.progress-100 { width: 100%; }

/* Avatar group: overlapping avatars + "+3" counter */
.avatar-group {
  display: inline-flex;
  align-items: center;
}

.avatar-group > .avatar {
  box-shadow: 0 0 0 2px var(--color-surface);
}

.avatar-group > .avatar + .avatar {
  margin-left: -6px; /* keeps both initials visible, even on .avatar-sm */
}

.avatar-group-more {
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

/* Keyboard key */
.kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--color-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.kbd-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-subtle);
  font-size: 12px;
}

/* 09. Tables & pagination ----------------------------------------------- */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.table-toolbar-search {
  flex: 1 1 240px;
  max-width: 320px;
}

.table-toolbar-filter {
  flex: 0 1 180px;
}

.table-toolbar-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.table-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
  font-weight: 500;
}

.table-wrapper {
  position: relative;
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 10px 12px;
  background: var(--color-surface-muted);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Number and action headers line up with their cells (.table th would keep them left) */
.table th.table-cell-number,
.table th.table-col-actions {
  text-align: right;
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

/* Long text column (descriptions, notes): keeps a readable width */
.table td.table-cell-wrap {
  min-width: 240px;
}

/* Names and emails in a table may wrap instead of forcing a scroll */
.table .media-title,
.table .media-text {
  white-space: normal;
  overflow-wrap: break-word; /* break inside a word only when it cannot fit at all */
}

.table .media {
  min-width: 220px;
}

.table .badge,
.table .table-row-actions,
.table .font-mono {
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--color-surface-hover);
}

.table tbody tr.is-selected {
  background: var(--color-primary-soft);
}

.table th:first-child,
.table td:first-child {
  padding-left: 20px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 20px;
}

.table-col-check {
  width: 44px;
}

.table-col-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.table-cell-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table-cell-muted {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.table-row-actions {
  display: inline-flex;
  gap: 2px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-link {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 500;
}

.page-link:hover {
  background: var(--color-surface-hover);
  text-decoration: none;
}

.page-link.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

[data-theme="dark"] .page-link.is-active {
  color: #0c0e13;
}

.page-link.is-disabled {
  color: var(--color-text-subtle);
  pointer-events: none;
}

.pagination-info {
  font-size: 13px;
  color: var(--color-text-muted);
}

/* Description list (detail pages) */
.detail-list {
  display: grid;
  grid-template-columns: minmax(0, 160px) minmax(0, 1fr);
  gap: 12px 16px;
  margin: 0;
}

.detail-list dt {
  color: var(--color-text-muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 500;
}

/* 10. Alerts, empty state, skeleton ------------------------------------- */
.alert {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
}

.alert-title {
  font-weight: 600;
}

.alert-text {
  font-size: 13px;
}

.alert-info { background: var(--color-info-soft); color: var(--color-info); }
.alert-success { background: var(--color-success-soft); color: var(--color-success); }
.alert-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.alert-danger { background: var(--color-danger-soft); color: var(--color-danger); }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  border-radius: var(--radius-lg);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.empty-state-title {
  font-size: 15px;
  font-weight: 600;
}

.empty-state-text {
  max-width: 360px;
  color: var(--color-text-muted);
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-muted) 25%, var(--color-surface-hover) 50%, var(--color-surface-muted) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.4s ease infinite;
}

.skeleton-text { height: 12px; }
.skeleton-title { height: 20px; width: 40%; }
.skeleton-avatar { width: 36px; height: 36px; border-radius: var(--radius-full); }

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

/* 11. Tabs, dropdown, modal, tooltip ------------------------------------ */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
  scrollbar-width: none; /* tabs scroll by swipe; a scrollbar would cover the active line */
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--color-text);
  text-decoration: none;
}

.tab.is-active {
  border-bottom-color: var(--color-primary);
  color: var(--color-primary-text);
}

.tab-panel {
  display: none;
  padding-top: 20px;
}

.tab-panel.is-active {
  display: block;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.segmented-item {
  padding: 5px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.segmented-item.is-active {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: none;
  min-width: 200px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.dropdown-menu-left {
  right: auto;
  left: 0;
}

.dropdown.is-open .dropdown-menu,
.dropdown-menu.is-static {
  display: block;
}

.dropdown-menu.is-static {
  position: static;
}

.dropdown-header {
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 6px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dropdown-item:hover {
  background: var(--color-surface-hover);
  text-decoration: none;
}

.dropdown-item-danger {
  color: var(--color-danger);
}

.dropdown-divider {
  height: 1px;
  margin: 6px 0;
  background: var(--color-border);
}

/* Notifications (navbar bell + dropdown panel) */
.icon-button-count {
  position: absolute;
  top: 4px;
  right: 2px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--color-surface);
  border-radius: var(--radius-full);
  background: var(--color-danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .icon-button-count {
  color: #0c0e13;
}

.notification-menu {
  width: 380px;
  padding: 0;
  overflow: hidden;
}

.notification-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 8px 16px;
}

.notification-menu-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.notification-menu-filter {
  margin: 0 16px 8px;
}

.notification-list {
  max-height: min(420px, calc(100vh - 220px));
  overflow-y: auto;
  border-top: 1px solid var(--color-border);
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

.notification-group-title {
  padding: 10px 16px 4px;
  color: var(--color-text-subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.notification-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 32px 10px 16px;
  color: var(--color-text);
  font-size: 13px;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.notification-item:hover,
.notification-item:focus-visible {
  background: var(--color-surface-hover);
  text-decoration: none;
}

.notification-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.notification-icon-success { background: var(--color-success-soft); color: var(--color-success); }
.notification-icon-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.notification-icon-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.notification-icon-info { background: var(--color-primary-soft); color: var(--color-primary-text); }

.notification-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.notification-title {
  color: var(--color-text-muted);
  font-weight: 500;
  line-height: 1.4;
}

.notification-item.is-unread .notification-title {
  color: var(--color-text);
  font-weight: 600;
}

.notification-text {
  color: var(--color-text-muted);
  line-height: 1.45;
}

.notification-time {
  color: var(--color-text-subtle);
  font-size: 12px;
}

/* Unread marker: a dot on the right, so read and unread rows keep one background */
.notification-item.is-unread::after {
  content: "";
  position: absolute;
  top: 16px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
}

.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 32px 24px;
  text-align: center;
}

.notification-empty .icon {
  margin-bottom: 6px;
  color: var(--color-success);
}

.notification-empty-title {
  font-weight: 600;
}

.notification-empty-text {
  color: var(--color-text-muted);
  font-size: 13px;
}

.notification-menu-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--color-border);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--overlay);
  z-index: 100;
}

.modal.is-open {
  display: flex;
  animation: fade-in var(--transition-base);
}

.modal-preview {
  position: static;
  display: flex;
  padding: 24px;
  border-radius: var(--radius-lg);
}

.modal-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-dialog-lg {
  max-width: 760px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
}

/* Accordion: native <details>; give items the same name="" to keep one open */
.accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.accordion-item + .accordion-item {
  border-top: 1px solid var(--color-border);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 16px;
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.accordion-header::-webkit-details-marker {
  display: none;
}

.accordion-header:hover {
  background: var(--color-surface-hover);
}

.accordion-header:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}

.accordion-item:first-child .accordion-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.accordion-item:last-child:not([open]) .accordion-header {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.accordion-icon {
  flex-shrink: 0;
  color: var(--color-text-subtle);
  transition: transform var(--transition-fast);
}

.accordion-item[open] .accordion-icon {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 0 16px 16px;
  color: var(--color-text-muted);
  animation: fade-in var(--transition-base);
}

/* Drawer: a .modal that slides in from the right (same data-modal-open / close) */
.modal.modal-drawer {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.modal-drawer .modal-dialog {
  max-width: 440px;
  max-height: none;
  height: 100%;
  border-width: 0 0 0 1px;
  border-radius: 0;
  animation: drawer-in var(--transition-base);
}

.modal-drawer .modal-body {
  flex: 1;
}

@keyframes drawer-in {
  from { transform: translateX(32px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Tooltip: <button data-tooltip="Text"> */
[data-tooltip] {
  position: relative;
}

/* Rendered only while visible, so a hidden tooltip never widens a scroll area */
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: #111827;
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%);
  animation: fade-in var(--transition-fast);
  z-index: 60;
}

/* Row actions sit at the right edge of a table: open the tooltip leftwards */
.table-row-actions [data-tooltip]:hover::after,
.table-row-actions [data-tooltip]:focus-visible::after {
  left: auto;
  right: 0;
  transform: none;
}

/* 12. Toast -------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  z-index: 200;
}

.toast-container.is-static {
  position: static;
  width: 100%;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  animation: toast-in var(--transition-base);
}

.toast.is-leaving {
  animation: toast-out var(--transition-base) forwards;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
}

.toast-success .toast-icon { background: var(--color-success-soft); color: var(--color-success); }
.toast-error .toast-icon { background: var(--color-danger-soft); color: var(--color-danger); }
.toast-warning .toast-icon { background: var(--color-warning-soft); color: var(--color-warning); }
.toast-info .toast-icon { background: var(--color-info-soft); color: var(--color-info); }

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
}

.toast-message {
  font-size: 13px;
  color: var(--color-text-muted);
}

.toast-close {
  width: 28px;
  height: 28px;
}

/* 13. Auth pages --------------------------------------------------------- */
.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
}

.auth-main {
  display: flex;
  flex-direction: column;
  padding: 32px 48px;
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-content {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 48px 0;
}

.auth-card {
  width: 100%;
  max-width: 400px;
}

.auth-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-subtitle {
  margin-top: 6px;
  color: var(--color-text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 28px;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-footer-text {
  margin-top: 24px;
  font-size: 13px;
  color: var(--color-text-muted);
  text-align: center;
}

.auth-bottom {
  font-size: 12px;
  color: var(--color-text-subtle);
}

.auth-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 48px;
  background: #151a2e;
  color: #e7e9ee;
}

.auth-aside-title {
  max-width: 440px;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.auth-aside-text {
  max-width: 440px;
  margin-top: 12px;
  color: #a9b0c2;
}

.auth-feature-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d3d7e2;
}

.auth-feature-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(112, 136, 255, 0.16);
  color: #a9b8ff;
}

.auth-preview {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
}

.auth-preview-label {
  font-size: 12px;
  color: #a9b0c2;
}

.auth-preview-value {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 600;
}

.auth-preview-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 64px;
  margin-top: 16px;
}

.auth-preview-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background: rgba(112, 136, 255, 0.35);
}

.auth-preview-bar.is-highlight {
  background: #7088ff;
}

.bar-h-30 { height: 30%; }
.bar-h-40 { height: 40%; }
.bar-h-45 { height: 45%; }
.bar-h-55 { height: 55%; }
.bar-h-60 { height: 60%; }
.bar-h-70 { height: 70%; }
.bar-h-80 { height: 80%; }
.bar-h-100 { height: 100%; }

/* 14. Error pages -------------------------------------------------------- */
.error-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 32px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
}

.error-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.error-code {
  font-family: var(--font-mono);
  font-size: 96px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--color-primary);
}

.error-code-danger {
  color: var(--color-danger);
}

.error-code-warning {
  color: var(--color-warning);
}

.error-title {
  font-size: 24px;
  font-weight: 600;
}

.error-text {
  max-width: 440px;
  color: var(--color-text-muted);
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.error-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-text-subtle);
}

/* Compact card used on the design canvas to show several errors at once */
.error-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 24px;
  text-align: center;
}

.error-card .error-code {
  font-size: 64px;
}

.error-card .error-title {
  font-size: 18px;
}

/* 15. Charts & activity -------------------------------------------------- */
.chart-box {
  position: relative;
  width: 100%;
  height: 280px;
}

.chart-box-sm {
  height: 200px;
}

/* Card whose chart grows to fill the card height (e.g. next to a taller aside card) */
.card-chart {
  display: flex;
  flex-direction: column;
}

.card-chart > .card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
}

.card-chart .chart-box {
  flex: 1 1 auto;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--color-chart-1);
}

.chart-legend-swatch-2 { background: var(--color-chart-2); }
.chart-legend-swatch-3 { background: var(--color-chart-3); }
.chart-legend-swatch-4 { background: var(--color-chart-4); }
.chart-legend-swatch-5 { background: var(--color-chart-5); }

/* Static SVG chart used in the design canvas */
.chart-svg {
  width: 100%;
  height: 100%;
}

.chart-svg-grid { stroke: var(--color-chart-grid); stroke-width: 1; }
.chart-svg-axis { fill: var(--color-text-subtle); font-size: 11px; font-family: var(--font-sans); }
.chart-svg-area { fill: var(--color-primary-soft); }
.chart-svg-line { fill: none; stroke: var(--color-chart-1); stroke-width: 2.5; }
.chart-svg-line-2 { fill: none; stroke: var(--color-chart-2); stroke-width: 2; stroke-dasharray: 5 5; }
.chart-svg-dot { fill: var(--color-surface); stroke: var(--color-chart-1); stroke-width: 2.5; }

.plan-split {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.plan-split-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.plan-split-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.plan-split-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.activity-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-border);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
}

.activity-body {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

.activity-time {
  margin-top: 2px;
  font-size: 12px;
  color: var(--color-text-subtle);
}

/* Timeline (payment status, history) */
.timeline {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding-bottom: 18px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 0;
  left: 11px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: transparent;
}

.timeline-item.is-done .timeline-dot {
  border-color: var(--color-success);
  background: var(--color-success);
  color: #ffffff;
}

.timeline-item.is-current .timeline-dot {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-soft);
}

.timeline-item.is-failed .timeline-dot {
  border-color: var(--color-danger);
  background: var(--color-danger);
  color: #ffffff;
}

[data-theme="dark"] .timeline-item.is-done .timeline-dot,
[data-theme="dark"] .timeline-item.is-failed .timeline-dot {
  color: #0c0e13;
}

.timeline-title {
  font-weight: 500;
}

.timeline-item.is-pending .timeline-title {
  color: var(--color-text-muted);
}

.timeline-text {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 13px;
}

.timeline-time {
  font-size: 12px;
  color: var(--color-text-subtle);
}

/* Stat card with a sparkline: canvas[data-sparkline="1,4,2,…"] */
.stat-sparkline {
  position: relative;
  height: 40px;
  margin-top: 12px;
}

/* Description list: label / value / actions rows, with copy and inline edit */
.description-list {
  margin: 0;
}

.description-item {
  display: grid;
  grid-template-columns: minmax(0, 180px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 16px;
  min-height: 52px;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.description-item:last-child {
  border-bottom: 0;
}

.description-term {
  color: var(--color-text-muted);
  font-size: 13px;
}

.description-content {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.description-actions {
  display: flex;
  gap: 2px;
  margin: 0;
}

.description-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.description-edit .form-control {
  flex: 1 1 200px;
}

/* Sortable list: [data-sortable] + .sortable-handle (SortableJS) */
.sortable-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sortable-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.sortable-handle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 32px;
  flex-shrink: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-subtle);
  cursor: grab;
}

.sortable-handle:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

.sortable-item.is-ghost {
  border-style: dashed;
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  opacity: 0.6;
}

.sortable-item.is-dragging {
  box-shadow: var(--shadow-lg);
  cursor: grabbing;
}

/* 16. Vendor overrides --------------------------------------------------- */

/* Select2 */
.select2-container {
  width: 100% !important;
  font-family: var(--font-sans);
}

.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  min-height: 40px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding-left: 12px;
  padding-right: 36px;
  line-height: 38px;
  color: var(--color-text);
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--color-text-subtle);
}

/* Same chevron as the native .form-select, so both kinds of select look alike side by side. */
.select2-container--default .select2-selection--single .select2-selection__arrow {
  top: 1px;
  right: 4px;
  width: 32px;
  height: 38px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237a8394' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  display: none;
}

.select2-container--default .select2-selection:focus-visible {
  outline: none;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--multiple {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

/* Select2 4.1 renders the search field next to the list, not inside it: lay both out on one row. */
.select2-container--default .select2-selection--multiple {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
  display: contents;
}

.select2-container--default .select2-selection--multiple .select2-search--inline {
  flex: 1 1 120px;
  min-width: 120px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 2px 8px 2px 24px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
  font-size: 13px;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  top: 0;
  bottom: 0;
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border: 0;
  color: var(--color-primary-text);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  background: transparent;
  color: var(--color-danger);
}

.select2-container--default .select2-search--inline .select2-search__field {
  height: 30px;
  margin: 0;
  padding: 0 4px;
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 30px;
}

.select2-container--default .select2-search--inline .select2-search__field::placeholder {
  color: var(--color-text-subtle);
}

.select2-dropdown {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  padding: 6px 10px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}

.select2-results__option {
  padding: 8px 12px;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

.select2-container--default .select2-results__option--selected {
  background: var(--color-surface-muted);
}

/* SweetAlert2 */
.swal2-popup {
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-lg);
}

.swal2-title {
  padding: 8px 0 0;
  color: var(--color-text);
  font-size: 20px;
  font-weight: 600;
}

.swal2-html-container {
  margin: 8px 0 0;
  color: var(--color-text-muted);
  font-size: 14px;
}

.swal2-actions {
  gap: 8px;
  margin-top: 20px;
}

.swal2-actions .btn {
  margin: 0;
}

.swal2-input,
.swal2-textarea {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
}

div:where(.swal2-container).swal2-backdrop-show {
  background: var(--overlay);
}

/* Flatpickr */
.flatpickr-calendar {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  font-family: var(--font-sans);
}

.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after {
  display: none;
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
span.flatpickr-weekday {
  background: var(--color-surface);
  color: var(--color-text);
  fill: var(--color-text);
}

.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
  fill: var(--color-text-muted);
}

.flatpickr-day {
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.flatpickr-day:hover {
  background: var(--color-surface-hover);
  border-color: transparent;
}

.flatpickr-day.today {
  border-color: var(--color-primary);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.flatpickr-day.inRange {
  background: var(--color-primary-soft);
  border-color: var(--color-primary-soft);
  box-shadow: -5px 0 0 var(--color-primary-soft), 5px 0 0 var(--color-primary-soft);
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: var(--color-text-subtle);
}

/* Tippy.js popover: data-popover="#template-id" */
.tippy-box[data-theme~="app"] {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  color: var(--color-text);
  font-size: 13px;
}

.tippy-box[data-theme~="app"] > .tippy-content {
  padding: 12px 14px;
}

.tippy-box[data-theme~="app"] > .tippy-arrow {
  color: var(--color-surface);
}

.popover-title {
  margin-bottom: 4px;
  font-weight: 600;
}

.popover-text {
  color: var(--color-text-muted);
}

/* Quill rich text editor: [data-rich-text] */
.rich-text {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.rich-text:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.rich-text .ql-toolbar.ql-snow {
  border: 0;
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-sans);
}

.rich-text .ql-container.ql-snow {
  border: 0;
  font-family: var(--font-sans);
  font-size: 14px;
}

.rich-text .ql-editor {
  min-height: 140px;
  color: var(--color-text);
}

.rich-text .ql-editor.ql-blank::before {
  color: var(--color-text-subtle);
  font-style: normal;
}

.rich-text .ql-snow .ql-stroke {
  stroke: var(--color-text-muted);
}

.rich-text .ql-snow .ql-fill {
  fill: var(--color-text-muted);
}

.rich-text .ql-snow .ql-picker {
  color: var(--color-text-muted);
}

.rich-text .ql-snow button:hover .ql-stroke,
.rich-text .ql-snow button.ql-active .ql-stroke {
  stroke: var(--color-primary);
}

.rich-text .ql-snow button:hover .ql-fill,
.rich-text .ql-snow button.ql-active .ql-fill {
  fill: var(--color-primary);
}

.rich-text .ql-snow .ql-picker-options {
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

.rich-text .ql-snow .ql-tooltip {
  border-color: var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
}

.rich-text .ql-snow .ql-tooltip input[type="text"] {
  border-color: var(--color-border-strong);
  background: var(--color-surface);
  color: var(--color-text);
}

/* Cropper.js: image stage inside the crop modal */
.cropper-stage {
  height: min(360px, 60vh);
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted);
}

.cropper-stage img {
  display: block;
  max-width: 100%;
}

.cropper-view-box,
.cropper-face {
  border-radius: var(--radius-full);
}

.cropper-view-box {
  outline-color: var(--color-primary);
}

.cropper-line,
.cropper-point {
  background-color: var(--color-primary);
}

/* 17. Utilities ---------------------------------------------------------- */
.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }
.text-primary { color: var(--color-primary-text); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 16px; }
.text-strong { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-nowrap { white-space: nowrap; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabular-nums { font-variant-numeric: tabular-nums; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }

.w-full { width: 100%; }
.flex-1 { flex: 1; min-width: 0; }

.is-hidden,
[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}

/* Theme preview panels on the components board */
.theme-preview {
  padding: 32px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
}

.theme-preview-title {
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.component-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.component-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-subtle);
}

.swatch-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.swatch {
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.swatch-bg { background: var(--color-bg); }
.swatch-surface { background: var(--color-surface); }
.swatch-primary { background: var(--color-primary); }
.swatch-success { background: var(--color-success); }
.swatch-warning { background: var(--color-warning); }
.swatch-danger { background: var(--color-danger); }

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateX(16px); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* 18. Responsive ---------------------------------------------------------
   Desktop      >= 1025px  sidebar always visible
   Small laptop <= 1200px  4-column grids become 2 columns, aside drops below
   Tablet       <= 1024px  sidebar becomes an off-canvas drawer (.sidebar-open)
   Smartphone   <=  720px  single column, compact navbar, full-width actions
   ------------------------------------------------------------------------ */
@media (max-width: 1200px) {
  .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-aside { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1024px) {
  .grid-cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-open .sidebar-backdrop {
    position: fixed;
    inset: 0;
    display: block;
    background: var(--overlay);
    z-index: 35;
  }

  .navbar-toggle {
    display: inline-grid;
  }

  .auth-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-aside {
    display: none;
  }

  .form-section {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .page { padding: 16px; }
  .navbar { padding: 0 16px; }
  .navbar-search,
  .user-menu-name,
  .navbar-divider { display: none; }
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4,
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .col-span-2 { grid-column: auto; }
  .auth-main { padding: 24px 16px; }
  .detail-list { grid-template-columns: minmax(0, 1fr); }
  .table-toolbar-search { max-width: none; }
  .table-toolbar-search,
  .table-toolbar-filter { flex: 1 1 100%; }
  .table-toolbar-actions { margin-left: 0; }
  .error-code { font-size: 72px; }
  .swatch-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .page-header { flex-direction: column; align-items: stretch; }
  .page-title { font-size: 20px; }
  .page-actions > .btn { flex: 1; }
  .stat-value { font-size: 24px; }
  .card-header,
  .card-body,
  .card-footer,
  .table-toolbar { padding-left: 16px; padding-right: 16px; }
  .card-footer { flex-direction: column; align-items: stretch; }
  .pagination { justify-content: center; }
  .pagination-info { text-align: center; }
  .chart-box { height: 220px; }
  .activity-item { padding: 12px 16px; }

  /* Modal becomes a bottom sheet */
  .modal { align-items: flex-end; padding: 0; }
  .modal-dialog { max-width: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-footer > .btn { flex: 1; }

  /* Toasts sit at the bottom, full width */
  .toast-container { top: auto; right: 12px; bottom: 12px; left: 12px; width: auto; }

  /* Drawer fills the phone screen; description rows stack */
  .modal-drawer .modal-dialog { max-width: none; border-width: 0; border-radius: 0; }
  .description-item { grid-template-columns: minmax(0, 1fr) auto; }
  .description-term { grid-column: 1 / -1; }

  /* Notifications open as a full-width panel under the navbar */
  .notification-menu { position: fixed; top: calc(var(--navbar-height) - 4px); right: 12px; left: 12px; width: auto; }
}
