

/* Focus ring - blue box-shadow */
.input:focus,
textarea.input:focus,
select.input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: var(--focus-ring);
}

/* Placeholder styling */
.input::placeholder,
textarea.input::placeholder {
  color: var(--text-muted);
}

/* Disabled state - 0.6 opacity, not-allowed cursor */
.input:disabled,
textarea.input:disabled,
select.input:disabled,
.input--disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: var(--workspace-alt);
  border-color: var(--border);
}

/* ===========================================
   CARDS
   =========================================== */
.card, .stat-card, .model-card, .plan-card, .feature-card, .docs-card, .key-item, .info-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Responsive table adjustments */
/* Sidebar navigation containers are owned by styles/app-ui.css. */

/* Settings sub-navigation tabs */
.settings-tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  margin-bottom: -1px;
}

.settings-tab:hover {
  color: var(--text-primary);
}

.settings-tab.active {
  color: var(--blue-500);
  border-bottom-color: var(--blue-500);
}

.settings-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Settings content sections */
.settings-section {
  display: none;
}

.settings-section.active {
  display: block;
}

/* Settings card with sections */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-card + .settings-card {
  margin-top: var(--space-4);
}

.settings-card-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.settings-card-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0 0 var(--space-1) 0;
}

.settings-card-description {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
}

.settings-card-body {
  padding: var(--space-5);
}

/* Settings form rows */
.settings-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-soft);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  padding-top: var(--space-2);
}

.settings-row-label .label {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  display: block;
}

.settings-row-label .hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-row-input {
  flex: 1;
}

.settings-row-input .input {
  width: 100%;
}

/* Dirty state indicator */
.settings-row.dirty {
  background: rgba(245, 158, 11, 0.05);
  margin: 0 calc(var(--space-5) * -1);
  padding-left: var(--space-5);
  padding-right: var(--space-5);
  border-left: 3px solid var(--warning);
}

/* Settings actions footer — full width of the card, no negative offsets:
   the footer is a direct child of .settings-card (unpadded), so negative
   margins only pushed its buttons outside the card's overflow: hidden box. */
.settings-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--workspace-alt);
  border-top: 1px solid var(--border);
  margin: 0;
}

.settings-actions--end {
  justify-content: flex-end;
}

/* Password change section */
.password-change-section {
  max-width: 400px;
}

.password-change-section .form-group {
  margin-bottom: var(--space-4);
}

.password-change-section .form-group:last-of-type {
  margin-bottom: var(--space-5);
}

/* Password strength indicator */
.password-strength {
  display: flex;
  gap: 4px;
  margin-top: var(--space-2);
}

.password-strength-bar {
  height: 4px;
  flex: 1;
  background: var(--border);
  border-radius: 2px;
  transition: background var(--transition-fast);
}

.password-strength-bar.weak {
  background: var(--danger);
}

.password-strength-bar.medium {
  background: var(--warning);
}

.password-strength-bar.strong {
  background: var(--success);
}

/* Responsive settings */
@media (max-width: 768px) {
  .settings-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  
  .settings-row-label {
    padding-top: 0;
  }
  
  .settings-actions {
    flex-direction: column;
  }
  
  .settings-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

.server-error-state-actions .btn {
  min-height: 44px;
}

/* ===========================================
   404 NOT FOUND PAGE
   =========================================== */
.not-found-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: var(--space-8);
  text-align: center;
}

.not-found-icon {
  width: 96px;
  height: 96px;
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-50);
  border-radius: 24px;
  color: var(--blue-500);
}

.not-found-icon svg,
.not-found-icon i {
  width: 48px;
  height: 48px;
  stroke: currentColor;
  stroke-width: 1.5;
}

.not-found-code {
  font-size: 80px;
  font-weight: var(--font-bold);
  color: var(--blue-500);
  line-height: 1;
  margin-bottom: var(--space-3);
  letter-spacing: -0.04em;
}

