@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Sarabun:wght@400;500;600;700;800&display=swap');

:root {
  /* Retro OS Colors */
  --bg-canvas: #fcf9f2;         /* Warm cream vintage paper */
  --grid-line: rgba(220, 214, 198, 0.4); /* Gridlines */
  --win-bg: #f3f0e8;            /* Retro Window beige */
  --win-title-pink: #ff8ebb;    /* Retro Y2K pink */
  --win-title-blue: #9cd5ec;    /* Retro cyan/blue */
  --win-title-grey: #c3c3c3;    /* Classic Win95 grey */
  --border-dark: #1e1e1e;       /* Thick brutalist border */
  
  /* Accent Colors */
  --btn-yellow: #fcd535;
  --btn-green: #82c99b;
  --btn-blue: #a3c4f3;
  --btn-orange: #ff9f1c;
  --btn-red: #ff595e;
  
  --font-display: 'Outfit', 'Sarabun', sans-serif;
  --font-body: 'Sarabun', sans-serif;
  --font-mono: 'Courier New', Courier, monospace;
}

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

body {
  background-color: var(--bg-canvas);
  background-image: 
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--border-dark);
  font-family: var(--font-body);
  line-height: 1.5;
  padding: 20px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
}

/* -------------------------------------------------- */
/* Neubrutalist / Retro OS Window Panel               */
/* -------------------------------------------------- */
.win-panel {
  background: var(--win-bg);
  border: 3px solid var(--border-dark);
  box-shadow: 8px 8px 0px var(--border-dark);
  margin-bottom: 30px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Color Themes for Titlebar */
.win-panel.win-pink .win-header { background-color: var(--win-title-pink); }
.win-panel.win-blue .win-header { background-color: var(--win-title-blue); }
.win-panel.win-grey .win-header { background-color: var(--win-title-grey); }

.win-header {
  border-bottom: 3px solid var(--border-dark);
  padding: 10px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.win-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.win-controls {
  display: flex;
  gap: 6px;
}

.win-btn {
  width: 22px;
  height: 22px;
  background-color: var(--win-bg);
  border: 2px solid var(--border-dark);
  box-shadow: 1px 1px 0px var(--border-dark);
  font-weight: bold;
  font-size: 0.8rem;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
}

.win-btn:active {
  box-shadow: none;
  transform: translate(1px, 1px);
}

.win-body {
  padding: 20px;
  flex-grow: 1;
}

/* -------------------------------------------------- */
/* Neubrutalist Buttons & Interactive Inputs         */
/* -------------------------------------------------- */
.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 20px;
  border: 3px solid var(--border-dark);
  box-shadow: 4px 4px 0px var(--border-dark);
  background-color: var(--win-bg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--border-dark);
  transition: transform 0.05s, box-shadow 0.05s;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0px var(--border-dark);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0px var(--border-dark);
}

.btn-primary { background-color: var(--win-title-pink); }
.btn-secondary { background-color: var(--btn-blue); }
.btn-yellow { background-color: var(--btn-yellow); }
.btn-orange { background-color: var(--btn-orange); }
.btn-green { background-color: var(--btn-green); }
.btn-red { background-color: var(--btn-red); }

/* Form Controls */
.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 3px solid var(--border-dark);
  background-color: #ffffff;
  color: var(--border-dark);
  font-family: var(--font-body);
  font-size: 0.95rem;
  box-shadow: inset 2px 2px 0px rgba(0,0,0,0.08);
  outline: none;
}

