/* ==========================================================================
   Meridian Analytics — Dashboard & Application Styles
   Requires base.css design tokens
   ========================================================================== */

/* --------------------------------------------------------------------------
   APP LAYOUT — Sidebar + Main Content Grid
   -------------------------------------------------------------------------- */

.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-content {
  flex: 1;
  padding: 32px 40px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   SIDEBAR
   -------------------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform var(--transition);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

/* Sidebar Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--amber);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--navy);
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.sidebar-logo-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--amber);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: auto;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
}

.sidebar-nav-section {
  margin-bottom: 8px;
}

.sidebar-nav-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.45);
  padding: 16px 12px 8px;
  user-select: none;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: 1px 0;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.sidebar-nav-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: var(--amber);
  border-left: 3px solid var(--amber);
  padding-left: 13px;
}

.sidebar-nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-nav-item:hover .nav-icon,
.sidebar-nav-item.active .nav-icon {
  opacity: 1;
}

.sidebar-nav-item .nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav-item .nav-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--amber);
  color: var(--navy);
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  line-height: 1.5;
}

/* Sidebar Trial Info Box */
.sidebar-trial-box {
  margin: 8px 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.sidebar-trial-box .trial-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}

.sidebar-trial-box .trial-timer {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.sidebar-trial-box .trial-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 12px;
}

.sidebar-trial-box .trial-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.sidebar-trial-box .trial-progress-bar {
  height: 100%;
  background: var(--amber);
  border-radius: 2px;
  transition: width 0.6s ease;
}

.sidebar-trial-box .trial-cta {
  display: block;
  width: 100%;
  padding: 8px;
  background: var(--amber);
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.sidebar-trial-box .trial-cta:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Sidebar User Area */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), #e8a020);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
}

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

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

.sidebar-user-email {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-menu {
  color: rgba(255, 255, 255, 0.3);
  font-size: 16px;
}

/* Mobile Sidebar Toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--navy);
  border: none;
  border-radius: var(--radius);
  color: var(--white);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.active {
  opacity: 1;
}


/* --------------------------------------------------------------------------
   APP HEADER
   -------------------------------------------------------------------------- */

.app-header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 40px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 64px;
  box-sizing: border-box;
  flex-wrap: nowrap;
}

.app-header-title {
  flex-shrink: 0;
}

.app-header-title h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.3px;
}

.app-header-title p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.app-header-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}

.header-meta-item {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.header-meta-item:empty {
  display: none;
}

.header-meta-item + .header-meta-item:not(:empty)::before {
  content: "\00b7";
  margin-right: 12px;
  color: var(--border);
}

.header-meta-link {
  color: var(--amber);
}

/* Search Bar */
.app-search {
  flex: 1;
  max-width: 480px;
  min-width: 0;
  margin: 0 auto;
  position: relative;
}

.app-search-input {
  width: 100%;
  padding: 9px 16px 9px 40px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  box-sizing: border-box;
}

.app-search-input::placeholder {
  color: var(--text-secondary);
}

.app-search-input:focus {
  background: var(--white);
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(232, 168, 62, 0.1);
}

.app-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-secondary);
  pointer-events: none;
}

.app-search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--white);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  pointer-events: none;
}

/* Header Actions */
.app-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-action-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.header-action-btn:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

/* Notification Badge */
.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  background: var(--amber);
  color: var(--navy);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 0 4px;
  line-height: 1;
  box-sizing: border-box;
  pointer-events: none;
}

/* User Avatar Dropdown in Header */
.header-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), #1a2744);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition);
  flex-shrink: 0;
}

.header-user-avatar:hover {
  border-color: var(--amber);
}

/* Header Dropdown Menu */
.header-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 60;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: all var(--transition);
}

.header-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.header-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

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

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


/* --------------------------------------------------------------------------
   DASHBOARD GRID
   -------------------------------------------------------------------------- */

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.dashboard-grid .span-2 {
  grid-column: span 2;
}

