:root {
  --bg: #f4f6f8; --card: #fff; --line: #e2e6ea; --ink: #1f2a37;
  --muted: #6b7280; --accent: #2563eb; --ok: #16a34a; --bad: #dc2626; --warn: #d97706;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(360px, 92vw); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.card h1, .card h2 { margin: 0 0 4px; }
input, select, button { font: inherit; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--line); }
.pw-wrap { position: relative; display: flex; }
.pw-wrap input { flex: 1; padding-right: 42px; }
button.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); background: none; color: var(--muted); padding: 6px; display: grid; place-items: center; }
button.pw-toggle:hover { color: var(--ink); }
label { display: flex; flex-direction: column; gap: 4px; }
label.check { flex-direction: row; align-items: center; gap: 8px; }

button { background: var(--accent); color: #fff; border: none; cursor: pointer; }
button.secondary { background: #eef1f4; color: var(--ink); }
button.link { background: none; color: var(--accent); padding: 4px; }
button:disabled { opacity: .55; cursor: default; }

/* App */
header { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; background: var(--card); border-bottom: 1px solid var(--line); }
header h1 { font-size: 18px; margin: 0; }
.tabs { display: flex; gap: 4px; padding: 10px 22px 0; background: var(--card); border-bottom: 1px solid var(--line); }
.tab { background: none; color: var(--muted); border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 14px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { padding: 22px; }
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); }
th { background: #fafbfc; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
td.fail { color: var(--bad); }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.badge.ui { background: #dbeafe; color: #1e40af; }
.badge.cron { background: #e5e7eb; color: #374151; }
.badge.retry { background: #fef3c7; color: #92400e; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.inactive { background: #fee2e2; color: #991b1b; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 50; }
.toast.bad { background: var(--bad); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; z-index: 40; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #fff; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
.spinner.dark { border-color: var(--accent); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Attendance machine card */
.device-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 22px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.device-card h2 { font-size: 16px; margin: 0 0 2px; }
.device-card .device-info p { margin: 0; }
.device-card .hint { margin: 0; font-size: 13px; max-width: 70ch; }
button.big { font-size: 15px; font-weight: 600; padding: 12px 18px; }
.job { width: 100%; }
.job-status { margin: 4px 0 6px; font-weight: 600; }
.job-status.ok { color: var(--ok); }
.job-status.bad { color: var(--bad); }
.job pre { max-height: 260px; overflow: auto; background: #0f172a; color: #e2e8f0; font-size: 12px; padding: 10px; border-radius: 7px; white-space: pre-wrap; word-break: break-word; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #fef3c7; color: #92400e; }
.pill.ok { background: #dcfce7; color: #166534; }
