/* Ponto Estofcar — painel administrativo */
:root {
  --brand: #156ba4;
  --brand-600: #115a8b;
  --brand-50: #eef5fb;
  --brand-red: #c42f33;

  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #6b7280;

  --success: #0f7a4a;  --success-bg: #e9f7ef;
  --warning: #a15c07;  --warning-bg: #fef6e7;
  --danger:  #b42318;  --danger-bg:  #fdecea;
  --neutral: #475467;  --neutral-bg: #f0f2f5;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .08);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono, .tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none;
        stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

/* ------------------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 12px;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.sidebar .brand img { height: 26px; width: auto; }
.sidebar .brand span { font-size: 12px; color: var(--muted); font-weight: 500; border-left: 1px solid var(--border); padding-left: 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
             color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand-50); color: var(--brand); }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.user-box { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-50); color: var(--brand);
          display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.user-box .who { min-width: 0; flex: 1; }
.user-box .who strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-box .who a { font-size: 12px; color: var(--muted); }

.main { min-width: 0; }
.topbar { display: none; }
.content { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
             margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }

/* ------------------------------------------------------------ cards / grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.stats > .card, .grid-main > .card, .grid-2 > .card { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
             padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px;
             justify-content: flex-end; background: #fafbfc; border-radius: 0 0 var(--radius) var(--radius); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat .value { font-size: 28px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-main { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: #fafbfc; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfc; }
td .sub { display: block; color: var(--muted); font-size: 12.5px; }
tr.is-muted td { color: var(--muted); }
tr.is-weekend td { background: #fbfbfc; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .icon { width: 28px; height: 28px; margin-bottom: 8px; color: var(--border-strong); }

/* ------------------------------------------------------------ badges / chips */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
         font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral); }
.badge.success { background: var(--success-bg); color: var(--success); }
.badge.warning { background: var(--warning-bg); color: var(--warning); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.brand { background: var(--brand-50); color: var(--brand); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px;
        border: 1px solid var(--border); font-variant-numeric: tabular-nums; font-size: 13px; background: var(--surface); }
.chip.in { border-color: #bcd7ec; background: var(--brand-50); color: var(--brand-600); }
.chip.out { border-color: var(--border-strong); }
.chip.void { text-decoration: line-through; color: var(--muted); border-style: dashed; }
.chip.manual::after { content: "M"; font-size: 10px; font-weight: 700; color: var(--warning); margin-left: 2px; }

/* ------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px;
       padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
       background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
       white-space: nowrap; box-shadow: var(--shadow); }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(21, 107, 164, .25); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); border-color: #f4c7c2; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }
form.inline { display: inline; }

/* ------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.field .error { color: var(--danger); font-size: 12.5px; margin-top: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow);
}
textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }
.input-group { display: flex; align-items: stretch; }
.input-group input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .suffix { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border-strong);
  border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: #fafbfc; color: var(--muted); font-size: 13px; white-space: nowrap; }
.section-title { font-size: 14px; font-weight: 600; margin: 4px 0 2px; }
.section-desc { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.divider { height: 1px; background: var(--border); margin: 22px 0; }
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.radio-cards.cols-2 { grid-template-columns: repeat(2, 1fr); }
.radio-card { position: relative; display: block; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
              padding: 12px 14px; cursor: pointer; background: var(--surface); }
.radio-card input { position: absolute; opacity: 0; }
.radio-card strong { display: block; font-size: 13.5px; }
.radio-card span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.radio-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); background: var(--brand-50); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.filters .field { min-width: 160px; }
.filters .field.grow { flex: 1; min-width: 200px; }
.filters label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }

/* ------------------------------------------------------------ escala */
.week { display: grid; gap: 0; }
.week-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 14px; align-items: center;
            padding: 12px 0; border-bottom: 1px solid var(--border); }
.week-row:last-child { border-bottom: 0; }
.week-row .day { font-weight: 600; }
.week-row .periods { display: flex; gap: 10px; flex-wrap: wrap; }
.period { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.period input { width: 104px; height: 32px; box-shadow: none; }
.period span { color: var(--muted); font-size: 12px; }
.week-mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week-mini div { text-align: center; padding: 6px 2px; border-radius: 6px; background: var(--brand-50); color: var(--brand-600); font-size: 11.5px; line-height: 1.3; }
.week-mini div.off { background: var(--neutral-bg); color: var(--muted); }
.week-mini b { display: block; font-size: 11px; }

/* ------------------------------------------------------------ alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm);
         border: 1px solid; margin-bottom: 16px; font-size: 13.5px; }
.alert.success { background: var(--success-bg); border-color: #b7e4c9; color: #0b5d39; }
.alert.danger { background: var(--danger-bg); border-color: #f4c7c2; color: #8f1d14; }
.alert.warning { background: var(--warning-bg); border-color: #f6dcab; color: #7a4505; }
.alert.info { background: var(--brand-50); border-color: #c7deef; color: var(--brand-600); }
.flash-stack { position: fixed; top: 16px; right: 16px; z-index: 50; width: min(380px, calc(100vw - 32px)); }
.flash-stack .alert { box-shadow: var(--shadow-lg); animation: slide .25s ease-out; }
@keyframes slide { from { transform: translateY(-6px); opacity: 0; } }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

/* ------------------------------------------------------------ login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
        background: radial-gradient(1200px 500px at 50% -10%, #e6f0f8, transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card-body { padding: 32px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 24px; }
.auth-logo img { height: 40px; }
.auth h1 { font-size: 19px; text-align: center; }
.auth .lead { text-align: center; color: var(--muted); margin: 6px 0 24px; }
.stack { display: grid; gap: 16px; }

.qr-box { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.qr-box svg { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: #fff; }
.link-box { font-family: var(--mono); font-size: 12px; word-break: break-all; padding: 10px 12px;
            background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.secret { font-family: var(--mono); font-size: 22px; letter-spacing: .06em; padding: 14px 16px; text-align: center;
          background: var(--bg); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }

/* ------------------------------------------------------------ responsivo */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-main, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%);
             transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(16,24,40,.35); z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface);
            border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .topbar img { height: 22px; }
  .content { padding: 20px 16px 48px; }
  .form-grid, .form-grid.cols-3, .radio-cards { grid-template-columns: 1fr; }
  .week-row { grid-template-columns: 1fr; gap: 8px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  th, td { padding: 10px 12px; }
}
