:root {
  --primary: #6c5ce7;
  --primary-dark: #5a4bd1;
  --primary-light: #a78bfa;
  --primary-50: #f5f3ff;
  --primary-100: #ede9fe;
  --accent: #6c177c;
  --accent-light: #b83bb2;
  --sky: #009ddb;
  --sky-dark: #1e5a92;
  --bg: #f8f9fc;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-light: #f0f0f5;
  --text: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-text: #065f46;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-text: #92400e;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-text: #991b1b;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --info-text: #1e40af;
  --header-height: 90px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  background: #fff;
  color: #2d2d2d;
  position: sticky;
  top: 12px;
  z-index: 200;
  margin: 12px 24px 0;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.06);
}
@keyframes headerGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 32px;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
  min-width: 0;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
}
.header-brand:hover { text-decoration: none; }
.header-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #a78bfa, #6c5ce7, #b83bb2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(108,92,231,0.4);
}
.header-brand-logo {
  width: 250px;
  height: 74px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}
.header-brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #fff 0%, #c4b5fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 1;
  min-width: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.header-nav::-webkit-scrollbar { display: none; }
.header-nav-link {
  color: #1a1a2e;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.1px;
  transition: all var(--transition);
  position: relative;
  flex-shrink: 0;
}
.header-nav-link:hover {
  background: #f3f0ff;
  color: #6c5ce7;
  text-decoration: none;
}
.header-nav-link.active {
  background: #6c5ce7;
  color: #fff;
  font-weight: 800;
  border-radius: 30px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.header-user-menu {
  position: relative;
}
.header-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  color: #2d2d2d;
  transition: background var(--transition);
}
.header-user-btn:hover { background: #f3f0ff; }
.header-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(167,139,250,0.5);
}
.header-avatar-placeholder {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
}
.header-user-name {
  font-size: 14px;
  font-weight: 500;
}
.header-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  z-index: 300;
}
.header-user-menu.open .header-dropdown { display: block; }
.header-dropdown-info {
  padding: 12px 16px;
}
.header-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.header-dropdown-role {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: capitalize;
}
.header-dropdown-divider {
  height: 1px;
  background: var(--border-light);
}
.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--transition);
}
.header-dropdown-item:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.header-mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #2d2d2d;
  border-radius: var(--radius-sm);
}
.header-mobile-toggle:hover { background: #f3f0ff; }
.header-mobile-toggle svg { width: 22px; height: 22px; }

.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  margin-top: auto;
  flex-shrink: 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-brand {
  font-weight: 600;
  color: var(--text-secondary);
}
.footer-sep { color: var(--border); }
.footer-right {
  font-size: 12px;
  color: var(--text-muted);
}
.footer-version {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.main-area {
  flex: 1;
  margin-left: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}


.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.env-badge.test {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid #fcd34d;
}
.env-badge.live {
  background: #dcfce7;
  color: #15803d;
  border: 2px solid #27A9F5;
}
.env-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}


.page-content {
  flex: 1;
  padding: 36px 48px;
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}

.page-content-wide {
  max-width: none;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-header-left {}
.page-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.5px;
}
.page-header .page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.5;
}
.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.card-body {
  padding: 20px;
}
.card-body-flush {
  padding: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  display: flex;
  align-items: flex-start;
  gap: 18px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 26px; height: 26px; }
.stat-icon.purple { background: var(--primary-100); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.blue { background: var(--info-bg); color: var(--info); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning); }
.stat-card.stat-purple::before { background: var(--primary); }
.stat-card.stat-green::before { background: var(--success); }
.stat-card.stat-blue::before { background: var(--info); }
.stat-card.stat-red::before { background: var(--danger); }
.stat-card.stat-amber::before { background: var(--warning); }
.stat-info {}
.stat-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 4px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.quick-action {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
.quick-action:hover {
  border-color: var(--primary-light);
  box-shadow: 0 8px 25px -5px rgba(108,92,231,0.15);
  transform: translateY(-3px);
  text-decoration: none;
}
.quick-action:hover .quick-action-icon {
  background: var(--primary);
  color: #fff;
}
.quick-action-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-lg);
  background: var(--primary-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: all 0.2s ease;
}
.quick-action-icon svg { width: 24px; height: 24px; }
.quick-action-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.quick-action-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  background: var(--bg);
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.data-table tbody td {
  padding: 13px 18px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.1s ease; }
