:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --primary: #0369a1;
  --primary-hover: #075985;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --excel-10611: #92d050;
  --excel-10611-soft: #e2f0d9;
  --excel-10720: #ffff00;
  --excel-10720-soft: #fff9db;
  --excel-cyan: #66ffff;
  --excel-pink: #ff66ff;
  --excel-green-col: #ccff99;
  --excel-blue-col: #dce6f1;
  --excel-orange-col: #fde9d9;
  --excel-purple-col: #e4dfec;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
}

.navbar {
  background: #0f172a;
  color: #ffffff;
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1e293b;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
}

.navbar-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #1e293b;
  color: #cbd5e1;
}

.ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

.ws-badge.connected .ws-dot {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.container {
  max-width: 1680px;
  margin: 0 auto;
  padding: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  margin-bottom: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(3, 105, 161, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #0c4a6e 100%);
  box-shadow: 0 3px 8px rgba(3, 105, 161, 0.25);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(3, 105, 161, 0.2);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background: #15803d;
}

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  border-color: #cbd5e1;
}
.btn-outline:hover {
  background: #f1f5f9;
}

.btn-danger-outline {
  background: #ffffff;
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger-outline:hover {
  background: #fef2f2;
}

/* Report Spreadsheet Table Styling */
.report-table-wrap {
  overflow-x: auto;
  border: 1px solid #cbd5e1;
  border-radius: 0.5rem;
  max-height: 75vh;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.81rem;
}

.report-table th,
.report-table td {
  border: 1px solid #cbd5e1;
  padding: 0.38rem 0.55rem;
}

.report-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f1f5f9;
  font-weight: 700;
  text-align: center;
}

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

.col-grams { text-align: center; font-weight: 500; }
.col-output { }
.col-sales { }
.col-closing { }
.hdr-yellow { background-color: #f1f5f9 !important; color: #0f172a; }
.hdr-green { background-color: #f1f5f9 !important; color: #0f172a; }
.hdr-pink { background-color: #1e3a8a !important; color: #ffffff !important; }

.subtotal-10720 td,
.subtotal-10611 td {
  background-color: #f8fafc !important;
  font-weight: 700;
  border-top: 1px solid #94a3b8 !important;
  border-bottom: 3px double #64748b !important;
}

.summary-10611 { background-color: #f0fdf4; font-weight: 700; }
.summary-10611 td:first-child { background-color: #dcfce7; color: #166534; font-weight: 700; }
.summary-10720 { background-color: #fffbeb; font-weight: 700; }
.summary-10720 td:first-child { background-color: #fef3c7; color: #92400e; font-weight: 700; }
.summary-total {
  background-color: #dbeafe !important;
  color: #1e3a8a !important;
  font-weight: 700;
  border-top: 1px solid #94a3b8 !important;
  border-bottom: 3px double #64748b !important;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-10611 { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.badge-10720 { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.badge-excluded { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ═══════════════════════════════════════════════════════════════════
   CYFRA UNIFIED COMPONENT HEADER DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --header-height: 58px;
  --header-bg: #0f172a;
  --header-border: rgba(255, 255, 255, 0.08);
  --header-text: #f8fafc;
  --header-text-muted: #94a3b8;
}

.app-header {
  height: var(--header-height);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 1000;
  user-select: none;
  -webkit-user-select: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform 0.2s ease;
  line-height: 1;
}

.header-logo-link:hover {
  transform: scale(1.08);
}

.header-logo-img {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.45));
}

.header-title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  user-select: none;
}

.header-title {
  font-size: 16px;
  font-weight: 850;
  color: #ffffff;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1;
  padding: 0;
  margin: 0;
  display: block;
  transition: color 0.15s ease;
}

.header-title:hover {
  color: #38bdf8;
}

.header-line {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, #38bdf8 0%, rgba(56, 189, 248, 0.5) 60%, transparent 100%);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.5);
  margin: 5px 0 4px 0;
}

.header-subtitle {
  font-size: 9.5px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.85px;
  line-height: 1;
  padding: 0;
  margin: 0;
  white-space: nowrap;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  margin-left: 4px;
}

.header-breadcrumb .bc-sep {
  color: #475569;
  font-size: 14px;
}

.header-breadcrumb .bc-title {
  color: #e2e8f0;
  font-weight: 600;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-left: 6px;
}

.header-badge.dev-mode {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-right > * {
  margin: 0;
}

.header-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-size: 17.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
  line-height: 1;
  flex-shrink: 0;
  box-sizing: border-box;
}

.header-icon-btn i {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.15);
}

/* Connection Sync Heartbeat Status (Matching Reference Project) */
#btnSyncStatus #headerConnectionIcon {
  font-size: 18px;
  transition: color 0.06s ease !important;
}

/* Connected, waiting for first data: neutral gray */
#btnSyncStatus.connected #headerConnectionIcon {
  color: #94a3b8;
  filter: none !important;
  animation: none !important;
}

/* Connected + data flowing: emerald green idle */
#btnSyncStatus.connected.data-live #headerConnectionIcon {
  color: #34d399;
}

/* Receiving data: bright mint green flash (150ms) */
#btnSyncStatus.connected.sync-receiving #headerConnectionIcon {
  color: #a7f3d0;
}

