:root {
  /* Brand palette derived from logo */
  --sd-blue-900: #0e1b2a;
  --sd-blue-800: #14263d;
  --sd-blue-700: #1b324f;
  --sd-blue-600: #2e4765;
  --sd-blue-500: #2e5d8e;
  --sd-blue-300: #5d738e;
  --sd-gold-600: #b08f22;
  --sd-gold-500: #cfa82b;
  --sd-gold-300: #f1d15b;
  --sd-teal-600: #15584f;
  --sd-teal-500: #1f7a6b;

  /* Neutrals */
  --sd-white: #ffffff;
  --sd-gray-50: #f7f8fa;
  --sd-gray-100: #e2e6eb;
  --sd-gray-200: #cfd6df;
  --sd-gray-400: #9aa6b2;
  --sd-gray-700: #2f3a45;
  --sd-gray-900: #0b1927;

  /* Semantic */
  --sd-primary: var(--sd-blue-700);
  --sd-primary-dark: var(--sd-blue-900);
  --sd-primary-light: var(--sd-blue-500);
  --sd-secondary: var(--sd-teal-500);
  --sd-secondary-dark: var(--sd-teal-600);
  --sd-accent: var(--sd-gold-500);
  --sd-accent-soft: var(--sd-gold-300);

  --sd-success: var(--sd-secondary);
  --sd-warning: var(--sd-accent);
  --sd-danger: #b23a2d;
  --sd-info: var(--sd-primary-light);

  /* Typography */
  --font-primary: "Manrope", "Segoe UI", Tahoma, sans-serif;
  --font-secondary: "Sora", "Segoe UI", Tahoma, sans-serif;

  /* Spacing and radius */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 2px rgba(11, 25, 39, 0.08);
  --shadow-md: 0 8px 20px rgba(11, 25, 39, 0.12);
  --shadow-lg: 0 18px 40px rgba(11, 25, 39, 0.16);
  --sd-sidebar-expanded: 16rem;
  --sd-sidebar-collapsed: 5.25rem;
  --sd-motion-fast: 220ms cubic-bezier(0.2, 0.72, 0.2, 1);

  /* Surfaces and text */
  --sd-bg: var(--sd-gray-50);
  --sd-surface: #ffffff;
  --sd-surface-2: #f2f5f8;
  --sd-border: var(--sd-gray-100);
  --sd-text: var(--sd-gray-700);
  --sd-text-strong: var(--sd-gray-900);
  --sd-muted: var(--sd-gray-400);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-primary);
  color: var(--sd-text);
  background: radial-gradient(1200px 600px at 10% -20%, rgba(31, 122, 107, 0.08), transparent),
              radial-gradient(1000px 500px at 110% -30%, rgba(207, 168, 43, 0.08), transparent),
              var(--sd-bg);
}

h1,
h2,
h3,
.sd-heading {
  font-family: var(--font-secondary);
  letter-spacing: -0.01em;
  color: var(--sd-text-strong);
}

a {
  color: var(--sd-primary);
}

a:hover {
  color: var(--sd-primary-dark);
}

/* Layout base */
.sd-header {
  background: var(--sd-surface);
  border-bottom: 1px solid var(--sd-border);
  box-shadow: var(--shadow-sm);
}

.sd-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--sd-primary);
  font-family: var(--font-secondary);
}

.sd-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.sd-logo-lg {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

@media (min-width: 640px) {
  .sd-logo {
    width: 32px;
    height: 32px;
  }
  .sd-logo-lg {
    width: 64px;
    height: 64px;
  }
}

.sd-header-actions a {
  font-weight: 600;
}

.sd-sidebar {
  background: linear-gradient(180deg, var(--sd-blue-800), var(--sd-blue-900));
  color: var(--sd-white);
  box-shadow: var(--shadow-lg);
  width: var(--sd-sidebar-expanded) !important;
  transition: width var(--sd-motion-fast), transform var(--sd-motion-fast);
  overflow-x: hidden;
}

.sd-sidebar-logo {
  position: relative;
  padding: 22px 18px 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(15, 30, 49, 0.85), rgba(11, 25, 39, 0.6));
}

.sd-sidebar-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(220px 160px at 50% 0%, rgba(207, 168, 43, 0.25), transparent 70%);
  pointer-events: none;
}