.form-control:focus {
  background-color: #fffff6;
  border-color: var(--border-dark);
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg fill='black' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* -------------------------------------------------- */
/* Layout Grid                                        */
/* -------------------------------------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 0;
}

header {
  margin-bottom: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

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

.brand-logo {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.6rem;
  background-color: var(--win-title-pink);
  border: 3px solid var(--border-dark);
  box-shadow: 4px 4px 0px var(--border-dark);
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title h1 {
  font-size: 1.8rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-title p {
  font-size: 0.85rem;
  color: #555;
  font-weight: 600;
}

/* Search Bar Station */
.search-station-box {
  background: var(--win-bg);
  border: 3px solid var(--border-dark);
  box-shadow: 4px 4px 0px var(--border-dark);
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  width: 100%;
}

.search-station-box input {
  border: none;
  background: transparent;
  box-shadow: none;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  width: 100%;
}

.search-station-box input:focus {
  background: transparent;
}

/* Main Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 30px;
  align-items: start;
}

@media (max-width: 950px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------- */
/* Custom Stages Editor (Dynamic List)                */
/* -------------------------------------------------- */
.stages-editor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.stage-editor-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.03);
  padding: 6px 10px;
  border: 2px solid var(--border-dark);
}

.stage-num {
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 0.9rem;
  width: 20px;
}

/* -------------------------------------------------- */
/* Vintage Badges                                     */
/* -------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 2px solid var(--border-dark);
  font-weight: 700;
  font-size: 0.8rem;
  box-shadow: 2px 2px 0px var(--border-dark);
}

.badge-normal { background-color: var(--win-bg); }
.badge-urgent { background-color: var(--btn-orange); }
.badge-critical { background-color: var(--btn-red); }

.badge-step { background-color: var(--btn-blue); }
.badge-completed { background-color: var(--btn-green); }

.item-id {
  font-family: var(--font-mono);
  font-weight: 700;
  background-color: #ffffff;
  border: 2px solid var(--border-dark);
  padding: 3px 8px;
}

/* -------------------------------------------------- */
/* Vintage Table                                      */
/* -------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border: 3px solid var(--border-dark);
  box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1);
  background-color: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background-color: var(--win-bg);
  border-bottom: 3px solid var(--border-dark);
  border-right: 2px solid var(--border-dark);
  padding: 10px 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--border-dark);
  user-select: none;
}

td {
  border-bottom: 2px solid var(--border-dark);
  border-right: 2px solid var(--border-dark);
  padding: 12px;
  font-size: 0.9rem;
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

th:last-child, td:last-child {
  border-right: none;
}

tr:hover td {
  background-color: #fffff2;
}

/* -------------------------------------------------- */
/* QR Code Card Modal (Retro Alert Box)               */
/* -------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 90%;
  max-width: 460px;
}

.qr-result-container {
  background: white;
  border: 3px solid var(--border-dark);
  padding: 15px;
  margin: 15px 0;
  display: inline-block;
  box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1);
}

.qr-result-container img {
  display: block;
  width: 200px;
  height: 200px;
}

/* -------------------------------------------------- */
/* Segmented Retro Progress Bar (Process Stepper)     */
/* -------------------------------------------------- */
.retro-progress {
  height: 24px;
  border: 3px solid var(--border-dark);
  background-color: #ffffff;
  box-shadow: inset 2px 2px 0px rgba(0,0,0,0.1);
  display: flex;
  overflow: hidden;
  margin-bottom: 10px;
}

.retro-progress-fill {
  background-color: var(--btn-green);
  border-right: 3px solid var(--border-dark);
  width: 20%;
  height: 100%;
}

.retro-progress-fill:last-child {
  border-right: none;
}

/* -------------------------------------------------- */
/* Retro Timeline                                     */
/* -------------------------------------------------- */
.timeline-card {
  max-width: 650px;
  margin: 10px auto 40px auto;
}

.track-info-header {
  border-bottom: 3px solid var(--border-dark);
  padding-bottom: 15px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 15px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  padding-left: 50px;
  margin: 25px 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 5px;
  bottom: 5px;
  width: 4px;
  background-color: var(--border-dark);
}

.timeline-step {
  position: relative;
}