/* Connecting: amber/yellow icon with slow pulse */
#btnSyncStatus.connecting #headerConnectionIcon {
  color: #fbbf24;
  animation: heart-amber-pulse 1.8s ease-in-out infinite;
}

@keyframes heart-amber-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.9);
  }
}

/* Disconnected: red/dim icon */
#btnSyncStatus.disconnected #headerConnectionIcon {
  color: #f87171;
  opacity: 0.7;
  animation: none;
}

/* Active Clients Badge */
.active-clients-btn {
  color: #38bdf8;
  position: relative;
}

.active-clients-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  background: #2563eb;
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 750;
  min-width: 16px;
  height: 16px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.6);
}

/* User Profile Badge */
.header-user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 32px;
  margin: 0 10px !important;
  padding: 0 13px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  box-sizing: border-box;
  line-height: 1;
  transition: all 0.15s ease;
  user-select: none;
}

.header-user-badge:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}

.header-user-badge .user-icon {
  color: #38bdf8;
  font-size: 16.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.header-user-badge .user-name {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  color: #f1f5f9;
  letter-spacing: 0.1px;
}

.header-user-badge .user-role-tag {
  background: #1e293b;
  color: #93c5fd;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2.5px 6.5px;
  border-radius: 4px;
  border: 1px solid rgba(147, 197, 253, 0.2);
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.header-icon-btn.logout-btn:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════
   RICH HTML TOOLTIPS
   ═══════════════════════════════════════════════════════════════════ */
.rich-tooltip-container {
  position: absolute;
  z-index: 10000;
  padding: 8px 12px;
  width: max-content;
  max-width: 290px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  line-height: 1.5;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.25);
  pointer-events: none;
  white-space: pre-line;
  text-align: left;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  display: none;
}

.rich-tooltip-container.active {
  opacity: 1;
  transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 16px);
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.notification {
  pointer-events: auto;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transform: translateX(400px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 340px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  border-left: 4px solid #10b981;
}

.notification.info {
  border-left: 4px solid #38bdf8;
}

.notification.warning {
  border-left: 4px solid #fbbf24;
}

.notification.error {
  border-left: 4px solid #ef4444;
}

.notification i {
  font-size: 1.15rem;
  margin-top: 2px;
  color: #38bdf8;
}

.notification.success i { color: #10b981; }
.notification.warning i { color: #fbbf24; }
.notification.error i { color: #ef4444; }

.notification-content h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: #f8fafc;
}

.notification-content p {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.4;
}




