:root {
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-table-alt: #f8fafc;
  --primary: #0078d4;
  --primary-hover: #005a9e;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --cell-width: 40px;
  
  --phase-ready: linear-gradient(135deg, #8b5cf6, #6d28d9);
  --phase-iv: linear-gradient(135deg, #f97316, #ea580c);
  --phase-iv-pass: linear-gradient(135deg, #10b981, #059669);
  --phase-fixing: linear-gradient(135deg, #06b6d4, #0891b2);
  --phase-dhl: linear-gradient(135deg, #475569, #334155);
  --phase-official: linear-gradient(135deg, #0284c7, #0369a1);
  --phase-pass: linear-gradient(135deg, #10b981, #047857);
}

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

body {
  font-family: 'Segoe UI', 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

.toolbar {
  padding: 0;
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  z-index: 20;
}

.toolbar-row {
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
}

.toolbar-row-top {
  padding-top: 0.6rem;
  padding-bottom: 0.5rem;
  gap: 1.25rem;
}

.toolbar-row-top h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.3px;
  margin: 0;
  flex-shrink: 0;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  flex: 1;
  justify-content: flex-end;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: #cbd5e1;
  flex-shrink: 0;
}

/* Global Ready input group */
.global-ready-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.global-ready-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.global-ready-group input {
  width: 100px;
  padding: 0.3rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: #f8fafc;
  transition: border-color 0.15s;
}

.global-ready-group input:focus {
  outline: none;
  border-color: #0078d4;
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.15);
  background: #fff;
}

.btn-accent {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  box-shadow: 0 1px 4px rgba(5, 150, 105, 0.25);
}

.btn-accent:hover {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 3px 8px rgba(16, 185, 129, 0.35);
  transform: translateY(-1px);
}

/* Legend row */
.toolbar-row-legend {
  padding-top: 0.3rem;
  padding-bottom: 0.5rem;
  border-top: 1px solid #f1f5f9;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.4rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 3px;
  transition: background 0.15s;
}

.legend-item:hover {
  background: #e2e8f0;
}

.legend-color {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.toolbar-actions .btn-secondary {
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
}

.btn {
  padding: 0.45rem 0.9rem;
  border: none;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease-in-out;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-primary {
  background: linear-gradient(135deg, #0078d4 0%, #005a9e 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(0, 120, 212, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0078d4 100%);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.btn-secondary:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-danger {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-danger:hover {
  background-color: #dc2626;
  color: white;
}

/* Forms */
input, select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.2);
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.content-area {
  display: flex;
  flex: 1;
  overflow: hidden;
  background-color: var(--bg-dark);
}