.timeline-marker {
  position: absolute;
  left: -50px;
  top: 0;
  width: 44px;
  height: 44px;
  background-color: var(--win-bg);
  border: 3px solid var(--border-dark);
  box-shadow: 3px 3px 0px var(--border-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.1rem;
  z-index: 10;
}

.timeline-step.completed .timeline-marker {
  background-color: var(--btn-green);
}

.timeline-step.active .timeline-marker {
  background-color: var(--win-title-pink);
  animation: pulse-marker 1.5s infinite alternate;
}

@keyframes pulse-marker {
  0% { transform: scale(1); }
  100% { transform: scale(1.05); background-color: #ffb3d1; }
}

.timeline-content {
  background: white;
  border: 3px solid var(--border-dark);
  box-shadow: 4px 4px 0px var(--border-dark);
  padding: 12px 15px;
}

.timeline-step.completed .timeline-content {
  border-color: var(--border-dark);
  background-color: #fafdfb;
}

.timeline-step.active .timeline-content {
  border-color: var(--border-dark);
  background-color: #fffafc;
}

.timeline-step-title {
  font-size: 1.1rem;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timeline-step-desc {
  font-size: 0.85rem;
  color: #666;
  margin-top: 4px;
}

.timeline-step-meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: bold;
  margin-top: 8px;
  display: flex;
  gap: 15px;
  border-top: 1px dashed #ccc;
  padding-top: 6px;
}

.timeline-step.inactive {
  opacity: 0.45;
}

/* -------------------------------------------------- */
/* Error Cascading Screens (Win95 Crash Screen)       */
/* -------------------------------------------------- */
.cascade-alert-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 30px 0;
  padding: 30px;
  background-color: #0000aa; /* Blue Screen of Death retro feel */
  border: 4px solid var(--border-dark);
  box-shadow: 10px 10px 0px var(--border-dark);
  color: white;
  font-family: var(--font-mono);
  text-align: center;
}

.cascade-alert-container h2 {
  font-size: 1.8rem;
  margin-bottom: 15px;
  color: var(--btn-yellow);
}

.cascade-alert-container p {
  font-size: 1rem;
  margin-bottom: 25px;
  max-width: 500px;
}

/* -------------------------------------------------- */
/* Camera/Scanner View Container                      */
/* -------------------------------------------------- */
#reader {
  width: 100%;
  max-width: 380px;
  margin: 20px auto;
  border: 3px solid var(--border-dark) !important;
  box-shadow: 6px 6px 0px var(--border-dark);
  background: white;
  overflow: hidden;
}

#reader__dashboard_section_csr button {
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  background: var(--win-title-pink) !important;
  color: var(--border-dark) !important;
  border: 3px solid var(--border-dark) !important;
  box-shadow: 2px 2px 0px var(--border-dark) !important;
  padding: 6px 12px !important;
  cursor: pointer !important;
}

#reader__dashboard_section_csr button:active {
  box-shadow: none !important;
  transform: translate(2px, 2px) !important;
}

#reader__camera_selection {
  background: white !important;
  border: 2px solid var(--border-dark) !important;
  padding: 4px !important;
  border-radius: 0 !important;
  margin: 10px 0 !important;
  font-family: var(--font-body);
}

.history-box {
  margin-top: 30px;
  background: white;
  border: 3px solid var(--border-dark);
  box-shadow: 4px 4px 0px var(--border-dark);
}