.data-table tbody tr:hover td { background: var(--primary-50); }
.data-table .cell-mono {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
}
.data-table .cell-nowrap { white-space: nowrap; }
.data-table .cell-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

.table-toolbar {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
  flex-wrap: wrap;
}
.table-toolbar .search-input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--transition);
  min-width: 200px;
}
.table-toolbar .search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.08);
}
.table-toolbar .filter-select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--transition);
}
.table-toolbar .filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  line-height: 1.4;
}
.badge-purple { background: var(--primary-100); color: var(--primary); }
.badge-green { background: var(--success-bg); color: var(--success-text); }
.badge-blue { background: var(--info-bg); color: var(--info-text); }
.badge-red { background: var(--danger-bg); color: var(--danger-text); }
.badge-amber { background: var(--warning-bg); color: var(--warning-text); }
.badge-gray { background: #f1f5f9; color: #475569; }

.badge-role { font-size: 11px; padding: 2px 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }

.badge-status-pending { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #fcd34d; }
.badge-status-accepted, .badge-status-approved { background: var(--success-bg); color: var(--success-text); border: 1px solid #6ee7b7; }
.badge-status-rejected { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #fca5a5; }
.badge-status-processing, .badge-status-submitted { background: var(--info-bg); color: var(--info-text); border: 1px solid #93c5fd; }
.badge-status-draft { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-status-parked { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.badge-status-filed { background: var(--primary-100); color: var(--primary); border: 1px solid var(--primary-light); }
.badge-status-in_review { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #fcd34d; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.2px;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(108,23,124,0.25);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-light), var(--accent)); box-shadow: 0 6px 20px rgba(108,23,124,0.35); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.btn-secondary:hover { background: var(--bg); border-color: #d1d5db; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}
.btn-warning:hover { box-shadow: 0 6px 20px rgba(245,158,11,0.4); }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,0.4); }

.btn-success {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(108,23,124,0.25);
}
.btn-success:hover { background: linear-gradient(135deg, var(--accent-light), var(--accent)); box-shadow: 0 6px 20px rgba(108,23,124,0.35); }

.btn-view {
  background: linear-gradient(135deg, var(--sky), var(--sky-dark));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(0,157,219,0.25);
}
.btn-view:hover { background: linear-gradient(135deg, var(--sky-dark), var(--sky)); box-shadow: 0 6px 20px rgba(0,157,219,0.35); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 8px 14px;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); transform: none; box-shadow: none; }

.btn-outline-primary {
  background: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}
.btn-outline-primary:hover { background: rgba(108,23,124,0.06); box-shadow: 0 4px 12px rgba(108,23,124,0.15); }

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: var(--radius); gap: 6px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 14px 28px; font-size: 15px; border-radius: var(--radius-xl); }
.btn-icon { padding: 10px; min-width: 40px; min-height: 40px; border-radius: var(--radius-lg); }

.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  height: 48px;
}
.form-textarea { height: auto; min-height: 100px; resize: vertical; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(108,23,124,0.1);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); font-size: 13px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  transition: background 0.25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: var(--shadow-sm);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--text-muted);
  opacity: 0.5;
}
.empty-state-icon svg { width: 48px; height: 48px; }
.empty-state-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.search-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search-input-wrap svg {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input-wrap input {
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  width: 260px;
  font-family: var(--font);
  transition: border-color var(--transition);
}
.search-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108,92,231,0.08);
}

