/* Station UI – Cloudflare Pages static app */
* { box-sizing: border-box; }
:root{
  --bg: #0e2243;
  --bg-2: #0f203e;
  --panel: #0f2649;
  --ink: #0c1222;
  --ink-soft:#5b6b8a;
  --white:#ffffff;
  --brand:#1928ff;
  --brand-2:#2233ff;
  --pill:#dfe4ec;
  --radius:18px;
}
html,body{height:100%;}
body{
  margin:0;
  font-family:Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--ink);
  overflow:hidden; /* no scroll */
  background:#f7f8fb;
}
#app{
  height:100vh;
  display:flex;
  overflow:hidden;
}

.sidebar{
  width:260px;
  background:linear-gradient(180deg, #0b1c3a, #0b1c35);
  color:#cfe3ff;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:22px 18px;
  gap:16px;
  position:relative;
  z-index:100;
}
.logo{ width:140px; height:auto; margin-top:8px; }
.line-station{
  width:100%;
  text-align:center;
  line-height:1.25;
  margin:14px 0 8px;
  font-weight:800;
  letter-spacing:.3px;
}
.btn{
  display:inline-flex; align-items:center; justify-content:center;
  font-weight:800; letter-spacing:.4px;
  padding:14px 18px; border-radius:var(--radius);
  border:none; cursor:pointer; user-select:none;
  transition:transform .06s ease;
  background:var(--brand); color:var(--white);
}
.btn:active{ transform:translateY(1px) scale(.99); }
.btn-block{ width:100%; }
.btn-outline{ background:#182d5b; color:#e6ecff; }
.btn-primary{ background:var(--brand); color:var(--white); }
.btn-wide{ width:min(760px, 80vw); height:64px; font-size:20px; border-radius:22px; }
.btn-retry{ background:#eab308; color:#000000; }
.link{ background:none; border:none; padding:0; color:var(--brand); cursor:pointer; text-decoration:underline; }

/* Azure result image display */
.result-image{
  max-width:100%; max-height:100%;
  width:auto; height:auto;
  object-fit:contain;
  border-radius:12px; box-shadow:0 4px 6px rgba(0,0,0,0.3);
}

.grow{ flex:1; }

.display{
  flex:1; position:relative;
  display:flex; flex-direction:column;
  align-items:center; justify-content:flex-start;
  padding:22px clamp(12px, 3vw, 36px);
}
.serial{
  font-size:38px; font-weight:800;
  margin: 8px 0 12px;
}
.order-meta{
  font-size:18px;
  font-weight:600;
  color:#1c2f55;
  margin-bottom:18px;
  text-align:center;
  min-height:24px;
}
.canvas-wrap{
  flex:1; min-height:0; width:100%; display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.footer{ flex-shrink:0; width:100%; display:flex; align-items:center; justify-content:center; padding:20px 0; }

.hidden{ display:none !important; }

/* Modals */
.modal{
  position:fixed; inset:0;
  background:rgba(0,0,0,.4);
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  z-index:9999;
  pointer-events:auto;
}
.modal-card{
  width:min(800px, 85vw);
  background:var(--panel);
  color:#eaf2ff;
  border-radius:var(--radius);
  padding:20px 22px 26px;
  box-shadow:0 20px 70px rgba(0,0,0,.3);
  position:relative;
  z-index:10000;
  pointer-events:auto;
}
.modal input,
.modal button,
.modal label,
.modal form{
  pointer-events:auto !important;
  position:relative;
  z-index:10001;
}
.modal-header{
  display:flex; align-items:center; justify-content:space-between;
  margin:4px 2px 14px;
}
.modal-header h2{
  margin:0; letter-spacing:.4px; font-size:26px;
}
.icon-btn{
  width:44px; height:44px; border-radius:50%;
  border:2px solid #9db7ff; color:var(--white); background:transparent;
  font-size:26px; line-height:1; cursor:pointer;
}
.orders-list{ display:flex; flex-direction:column; gap:14px; max-height:60vh; overflow:auto; padding-right:6px; }
.order-pill{
  background:var(--pill); color:var(--ink); border-radius:var(--radius); padding:16px 18px;
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px;
  font-weight:700;
  border:2px solid transparent;
}
.order-pill small{
  color:var(--ink-soft);
  font-weight:600;
  text-transform:none;
}
.order-pill__main{ display:flex; flex-direction:column; gap:6px; }
.order-pill__serial{ font-size:20px; letter-spacing:.3px; }
.order-pill__meta{ font-size:14px; font-weight:600; color:var(--ink-soft); text-transform:uppercase; }
.order-pill.is-active{ border-color:var(--brand); box-shadow:0 0 0 3px rgba(56,108,255,.2); }

/* Admin */
.admin-login, .admin-actions{ display:flex; flex-direction:column; gap:14px; }
.admin-login .row, .admin-actions .row{ display:flex; gap:12px; align-items:center; }
.admin-login label{ width:120px; color:#b8c7ea; font-weight:600; }
.admin-login input{
  flex:1; height:44px; border-radius:12px; border:1px solid #6f87bf; background:#0e1f40; color:var(--white); padding:0 12px;
  outline:none;
  pointer-events:auto !important;
}
.admin-login input:focus{
  border-color:#9db7ff;
  box-shadow:0 0 0 3px rgba(157, 183, 255, 0.2);
}
.actions{ justify-content:center; gap:24px !important; margin:10px 0 16px; }
.msg{ min-height:22px; color:#f7d774; }

/* Toast Notification System */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: #0f2649;
  color: #eaf2ff;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border: 2px solid #6f87bf;
  min-width: 320px;
  max-width: 500px;
  pointer-events: auto;
  animation: slideIn 0.3s ease-out;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.toast.toast-success {
  border-color: #10b981;
  background: #064e3b;
}

.toast.toast-error {
  border-color: #ef4444;
  background: #7f1d1d;
}

.toast.toast-info {
  border-color: #3b82f6;
  background: #1e3a8a;
}

.toast-header {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.toast-body {
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #cfe3ff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ─── DataAdmin Page ───────────────────────────────────────────────────────── */
.da-body{
  overflow:auto;
  background:#0b1829;
}
.da-app{
  min-height:100vh;
  color:#eaf2ff;
}
.da-login-pane{
  display:flex; align-items:center; justify-content:center;
  min-height:100vh;
}
.da-login-card{
  background:var(--panel); border-radius:var(--radius);
  padding:32px 28px; width:min(420px,90vw);
  box-shadow:0 20px 70px rgba(0,0,0,.3);
}
.da-login-card h1{ margin:0 0 20px; font-size:24px; }
.da-login-card .row{ display:flex; gap:12px; align-items:center; margin-bottom:12px; }
.da-login-card label{ width:100px; color:#b8c7ea; font-weight:600; }
.da-login-card input{
  flex:1; height:44px; border-radius:12px; border:1px solid #6f87bf;
  background:#0e1f40; color:var(--white); padding:0 12px; outline:none;
}
.da-login-card input:focus{ border-color:#9db7ff; box-shadow:0 0 0 3px rgba(157,183,255,.2); }

.da-main{ padding:20px clamp(16px,3vw,40px); }
.da-header{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:16px; flex-wrap:wrap; gap:12px;
}
.da-header h1{ margin:0; font-size:24px; }
.da-header-actions{ display:flex; gap:8px; }

.da-toolbar{
  display:flex; gap:8px; align-items:center;
  margin-bottom:16px; flex-wrap:wrap;
}
.da-filter-btn{
  padding:8px 16px; border-radius:12px; border:1px solid #6f87bf;
  background:transparent; color:#b8c7ea; font-weight:600; cursor:pointer;
}
.da-filter-btn.active{
  background:var(--brand); color:var(--white); border-color:var(--brand);
}
.da-count{ margin-left:auto; color:#6f87bf; font-size:14px; }

.da-table-wrap{ overflow-x:auto; }
.da-table{
  width:100%; border-collapse:collapse; font-size:14px;
}
.da-table th{
  text-align:left; padding:10px 12px;
  background:#0f2649; color:#8da4cc;
  font-weight:700; text-transform:uppercase; font-size:12px; letter-spacing:.5px;
  border-bottom:2px solid #1a3460;
  position:sticky; top:0;
}
.da-table td{
  padding:10px 12px; border-bottom:1px solid #162d52;
  vertical-align:top;
}
.da-table tr:hover td{ background:rgba(25,40,255,.06); }
.da-cell-id{
  max-width:260px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-family:monospace; font-size:13px;
}
.da-cell-preview{
  max-width:300px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  color:#8da4cc;
}

.da-badge{
  display:inline-block; padding:3px 10px; border-radius:8px;
  font-size:12px; font-weight:700; text-transform:uppercase;
}
.da-badge-order{ background:#1e3a8a; color:#93c5fd; }
.da-badge-component{ background:#064e3b; color:#6ee7b7; }
.da-badge-controls{ background:#713f12; color:#fde68a; }
.da-badge-override{ background:#5b21b6; color:#e9d5ff; }
.da-badge-audit{ background:#831843; color:#fbcfe8; }

.da-btn-sm{ padding:6px 12px !important; font-size:12px !important; border-radius:8px !important; }
.da-btn-danger{ background:#991b1b !important; color:#fecaca !important; }

.da-editor{
  width:100%; min-height:400px; border-radius:12px;
  background:#0b1829; color:#e2e8f0; border:1px solid #6f87bf;
  padding:16px; font-family:monospace; font-size:14px;
  resize:vertical; outline:none;
}
.da-editor:focus{ border-color:#9db7ff; box-shadow:0 0 0 3px rgba(157,183,255,.2); }

.da-empty{
  text-align:center; padding:40px; color:#6f87bf; font-size:16px;
}