.history-title {
  background-color: var(--win-title-grey);
  border-bottom: 3px solid var(--border-dark);
  padding: 8px 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.history-row {
  border-bottom: 2px solid var(--border-dark);
  padding: 12px 15px;
  display: grid;
  grid-template-columns: 140px 160px 1fr;
  gap: 15px;
  font-size: 0.9rem;
}

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

@media (max-width: 600px) {
  .history-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* -------------------------------------------------- */
/* Modern SaaS Theme Overrides (.theme-modern)        */
/* -------------------------------------------------- */

.theme-modern, :root.theme-modern, body.theme-modern {
  /* Modern Colors */
  --bg-canvas: #f8fafc; /* Slate 50 background */
  --win-bg: rgba(255, 255, 255, 0.85); /* Frosted white */
  --border-dark: #0f172a; /* Slate 900 for dark text/elements */
  --win-title-pink: #ff8ebb;
  --win-title-blue: #a3c4f3;
  --win-title-grey: #f1f5f9;
  
  /* Accent Colors */
  --btn-yellow: #fbbf24;
  --btn-green: #10b981;
  --btn-blue: #3b82f6;
  --btn-orange: #f97316;
  --btn-red: #ef4444;
  
  --font-display: 'Outfit', 'Sarabun', sans-serif;
  --font-body: 'Sarabun', sans-serif;
}

/* Base Body Modifications in Modern Theme */
body.theme-modern {
  background-color: var(--bg-canvas) !important;
  background-image: 
    radial-gradient(at 0% 0%, rgba(163, 196, 243, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(255, 142, 187, 0.12) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(130, 201, 155, 0.08) 0px, transparent 50+) !important;
  background-size: 100% 100% !important;
  background-attachment: fixed !important;
  color: #334155 !important; /* Slate 700 text color */
}

/* Modern Card Layout (removes thick black borders and flat shadows) */
.theme-modern .win-panel {
  background: var(--win-bg) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.02), 0 8px 10px -6px rgba(0, 0, 0, 0.02) !important;
  border-radius: 16px !important;
  transition: all 0.3s ease !important;
}

.theme-modern .win-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  background-color: rgba(255, 255, 255, 0.5) !important;
  padding: 14px 20px !important;
}

.theme-modern .win-title {
  font-weight: 700 !important;
  font-size: 1rem !important;
  color: #1e293b !important;
}

/* Convert Retro Windows Window Control Buttons into sleek Mac OS dots */
.theme-modern .win-controls {
  display: flex !important;
  gap: 8px !important;
}

.theme-modern .win-btn {
  width: 12px !important;
  height: 12px !important;
  border-radius: 50% !important;
  border: none !important;
  box-shadow: none !important;
  font-size: 0 !important;
  cursor: pointer !important;
  padding: 0 !important;
}

/* Style the dots: close (red), minimize (yellow), maximize (green) */
.theme-modern .win-controls .win-btn:nth-child(1) {
  background-color: #febc2e !important; /* yellow */
}
.theme-modern .win-controls .win-btn:nth-child(2) {
  background-color: #28c840 !important; /* green */
}
.theme-modern .win-controls .win-btn:nth-child(3),
.theme-modern .win-controls .win-btn[style*="background-color: var(--btn-red)"] {
  background-color: #ff5f56 !important; /* red */
}

/* Modern Buttons (no thick border, rounded corners, soft shadow) */
.theme-modern .btn {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  padding: 10px 18px !important;
  background-color: #ffffff !important;
  color: #1e293b !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  transform: none !important;
}

.theme-modern .btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
  filter: brightness(1.02) !important;
}

.theme-modern .btn:active {
  transform: translateY(1px) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* Specific Modern Button Theme Overrides */
.theme-modern .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  color: #ffffff !important;
  border: none !important;
}
.theme-modern .btn-secondary {
  background-color: #f1f5f9 !important;
  color: #475569 !important;
}
.theme-modern .btn-yellow {
  background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
  color: #ffffff !important;
  border: none !important;
}
.theme-modern .btn-green {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
  border: none !important;
}
.theme-modern .btn-red {
  background: linear-gradient(135deg, #ef4444, #dc2626) !important;
  color: #ffffff !important;
  border: none !important;
}

/* Modern Form Controls */
.theme-modern .form-control {
  border: 1px solid #cbd5e1 !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
  transition: all 0.15s ease !important;
}

.theme-modern .form-control:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
  background-color: #ffffff !important;
}

.theme-modern label {
  color: #475569 !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
}

/* Modern Search Capsule */
.theme-modern .search-station-box {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03) !important;
  border-radius: 30px !important;
  background-color: #ffffff !important;
  padding: 6px 15px !important;
}

.theme-modern .search-station-box .btn {
  border-radius: 20px !important;
  padding: 6px 12px !important;
}

/* Modern Badges */
.theme-modern .badge {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: none !important;
  border-radius: 6px !important;
  font-size: 0.75rem !important;
  padding: 3px 8px !important;
}

.theme-modern .item-id {
  border: 1px solid rgba(15, 23, 42, 0.1) !important;
  border-radius: 6px !important;
  background-color: #f8fafc !important;
  color: #0f172a !important;
  box-shadow: none !important;
}

