:root {
  --primary: #008a8a;
  --primary-hover: #007373;
  --primary-light: #e6f7f7;
  --secondary: #242a30;
  --dark-bg: #1a1e23;
  --sidebar-bg: #242a30;
  --accent-red: #d9534f;
  --accent-green: #00acac;
  --accent-blue: #348fe2;
  --accent-orange: #f59c1a;
  --text-dark: #2d353c;
  --text-muted: #707478;
  --border-color: #e2e7eb;
  --card-bg: #ffffff;
  --bg-light: #f4f6f9;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  font-size: 13px;
  line-height: 1.5;
}

/* Header */
.app-header {
  background: #ffffff;
  border-bottom: 2px solid var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  height: 60px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.brand-logo span.badge {
  font-size: 11px;
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
}

.header-clocks {
  display: flex;
  align-items: center;
  gap: 15px;
}

.clock-card {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.clock-card .city {
  font-weight: 600;
  color: var(--text-muted);
}

.clock-card .time {
  font-weight: 700;
  color: var(--primary);
  font-family: monospace;
}

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

.status-pill {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-pill.active {
  background: #e6fffa;
  color: #0d9488;
  border: 1px solid #99f6e4;
}

.status-pill.running {
  background: #fef3c7;
  color: #d97706;
  border: 1px solid #fde68a;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Layout */
.app-container {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: #a8b1bb;
  padding: 20px 0;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #a8b1bb;
  text-decoration: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover, .nav-item.active {
  background: #1b1f24;
  color: #ffffff;
  border-left-color: var(--primary);
}

.nav-item i {
  font-size: 15px;
  width: 18px;
}

.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Page Titles */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--secondary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-info .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.stat-info .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--secondary);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-icon.primary { background: #e0f2fe; color: #0284c7; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }

/* Control Panel */
.panel {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  overflow: hidden;
}

.panel-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 20px;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
}

.form-control {
  height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--text-dark);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 138, 138, 0.15);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #64748b;
  color: #fff;
}
.btn-secondary:hover {
  background: #475569;
}

.btn-success {
  background: #10b981;
  color: #fff;
}
.btn-success:hover {
  background: #059669;
}

.btn-outline {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: var(--text-dark);
}
.btn-outline:hover {
  background: #f1f5f9;
}

/* Live Terminal */
.terminal-window {
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
  font-family: "Cascadia Code", "Fira Code", Menlo, Monaco, Consolas, monospace;
}

.terminal-header {
  background: #1e293b;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.terminal-title {
  color: #94a3b8;
  font-size: 12px;
}

.terminal-body {
  padding: 14px;
  max-height: 280px;
  min-height: 160px;
  overflow-y: auto;
  color: #f8fafc;
  font-size: 12px;
  line-height: 1.6;
}

.terminal-line {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.term-time { color: #64748b; }
.term-step {
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 11px;
}
.term-step.INIT { background: #334155; color: #cbd5e1; }
.term-step.AUTH { background: #0284c7; color: #fff; }
.term-step.NAV { background: #6366f1; color: #fff; }
.term-step.FORM { background: #8b5cf6; color: #fff; }
.term-step.SEARCH { background: #ec4899; color: #fff; }
.term-step.EXTRACT { background: #0d9488; color: #fff; }
.term-step.PROCESS { background: #d97706; color: #fff; }
.term-step.EXCEL { background: #16a34a; color: #fff; }
.term-step.EMAIL { background: #2563eb; color: #fff; }
.term-step.DONE { background: #15803d; color: #fff; }
.term-step.ERROR { background: #b91c1c; color: #fff; }

.term-msg { color: #e2e8f0; }

/* Table */
.table-responsive {
  overflow-x: auto;
}

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

.data-table th {
  background: #f1f5f9;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: #475569;
  border-bottom: 2px solid var(--border-color);
}

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

.data-table tr:hover {
  background: #f8fafc;
}

/* Excel Preview Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-dialog {
  background: #fff;
  border-radius: 8px;
  width: 95%;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  overflow: hidden;
}

.modal-header {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.excel-preview-container {
  border: 1px solid #cbd5e1;
  background: #fff;
  font-family: Calibri, sans-serif;
}

.excel-section-title {
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
  color: #c00000; /* Red header as shown in screenshot 4 */
  background: #ffffff;
}

.excel-grid {
  width: 100%;
  border-collapse: collapse;
}

.excel-grid th {
  background: #f2f2f2;
  border: 1px solid #d9d9d9;
  padding: 6px 10px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.excel-grid td {
  border: 1px solid #d9d9d9;
  padding: 5px 8px;
  white-space: nowrap;
}

.excel-grid td.num { text-align: right; }
.excel-grid td.date { text-align: center; }

/* Tabs */
.tab-content { display: none; }
.tab-content.active { display: block; }
