* {
  box-sizing: border-box;
}
:root{
  --bg:#f3f6fb; --card:#ffffff; --muted:#7a8aa3;
  --primary1:#3b82f6; --primary2:#06b6d4;
  --green1:#10b981; --red1:#ef4444; --orange1:#f59e0b; --purple1:#8b5cf6;
}

/* global */
html {
  -webkit-text-size-adjust: 100%;
}
html,body{height:100%;margin:0;font-family:Inter,system-ui,Segoe UI,Roboto,Helvetica,Arial; background:var(--bg); color:#123;}
/*.container{padding:12px; max-width:720px;margin:0 auto;} */
button {
  -webkit-appearance: none;
  appearance: none;
}
.container {
  position: absolute;
  top: 40px;          /* same as topbar height */
  left: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  max-width:720px;
  margin:0 auto;
  /* padding: 10px 10px;   /* 👈 left/right space added ; */
  padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right));
}

/* center screen helper */
.center{display:flex;align-items:center;justify-content:center;}
.space-sm{height:8px;}
.mt8{margin-top:8px;} .mt12{margin-top:12px;} .mt16{margin-top:16px;}
.small{font-size:13px;}
.muted{color:var(--muted);}
#dashboardMessage {
  margin-top: 0px !important;
  padding-top: 12px;
  margin-top: 0;
  position: relative;
  top: -8px;
}
/* .card + #dashboardMessage {
  margin-top: 0px;
}
.dashboard-container {
  gap: 0;
} */
/* card */
/*.card{background:var(--card); padding:14px; border-radius:14px; box-shadow:0 6px 18px rgba(12,30,60,0.06); margin-bottom:12px;} */
.card {
  background:var(--card);
  display: flow-root;
  padding: 6px;
  border-radius:14px;
  box-shadow:0 6px 18px rgba(12,30,60,0.06);
  margin-bottom:8px;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden;
}
/* brand */
.brand{font-size:22px;font-weight:700;color:var(--primary1); text-align:center; margin-bottom:4px;}
.brand.small{font-size:16px; color:white;}
.subtitle{font-size:13px;color:var(--muted); text-align:center; margin-bottom:8px;}

/* form */
.label{display:block;font-weight:600;margin-bottom:6px;}
input[type="password"], input[type="tel"], input[type="number"], input[type="text"]{
  width:100%; padding:12px;border-radius:10px;border:1px solid #e1e8f3; font-size:16px; box-sizing:border-box;
}

/* topbar */
/*.topbar{display:flex;justify-content:space-between;align-items:center;padding:10px;background:linear-gradient(90deg,var(--primary1),var(--primary2));color:white;}*/
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 42px;
  display: flex;
  color:white;
  justify-content:space-between;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: lab(72.45% -22.4 -32.97);
  z-index: 100;
}
.userBadge{font-size:13px;padding:6px 10px;background:rgba(255,255,255,0.12);border-radius:12px;}
.status {
  text-align: center;
  font-weight: bold;
  padding: 6px;
  border-radius: 12px;
}

.status.online {
  background: #1abc9c;
  color: #fff;
}

.status.offline {
  background: #e74c3c;
  color: #fff;
}

/* lamp */
/* .lamp{width:18px;height:18px;border-radius:50%;box-shadow:0 0 8px rgba(0,0,0,0.08) inset;border:2px solid rgba(255,255,255,0.12);}
.lamp-gray{background:#cbd5e1;}
.lamp-green{background:#10b981; box-shadow:0 0 12px rgba(16,185,129,0.25);}
.lamp-red{background:#ef4444; box-shadow:0 0 12px rgba(239,68,68,0.25);}
.lamp-yellow{background:#f59e0b; box-shadow:0 0 12px rgba(245,158,11,0.22);} */
.conn-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.conn-lamp {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  margin-left: 8px;
}

.conn-lamp.red {
  background: #e53935;
}

.conn-lamp.green {
  background: #43a047;
}

.conn-lamp.yellow {
  background: #fbc02d;
}
.conn-text {
  font-weight: 500;
  color: #444;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.space-lg {
  height: 18px;   /* try 16–24px */
}
.gate-control-card {
  padding-bottom: 4px;   /* 👈 tighter bottom */
  padding-top: 6px;      /* optional */
}
.gate-header {
  padding: 2px 4px;
}

