/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f8fafc; color: #1e293b; min-height: 100vh; line-height: 1.5; }
input, select, textarea, button { font-family: inherit; }
a { text-decoration: none; }

/* ===== VARIABLES ===== */
:root {
  --green: #22c55e;  --green-d: #16a34a;
  --red: #ef4444;    --red-d: #dc2626;
  --yellow: #f59e0b; --yellow-d: #d97706;
  --blue: #3b82f6;   --blue-d: #2563eb;
  --gray: #94a3b8;
  /* Passyz brand */
  --pz-blue: #1d4ed8;  --pz-blue-d: #1e40af;
  --pz-yellow: #fcf90c; --pz-yellow-d: #e3e000;
  --pz-ink: #0f172a;
  --bg: #f8fafc;     --card: #ffffff;
  --text: #1e293b;   --text2: #64748b;
  --border: #e2e8f0;
  --r: 12px;         --r-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

/* ===== APP SHELL ===== */
.app-header {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 0 16px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.app-header .logo { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.hdr-logo { height: 30px; max-width: 150px; object-fit: contain; display: none; }
.app-header .hdr-left { display: flex; align-items: center; gap: 10px; }
.app-header .hdr-right { display: flex; align-items: center; gap: 12px; }
.app-header .user-name { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.app-header .biz-name { font-size: 0.8rem; color: var(--text2); }

.nav-tabs {
  display: flex; background: #fff;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  padding: 14px 18px; font-size: 0.875rem; font-weight: 500;
  color: var(--text2); cursor: pointer;
  border: none; border-bottom: 3px solid transparent;
  background: none; white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--accent, var(--pz-blue)); border-bottom-color: var(--accent, var(--pz-blue)); }

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

.page { max-width: 500px; margin: 0 auto; padding: 16px; }
.page.wide { max-width: 1100px; }

/* ===== CARDS ===== */
.card {
  background: var(--card); border-radius: var(--r);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 20px; margin-bottom: 16px;
}
.card-title { font-size: 0.875rem; font-weight: 600; color: var(--text2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.card-value { font-size: 2.2rem; font-weight: 700; color: var(--text); line-height: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-grid.four { grid-template-columns: repeat(4, 1fr); }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; text-align: center; }
.stat-card .val { font-size: 2rem; font-weight: 700; color: var(--text); }
.stat-card .lbl { font-size: 0.78rem; color: var(--text2); margin-top: 2px; }
.stat-card.green .val { color: var(--green-d); }
.stat-card.yellow .val { color: var(--yellow-d); }
.stat-card.red .val { color: var(--red-d); }
.stat-card.blue .val { color: #111827; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--r-sm);
  font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: opacity .15s, transform .1s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-green  { background: var(--green-d);  color: #fff; }
.btn-green:hover:not(:disabled)  { background: #15803d; }
.btn-red    { background: var(--red);    color: #fff; }
.btn-red:hover:not(:disabled)    { background: var(--red-d); }
.btn-yellow { background: var(--yellow); color: #fff; }
.btn-yellow:hover:not(:disabled) { background: var(--yellow-d); }
.btn-blue   { background: var(--accent, var(--pz-blue));   color: #fff; }
.btn-blue:hover:not(:disabled)   { background: var(--accent, var(--pz-blue-d)); filter: brightness(0.95); }
/* Passyz primary CTA (yellow with dark text) */
.btn-cta { background: var(--pz-yellow); color: var(--pz-ink); font-weight: 700; }
.btn-cta:hover:not(:disabled) { background: var(--pz-yellow-d); }
.btn-outline { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-full { width: 100%; }

/* Large clock action buttons */
.clock-btn {
  width: 100%; padding: 18px; border-radius: var(--r);
  font-size: 1.2rem; font-weight: 700;
  cursor: pointer; border: none;
  transition: opacity .15s, transform .1s;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.clock-btn:active:not(:disabled) { transform: scale(.97); }
.clock-btn:disabled { opacity: .4; cursor: not-allowed; }
.clock-btn-in  { background: var(--pz-yellow);  color: var(--pz-ink); }
.clock-btn-in:hover:not(:disabled)  { background: var(--pz-yellow-d); }
.clock-btn-out { background: #1e293b;    color: #fff; }
.clock-btn-out:hover:not(:disabled) { background: #334155; }
.clock-btn-brk { background: var(--pz-blue); color: #fff; }
.clock-btn-brk:hover:not(:disabled) { background: var(--pz-blue-d); }
.clock-btn-end { background: #fff; color: var(--text); border: 2px solid var(--border); }
.clock-btn-end:hover:not(:disabled) { background: var(--bg); }

/* ===== STATUS DISPLAY ===== */
.status-banner {
  text-align: center; padding: 14px 20px;
  border-radius: var(--r); margin-bottom: 16px;
  font-size: 0.95rem; font-weight: 500;
}
.status-out  { background: #f1f5f9; color: var(--text2); }
.status-in   { background: #dcfce7; color: #15803d; }
.status-brk  { background: #fef3c7; color: #92400e; }

.shift-timer {
  text-align: center; font-size: 3.5rem; font-weight: 800;
  color: var(--text); font-variant-numeric: tabular-nums;
  letter-spacing: -2px; line-height: 1; padding: 8px 0;
}
.timer-green { color: var(--pz-blue); }
.timer-yellow { color: var(--yellow-d); }

.time-display { text-align: center; font-size: 1.3rem; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.date-display { text-align: center; font-size: 0.95rem; color: var(--text2); margin-bottom: 16px; }

/* ===== LOGIN (Passyz look: blue field, black-bordered white card) ===== */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
  background: var(--pz-blue);
}
.login-card {
  background: #fff; border-radius: 18px;
  border: 3px solid var(--pz-ink);
  padding: 36px 30px; width: 100%; max-width: 420px;
  box-shadow: 0 14px 40px rgba(0,0,0,.25);
}
/* Logo block sits on the blue, above the card */
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo h1 { font-size: 1.9rem; font-weight: 800; color: #fff; }
.login-logo p  { color: rgba(255,255,255,.85); font-size: 0.9rem; margin-top: 4px; font-weight: 500; }
/* When the logo is still inside a card (not moved out), keep it readable */
.login-card .login-logo h1 { color: var(--text); }
.login-card .login-logo p  { color: var(--text2); }

.login-tabs {
  display: flex; background: var(--bg);
  border-radius: var(--r-sm); padding: 4px; margin-bottom: 24px;
}
.login-tab {
  flex: 1; padding: 8px; border-radius: 6px;
  text-align: center; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; color: var(--text2);
  border: none; background: none; transition: all .15s;
}
.login-tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow); }

.login-panel { display: none; }
.login-panel.active { display: block; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 5px; color: var(--text); }
.form-input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 0.9rem; color: var(--text); background: #fff;
  transition: border-color .15s;
}
.form-input:focus { outline: none; border-color: var(--pz-blue); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.form-input.pin { font-size: 2rem; text-align: center; letter-spacing: 10px; font-weight: 700; }
.form-error { color: var(--red); font-size: 0.8rem; margin-top: 8px; text-align: center; min-height: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 0.78rem; color: var(--text2); margin-top: 4px; }

/* ===== BADGES ===== */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-gray   { background: #f1f5f9; color: #475569; }

/* ===== TABLES ===== */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--border); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; min-width: 600px; }
th { padding: 10px 14px; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--text2); background: var(--bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fafafa; }

/* ===== MODAL ===== */
.modal-bg {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 200;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-bg.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--r);
  width: 100%; max-width: 540px;
  max-height: 90vh; overflow-y: auto;
  padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.modal-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--bg); cursor: pointer; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== ALERTS ===== */
.alert { padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 10px; font-size: 0.875rem; display: flex; align-items: flex-start; gap: 8px; }
.alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b; color: #fff;
  padding: 12px 24px; border-radius: var(--r-sm);
  font-size: 0.9rem; z-index: 300;
  transition: transform .3s; white-space: nowrap;
  box-shadow: var(--shadow-md); pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.toast-error { background: var(--red-d); }
.toast.toast-success { background: #111827; }

/* ===== SECTION HEADER ===== */
.sec-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sec-title { font-size: 1rem; font-weight: 700; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: flex-end; }
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 130px; }
.filter-bar .btn { align-self: flex-end; }

/* ===== SUMMARY ROWS ===== */
.summary-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.summary-row:last-child { border-bottom: none; }
.summary-row .lbl { color: var(--text2); }
.summary-row .val { font-weight: 600; }

/* ===== REPORT BAR CHART ===== */
.rep-row { display: grid; grid-template-columns: 150px 1fr 72px; align-items: center; gap: 10px; padding: 6px 0; font-size: 0.85rem; }
.rep-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-track { background: var(--bg); border-radius: 6px; height: 22px; overflow: hidden; }
.rep-fill { height: 100%; background: var(--accent, var(--pz-blue)); border-radius: 6px; min-width: 3px; }
.rep-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .rep-row { grid-template-columns: 110px 1fr 60px; } }

/* ===== LIVE DOT ===== */
.live-dot { display: inline-block; width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 1.5s infinite; margin-right: 5px; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ===== EMPTY STATE ===== */
.empty { text-align: center; padding: 48px 24px; color: var(--text2); }
.empty .icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty p { font-size: 0.875rem; }

/* ===== MISC ===== */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.gap-row { display: flex; gap: 10px; flex-wrap: wrap; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-4 { margin-bottom: 4px; }
.fw-bold { font-weight: 700; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.78rem; color: var(--text2); }
.text-green { color: var(--green-d); }
.text-red { color: var(--red-d); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .stat-grid.four { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { min-width: 100%; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }
  .page { padding: 12px; }
  .page.wide { padding: 12px; }
}
@media (min-width: 768px) {
  .page { padding: 24px; }
  .page.wide { padding: 24px; }
}