.sd-sidebar-close {
  position: absolute;
  top: 12px;
  right: 12px;
  color: rgba(255, 255, 255, 0.9);
  padding: 6px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.sd-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sd-sidebar-collapse-toggle {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: background var(--sd-motion-fast), color var(--sd-motion-fast), border-color var(--sd-motion-fast);
  z-index: 3;
}

.sd-sidebar-collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.sd-sidebar-brand {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  text-decoration: none;
  transition: gap var(--sd-motion-fast);
}

.sd-sidebar-logo-img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(6, 14, 24, 0.5));
  transition: width var(--sd-motion-fast), height var(--sd-motion-fast), opacity var(--sd-motion-fast);
}

.sd-sidebar-brand-icon {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  font-family: var(--font-secondary);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, rgba(207, 168, 43, 0.95), rgba(176, 143, 34, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 8px 20px rgba(6, 14, 24, 0.4);
}

.sd-sidebar-brand-text {
  font-family: var(--font-secondary);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  color: var(--sd-white);
  text-transform: uppercase;
  transition: opacity var(--sd-motion-fast);
}

.sd-sidebar-brand-sub {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.68);
  text-transform: uppercase;
  transition: opacity var(--sd-motion-fast);
}

@media (min-width: 1024px) {
  .sd-sidebar-logo {
    padding: 24px 18px 22px;
  }
  .sd-sidebar-logo-img {
    width: 102px;
    height: 102px;
  }
}

.sd-sidebar-section {
  margin: 16px 10px 8px;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 600;
}

.sd-sidebar-group {
  margin-bottom: 6px;
}

.sd-sidebar-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 10px 6px;
  padding: 4px 2px;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 700;
  transition: color var(--sd-motion-fast);
}

.sd-sidebar-section-toggle:hover {
  color: rgba(255, 255, 255, 0.78);
}

.sd-sidebar-section-toggle i {
  font-size: 0.7rem;
  transition: transform var(--sd-motion-fast), opacity var(--sd-motion-fast);
  opacity: 0.8;
}

.sd-sidebar-group.is-collapsed .sd-sidebar-section-toggle i {
  transform: rotate(-90deg);
}

.sd-sidebar-group-items {
  overflow: hidden;
  max-height: 720px;
  opacity: 1;
  transition: max-height var(--sd-motion-fast), opacity var(--sd-motion-fast);
}

.sd-sidebar-group.is-collapsed .sd-sidebar-group-items {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.sd-sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.82);
  position: relative;
  transition: background var(--sd-motion-fast), color var(--sd-motion-fast), padding var(--sd-motion-fast), justify-content var(--sd-motion-fast);
}

.sd-sidebar-link i {
  opacity: 0.75;
  transition: opacity var(--sd-motion-fast), transform var(--sd-motion-fast);
}

.sd-sidebar-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--sd-white);
}

.sd-sidebar-link.is-active {
  background: linear-gradient(90deg, rgba(207, 168, 43, 0.22), rgba(255, 255, 255, 0.16));
  color: var(--sd-white);
  box-shadow: inset 3px 0 0 rgba(207, 168, 43, 0.8);
}

.sd-sidebar-user {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  transition: padding var(--sd-motion-fast);
}

.sd-sidebar-user-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.84rem;
  transition: background var(--sd-motion-fast), color var(--sd-motion-fast), padding var(--sd-motion-fast), justify-content var(--sd-motion-fast);
}

.sd-sidebar-user-link:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.sd-sidebar-user-link.is-danger:hover {
  background: rgba(239, 68, 68, 0.22);
}

.sd-shell-offset {
  transition: margin-left var(--sd-motion-fast) !important;
}