/* Modern Table */
.theme-modern .table-container {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: none !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.theme-modern th {
  background-color: #f8fafc !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-right: none !important;
  font-weight: 600 !important;
  color: #475569 !important;
  padding: 12px 16px !important;
}

.theme-modern td {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
  border-right: none !important;
  padding: 14px 16px !important;
  color: #334155 !important;
}

.theme-modern tr:hover td {
  background-color: #f8fafc !important;
}

/* Modern Segmented Progress Bar (Stepper) */
.theme-modern .retro-progress {
  border: none !important;
  border-radius: 20px !important;
  background-color: #e2e8f0 !important;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05) !important;
  height: 12px !important;
}

.theme-modern .retro-progress-fill {
  background: linear-gradient(90deg, #10b981, #34d399) !important;
  border-right: 2px solid #ffffff !important;
}

/* Modern Timeline */
.theme-modern .timeline::before {
  background-color: #cbd5e1 !important;
  width: 2px !important;
  left: 21px !important;
}

.theme-modern .timeline-marker {
  width: 38px !important;
  height: 38px !important;
  left: -47px !important;
  border: 2px solid #cbd5e1 !important;
  border-radius: 50% !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.02) !important;
  background-color: #ffffff !important;
  color: #64748b !important;
  font-size: 0.95rem !important;
}

.theme-modern .timeline-step.completed .timeline-marker {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}

.theme-modern .timeline-step.active .timeline-marker {
  background-color: #3b82f6 !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
  animation: modern-pulse 2s infinite !important;
}

@keyframes modern-pulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.theme-modern .timeline-content {
  border: 1px solid rgba(15, 23, 42, 0.06) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02) !important;
  border-radius: 12px !important;
  background-color: #ffffff !important;
}

.theme-modern .timeline-step.completed .timeline-content {
  background-color: #ffffff !important;
  border-color: rgba(16, 185, 129, 0.15) !important;
}

.theme-modern .timeline-step.active .timeline-content {
  background-color: #ffffff !important;
  border-color: rgba(59, 130, 246, 0.2) !important;
}

.theme-modern .timeline-step-title {
  color: #0f172a !important;
  font-weight: 700 !important;
}

.theme-modern .timeline-step-desc {
  color: #475569 !important;
}

.theme-modern .timeline-step.inactive {
  opacity: 0.5 !important;
}

/* Modern Lock Screen Alert (Replaces retro blue screen) */
.theme-modern .cascade-alert-container {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(16, 185, 129, 0.2) !important;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.05), 0 1px 3px rgba(0,0,0,0.02) !important;
  border-radius: 20px !important;
  color: #1e293b !important;
  padding: 35px !important;
}

.theme-modern .cascade-alert-container h2 {
  color: #10b981 !important;
  font-weight: 800 !important;
  font-size: 1.6rem !important;
}

.theme-modern .cascade-alert-container p {
  color: #475569 !important;
}

.theme-modern .cascade-alert-container div {
  border-top: 1px dashed rgba(0,0,0,0.1) !important;
  color: #64748b !important;
}

/* Brand Section Styling */
.theme-modern .brand-logo {
  border-radius: 12px !important;
  border: none !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05) !important;
  background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
}

.theme-modern .brand-title h1 {
  color: #0f172a !important;
}

.theme-modern .brand-title p {
  color: #64748b !important;
  font-weight: 500 !important;
}

/* Custom stage items in modern mode */
.theme-modern .stage-editor-item {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 8px !important;
  background-color: #ffffff !important;
}

.theme-modern .qr-result-container {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02) !important;
}

.theme-modern #reader {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 30px rgba(0,0,0,0.04) !important;
}

.theme-modern #reader__dashboard_section_csr button {
  background: #3b82f6 !important;
  color: white !important;
  border: none !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04) !important;
}

.theme-modern #reader__camera_selection {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 8px !important;
}

.theme-modern .history-box {
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  border-radius: 16px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02) !important;
  overflow: hidden !important;
}

.theme-modern .history-title {
  background-color: #f8fafc !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
  color: #475569 !important;
}