.gate-title {
  text-align: right;
  margin: 0;
  white-space: nowrap;
}
.gate-header .conn-row {
  margin-left: -8px;   /* try -4px to -12px */
}

/* timer and counter */
.timer{font-size:28px;font-weight:700;color:#1f2937;}
/* .counter{font-size:34px;font-weight:800;color:#0f172a;} */
#productionCounterCard .h3 {
  margin: 0;
}
#productionCounterCard .card-header-row {
  position: relative;
  display: flex;
  align-items: center;        /* vertical center */
  margin-bottom: 6px;         
}
#resetPermanentBtn {
  background: linear-gradient(180deg, #fdf7df, #fceaa0);
  /* background: linear-gradient(180deg, #fde68a, #facc15); */
  color: #eca47b;
  /* color: #78350f; */
  border: 1px solid #f4c470;
  /* border: 1px solid #f59e0b; */
  position: absolute;
  box-shadow: 0 2px 0 #f3b976;
  /* box-shadow: 0 2px 0 #d97706; */
  left: 70%;
  transform: translateX(-56%);
  font-size: 11px;       /* smaller text */
  line-height: 1;
  margin-top: -2px;
}

.counter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
  border-bottom: 1px dashed #e5e7eb;
}

.counter-label {
  font-size: 14px;
  color: #374151;
}

.counter-value {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin-right: 6px;
  display: inline-flex;
  align-items: baseline;
  gap: 15px; /* controls spacing */
}
.counter-unit {
  /* margin-left: 6px;
  margin-right: 2px;
  font-size: 14px;
  opacity: 0.7; */
  /* margin-left: 8px; */
  font-size: 0.8em;
  font-weight: 400;
  opacity: 0.6;
}

/* .counter-actions {
  margin-top: 12px;
  text-align: right;
} */  


/* 3D button base */
.btn{border:0;border-radius:12px;padding:12px 18px;font-weight:700;font-size:16px;color:white;cursor:pointer;box-shadow:0 8px 0 rgba(42, 2, 2, 0.12);transition:transform .06s ease, box-shadow .06s ease;}
/* .btn:active{transform:translateY(6px); box-shadow:0 2px 0 rgba(0,0,0,0.08);} */
.btn-3d {
  transition: transform 0.08s ease, box-shadow 0.08s ease,;
}
/* .btn-3d {
  box-shadow: 0 6px #444;
} */
.btn-3d.pressed {
  transform: translateY(4px);
  box-shadow: 0 4px #b9b9b9;
}

