:root { --primary: #1d4ed8; --primary-dark: #1e3a8a; --text: #1f2937; --muted: #6b7280; --bg: #f3f4f6; --line: #e5e7eb; --danger: #b91c1c; --ok: #166534; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); line-height: 1.5; }
.wrap { width: min(100% - 2rem, 1040px); margin-inline: auto; }
main.wrap { padding: 1.5rem 0 4rem; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .5rem; }
a { color: var(--primary); }
.muted { color: var(--muted); font-size: .95rem; }

.bar { background: #0f172a; color: #fff; }
.bar-in { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; padding: .6rem 0; }
.brand { color: #fff; font-weight: 800; text-decoration: none; }
.menu { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1; }
.menu a { color: #cbd5e1; text-decoration: none; padding: .55rem .75rem; border-radius: 8px; min-height: 44px; display: inline-flex; align-items: center; }
.menu a:hover { background: #1e293b; color: #fff; }
.menu a.on { background: var(--primary); color: #fff; }
.logout { margin: 0; }
.link { background: none; border: 0; color: #cbd5e1; cursor: pointer; font: inherit; padding: .55rem .5rem; min-height: 44px; text-decoration: underline; }
.link:hover { color: #fff; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.card.narrow { max-width: 460px; margin: 2rem auto; }
.note { padding: .75rem 1rem; border-radius: 8px; margin: 0 0 1rem; background: #eff6ff; border: 1px solid #bfdbfe; }
.note.ok { background: #f0fdf4; border-color: #bbf7d0; color: var(--ok); }
.note.err { background: #fef2f2; border-color: #fecaca; color: var(--danger); }

form label { display: block; font-weight: 600; margin-bottom: .9rem; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=datetime-local], select, textarea {
  display: block; width: 100%; font: inherit; padding: .65rem .75rem; margin-top: .3rem; min-height: 46px;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff; color: var(--text);
}
textarea { min-height: 110px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid #f59e0b; outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .6rem 1.25rem; background: var(--primary); color: #fff; border: 0; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--primary-dark); }
.btn.alt { background: #475569; }
.btn.alt:hover { background: #334155; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #7f1d1d; }
.btn.small { min-height: 36px; padding: .3rem .8rem; font-size: .9rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.big-btn { min-height: 64px; font-size: 1.25rem; padding: .75rem 2rem; }

.status { text-align: center; }
.state { font-size: 1.15rem; margin: 0 0 .25rem; }
.big { font-size: 2.6rem; font-weight: 800; margin: .25rem 0 1rem; font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: 1rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); white-space: nowrap; }
tfoot td, tr.total td { font-weight: 700; background: #f9fafb; }
.tag { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: #fef3c7; color: #92400e; font-weight: 700; }
.tag.red { background: #fee2e2; color: #991b1b; }
.tag.gray { background: #e5e7eb; color: #374151; }

.filters { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: flex-end; }
.filters label { margin: 0; }
.inline { display: inline; }
.row-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.row-form select { margin: 0; min-height: 36px; width: auto; padding: .25rem .5rem; }
.pw-box { font: 700 1.3rem/1.2 ui-monospace, Consolas, monospace; background: #fff; border: 2px dashed var(--primary); padding: .75rem 1rem; border-radius: 8px; display: inline-block; user-select: all; }
.grid2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

@media (max-width: 640px) {
  .big { font-size: 2.2rem; }
  .actions .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Reports redesign ---------- */
.quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.period { margin: 0 0 1rem; font-size: 1.05rem; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 1.25rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.stat-n { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-l { font-size: .85rem; color: var(--muted); }
.stat.hot { border-color: #fbbf24; background: #fffbeb; }
.stat.hot .stat-n { color: #92400e; }
.live { margin: 0; padding-left: 1.2rem; }
.live li { margin: .3rem 0; }
.ok-line { color: var(--ok); font-weight: 600; margin: 0; }
.attn { list-style: none; margin: 0 0 .75rem; padding: 0; }
.attn li { padding: .6rem .8rem; border-radius: 8px; margin-bottom: .4rem; border-left: 4px solid #cbd5e1; background: #f9fafb; display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: center; }
.attn li.warn { border-left-color: var(--danger); background: #fef2f2; }
.attn li .btn { margin-left: auto; }

details.emp { padding: 0; }
details.emp > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; padding: 1rem 1.25rem; min-height: 56px; }
details.emp > summary::-webkit-details-marker { display: none; }
details.emp > summary::before { content: "\25B8"; color: var(--muted); font-size: 1.1rem; }
details.emp[open] > summary::before { content: "\25BE"; }
details.emp[open] > summary { border-bottom: 1px solid var(--line); }
details.emp > summary:focus-visible { outline: 3px solid #f59e0b; outline-offset: -3px; border-radius: 12px; }
.emp-name { font-weight: 700; font-size: 1.05rem; flex: 1 1 200px; }
.emp-fig { display: flex; flex-direction: column; align-items: flex-end; min-width: 58px; font-variant-numeric: tabular-nums; }
.emp-fig b { font-size: 1.05rem; }
.emp-fig small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.emp-fig.hot b { color: #92400e; }
.emp-body { padding: 1rem 1.25rem 1.25rem; }
progress { width: min(260px, 60%); height: 14px; vertical-align: middle; accent-color: var(--primary); }

@media print {
  .bar, .no-print, .filters, .quick { display: none !important; }
  body { background: #fff; }
  .card, .stat { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  main.wrap { padding: 0; width: 100%; }
  details.emp > summary::before { content: ""; }
  a { color: inherit; text-decoration: none; }
}
@media (max-width: 640px) {
  .emp-fig { align-items: flex-start; min-width: 64px; }
}