.not-found-title {
  font-size: var(--text-2xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.not-found-message {
  font-size: var(--text-base);
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto var(--space-6);
  line-height: var(--leading-relaxed);
}

.not-found-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

.subscription-callout-icon svg,
.subscription-callout-icon i {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
}

.subscription-callout-action .btn {
  background: var(--blue-500);
  color: white;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius);
  min-height: 36px;
}

.subscription-callout-action .btn:hover {
  background: var(--blue-600);
}

.subscription-callout-arrow {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue-500);
}

.dashboard-subscribe-link .icon {
  font-size: 18px;
  flex-shrink: 0;
}

.dashboard-subscribe-link strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1.3;
}

.dashboard-subscribe-link small {
  display: block;
  margin-top: 2px;
  font-size: var(--text-xs);
  opacity: 0.85;
}

.dashboard-subscribe-link .arrow {
  margin-left: auto;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.dashboard-access-banner .btn:hover {
  background: var(--blue-600);
  color: white;
}

/* ===========================================
   RESPONSIVE BREAKPOINTS - Sidebar Behavior
   =========================================== */

/* Desktop (1440px+): Full layout, sidebar expanded 260px */
/* Laptop (1280px - 1439px): Slight compression OK, sidebar still expanded */
/* Tablet (1024px - 1279px): Collapse toggle available */
/* Mobile/Tablet (768px - 1023px): sidebar becomes a drawer (see app-ui.css).
   The legacy .mobile-header is retired: the topbar toggle opens the drawer. */

/* Mobile (< 768px): same drawer behaviour, 16px page padding (app-ui.css). */

/* ===========================================
   ACCESSIBILITY: REDUCED MOTION
   =========================================== */
/* ===========================================
   ROUTE WIZARD STYLES (Admin wire management)
   =========================================== */
.route-wizard-step {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--workspace-alt);
}
.route-wizard-provider-row {
  display: flex;
  gap: 10px;
}
.route-wizard-provider-row select { flex: 1; }
.route-wizard-status, .route-wizard-count { color: var(--text-muted); font-size: 12px; }
.route-wizard-model-picker small, .route-wizard-model small { color: var(--text-muted); font-size: 11px; }
.route-wizard-model-list { display: grid; max-height: 330px; overflow-y: auto; gap: 7px; }
.route-wizard-model {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
}
.route-wizard-model:hover { border-color: var(--blue-500); }
.route-wizard-model span { display: grid; gap: 3px; min-width: 0; }
.route-wizard-model strong { font-family: var(--font-mono); font-size: 13px; overflow-wrap: anywhere; }
.route-wizard-model em { width: fit-content; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--warning-bg); color: var(--warning); font-size: 10px; font-style: normal; font-weight: 700; }
.route-wizard-empty { padding: 24px; color: var(--text-muted); text-align: center; }
@media (max-width: 640px) {
  .route-wizard-provider-row { flex-direction: column; }
  .route-wizard-provider-row .btn { width: 100%; justify-content: center; }
}

/* ===========================================
   DRAWER COMPONENT
   =========================================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-scrim-strong);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.drawer-overlay.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 90vw;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
}

.drawer-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  font-size: 18px;
}

.drawer-close:hover {
  background: var(--workspace-alt);
  color: var(--text-primary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-left.open {
  transform: translateX(0);
}

.drawer-top.open {
  transform: translateY(0);
}

.drawer-bottom.open {
  transform: translateY(0);
}

/* Sortable headers */
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

th.sortable:hover {
  background: var(--border-soft);
}

th.sortable .sort-icon {
  margin-left: var(--space-2);
  opacity: 0.3;
  transition: opacity var(--transition-fast);
}

th.sortable:hover .sort-icon,
th.sortable.sorted .sort-icon {
  opacity: 1;
}

th.sortable.sorted-asc .sort-icon {
  transform: rotate(180deg);
}