.dashboard-grid .span-3 {
  grid-column: span 3;
}

.dashboard-grid .span-4,
.dashboard-grid .span-full {
  grid-column: 1 / -1;
}

.dashboard-grid .span-row-2 {
  grid-row: span 2;
}

/* --------------------------------------------------------------------------
   DASHBOARD CONTENT & DASHBOARD CARDS
   -------------------------------------------------------------------------- */

.dashboard-content {
  padding: 32px 40px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.metric-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.metric-card-title {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.metric-card-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

.dashboard-row {
  display: grid;
  gap: 24px;
  margin-bottom: 32px;
}

.dashboard-row-2col {
  grid-template-columns: 1fr 1fr;
}

.dashboard-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow var(--transition);
  overflow: hidden;
  min-width: 0;
}

.dashboard-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dashboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.dashboard-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.dashboard-card-body {
  padding: 16px 24px 24px;
  flex: 1;
}

.dashboard-card-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------------------
   ACTIVITY FEED
   -------------------------------------------------------------------------- */

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

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  margin-top: 6px;
}

.activity-dot-warning {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

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

.activity-text {
  font-size: 14px;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
}

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

/* --------------------------------------------------------------------------
   CAMPAIGN PULSE
   -------------------------------------------------------------------------- */

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

.pulse-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pulse-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pulse-campaign-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.pulse-health-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.pulse-bar {
  width: 100%;
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}

.pulse-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.pulse-green { background: #22c55e; }
.pulse-amber { background: var(--amber); }
.pulse-red   { background: #ef4444; }

/* --------------------------------------------------------------------------
   QUICK ACTIONS
   -------------------------------------------------------------------------- */

.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   WIDGET CARDS
   -------------------------------------------------------------------------- */

.widget-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition);
  min-width: 0;
  overflow: hidden;
}

.widget-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.widget-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 0;
  gap: 12px;
}

.widget-header-info {
  flex: 1;
  min-width: 0;
}

.widget-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
}

.widget-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.widget-action-menu {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition);
  flex-shrink: 0;
}

.widget-action-menu:hover {
  background: var(--bg);
  color: var(--text);
}

.widget-body {
  flex: 1;
  padding: 16px 24px;
  min-height: 120px;
  position: relative;
}

.widget-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.widget-footer-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--transition);
}

.widget-footer-link:hover {
  opacity: 0.8;
}


/* --------------------------------------------------------------------------
   METRIC CARDS
   -------------------------------------------------------------------------- */

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  min-width: 0;
}

.metric-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

.metric-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 18px;
  flex-shrink: 0;
}

.metric-icon.navy {
  background: rgba(15, 23, 42, 0.08);
  color: var(--navy);
}

.metric-icon.amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}

.metric-icon.green {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.metric-icon.blue {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}

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

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
}

.metric-trend.up {
  color: #16a34a;
  background: rgba(34, 197, 94, 0.1);
}

.metric-trend.down {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.1);
}

.metric-trend.neutral {
  color: var(--text-secondary);
  background: var(--bg);
}

.metric-trend-arrow {
  font-size: 11px;
}

.metric-comparison {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}


/* --------------------------------------------------------------------------
   DATA TABLE
   -------------------------------------------------------------------------- */

.data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.data-table th.sortable {
  cursor: pointer;
  transition: color var(--transition);
}

.data-table th.sortable:hover {
  color: var(--text);
}

.data-table th .sort-indicator {
  display: inline-flex;
  flex-direction: column;
  margin-left: 4px;
  font-size: 8px;
  line-height: 1;
  vertical-align: middle;
  opacity: 0.3;
  transition: opacity var(--transition);
}

.data-table th.sorted-asc .sort-indicator,
.data-table th.sorted-desc .sort-indicator {
  opacity: 1;
  color: var(--amber);
}

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

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.015);
}

.data-table tbody tr:hover {
  background: rgba(245, 158, 11, 0.04);
}

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