.theme-modern .history-row {
  border-bottom: 1px solid rgba(15, 23, 42, 0.05) !important;
  color: #334155 !important;
}

.theme-modern .form-group[style*="background-color: #ffeef2"] {
  background-color: #fef2f2 !important; /* Soft Tailwind Red */
  border: 1px solid #fecaca !important;
  border-radius: 12px !important;
}

/* -------------------------------------------------- */
/* Entry Page Portal Grid Layout                      */
/* -------------------------------------------------- */
.portal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 40px;
  margin-bottom: 50px;
}

@media (max-width: 768px) {
  .portal-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.portal-card {
  padding: 30px !important;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 420px;
}

.portal-icon {
  font-size: 4.5rem;
  margin-top: 15px;
  margin-bottom: 20px;
  filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.1));
}

.theme-modern .portal-icon {
  filter: drop-shadow(0 8px 15px rgba(59, 130, 246, 0.15));
}

.portal-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 12px;
}

.portal-desc {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.5;
}

.theme-modern .portal-desc {
  color: #64748b;
}

.portal-features {
  list-style: none;
  text-align: left;
  margin: 0 auto 30px auto;
  max-width: 310px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9rem;
}

.portal-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.portal-footer-note {
  text-align: center;
  font-size: 0.85rem;
  color: #666;
  margin-top: 20px;
  border-top: 2px dashed var(--border-dark);
  padding-top: 15px;
}

.theme-modern .portal-footer-note {
  color: #94a3b8;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

/* -------------------------------------------------- */
/* Mobile Lookup & Sharing Styles                     */
/* -------------------------------------------------- */
.lookup-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 10px;
}

.copy-btn-group {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.copy-badge {
  font-size: 0.75rem;
  padding: 2px 6px;
  background-color: var(--btn-green);
  color: white;
  border: 1px solid var(--border-dark);
  border-radius: 4px;
  display: none;
  margin-left: 8px;
  vertical-align: middle;
}

.theme-modern .copy-badge {
  border: none;
  background-color: #10b981;
}

.search-box-large {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.search-box-large input {
  font-size: 1.15rem;
  padding: 12px 15px;
  text-align: center;
  border-radius: 8px;
}

.theme-modern .search-box-large input {
  border-radius: 12px;
}

.lookup-card {
  margin-top: 10px;
  animation: slide-up-lookup 0.25s ease-out;
}

@keyframes slide-up-lookup {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.status-summary-box {
  background-color: white;
  border: 3px solid var(--border-dark);
  padding: 15px;
  margin: 15px 0;
  text-align: center;
}

.theme-modern .status-summary-box {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background-color: #f8fafc;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.status-highlight-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--btn-orange);
  margin: 8px 0;
}

.theme-modern .status-highlight-text {
  color: #f97316;
}

.simple-timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed #ccc;
  text-align: left;
}

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

.simple-timeline-bullet {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-dark);
  background-color: white;
  flex-shrink: 0;
}

.simple-timeline-bullet.completed {
  background-color: var(--btn-green);
}

.simple-timeline-bullet.active {
  background-color: var(--win-title-pink);
  animation: pulse-marker 1.5s infinite alternate;
}

.theme-modern .simple-timeline-bullet.active {
  background-color: #3b82f6;
  animation: modern-pulse 2s infinite;
}

.lookup-list-item {
  background: white;
  border: 2px solid var(--border-dark);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.05s;
}

.lookup-list-item:hover {
  transform: translate(-1px, -1px);
  background-color: #fffff6;
}

.theme-modern .lookup-list-item {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background-color: #ffffff;
}

.theme-modern .lookup-list-item:hover {
  background-color: #f8fafc;
  transform: none;
}

/* -------------------------------------------------- */
/* Auth PIN Lock Overlay & Card Styles                */
/* -------------------------------------------------- */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.theme-modern .auth-overlay {
  background-color: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  animation: auth-card-fade-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes auth-card-fade-in {
  from { opacity: 0; transform: scale(0.95) translateY(5px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-shake {
  animation: auth-shake-anim 0.35s ease-in-out;
}

@keyframes auth-shake-anim {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