@media (min-width: 1024px) {
  .sd-shell-offset {
    margin-left: var(--sd-sidebar-expanded) !important;
  }

  .sd-sidebar-collapsed .sd-sidebar {
    width: var(--sd-sidebar-collapsed) !important;
  }

  .sd-sidebar-collapsed .sd-shell-offset {
    margin-left: var(--sd-sidebar-collapsed) !important;
  }

  .sd-sidebar-collapsed .sd-sidebar-logo {
    padding: 16px 10px 14px;
  }

  .sd-sidebar-collapsed .sd-sidebar-brand {
    gap: 6px;
    margin-top: 12px;
  }

  .sd-sidebar-collapsed .sd-sidebar-logo-img {
    width: 38px;
    height: 38px;
  }

  .sd-sidebar-collapsed .sd-sidebar-brand-icon {
    display: inline-flex;
  }

  .sd-sidebar-collapsed .sd-sidebar-brand-text,
  .sd-sidebar-collapsed .sd-sidebar-brand-sub,
  .sd-sidebar-collapsed .sd-sidebar-section,
  .sd-sidebar-collapsed .sd-sidebar-section-toggle,
  .sd-sidebar-collapsed .sd-sidebar-link span,
  .sd-sidebar-collapsed .sd-sidebar-user > div:first-child,
  .sd-sidebar-collapsed .sd-sidebar-user-link span {
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .sd-sidebar-collapsed .sd-sidebar-link,
  .sd-sidebar-collapsed .sd-sidebar-user-link {
    justify-content: center;
    padding: 10px;
  }

  .sd-sidebar-collapsed .sd-sidebar-group-items {
    max-height: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .sd-sidebar-collapsed .sd-sidebar-link i,
  .sd-sidebar-collapsed .sd-sidebar-user-link i {
    opacity: 1;
    transform: scale(1.05);
  }

  .sd-sidebar-collapsed .sd-sidebar-link.is-active {
    box-shadow: inset 0 0 0 1px rgba(207, 168, 43, 0.6), 0 0 0 1px rgba(207, 168, 43, 0.5);
    background: linear-gradient(135deg, rgba(207, 168, 43, 0.28), rgba(255, 255, 255, 0.18));
  }

  .sd-sidebar-collapsed .sd-sidebar-link[id="notificacoesLink"] #notificacoesBadge,
  .sd-sidebar-collapsed .sd-sidebar-link[id="notificacoesEmpresaLink"] #notificacoesEmpresaBadge {
    position: absolute;
    top: 4px;
    right: 4px;
    margin-left: 0;
  }

  .sd-sidebar-collapsed .sd-sidebar-link::after,
  .sd-sidebar-collapsed .sd-sidebar-user-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) scale(0.96);
    background: rgba(11, 25, 39, 0.96);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1;
    white-space: nowrap;
    padding: 8px 10px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(6, 14, 24, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease-out, transform 160ms ease-out;
    z-index: 80;
  }

  .sd-sidebar-collapsed .sd-sidebar-link:hover::after,
  .sd-sidebar-collapsed .sd-sidebar-link:focus-visible::after,
  .sd-sidebar-collapsed .sd-sidebar-user-link:hover::after,
  .sd-sidebar-collapsed .sd-sidebar-user-link:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
  }
}

.sd-main {
  min-height: 100vh;
}

main.sd-main {
  padding-bottom: 140px;
  position: relative;
  z-index: 1;
}

.sd-content {
  padding: 18px 0 28px;
}

.sd-footer {
  background: var(--sd-surface);
  border-top: 1px solid var(--sd-border);
  z-index: 100;
}

.sd-footer-fixed {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
}

.sd-card-elevated {
  background: var(--sd-surface);
  border: 1px solid var(--sd-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.sd-card-elevated.is-hoverable {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.sd-card-elevated.is-hoverable:hover {
  border-color: rgba(27, 50, 79, 0.2);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.sd-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 50, 79, 0.1);
  color: var(--sd-primary);
}

.sd-card-icon.is-secondary {
  background: rgba(31, 122, 107, 0.12);
  color: var(--sd-secondary-dark);
}

.sd-card-icon.is-accent {
  background: rgba(207, 168, 43, 0.18);
  color: #7a5f12;
}

.sd-card-icon.is-info {
  background: rgba(46, 93, 142, 0.12);
  color: var(--sd-primary);
}

.sd-welcome {
  background: linear-gradient(135deg, rgba(27, 50, 79, 0.08), rgba(31, 122, 107, 0.08));
  border-left: 4px solid var(--sd-primary);
}

/* Buttons */
.sd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  border: 1px solid transparent;
  transition: all 0.18s ease;
  box-shadow: var(--shadow-sm);
}

.sd-btn:active {
  transform: translateY(0);
  opacity: 0.92;
}

.sd-btn[disabled],
.sd-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  box-shadow: none;
}

/* Subtle form microinteractions */
form .border-2 {
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

form .border-2:not(.border-red-500):focus-within {
  border-color: var(--sd-primary);
  box-shadow: 0 0 0 3px rgba(27, 50, 79, 0.12);
  transform: translateY(-1px);
}

form input,
form select,
form textarea {
  transition: color 180ms ease, background-color 180ms ease;
}

.sd-btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  box-shadow: none;
}