/* Table Cell Variants */
.table-cell-primary {
  font-weight: 600;
  color: var(--text);
}

.table-cell-secondary {
  color: var(--text-secondary);
  font-size: 12px;
}

.table-cell-mono {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge.active,
.status-badge.status-active {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.status-badge.active::before,
.status-badge.status-active::before {
  background: #16a34a;
}

.status-badge.paused,
.status-badge.status-paused {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.status-badge.paused::before,
.status-badge.status-paused::before {
  background: #d97706;
}

.status-badge.completed {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.status-badge.completed::before {
  background: #2563eb;
}

.status-badge.error,
.status-badge.failed {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.status-badge.error::before,
.status-badge.failed::before {
  background: #dc2626;
}

.status-badge.draft {
  background: var(--bg);
  color: var(--text-secondary);
}

.status-badge.draft::before {
  background: var(--text-secondary);
}

/* Table Pagination */
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.table-pagination-info {
  font-size: 13px;
}

.table-pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.table-pagination-btn {
  padding: 6px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.table-pagination-btn:hover:not(:disabled) {
  border-color: var(--amber);
  color: var(--amber);
}

.table-pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.table-pagination-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}


/* --------------------------------------------------------------------------
   CHART CONTAINERS
   -------------------------------------------------------------------------- */

.chart-container {
  position: relative;
  width: 100%;
}

.chart-container canvas {
  width: 100% !important;
  height: auto !important;
}

.chart-container-16x9 {
  aspect-ratio: 16 / 9;
}

.chart-container-4x3 {
  aspect-ratio: 4 / 3;
}

.chart-container-square {
  aspect-ratio: 1 / 1;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Chart Loading Skeleton */
.chart-skeleton {
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: linear-gradient(
    90deg,
    var(--bg) 25%,
    rgba(255, 255, 255, 0.6) 50%,
    var(--bg) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
  border-radius: var(--radius);
}

/* Chart Period Selector Tabs */
.chart-period-tabs {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.chart-period-tab {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

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

.chart-period-tab.active {
  background: var(--white);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


/* --------------------------------------------------------------------------
   SIGNAL MAP CONTAINER
   -------------------------------------------------------------------------- */

.signal-map-container {
  position: relative;
  width: 100%;
  min-height: 400px;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.signal-map-container svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* SVG Node Styles */
.signal-map-container .node {
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.signal-map-container .node circle {
  stroke-width: 2;
  transition: all 0.2s ease;
}

.signal-map-container .node:hover circle {
  stroke-width: 3;
  filter: brightness(1.1);
}

.signal-map-container .node text {
  font-size: 11px;
  font-weight: 500;
  fill: var(--text);
  pointer-events: none;
}

/* SVG Edge Styles */
.signal-map-container .edge {
  stroke: var(--border);
  stroke-width: 1.5;
  fill: none;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.signal-map-container .edge.highlighted {
  stroke: var(--amber);
  stroke-width: 2.5;
  opacity: 1;
}

/* Map Legend Overlay */
.signal-map-legend {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 5;
}

.signal-map-legend-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.signal-map-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  color: var(--text);
}

.signal-map-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid;
  flex-shrink: 0;
}

/* Map Controls */
.signal-map-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}

.signal-map-controls button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.signal-map-controls button:hover {
  border-color: var(--amber);
  color: var(--amber);
}


/* --------------------------------------------------------------------------
   USER PROFILE CARDS
   -------------------------------------------------------------------------- */

.user-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
}

.user-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--amber);
}

.user-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-card-avatar.navy {
  background: rgba(15, 23, 42, 0.08);
  color: var(--navy);
}

.user-card-avatar.amber {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}

.user-card-avatar.blue {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}

.user-card-avatar.green {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.user-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.user-card-role {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: -4px;
}

.user-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.user-card-stat {
  text-align: center;
}

.user-card-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.user-card-stat-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}


/* --------------------------------------------------------------------------
   USER PROFILES PAGE (users.html)
   -------------------------------------------------------------------------- */

.user-profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.user-avatar-large {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-initials {
  font-size: 16px;
  font-weight: 700;
}

.user-card-identity {
  flex: 1;
  min-width: 0;
}

.user-segment-id {
  font-size: 12px;
  color: var(--text-secondary);
  font-family: monospace;
  display: block;
  margin-top: 2px;
}

.user-card-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 0 0 16px;
}

.user-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.user-metric {
  text-align: center;
}

.user-metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}

.user-metric-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.user-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.user-meta-item {
  font-size: 12px;
  color: var(--text-secondary);
}

.user-details-panel {
  margin-top: 32px;
}

.user-detail-tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

.tab-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.user-detail-content-area {
  min-height: 200px;
}

.user-detail-placeholder {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 20px;
  font-size: 15px;
}

/* --------------------------------------------------------------------------
   SETTINGS PAGE
   -------------------------------------------------------------------------- */

.settings-section {
  max-width: 720px;
}

.settings-section + .settings-section {
  margin-top: 40px;
}

.settings-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px;
}

.settings-section-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 24px;
}

.settings-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.settings-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
}

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

.settings-item-info {
  flex: 1;
  min-width: 0;
}

.settings-item-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.settings-item-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.settings-item-control {
  flex-shrink: 0;
  padding-top: 2px;
}

/* Setting Rows (settings.html) */
.setting-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
}

.setting-row + .setting-row {
  border-top: 1px solid var(--border);
}

.setting-row-info {
  flex: 1;
  min-width: 0;
}

.setting-row-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.setting-row-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Integrations Grid */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.integration-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
}

.integration-card:hover {
  border-color: var(--amber);
}

.integration-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  background: var(--card);
  border-radius: 10px;
}

