/* Cùng bộ màu với app nh_dms (lib/core/theme.dart): đỏ thương hiệu, tông slate, Be Vietnam Pro. */
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/BeVietnamPro-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/BeVietnamPro-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('/fonts/BeVietnamPro-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --bg: #F8FAFC; --fg: #0F172A; --surface: #FFFFFF; --muted: #475569;
  --border: #E2E8F0; --outline: #7C8BA1; --container: #F1F5F9;
  --primary: #D71920; --on-primary: #FFFFFF; --danger-soft: #FEF2F2;
  --success: #047857; --on-success: #FFFFFF; --success-soft: #ECFDF5;
  --warning: #B45309; --warning-soft: #FFFBEB;
  --radius: 12px; --gap: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F172A; --fg: #F1F5F9; --surface: #1E293B; --muted: #B4C0D0;
    --border: #334155; --outline: #7D8DA3; --container: #273449;
    --primary: #F87171; --on-primary: #450A0A; --danger-soft: #450A0A;
    --success: #34D399; --on-success: #022C22; --success-soft: #064E3B;
    --warning: #FBBF24; --warning-soft: #451A03;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 16px/1.5 'Be Vietnam Pro', system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
h1 { font-size: 20px; font-weight: 700; margin: 0; }
h2 { font-size: 17px; font-weight: 600; margin: 24px 0 8px; }
p { margin: 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; width: 100%; }
svg { width: 24px; height: 24px; fill: currentColor; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Nút: vùng bấm tối thiểu 48px */
.btn {
  min-height: 52px; padding: 0 20px; border-radius: var(--radius); font: inherit; font-weight: 600;
  border: 1px solid var(--outline); background: var(--surface); color: var(--primary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: transparent; width: 100%; font-size: 17px; }
.btn.success { background: var(--success); color: var(--on-success); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.busy:disabled { opacity: 1; }
.btn:active:not(:disabled) { filter: brightness(.92); }
.icon-btn {
  min-width: 48px; min-height: 48px; border: 0; background: transparent; color: inherit;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer;
}
.text-btn { min-height: 48px; padding: 0 12px; border: 0; background: transparent; color: var(--primary); font: inherit; font-weight: 600; cursor: pointer; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Ô nhập */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; font-size: 14px; color: var(--muted); }
.field input {
  min-height: 52px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--outline);
  background: var(--surface); color: var(--fg); font: inherit; font-size: 16px;
}
.field input:focus { outline: none; border: 2px solid var(--primary); padding: 0 15px; }
.password { position: relative; display: flex; }
.password input { flex: 1; padding-right: 56px; }
.password .icon-btn { position: absolute; right: 2px; top: 2px; color: var(--muted); }

.banner { border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px; font-size: 15px; }
.banner.error { background: var(--danger-soft); color: var(--fg); border: 1px solid var(--primary); }

/* Đăng nhập */
.login-box { max-width: 420px; margin: 0 auto; padding: 48px 24px 32px; text-align: center; }
.login-box .logo { display: block; margin: 0 auto 16px; }
.login-box h1 { font-size: 24px; }
.login-box .muted { margin: 4px 0 32px; }
.login-box form { text-align: left; }

/* Chấm công */
.topbar {
  position: sticky; top: 0; z-index: 2; background: var(--bg);
  display: flex; align-items: center; gap: 4px; padding: max(8px, env(safe-area-inset-top)) 8px 8px 16px;
}
.topbar h1 { flex: 1; }
.content { max-width: 560px; margin: 0 auto; padding: 8px 16px 120px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.status-card { padding: 24px 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.emp-name { font-size: 18px; font-weight: 600; }
.clock { font-size: 52px; line-height: 1.15; font-weight: 700; font-variant-numeric: tabular-nums; margin: 12px 0 8px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.pill.in { background: var(--success-soft); color: var(--success); }
.pill.out { background: var(--container); color: var(--muted); }
.pill.none { background: var(--warning-soft); color: var(--warning); }
.worked { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; justify-content: center; }
.worked strong { font-size: 18px; font-variant-numeric: tabular-nums; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; gap: 12px; padding: 14px 16px; }
.history li + li { border-top: 1px solid var(--border); }
.history .dot { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.history .dot.in { background: var(--success-soft); color: var(--success); }
.history .dot.out { background: var(--danger-soft); color: var(--primary); }
.history .what { font-weight: 600; }
.history .detail { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.history .empty { color: var(--muted); }

.bottombar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2; background: var(--surface); border-top: 1px solid var(--border);
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
}
.bottombar .btn { max-width: 528px; margin: 0 auto; display: flex; }

/* Hộp xác nhận: ảnh + ghi chú */
dialog {
  width: min(480px, calc(100% - 32px)); max-height: calc(100% - 32px); border: 0; border-radius: 20px; padding: 20px;
  background: var(--surface); color: var(--fg);
}
dialog::backdrop { background: rgba(15, 23, 42, .6); }
dialog h2 { margin: 0 0 12px; font-size: 20px; }
.preview { display: block; width: 100%; max-height: 42vh; object-fit: cover; border-radius: var(--radius); margin-bottom: 16px; background: var(--container); }
.dialog-actions { display: flex; gap: 8px; margin-top: 16px; }
.dialog-actions .btn { flex: 1; padding: 0 8px; }
.dialog-actions .btn.primary { width: auto; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: 96px; z-index: 5; margin: 0 auto; max-width: 528px;
  background: var(--fg); color: var(--bg); padding: 14px 16px; border-radius: var(--radius); font-size: 15px;
}