.sd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--sd-surface-2);
  color: var(--sd-text);
  transition: all 0.2s ease;
}

.sd-chip.is-active {
  background: var(--sd-primary);
  color: var(--sd-white);
}

.sd-chip-info {
  background: rgba(46, 93, 142, 0.12);
  color: var(--sd-primary);
}

.sd-chip-warning {
  background: rgba(207, 168, 43, 0.18);
  color: #7a5f12;
}

.sd-chip-success {
  background: rgba(31, 122, 107, 0.14);
  color: var(--sd-secondary-dark);
}

.sd-chip-danger {
  background: rgba(178, 58, 45, 0.14);
  color: #7b241c;
}

.sd-action-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  color: var(--sd-primary);
  background: rgba(27, 50, 79, 0.06);
  transition: all 0.18s ease;
}

.sd-action-btn:active {
  transform: scale(0.98);
}

.sd-action-btn:hover {
  background: rgba(27, 50, 79, 0.14);
}

.sd-action-btn.is-success {
  color: var(--sd-secondary-dark);
  background: rgba(31, 122, 107, 0.1);
}

.sd-action-btn.is-success:hover {
  background: rgba(31, 122, 107, 0.18);
}

.sd-action-btn.is-warning {
  color: #7a5f12;
  background: rgba(207, 168, 43, 0.15);
}

.sd-action-btn.is-warning:hover {
  background: rgba(207, 168, 43, 0.24);
}

.sd-action-btn.is-danger {
  color: #7b241c;
  background: rgba(178, 58, 45, 0.12);
}

.sd-action-btn.is-danger:hover {
  background: rgba(178, 58, 45, 0.2);
}

.sd-btn-primary {
  background: linear-gradient(135deg, var(--sd-primary), var(--sd-primary-dark));
  color: var(--sd-white);
}

.sd-btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.sd-btn-secondary {
  background: linear-gradient(135deg, var(--sd-secondary), var(--sd-secondary-dark));
  color: var(--sd-white);
}

.sd-btn-secondary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.sd-btn-danger {
  background: linear-gradient(135deg, #c34434, #92281f);
  color: var(--sd-white);
}

.sd-btn-danger:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.sd-btn-accent {
  background: linear-gradient(135deg, var(--sd-accent), #b58f1f);
  color: var(--sd-white);
}

.sd-btn-accent:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.sd-btn-outline {
  background: transparent;
  color: var(--sd-primary);
  border-color: rgba(27, 50, 79, 0.4);
  box-shadow: none;
}

.sd-btn-outline:hover {
  background: rgba(27, 50, 79, 0.08);
}

/* Inputs */
.sd-input,
.sd-select,
.sd-textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--sd-border);
  background: var(--sd-surface);
  color: var(--sd-text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sd-input:focus,
.sd-select:focus,
.sd-textarea:focus {
  outline: none;
  border-color: var(--sd-primary);
  box-shadow: 0 0 0 3px rgba(27, 50, 79, 0.12);
}

.sd-input::placeholder,
.sd-textarea::placeholder {
  color: var(--sd-muted);
}

/* Tables */
.sd-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--sd-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.sd-table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--sd-blue-800);
  color: var(--sd-white);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sd-table tbody td {
  padding: 12px 16px;
  border-top: 1px solid var(--sd-border);
  font-size: 0.875rem;
  color: var(--sd-text);
}

.sd-table tbody tr:hover {
  background: rgba(27, 50, 79, 0.04);
}

.sd-table .sd-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--sd-surface-2);
  color: var(--sd-text);
}

.sd-status-success {
  background: rgba(31, 122, 107, 0.12);
  color: var(--sd-secondary-dark);
}

.sd-status-warning {
  background: rgba(207, 168, 43, 0.18);
  color: #7a5f12;
}

.sd-status-danger {
  background: rgba(178, 58, 45, 0.12);
  color: #7b241c;
}

.sd-status-info {
  background: rgba(46, 93, 142, 0.12);
  color: var(--sd-primary);
}

/* Cards and containers */
.sd-card {
  background: var(--sd-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--sd-border);
  box-shadow: var(--shadow-sm);
}