.integration-card-info {
  flex: 1;
  min-width: 0;
}

.integration-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.integration-card-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.integration-card-status.connected {
  color: #16a34a;
  font-weight: 500;
}

/* Form actions */
.form-actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background var(--transition);
}

.toggle-switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition);
}

.toggle-switch input:checked + .toggle-switch-slider {
  background: var(--amber);
}

.toggle-switch input:checked + .toggle-switch-slider::before {
  transform: translateX(20px);
}

.toggle-switch input:focus-visible + .toggle-switch-slider {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label-description {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 2px;
}

/* Range inputs */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--amber);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--amber);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Signal filters panel */
.signal-filters .card {
  overflow: hidden;
}

.signal-filters .form-group div[style*="flex"] {
  overflow: hidden;
  min-width: 0;
}

/* Overflow protection for range sliders in constrained containers */
.signal-filters input[type="range"] {
  min-width: 0;
  max-width: 100%;
  flex: 1 1 0;
  overflow: hidden;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  box-sizing: border-box;
  font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-secondary);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10L6 8z' fill='%2364748b'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

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

.form-error {
  font-size: 12px;
  color: #dc2626;
  margin-top: 4px;
}

/* Settings Save Area */
.settings-save-area {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}


/* --------------------------------------------------------------------------
   BILLING PAGE
   -------------------------------------------------------------------------- */

.billing-section {
  max-width: 800px;
}

.billing-section + .billing-section {
  margin-top: 32px;
}

/* Plan Card */
.plan-card {
  padding: 4px 0;
}

