:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --success-light: #dcfce7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --sidebar-w: 240px;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Noto Sans Lao Looped', 'Noto Sans Lao', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ---------------- Layout ---------------- */
.page-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, #1e3a8a 0%, #2563eb 45%, #3b82f6 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px 28px;
}
.auth-logo {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin: 0 auto 16px;
}
.auth-card h1 { text-align: center; font-size: 20px; margin: 0 0 4px; }
.auth-card p.subtitle { text-align: center; color: var(--gray-500); margin: 0 0 24px; font-size: 14px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--gray-700); }
.input-wrap { position: relative; }
.input-wrap i.fa-solid, .input-wrap i.fa-regular { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray-500); }
.input-wrap input, .input-wrap select { padding-left: 40px; }

input[type=text], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--gray-900);
  transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px; border: none; cursor: pointer;
  font-size: 15px; font-weight: 700; transition: transform .05s, opacity .15s, background .15s;
}
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border: 1.5px solid var(--gray-200); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn-disabled, .btn:disabled { background: var(--gray-200); color: var(--gray-500); cursor: not-allowed; }
.btn-block[disabled] { opacity: .7; }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px;}
.alert-error { background: var(--danger-light); color: #991b1b; }
.alert-success { background: var(--success-light); color: #14532d; }

/* ---------------- Employee mobile UI ---------------- */
.emp-wrap { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--gray-50); padding-bottom: 40px; }
.emp-header {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff; padding: 24px 20px 50px; border-radius: 0 0 28px 28px; position: relative;
}
.emp-header .top-row { display: flex; justify-content: space-between; align-items: center; }
.emp-header .greeting { font-size: 13px; opacity: .85; margin: 0; }
.emp-header .name { font-size: 20px; font-weight: 700; margin: 2px 0 0; }
.emp-header .logout-btn { background: rgba(255,255,255,.15); border: none; color: #fff; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.emp-header .date-badge { margin-top: 18px; background: rgba(255,255,255,.15); display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-size: 14px; }

.emp-body { padding: 0 16px; margin-top: -32px; }

.shift-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 14px; display: flex; align-items: center; gap: 14px;
}
.shift-icon {
  width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0; background: var(--primary-light); color: var(--primary);
}
.shift-icon.done { background: var(--success-light); color: var(--success); }
.shift-info { flex: 1; min-width: 0; }
.shift-info .shift-name { font-weight: 700; font-size: 16px; margin: 0 0 2px; }
.shift-info .shift-time { color: var(--gray-500); font-size: 13px; margin: 0; }
.shift-info .checkin-time { color: var(--success); font-size: 13px; font-weight: 700; margin-top: 4px; }
.shift-action .btn { white-space: nowrap; }

.section-title { font-weight: 700; font-size: 15px; margin: 24px 0 12px; color: var(--gray-700); display: flex; align-items: center; gap: 8px;}

.history-item {
  background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.history-item .h-icon { width: 40px; height: 40px; border-radius: 10px; background: var(--success-light); color: var(--success); display: flex; align-items: center; justify-content: center; }
.history-item .h-info { flex: 1; }
.history-item .h-title { font-weight: 600; font-size: 14px; }
.history-item .h-sub { font-size: 12px; color: var(--gray-500); }
.history-item .h-time { font-weight: 700; color: var(--gray-700); font-size: 13px; }
.empty-state { text-align: center; color: var(--gray-500); padding: 30px 10px; font-size: 14px; }
.empty-state i { font-size: 32px; color: var(--gray-300); margin-bottom: 10px; display: block; }

/* ---------------- Admin layout ---------------- */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: #111827; color: #e5e7eb; flex-shrink: 0;
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  transition: transform .2s;
}
.sidebar .brand { padding: 22px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #1f2937; }
.sidebar .brand .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); display: flex; align-items: center; justify-content: center; }
.sidebar .brand span { font-weight: 700; font-size: 14px; line-height: 1.3; }
.sidebar nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: #9ca3af;
  font-size: 14px; font-weight: 600; margin-bottom: 4px;
}
.sidebar nav a i { width: 18px; text-align: center; }
.sidebar nav a:hover { background: #1f2937; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .sidebar-footer { padding: 14px; border-top: 1px solid #1f2937; }
.sidebar .sidebar-footer .user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; }
.sidebar .sidebar-footer .avatar { width: 34px; height: 34px; border-radius: 50%; background: #374151; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.sidebar .sidebar-footer .uname { font-size: 13px; font-weight: 700; color: #fff; }
.sidebar .sidebar-footer .urole { font-size: 11px; color: #9ca3af; }
.sidebar .logout-link { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 9px 8px; color: #f87171; font-size: 13px; font-weight: 600; border-radius: 8px; }
.sidebar .logout-link:hover { background: #1f2937; }

.main-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.topbar {
  display: none; align-items: center; justify-content: space-between; background: #fff; padding: 14px 16px;
  border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 40;
}
.topbar .menu-btn { background: var(--gray-100); border: none; width: 38px; height: 38px; border-radius: 10px; }
.content-inner { padding: 26px 30px; max-width: 1400px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 22px; margin: 0; }
.page-header p { color: var(--gray-500); font-size: 14px; margin: 4px 0 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.stat-card .icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-card .value { font-size: 24px; font-weight: 800; }
.stat-card .label { color: var(--gray-500); font-size: 13px; }

.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px; }
.card-title { font-weight: 700; font-size: 16px; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; color: var(--gray-500); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 2px solid var(--gray-100); white-space: nowrap; }
tbody td { padding: 12px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:hover { background: var(--gray-50); }
.table-responsive { overflow-x: auto; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-success { background: var(--success-light); color: #14532d; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar .search-box { position: relative; flex: 1; min-width: 200px; }
.toolbar .search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-500); font-size: 13px; }
.toolbar .search-box input { padding-left: 34px; }

.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; align-items: end; }
.filter-bar .form-group { margin-bottom: 0; }

.action-icons { display: flex; gap: 6px; }
.action-icons a, .action-icons button {
  width: 32px; height: 32px; border-radius: 8px; border: none; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px;
}
.action-icons .edit-btn { background: var(--primary-light); color: var(--primary); }
.action-icons .delete-btn { background: var(--danger-light); color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

.empty-row td { text-align: center; padding: 40px 10px; color: var(--gray-500); }

.report-summary-line { font-size: 13px; color: var(--gray-700); background: var(--gray-50); padding: 10px 14px; border-radius: 8px; margin: 10px 0 20px; }
.emp-report-block { margin-bottom: 30px; }
.emp-report-block h3 { font-size: 15px; color: var(--primary-dark); margin-bottom: 8px; }

/* ---------------- Kiosk-style employee check-in ---------------- */
.kiosk-wrap { max-width: 440px; margin: 0 auto; min-height: 100vh; background: var(--gray-50); padding-bottom: 40px; }

.kiosk-header {
  background: linear-gradient(150deg, #3730a3 0%, #4338ca 55%, #4f46e5 100%);
  color: #fff; padding: 28px 20px 70px; border-radius: 0 0 32px 32px; text-align: center;
}
.kiosk-icon {
  width: 56px; height: 56px; border-radius: 16px; background: rgba(255,255,255,.18);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 24px;
}
.kiosk-title { font-size: 18px; font-weight: 800; margin: 0; }
.kiosk-subtitle { font-size: 13px; opacity: .8; margin: 4px 0 0; }

.kiosk-clock-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  margin: -46px 16px 0; padding: 22px 20px 18px; text-align: center; position: relative;
}
.kiosk-clock { font-size: 40px; font-weight: 800; color: var(--gray-900); letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.kiosk-clock .secs { font-size: 22px; color: var(--gray-300); font-weight: 700; }
.kiosk-date { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.kiosk-status {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; color: var(--gray-500);
}
.kiosk-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.kiosk-status.offline .dot { background: var(--danger); }

.kiosk-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin: 16px; padding: 20px; }
.kiosk-card-label { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--gray-700); margin-bottom: 14px; }

.remember-chip {
  display: flex; align-items: center; gap: 8px; background: var(--primary-light); color: var(--primary-dark);
  border-radius: 10px; padding: 10px 12px; font-size: 13.5px; font-weight: 600; margin-bottom: 12px; cursor: pointer;
}
.remember-chip i.fa-circle-check { color: var(--primary); }
.remember-chip .clear-chip { margin-left: auto; background: none; border: none; color: var(--gray-500); cursor: pointer; font-size: 12px; padding: 2px 6px; }

.kiosk-code-input {
  width: 100%; text-align: center; font-size: 24px; font-weight: 800; letter-spacing: 3px;
  padding: 16px 10px; border: 1.5px solid var(--gray-200); border-radius: 12px; text-transform: uppercase;
  font-family: 'Noto Sans Lao Looped', monospace;
}
.kiosk-code-input:focus { outline: none; border-color: var(--primary); }

.toggle-row { display: flex; align-items: center; gap: 10px; margin: 14px 2px 18px; font-size: 13px; color: var(--gray-500); }
.toggle-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-300); border-radius: 999px; cursor: pointer; transition: .2s; }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-row .private-note { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.kiosk-btn {
  width: 100%; padding: 17px; border: none; border-radius: 14px; font-size: 16px; font-weight: 800;
  color: #fff; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  background: linear-gradient(135deg, #4338ca, #4f46e5); box-shadow: 0 8px 20px rgba(67,56,202,.3);
}
.kiosk-btn:active { transform: scale(.98); }
.kiosk-btn.success { background: linear-gradient(135deg, #16a34a, #22c55e); box-shadow: 0 8px 20px rgba(22,163,74,.3); }

.kiosk-summary-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--gray-700); margin-bottom: 14px; }
.kiosk-summary-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--gray-100); font-size: 14px; }
.kiosk-summary-row:last-child { border-bottom: none; }
.kiosk-summary-row .label { display: flex; align-items: center; gap: 8px; color: var(--gray-500); }
.kiosk-summary-row .value { font-weight: 700; color: var(--gray-900); }
.kiosk-summary-row .value.green { color: var(--success); display: flex; align-items: center; gap: 6px; }
.kiosk-summary-row .value.green .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

.kiosk-link { display: block; text-align: center; margin: 16px 0 0; font-size: 13px; color: var(--gray-500); }


@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar { display: flex; }
  .content-inner { padding: 18px 14px; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
  .sidebar-overlay.show { display: block; }
}