.sd-card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--sd-border);
  background: linear-gradient(135deg, rgba(27, 50, 79, 0.06), rgba(31, 122, 107, 0.06));
  font-weight: 700;
  color: var(--sd-text-strong);
}

.sd-card-body {
  padding: 18px;
}

.sd-container {
  background: var(--sd-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--sd-border);
}

/* Alerts */
.sd-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.875rem;
  animation: sd-fade-in 160ms ease-out;
}

.sd-alert-success {
  background: rgba(31, 122, 107, 0.12);
  color: var(--sd-secondary-dark);
  border-color: rgba(31, 122, 107, 0.28);
}

.sd-alert-warning {
  background: rgba(207, 168, 43, 0.12);
  color: #7a5f12;
  border-color: rgba(207, 168, 43, 0.3);
}

.sd-alert-danger {
  background: rgba(178, 58, 45, 0.12);
  color: #7b241c;
  border-color: rgba(178, 58, 45, 0.3);
}

.sd-alert-info {
  background: rgba(27, 50, 79, 0.1);
  color: var(--sd-primary);
  border-color: rgba(27, 50, 79, 0.25);
}

/* Dark theme overrides */
[data-theme="dark"] {
  --sd-bg: #0e141d;
  --sd-surface: #121b26;
  --sd-surface-2: #182233;
  --sd-border: #2a3a52;
  --sd-text: #dce4f0;
  --sd-text-strong: #f6f8fb;
  --sd-muted: #a9b6c8;

  --shadow-sm: 0 2px 6px rgba(4, 8, 14, 0.35);
  --shadow-md: 0 12px 28px rgba(4, 8, 14, 0.4);
  --shadow-lg: 0 20px 48px rgba(4, 8, 14, 0.45);
}

[data-theme="dark"] .sd-table thead th {
  background: #1b2a40;
  color: var(--sd-text-strong);
}

[data-theme="dark"] .sd-table tbody tr:hover {
  background: rgba(46, 93, 142, 0.16);
}

[data-theme="dark"] .sd-table tbody,
[data-theme="dark"] .sd-table tbody tr,
[data-theme="dark"] .sd-table tbody .bg-white {
  background: var(--sd-surface) !important;
}

[data-theme="dark"] .sd-table .bg-gray-50 {
  background: #1b2a40 !important;
}

[data-theme="dark"] .sd-table .border-gray-200 {
  border-color: var(--sd-border) !important;
}

[data-theme="dark"] .sd-table .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--sd-border) !important;
}

[data-theme="dark"] .sd-table tbody td {
  color: var(--sd-text);
}

[data-theme="dark"] .sd-table tbody td .text-gray-900,
[data-theme="dark"] .sd-table tbody td .text-gray-800 {
  color: var(--sd-text-strong) !important;
}

[data-theme="dark"] .sd-table tbody td .text-gray-700,
[data-theme="dark"] .sd-table tbody td .text-gray-600,
[data-theme="dark"] .sd-table tbody td .text-gray-500 {
  color: var(--sd-text) !important;
}

[data-theme="dark"] .sd-table tbody td .text-gray-400,
[data-theme="dark"] .sd-table tbody td .text-gray-300 {
  color: var(--sd-muted) !important;
}

[data-theme="dark"] .sd-table a {
  color: var(--sd-text);
}

[data-theme="dark"] .sd-table a:hover {
  color: var(--sd-text-strong);
}