/* color variants */
.btn-primary{background:linear-gradient(180deg,var(--primary1),var(--primary2));}
.btn-open{background:linear-gradient(180deg,#08a05b,#15b981);}
.btn-close{background:linear-gradient(180deg,#f43f5e,#ef4444);}
.btn-blue{background:linear-gradient(180deg,#2563eb,#3b82f6);}
.btn-orange{background:linear-gradient(180deg,#f97316,#fb923c);}
.btn-purple{background:linear-gradient(180deg,var(--purple1),#7c3aed);}
.btn-ghost{background:transparent;color:#123;border:1px solid rgba(0,0,0,0.06);box-shadow:none;padding:10px 14px;border-radius:10px;}
.btn.btn-green {
  background: linear-gradient(180deg, #34d399, #059669);
  color: #ffffff;
  border: 1px solid #059669;
}
.admin-actions-row {
  display: flex;
  flex-wrap: wrap;            /* allow next row */
  align-items: center;
  gap: 8px;
}
.btn.btn-green:hover {
  background: linear-gradient(180deg, #3ee7a8, #047857);
}

.btn.btn-green:active {
  transform: translateY(1px);
}

#refresh-button {
  width: 60px;
  height: 60px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  margin-bottom: 1px;
  margin-left: auto;          /* push to far right */
  flex-shrink: 0;             /* never shrink */
  outline: none;
  -webkit-tap-highlight-color: transparent;
  appearance: none;
}

#refresh-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  outline: none;
  border: none;
}
#refresh-button:focus,
#refresh-button:active {
  outline: none;
  box-shadow: none;
}
#refresh-button::-moz-focus-inner {
  border: 0;
}
#refresh-button:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
/* #refresh-button:hover {
  transform: rotate(90deg);
  transition: transform 0.2s ease;
} */
/* controls layout */
/*.controls-row{display:flex;gap:10px;} */
.controls-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.controls-row button {
  flex: 1 1 45%;
}
/*.controls-row .btn{flex:1;padding:12px 0;} */
.buttons-row{display:flex;gap:8px;}

/* .gate-card {
  padding: 16px;
  margin-top: 16px;
  text-align: center;
}

.gate-track {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 80px;
  margin: 20px auto;
  background: #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.gate-leaf {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: #4f46e5;
  transition: transform 1s linear;
}

.gate-timer {
  font-size: 32px;
  font-weight: bold;
  color: #111827;
} */


/* #gateCard {
  position: relative;
  padding: 16px;
  margin-top: 50px;
  width: 100%;
  height: 80px;
  overflow: hidden;
  background: rgb(246, 246, 187);
}

#gateLeaf {
  position: absolute;
  right: 0;               
  top: 0;
  height: 100%;
  width: 100%;
  background: #1f15dc;
  transform-origin: left center;
  transition: transform 1s linear;
}

#gateTimer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: top;
  justify-content: center;
  font-size: 38px;
  font-weight: bold;
  color: #111827;
  pointer-events: none;
} */

/* #gateCard {
  position: relative;
  padding: 16px;
  margin-top: 50px;
  width: 100%;
  height: 80px;
  overflow: hidden;
  background: rgb(246, 246, 187);
}

#gateLeaf {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: #1f15dc;
  transform-origin: left center;
  transition: transform 1s linear;
  z-index: 1;           /* 👈 gate layer 
}

#gateTimer {
  position: absolute;
  top: 6px;             /* 👈 move to top 
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-size: 38px;
  font-weight: bold;
  color: #111827;
  pointer-events: none;
  z-index: 2;           /* 👈 ALWAYS ABOVE gate 
} */
#gateCard {
  position: relative;
  padding: 2%;
  display: flex;
  flex-direction: column;
  margin-top: 16px;   /* 👈 space from buttons */
  margin-bottom: -50;
  background: white;
}

/* 🔹 TIMER AREA */
#gateTimer {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  font-weight: bold;
  color: #7c3aed;
  margin-top: 0px;
  margin-bottom: 0px;   /* 👈 space above gate */
}

/* 🔹 GATE CONTAINER */
/* #gateTrack {
  position: relative;
  width: 100%;
  height: 70px;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 6px;
} */
.gate-scene {
  display: block;
  padding: 0;
  margin: 0;
  width: 100%;
  line-height: 0;       /* 🔑 removes hidden whitespace */
  margin-bottom: -24px;   /* pulls bottom tighter */
}
.gate-svg {
  width: 100%;
  height: auto;
  vertical-align: top;
}
/* 🔹 MOVING GATE */
#gateLeaf {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 100%;
  background: #1f15dc;
  transform-origin: left center;
  /* will-change: transform; */
  /* transform: translateZ(0); */
  transition: transform 1s linear;
}


/* users area */
#adminPanel {
  padding: 5px;
  overflow-x: hidden;
}
/*.usersArea{display:flex;flex-direction:column;gap:8px;margin-top:8px;} */
.usersArea {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* .userRow {
  max-width: 70%;
} */
/* .userRow input {
  min-width: 0;
} */
.dict-item {
  max-width: 70px;     /* adjust this */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* .userRow{display:flex;gap:8px;align-items:center;} */
.userRow {
  display: grid;
  grid-template-columns: 130px 120px 40px 36px 65px;
  gap: 8px;
  align-items: center;
  font-size: 16px;
}
/* .userRow .deleteBtn {
  width: 32px;
  height: 32px;
  padding: 0;
  justify-self: end;
} */
.userRow input{padding:8px;border-radius:8px;border:1px solid #e6eef6;font-size: 14px;color: #111827;opacity: 1;min-width: 0;}
/* .userRow input:disabled {
  color: #111827;
  -webkit-text-fill-color: #111827;
  opacity: 1;
} */
.users-container {
  margin-top: 8px;
  max-height: 130px;     /* ~3 user rows */
  overflow-y: scroll;          /* force scroll */
  overflow-x: scroll;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e6eef6;
  border-radius: 10px;
  padding: 6px;
  background: #f9fafb;
}

.users-container::-webkit-scrollbar {
  width: 6px;
}

.users-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}
/* Login-only visibility */
#loginPage .login-hidden {
  display: block;
}

/* optional: nicer scrollbar */
.users-container::-webkit-scrollbar {
  width: 6px;
}
.users-container::-webkit-scrollbar-thumb {
  background: #666;
  border-radius: 4px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: white;
  padding: 16px;
  border-radius: 12px;
  width: 90%;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.hidden {
  display: none !important;
}
/* dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  width: 90%;
  max-width: 320px;
} */
#exportExcelBtn {
  display: flex;
  /* justify-content: flex-start; */
  padding-left: 16px; /* 👈 spacing from left */
  margin-left: 80px;
  margin-top: 12px;   /* 👈 This creates space from row above */
}

/* responsiveness (mobile)
make big fonts for mobile */
/*@media (max-width:480px){
  .brand{font-size:20px;}
  .btn{font-size:16px;padding:14px;}
  .timer{font-size:30px;}
  .counter{font-size:36px;}
}*/
/* .logo-text {
  color: green;
  font-size: 18px;
  font-weight: bold;
  font-style: italic;
  text-align: center;
  position: absolute;
  bottom: 0px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
} */
.app-footer {
  position: fixed;
  bottom: 10px;
  left: 0;
  width: 100%;
  text-align: center;

  font-size: 16px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 1px;

  color: #888;
  opacity: 0.8;
  bottom: env(safe-area-inset-bottom, 10px);
  pointer-events: none; /* so it never blocks clicks */
}

@media (max-width: 480px) {
  .h3 {
    margin-top: 0px;
    font-size: 16px;
  }
  /* .userRow {
    grid-template-columns: 100px 100px 70px auto;
  } */
  /* .counter {
    font-size: 28px;
  } */

  .timer {
    font-size: 20px;
  }

  .btn {
    font-size: 14px;
    padding: 10px;
  }
  .btn-wide {
    width: 100%;
    max-width: 280px;
  }
  .buttons-row.center {
    display: flex;
    justify-content: center;
  }
  .step button {
   margin-bottom: 24px;
} 
.btn-open,
.btn-close {
  font-size: 20px;   /* try 1.3rem if you want bigger */
  font-weight: 600;     /* makes it feel stronger */
  letter-spacing: 1px;  /* optional, looks industrial */
}
.gate-scene {
  width: 320px;
  margin: 10px auto;
}

.gate-svg {
  width: 100%;
  height: auto;
  display: block;
}

  #screen-login {
  padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right));
  }
  #loginMessage {
    min-height: 42px;
    padding: 10px 12px;
    margin-top: 12px;
    border-radius: 8px;

    background: #fff3cd;       /* soft warning yellow */
    color: #7a1c1c;

    text-align: center;
    font-size: 20px;
    font-weight: 500;

    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  }
  .dash-msg {
    min-height: 42px;
    margin: 12px auto;
    padding: 10px 14px;
    width: 90%;
    text-align: center;
    font-weight: bold;
    border-radius: 6px;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
  }
  /* === Last Gate Log Card === */
  .gate-log-card {
    border-radius: 10px;
    padding: 12px 14px;
    background: #e6ecf3;
    border-left: 6px solid #9ca3af;
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
    max-width: 420px;
    margin-top: 0px;
    margin-bottom: 4px;
    font-size: 15px;        /* 👈 base size */
  }

  .gate-log-card.open {
    border-left-color: #10b981;
    font-size: 15px;        /* 👈 base size */
  }

  .gate-log-card.closed {
    border-left-color: #ef4444;
  }

  .log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 16px;        /* 👈 header slightly bigger */
  }

  .log-status {
    font-weight: bold;
    font-size: 15px;
    padding: 2px 10px;
    border-radius: 999px;
  }

  .log-status.open {
    background: #d1fae5;
    color: #065f46;
  }

  .log-status.closed {
    background: #fee2e2;
    color: #7f1d1d;
  }

  .log-time {
    font-size: 14px;
    color: #6b7280;
  }

  .log-body {
    font-size: 14px;
    color: #111827;
  }
}