.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar select, .filter-bar input {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg-card);
}
.filter-bar select:focus, .filter-bar input:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.active { display: flex; }
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.modal-close:hover { background: var(--border-light); color: var(--text); }
.modal-close svg { width: 20px; height: 20px; }

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.settings-card .card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.info-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.info-banner.info { background: var(--info-bg); color: var(--info-text); border: 1px solid #bfdbfe; }
.info-banner.warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #fcd34d; }
.info-banner.danger { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #fca5a5; }
.info-banner.success { background: var(--success-bg); color: var(--success-text); border: 1px solid #6ee7b7; }

.user-profile-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-profile-cell img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}
.user-profile-cell .avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
}
.pagination nav { width: 100%; }
.pagination nav > div { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pagination nav > div > div:first-child { order: 2; }
.pagination nav > div > div:last-child { order: 1; }
.pagination nav span[aria-label], .pagination nav a[aria-label] {
  display: inline-flex; align-items: center; justify-content: center;
}
.pagination svg {
  width: 16px !important;
  height: 16px !important;
  display: inline-block;
}
.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.pagination span[aria-current="page"] > span { background: var(--primary); color: #fff; border-radius: var(--radius-sm); padding: 6px 12px; }
.pagination a:hover { background: var(--bg); color: var(--text); }
.pagination .active { background: var(--primary); color: #fff; }
.pagination nav > div > div > span.relative { display: inline-flex; align-items: center; }
.pagination [rel="prev"], .pagination [rel="next"] { display: inline-flex; align-items: center; gap: 4px; }
.pagination nav span[aria-disabled="true"] { opacity: 0.4; cursor: default; }

.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.company-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
  display: block;
  box-shadow: var(--shadow-sm);
}
.company-card-item:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
.company-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.company-card-number {
  font-size: 13px;
  color: var(--text-secondary);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stats-row .stat-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 24px 22px;
  min-height: 80px;
  border-radius: 12px;
  border: 1.5px solid #e5e7eb;
  border-left: 5px solid transparent;
  background: #fff;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.stats-row .stat-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.stats-row .stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}
.stats-row .stat-card .stat-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}
.stat-card-active {
  border: 2px solid var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(124,58,237,0.12) !important;
}
.stat-card-purple { border-left-color: #7c3aed !important; }
.stat-card-green { border-left-color: #22c55e !important; }
.stat-card-red { border-left-color: #ef4444 !important; }
.stat-card-yellow { border-left-color: #f59e0b !important; }

.companies-filter-bar {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0;
  background: transparent;
  border: none;
  box-sizing: border-box;
}
.companies-filter-bar .search-input-wrap {
  min-width: 0;
}
.companies-filter-bar .search-input-wrap input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  width: 100%;
  background: var(--bg-card);
  box-sizing: border-box;
}
.companies-filter-bar .form-select {
  padding: 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text);
  width: auto;
}
.companies-filter-bar .form-input {
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  background: var(--bg-card);
  color: var(--text);
  width: 120px;
}
.companies-filter-bar .filter-date-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.companies-filter-bar .filter-date-group span {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}
.companies-filter-bar .btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.company-cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.company-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: all var(--transition);
}
.company-card-row:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}
.company-card-left {
  flex: 1;
  min-width: 0;
}
.company-card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.company-meta-item {
  font-size: 13px;
  color: var(--text-secondary);
}
.btn-view-auth {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(108,92,231,0.08);
  border: 1px solid rgba(108,92,231,0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  vertical-align: middle;
}
.btn-view-auth:hover {
  background: rgba(108,92,231,0.15);
  border-color: var(--primary);
}
.company-card-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.company-due-dates {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-size: 12px;
  margin-right: 4px;
}
.due-date-item { white-space: nowrap; color: #27A9F5; font-weight: 500; }
.due-date-item.due-soon { color: #F2BD11; font-weight: 600; }
.due-date-item.due-overdue { color: #F54927; font-weight: 700; }
.btn-outline-secondary {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-block;
}
.btn-outline-secondary:hover {
  background: var(--primary-100);
}
.btn-success-sm {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: #fff;
  border: none;
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 2px 8px rgba(108,23,124,0.25);
  transition: all var(--transition);
}
.btn-success-sm:hover { background: linear-gradient(135deg, var(--accent-light), var(--accent)); box-shadow: 0 6px 20px rgba(108,23,124,0.35); color: #fff; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.spin { animation: spin 1s linear infinite; }

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1400px) {
  .header-nav-link {
    padding: 7px 10px;
    font-size: 13px;
  }
  .header-nav { gap: 0; }
  .header-left { gap: 12px; }
  .header-brand-logo { width: 160px; height: 48px; }
}
@media (max-width: 1200px) {
  .header-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    padding: 8px 16px 16px;
    gap: 2px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border-top: 1px solid #eee;
    border-radius: 0 0 12px 12px;
    z-index: 300;
  }
  .header-nav.open { display: flex; }
  .header-nav-link {
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 8px;
  }
  .header-nav-link.active {
    border-radius: 8px;
  }
  .header-mobile-toggle { display: block; }
  .header-user-name { display: none; }
  .header-brand-name { display: none; }
}
@media (max-width: 768px) {
  .page-content {
    padding: 20px 16px;
  }
  .page-header h1 { font-size: 24px; }
  .stat-value { font-size: 28px; }
  .footer-left { flex-wrap: wrap; }
  .site-header { margin: 8px 12px 0; }
  .header-brand-logo { width: 140px; height: 44px; }
  .env-badge { font-size: 11px; padding: 3px 8px; }
  .header-inner { padding: 0 16px; height: 64px; }
  .site-header { --header-height: 64px; }
  .header-brand-icon { width: 32px; height: 32px; font-size: 14px; }

  .card-header { padding: 14px 16px; flex-wrap: wrap; }
  .card-body { padding: 16px; }

  .data-table thead th { padding: 10px 12px; font-size: 11px; }
  .data-table tbody td { padding: 10px 12px; font-size: 13px; }

  .modal-card { margin: 12px; max-width: calc(100% - 24px); padding: 20px; max-height: calc(100vh - 24px); }
  .modal-title { font-size: 16px; }

  .form-row { grid-template-columns: 1fr; }

  .settings-card { padding: 16px; }

  .table-toolbar { padding: 10px 12px; }
  .table-toolbar .search-input { min-width: 0; width: 100%; }

  .stat-card { padding: 16px 18px; gap: 12px; }
  .stat-icon { width: 42px; height: 42px; }
  .stat-icon svg { width: 22px; height: 22px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .company-card-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .company-card-right { width: 100%; justify-content: flex-start; }
  .company-due-dates { align-items: flex-start; }

  .footer-inner { flex-direction: column; gap: 8px; text-align: center; }

  .btn { padding: 10px 18px; font-size: 13px; }
  .btn-lg { padding: 12px 22px; font-size: 14px; }

  .info-banner { font-size: 12px; padding: 10px 12px; }

  .page-header { margin-bottom: 20px; }

  .search-input-wrap input { width: 100%; }
  .search-input-wrap { width: 100%; }

  .pagination { flex-wrap: wrap; gap: 2px; }
  .pagination a, .pagination span { padding: 5px 8px; font-size: 12px; }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .quick-actions-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .page-header-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .search-input-wrap input {
    width: 100%;
  }
  .page-content {
    padding: 16px 12px;
  }

  .quick-action { padding: 16px 10px; gap: 10px; }
  .quick-action-icon { width: 40px; height: 40px; }
  .quick-action-icon svg { width: 20px; height: 20px; }
  .quick-action-label { font-size: 12px; }
  .quick-action-desc { font-size: 11px; }

  .company-grid { grid-template-columns: 1fr; }

  .cell-actions { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .site-header { margin: 6px 8px 0; border-radius: 10px; }
  .header-inner { padding: 0 12px; height: 56px; }
  .page-content { padding: 12px 10px; }

  .page-header h1 { font-size: 20px; }
  .page-subtitle { font-size: 13px; }

  .stat-card { padding: 14px; }
  .stat-value { font-size: 24px; }
  .stat-label { font-size: 12px; }
  .stat-icon { width: 38px; height: 38px; }

  .card-header { padding: 12px 14px; }
  .card-body { padding: 14px; }
  .card-title { font-size: 15px; }

  .modal-card { margin: 8px; max-width: calc(100% - 16px); padding: 16px; }
  .modal-title { font-size: 15px; }

  .footer-inner { padding: 12px; }
  .footer-left { font-size: 12px; }
  .footer-right { font-size: 11px; }

  .env-badge { font-size: 10px; padding: 2px 6px; }
}

.inc-docs-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.inc-docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.inc-docs-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inc-docs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.inc-doc-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s;
  cursor: pointer;
  text-align: center;
}
.inc-doc-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(108,92,231,0.12);
  transform: translateY(-2px);
}
.inc-doc-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.inc-doc-icon svg {
  width: 22px;
  height: 22px;
  color: white;
  stroke: white;
}
.inc-doc-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.inc-doc-size {
  font-size: 11px;
  color: var(--text-muted);
}
.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  color: white;
  border: none;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}
.btn-warning:hover {
  box-shadow: 0 6px 20px rgba(245,158,11,0.4);
}

@media (max-width: 640px) {
  .inc-docs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 420px) {
  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .btn { font-size: 12px; padding: 7px 12px; gap: 5px; }
  .btn svg { width: 14px; height: 14px; }
  .data-table thead th { padding: 8px 8px; font-size: 10px; }
  .data-table tbody td { padding: 8px 8px; font-size: 12px; }
  .inc-docs-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #htx-toast-container { top: 12px; right: 12px; left: 12px; }
  .htx-toast { min-width: 0; max-width: 100%; }
}