[data-theme="dark"] .sd-sidebar {
  background: linear-gradient(180deg, #141f2d, #0e1622);
}

[data-theme="dark"] .sd-header,
[data-theme="dark"] .sd-footer {
  box-shadow: 0 1px 0 rgba(23, 35, 52, 0.65);
}

[data-theme="dark"] .sd-chip.is-active {
  background: var(--sd-primary-light);
  color: var(--sd-white);
}

[data-theme="dark"] body {
  background: radial-gradient(1200px 600px at 10% -20%, rgba(31, 122, 107, 0.16), transparent),
              radial-gradient(1000px 500px at 110% -30%, rgba(46, 93, 142, 0.18), transparent),
              var(--sd-bg);
}

[data-theme="dark"] .sd-welcome {
  background: linear-gradient(135deg, rgba(27, 50, 79, 0.2), rgba(31, 122, 107, 0.16));
  border-left-color: var(--sd-primary-light);
}

[data-theme="dark"] .sd-card-elevated,
[data-theme="dark"] .sd-card,
[data-theme="dark"] .sd-container {
  box-shadow: 0 10px 28px rgba(4, 8, 14, 0.38);
}

[data-theme="dark"] .sd-card-elevated.is-hoverable:hover {
  border-color: rgba(46, 93, 142, 0.45);
  box-shadow: 0 16px 36px rgba(4, 8, 14, 0.5);
}

[data-theme="dark"] .sd-card-icon {
  background: rgba(46, 93, 142, 0.22);
  color: #cfe1f7;
}

[data-theme="dark"] .sd-card-icon.is-secondary {
  background: rgba(31, 122, 107, 0.22);
  color: #cde9e4;
}

[data-theme="dark"] .sd-card-icon.is-accent {
  background: rgba(207, 168, 43, 0.22);
  color: #f3dc8c;
}

[data-theme="dark"] .sd-card-icon.is-info {
  background: rgba(46, 93, 142, 0.22);
  color: #cfe1f7;
}

[data-theme="dark"] .sd-action-btn.is-danger {
  background: rgba(178, 58, 45, 0.2);
}

[data-theme="dark"] .sd-status-warning,
[data-theme="dark"] .sd-chip-warning {
  background: rgba(207, 168, 43, 0.22);
  color: #f1d88a;
}

[data-theme="dark"] .sd-status-success,
[data-theme="dark"] .sd-chip-success {
  background: rgba(31, 122, 107, 0.22);
  color: #cfe9e3;
}

[data-theme="dark"] .sd-status-info,
[data-theme="dark"] .sd-chip-info {
  background: rgba(46, 93, 142, 0.22);
  color: #cfe1f7;
}

[data-theme="dark"] .sd-status-danger,
[data-theme="dark"] .sd-chip-danger {
  background: rgba(178, 58, 45, 0.22);
  color: #f0b2aa;
}

[data-theme="dark"] .sd-btn-outline {
  border-color: rgba(162, 184, 209, 0.4);
  color: var(--sd-text);
}

/* Tailwind text utility harmonization for dark theme */
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800 {
  color: var(--sd-text-strong) !important;
}

[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600,
[data-theme="dark"] .text-gray-500 {
  color: var(--sd-text) !important;
}

[data-theme="dark"] .text-gray-400,
[data-theme="dark"] .text-gray-300 {
  color: var(--sd-muted) !important;
}

/* Tailwind background and border utility harmonization for dark theme */
[data-theme="dark"] .bg-white {
  background-color: var(--sd-surface) !important;
}

[data-theme="dark"] .bg-gray-50 {
  background-color: var(--sd-surface-2) !important;
}

[data-theme="dark"] .bg-gray-100 {
  background-color: #1a2534 !important;
}

[data-theme="dark"] .bg-gray-200 {
  background-color: #223246 !important;
}

[data-theme="dark"] .border-gray-100,
[data-theme="dark"] .border-gray-200,
[data-theme="dark"] .border-gray-300 {
  border-color: var(--sd-border) !important;
}

[data-theme="dark"] .divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--sd-border) !important;
}

[data-theme="dark"] .shadow-md,
[data-theme="dark"] .shadow-lg,
[data-theme="dark"] .shadow-xl {
  box-shadow: var(--shadow-md) !important;
}

[data-theme="dark"] .sd-action-btn {
  background: rgba(46, 93, 142, 0.18);
}

[data-theme="dark"] .sd-action-btn:hover {
  background: rgba(46, 93, 142, 0.28);
}

/* Focus ring for keyboard navigation */
:focus-visible {
  outline: 2px solid rgba(27, 50, 79, 0.55);
  outline-offset: 2px;
}

/* Icon system */
.sd-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

i.bi-truck,
i.bi-building,
i.bi-clock,
i.bi-hourglass,
i.bi-hourglass-split,
i.bi-calendar,
i.bi-calendar-event,
i.bi-calendar-check,
i.bi-check-circle,
i.bi-check2-circle,
i.bi-x-circle,
i.bi-exclamation-triangle,
i.bi-exclamation-circle,
i.bi-info-circle {
  color: var(--sd-primary);
}

.sd-status i,
.sd-chip i {
  opacity: 0.9;
}

/* Subtle loading spinner */
.spinner-border {
  border-width: 0.14em;
  border-right-color: transparent;
  opacity: 0.85;
}

@keyframes sd-fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