/* ===========================================
   ICON SYSTEM
   =========================================== */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }

/* ===========================================
   LOADING STATES
   =========================================== */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--border-soft) 25%,
    var(--workspace-alt) 50%,
    var(--border-soft) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-soft);
}

.skeleton-row:last-child {
  border-bottom: none;
}

/* Reduced motion for skeleton animations */
@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: var(--border-soft);
  }
}

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

.dropdown.open .dropdown-toggle::after {
  transform: rotate(180deg);
}

.dropdown.open .dropdown-menu--center {
  transform: translateX(-50%) translateY(4px);
}

.dropdown.open .dropdown-menu--up {
  transform: translateY(-4px);
}

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

.dropdown-item.danger:hover {
  background: var(--danger-bg);
}

/* ===========================================
   TABS
   =========================================== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

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

.tab {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.tab.active {
  color: var(--blue-500);
  border-bottom-color: var(--blue-500);
}

/* ===========================================
   BREADCRUMB
   =========================================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.breadcrumb-item {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb-item:hover {
  color: var(--blue-500);
}

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

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: var(--font-medium);
}

/* ===========================================
   PROGRESS
   =========================================== */
.progress {
  width: 100%;
  height: 8px;
  background: var(--workspace-alt);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar.success {
  background: var(--success);
}

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

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

/* ===========================================
   AVATAR
   =========================================== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--workspace-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  overflow: hidden;
}

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

/* ===========================================
   TOOLTIP
   =========================================== */
[data-tooltip] {
  position: relative;
  display: inline-block;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-2) var(--space-3);
  background: var(--text-primary);
  color: white;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  white-space: nowrap;
  border-radius: var(--radius);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 1100;
  pointer-events: none;
  max-width: 280px;
  white-space: normal;
  text-align: center;
  line-height: 1.4;
}

/* Arrow */
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 5px solid transparent;
  border-top-color: var(--text-primary);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 1100;
  pointer-events: none;
}

[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Tooltip positions */
[data-tooltip-bottom]::after {
  bottom: auto;
  top: calc(100% + 8px);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-bottom]::before {
  bottom: auto;
  top: calc(100% + 4px);
  border-top-color: transparent;
  border-bottom-color: var(--text-primary);
  transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-bottom]:hover::after,
[data-tooltip-bottom]:hover::before {
  transform: translateX(-50%) translateY(0);
}

[data-tooltip-left]::after {
  bottom: auto;
  left: auto;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
}

[data-tooltip-left]::before {
  bottom: auto;
  left: auto;
  right: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  border-top-color: transparent;
  border-left-color: var(--text-primary);
}

[data-tooltip-left]:hover::after,
[data-tooltip-left]:hover::before {
  transform: translateY(-50%) translateX(0);
}

[data-tooltip-right]::after {
  bottom: auto;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
}

[data-tooltip-right]::before {
  bottom: auto;
  left: calc(100% + 4px);
  top: 50%;
  transform: translateY(-50%) translateX(4px);
  border-top-color: transparent;
  border-right-color: var(--text-primary);
}

[data-tooltip-right]:hover::after,
[data-tooltip-right]:hover::before {
  transform: translateY(-50%) translateX(0);
}

/* Tooltip variants */
[data-tooltip-error]::after {
  background: var(--danger);
}

[data-tooltip-error]::before {
  border-top-color: var(--danger);
}

[data-tooltip-success]::after {
  background: var(--success);
}

[data-tooltip-success]::before {
  border-top-color: var(--success);
}

[data-tooltip-warning]::after {
  background: var(--warning);
}

[data-tooltip-warning]::before {
  border-top-color: var(--warning);
}

.tooltip-container:hover .tooltip-content {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tooltip-container:hover .tooltip-content--bottom {
  transform: translateX(-50%) translateY(0);
}

/* Responsive content padding */
/* Responsive page header */