.plan-card-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.plan-card-label {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.plan-card-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

/* Usage Meters */
.usage-meters {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.usage-meter {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-meter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.usage-meter-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.usage-meter-value {
  font-size: 13px;
  color: var(--text-secondary);
}

.usage-meter-bar {
  width: 100%;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
}

.usage-meter-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* Plan Comparison */
.plan-comparison {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.plan-tier {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.plan-tier-current {
  border-color: var(--amber);
  background: var(--card);
  box-shadow: 0 4px 16px rgba(232, 168, 62, 0.15);
}

.plan-tier-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--amber);
  color: var(--navy);
  padding: 3px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.plan-tier-header {
  text-align: center;
  margin-bottom: 20px;
}

.plan-tier-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.plan-tier-price {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.plan-tier-period {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.plan-tier-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  flex: 1;
}

.plan-tier-features li {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.plan-tier-features li:last-child {
  border-bottom: none;
}

/* Current Plan Card (legacy) */
.billing-plan-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.billing-plan-info {
  flex: 1;
}

.billing-plan-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.billing-plan-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
  padding: 3px 10px;
  border-radius: 12px;
}

.billing-plan-price {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.billing-plan-usage {
  margin-top: 16px;
}

.billing-plan-usage-bar {
  width: 100%;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.billing-plan-usage-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.billing-plan-usage-text {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Payment Method Card */
.billing-payment-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.billing-card-icon {
  width: 48px;
  height: 32px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.billing-card-details {
  flex: 1;
}

.billing-card-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.billing-card-expiry {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Coupon Code Input */
.coupon-input {
  display: flex;
  gap: 8px;
  max-width: 400px;
}

.coupon-input input {
  flex: 1;
  padding: 9px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text);
  transition: border-color var(--transition);
  box-sizing: border-box;
}

.coupon-input input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.coupon-input input::placeholder {
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-secondary);
}

.coupon-input .coupon-apply-btn {
  padding: 9px 20px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.coupon-input .coupon-apply-btn:hover {
  background: #1a2744;
}

/* Invoice Table */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.invoice-table th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.invoice-table td {
  padding: 14px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

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

.invoice-download-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
  text-decoration: none;
  cursor: pointer;
}

.invoice-download-link:hover {
  text-decoration: underline;
}


/* --------------------------------------------------------------------------
   REPORTS
   -------------------------------------------------------------------------- */

.report-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition);
  cursor: pointer;
}

.report-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.report-card-thumbnail {
  width: 100%;
  height: 160px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 32px;
  overflow: hidden;
}

.report-card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.report-card-body {
  padding: 16px 20px;
}

.report-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.report-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Report Actions Bar */
.report-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.report-actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-range-selector {
  display: flex;
  align-items: center;
  gap: 4px;
}

.date-range-btn {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

.date-range-btn.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.export-dropdown {
  position: relative;
}

.export-dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 50;
  min-width: 120px;
  padding: 4px;
}

.export-option {
  display: block;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border-radius: 4px;
  text-align: left;
}

.export-option:hover {
  background: var(--bg);
}

/* Report Cards Grid */
.report-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.report-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.report-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.report-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.report-content-area {
  min-height: 200px;
}

.report-placeholder {
  text-align: center;
  color: var(--text-secondary);
  padding: 60px 20px;
  font-size: 15px;
}

.report-preview-panel {
  margin-top: 0;
}

/* Notification Panel */
.notification-panel {
  position: absolute;
  right: 20px;
  top: 64px;
  width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
  z-index: 200;
}

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

.notification-panel-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.notification-mark-read {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--amber);
  cursor: pointer;
  font-weight: 500;
}

.notification-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

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

.notification-item:last-child {
  border-bottom: none;
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  margin-top: 6px;
}

.notification-content {
  flex: 1;
}

.notification-message {
  font-size: 14px;
  color: var(--text);
  margin: 0;
  line-height: 1.4;
}

.notification-time {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: block;
}

/* Date Range Selector */
.date-range-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.date-range-preset {
  padding: 7px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.date-range-preset:hover {
  border-color: var(--amber);
}

.date-range-preset.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.date-range-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.date-range-input {
  padding: 7px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}

.date-range-input:focus {
  outline: none;
  border-color: var(--amber);
}

.date-range-separator {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Export Button */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.export-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.export-btn-icon {
  font-size: 14px;
}


/* --------------------------------------------------------------------------
   EMPTY STATES
   -------------------------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px;
  min-height: 320px;
}

.empty-state-illustration {
  width: 120px;
  height: 120px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 24px;
  color: var(--text-secondary);
  opacity: 0.6;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
}

.empty-state-description {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.6;
  margin: 0 0 24px;
}

.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--amber);
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.empty-state-action:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}


/* --------------------------------------------------------------------------
   LOADING STATES
   -------------------------------------------------------------------------- */

/* Skeleton Shimmer */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg) 0%,
    rgba(255, 255, 255, 0.7) 40%,
    rgba(255, 255, 255, 0.7) 60%,
    var(--bg) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.8s ease-in-out infinite;
  border-radius: 6px;
}

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

.skeleton-text {
  height: 14px;
  margin-bottom: 10px;
  width: 100%;
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.shorter {
  width: 40%;
}

.skeleton-heading {
  height: 24px;
  width: 50%;
  margin-bottom: 16px;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.skeleton-card {
  height: 200px;
}

.skeleton-chart {
  height: 240px;
  border-radius: var(--radius);
}

/* Loading Spinner */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spinner-rotate 0.7s linear infinite;
}

.loading-spinner.sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.loading-spinner.lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

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

/* Full-page Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.loading-overlay-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Inline Loading */
.loading-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 12px;
}

.loading-inline-text {
  font-size: 13px;
  color: var(--text-secondary);
}


/* --------------------------------------------------------------------------
   BUTTONS (App-level extensions)
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--amber);
  color: var(--navy);
  border-color: var(--amber);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-secondary {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.btn-secondary:hover:not(:disabled) {
  background: #1a2744;
}

.btn-outline {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--navy);
  color: var(--navy);
}

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}

.btn-danger {
  background: #dc2626;
  color: var(--white);
  border-color: #dc2626;
}

.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 12px 28px;
  font-size: 16px;
}

.btn-icon {
  padding: 8px;
  width: 36px;
  height: 36px;
}


/* --------------------------------------------------------------------------
   TABS (Page-level navigation)
   -------------------------------------------------------------------------- */

.page-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.page-tab {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

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

.page-tab.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
  font-weight: 600;
}


/* --------------------------------------------------------------------------
   BREADCRUMBS
   -------------------------------------------------------------------------- */

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

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

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

.breadcrumb-item.current {
  color: var(--text);
  font-weight: 600;
  pointer-events: none;
}

.breadcrumb-separator {
  color: var(--border);
  font-size: 10px;
}


/* --------------------------------------------------------------------------
   TOOLTIPS & POPOVERS
   -------------------------------------------------------------------------- */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: var(--navy);
  color: var(--white);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 200;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}


/* --------------------------------------------------------------------------
   TOAST / NOTIFICATION BAR
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  min-width: 300px;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  z-index: 1000;
  animation: toast-slide-in 0.3s ease;
}

.toast.toast-exit {
  animation: toast-slide-out 0.3s ease forwards;
}

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.toast-message {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  flex-shrink: 0;
}

.toast.success {
  border-left: 3px solid #16a34a;
}

.toast.error {
  border-left: 3px solid #dc2626;
}

.toast.warning {
  border-left: 3px solid #d97706;
}

.toast.info {
  border-left: 3px solid #2563eb;
}


/* --------------------------------------------------------------------------
   MODAL / DIALOG
   -------------------------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 24px;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity var(--transition);
}

.modal-backdrop.open {
  opacity: 1;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(8px);
  transition: transform var(--transition);
}

.modal-backdrop.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 24px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

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

.modal-close:hover {
  background: var(--bg);
  color: var(--text);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 0 24px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}


/* --------------------------------------------------------------------------
   RESPONSIVE — Tablet (below 1024px)
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    transform: translateX(-100%);
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
  }

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

  .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .app-header {
    padding: 16px 20px;
    padding-left: 64px;
  }

  .app-content {
    padding: 24px 20px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .dashboard-grid .span-3 {
    grid-column: 1 / -1;
  }

  .dashboard-grid .span-2 {
    grid-column: span 2;
  }

  .metric-cards-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .dashboard-row-2col {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-content {
    padding: 24px 20px;
  }

  .app-search {
    max-width: 320px;
  }

  .app-search-shortcut {
    display: none;
  }

  .billing-plan-card {
    flex-direction: column;
    align-items: flex-start;
  }
}


/* --------------------------------------------------------------------------
   RESPONSIVE — Mobile (below 768px)
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .app-header {
    flex-wrap: wrap;
    gap: 12px;
    min-height: auto;
  }

  .app-header-title {
    order: 1;
    flex: 1;
  }

  .app-header-actions {
    order: 2;
  }

  .app-search {
    order: 3;
    max-width: 100%;
    width: 100%;
    margin: 0;
  }

  .app-content {
    padding: 20px 16px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .dashboard-grid .span-2,
  .dashboard-grid .span-3 {
    grid-column: 1 / -1;
  }

  .metric-value {
    font-size: 26px;
  }

  .metric-cards-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .dashboard-row-2col {
    grid-template-columns: 1fr;
  }

  .dashboard-content {
    padding: 20px 16px;
  }

  .metric-card-value {
    font-size: 26px;
  }

  .quick-actions-grid {
    grid-template-columns: 1fr;
  }

  .data-table-wrapper {
    margin: 0 -16px;
    padding: 0 16px;
  }

  .widget-header {
    padding: 16px 18px 0;
  }

  .widget-body {
    padding: 12px 18px;
  }

  .widget-footer {
    padding: 10px 18px;
  }

  .page-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
  }

  .page-tab {
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 13px;
  }

  .date-range-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .date-range-custom {
    margin-left: 0;
  }

  .settings-item {
    flex-direction: column;
    gap: 12px;
  }

  .user-card-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .coupon-input {
    max-width: 100%;
    flex-direction: column;
  }

  .toast {
    left: 16px;
    right: 16px;
    min-width: auto;
  }

  .modal {
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 90vh;
  }

  .table-pagination {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .empty-state {
    padding: 40px 20px;
    min-height: 240px;
  }

  .empty-state-illustration {
    width: 96px;
    height: 96px;
    font-size: 36px;
  }
}


/* --------------------------------------------------------------------------
   RESPONSIVE — Small Mobile (below 480px)
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
  .app-header {
    padding-left: 56px;
    padding-right: 12px;
  }

  .app-header-title h1 {
    font-size: 17px;
  }

  .metric-card {
    padding: 18px;
  }

  .metric-value {
    font-size: 22px;
  }

  .billing-plan-name {
    font-size: 17px;
    flex-wrap: wrap;
  }

  .breadcrumbs {
    font-size: 12px;
    overflow-x: auto;
    white-space: nowrap;
  }
}


/* --------------------------------------------------------------------------
   PRINT STYLES
   -------------------------------------------------------------------------- */

@media print {
  .sidebar,
  .sidebar-toggle,
  .sidebar-overlay,
  .app-header-actions,
  .app-search,
  .widget-action-menu,
  .table-pagination,
  .toast,
  .modal-backdrop {
    display: none !important;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .app-header {
    position: static;
    border-bottom: 2px solid #000;
  }

  .widget-card,
  .metric-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* --------------------------------------------------------------------------
   ACCESSIBILITY: Reduced Motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .chart-skeleton {
    animation: none;
    background: var(--bg);
  }

  .loading-spinner {
    animation-duration: 1.5s;
  }

  .toast {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}


/* --------------------------------------------------------------------------
   ACCESSIBILITY: Focus Visible
   -------------------------------------------------------------------------- */

.sidebar-nav-item:focus-visible,
.header-action-btn:focus-visible,
.btn:focus-visible,
.page-tab:focus-visible,
.date-range-preset:focus-visible,
.export-btn:focus-visible,
.table-pagination-btn:focus-visible,
.chart-period-tab:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
