:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --purple: #7c3aed;
  --purple-light: #f5f3ff;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--slate-100);
  color: var(--slate-800);
  line-height: 1.5;
  padding-bottom: 60px;
}

/* Compact Top Account Bar (No longer blocks mobile screen) */
.demo-banner {
  background: linear-gradient(90deg, #0f172a 0%, #1e3a8a 100%);
  color: #fff;
  padding: 8px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.demo-banner-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}

.demo-badge {
  background: #f59e0b;
  color: #0f172a;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11px;
  text-transform: uppercase;
  white-space: nowrap;
}

.role-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.role-select-mobile {
  background: #ffffff;
  color: #0f172a;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 2px solid #f59e0b;
  cursor: pointer;
}

.role-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.role-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.role-btn.active {
  background: #fff;
  color: #0f172a;
  border-color: #fff;
  font-weight: 700;
}

@media (max-width: 768px) {
  .role-btn-desktop {
    display: none;
  }
}

@media (min-width: 769px) {
  .role-select-mobile {
    display: none;
  }
}

/* Main Layout */
.app-container {
  max-width: 1340px;
  margin: 0 auto;
  padding: 12px;
}

.top-header {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  border: 1px solid var(--slate-200);
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-title h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate-900);
}

.brand-title p {
  font-size: 12px;
  color: var(--slate-500);
}

.user-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ip-pill {
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.ip-dot.invalid {
  background: var(--danger);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  background: #fff;
  padding: 6px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-200);
}

.nav-tab {
  padding: 8px 13px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--slate-700);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.nav-tab:hover {
  background: var(--slate-100);
}

.nav-tab.active {
  background: var(--primary);
  color: #fff;
}

.tab-badge {
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.nav-tab.active .tab-badge {
  background: #fff;
  color: var(--primary);
}

/* Cards & Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1.08fr 1.22fr;
  gap: 16px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

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

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-200);
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--slate-100);
  flex-wrap: wrap;
}

.card-title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--slate-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stat Cards */
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  color: var(--slate-500);
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--slate-900);
}

.stat-sub {
  font-size: 11.5px;
  color: var(--slate-500);
  margin-top: 4px;
}

/* Camera & Checkin Box - Real Face Capture */
.camera-container {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto 12px auto;
  background: #0f172a;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--primary);
}

.camera-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* Gương lật tự nhiên khi soi mặt Selfie */
}

.camera-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.live-camera-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(220, 38, 38, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  display: none;
  align-items: center;
  gap: 5px;
  z-index: 5;
}

.shift-selector {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-bottom: 14px;
}

.shift-option {
  border: 2px solid var(--slate-200);
  border-radius: 9px;
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s;
}

.shift-option:hover {
  border-color: #93c5fd;
  background: var(--slate-50);
}

.shift-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.shift-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--slate-900);
}

.shift-time {
  font-size: 12px;
  color: var(--slate-500);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover:not(:disabled) {
  background: #15803d;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: #fff;
  border-color: var(--slate-300);
  color: var(--slate-700);
}

.btn-outline:hover:not(:disabled) {
  background: var(--slate-100);
}

.btn-sm {
  padding: 5px 9px;
  font-size: 11.5px;
  border-radius: 6px;
}

.btn-lg {
  padding: 12px 16px;
  font-size: 14.5px;
  border-radius: 10px;
  width: 100%;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.badge-warning {
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.badge-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecaca;
}

.badge-info {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid #bfdbfe;
}

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

th {
  background: var(--slate-50);
  color: var(--slate-700);
  font-weight: 700;
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid var(--slate-200);
  white-space: nowrap;
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--slate-200);
  vertical-align: middle;
}

tr:hover td {
  background-color: var(--slate-50);
}

.selfie-thumb {
  width: 68px;
  height: 51px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--slate-300);
  cursor: pointer;
}

/* Forms */
.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  font-size: 13px;
  color: var(--slate-900);
  background: #fff;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

/* Payslip Box */
.payslip-paper {
  border: 2px solid var(--slate-200);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.payslip-line {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--slate-200);
  font-size: 13px;
}

.payslip-total {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--primary-light);
  border-radius: 8px;
  margin-top: 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 14px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
}

.toast-box {
  position: fixed;
  bottom: 16px;
  right: 16px;
  left: 16px;
  max-width: 420px;
  margin: 0 auto;
  background: #0f172a;
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  z-index: 300;
  display: none;
  text-align: center;
}
