/* ============================================================
   Genesis Consulting — Apontamento de Horas
   Design system inspirado no psiclinic:
   Inter (corpo) + Instrument Serif (títulos), fundo stone,
   cards arredondados, primário azul consultoria.
   ============================================================ */
:root {
  --primary: #2451c9;
  --primary-hover: #1d43ab;
  --primary-active: #17398f;
  --primary-light: #dbe4fb;
  --primary-lighter: #eef3fe;
  --primary-border: #a9c0f4;
  --primary-dark: #16367f;
  --primary-fg: #ffffff;

  --accent: #b7791f;          /* âmbar sóbrio p/ destaques (total) */
  --ink: #1a2438;             /* texto forte */
  --ink-2: #33405c;
  --muted: #6b7280;
  --border: #e6e8ee;
  --border-strong: #d3d7e0;
  --surface: #ffffff;
  --bg: #f6f6f4;              /* stone-50 */
  --weekend: #f3f1ec;

  --success: #16a34a; --success-bg: #dcfce7; --success-border: #86efac;
  --danger: #dc2626;  --danger-bg: #fee2e2;  --danger-border: #fecaca;
  --warn-bg: #fef3c7; --warn-fg: #92600b; --warn-border: #fcd34d;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-xs: 0 1px 2px rgba(20,25,40,.05);
  --shadow: 0 1px 2px rgba(20,25,40,.04), 0 10px 30px -14px rgba(20,25,40,.22);
  --shadow-lg: 0 24px 50px -20px rgba(20,25,40,.32);

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", ui-serif, Georgia, serif;
  --mono: "SFMono-Regular", ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -.015em; margin: 0; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-weight: 600; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .06s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border-strong); }
.btn-secondary:hover { background: #fafafa; border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(20,25,40,.05); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-elevated { box-shadow: 0 10px 22px -10px rgba(36,81,201,.7); }
.btn-elevated:hover { box-shadow: 0 14px 26px -10px rgba(36,81,201,.75); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-md { height: 40px; padding: 0 16px; font-size: 14px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- Campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted);
}
.field input, .field select, .period input, .period select {
  height: 42px; padding: 0 12px; font-family: var(--sans); font-size: 14.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .field select:focus, .period input:focus, .period select:focus,
.grid input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36,81,201,.16);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 2px 0 0; }

/* ============ LOGIN ============ */
.login-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1000px 500px at 85% -5%, rgba(36,81,201,.10), transparent 60%),
    radial-gradient(800px 400px at 0% 110%, rgba(183,121,31,.07), transparent 55%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 34px 32px;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-brand h1 { font-size: 26px; line-height: 1.05; }
.login-brand p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.pass-wrap { position: relative; display: flex; }
.pass-wrap input { flex: 1; padding-right: 42px; }
.pass-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); height: 34px; width: 34px; display: grid; place-items: center; border: none; background: transparent; color: var(--muted); cursor: pointer; border-radius: 8px; }
.pass-toggle:hover { color: var(--ink); background: rgba(20,25,40,.05); }
.pass-toggle .eye { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pass-toggle.on { color: var(--primary); }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 20px 0 0; }

.brand-mark {
  display: grid; place-items: center; width: 46px; height: 46px; flex: none;
  border-radius: 12px; color: #fff; font-weight: 800; letter-spacing: .5px;
  font-size: 17px; background: linear-gradient(150deg, var(--primary-dark), var(--primary));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 8px 18px -8px rgba(36,81,201,.6);
}

/* ============ APP SHELL ============ */
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--border); padding: 20px 16px;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.sidebar-brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.sidebar-brand-txt strong { font-family: var(--serif); font-size: 20px; }
.sidebar-brand-txt span { font-size: 12px; color: var(--muted); }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border: none; background: transparent; cursor: pointer;
  font-family: var(--sans); font-size: 14.5px; font-weight: 500; color: var(--ink-2);
  border-radius: var(--radius-sm); text-align: left; transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--primary-lighter); color: var(--primary-dark); }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.user-avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-light); color: var(--primary-dark); font-weight: 700; font-size: 13px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; }
.user-meta strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }

.content { padding: 30px clamp(18px, 3.5vw, 44px) 60px; min-width: 0; }
.view { max-width: 1360px; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 32px; }
.page-desc { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.period { display: flex; gap: 12px; }
.period label { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.period input { width: 92px; }
.period select { min-width: 120px; }

/* ---------- Cards de resumo ---------- */
.cards-row { display: grid; grid-template-columns: auto auto 1fr; gap: 16px; align-items: stretch; margin-bottom: 22px; }
.stat-card {
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  padding: 16px 22px; border-radius: var(--radius); min-width: 150px;
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}
.stat-card.accent { background: linear-gradient(155deg, #16367f, #2451c9); border: none; color: #fff; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .82; }
.stat-value { font-family: var(--mono); font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.meta-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-content: center; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow-xs); }
.field.sm input { height: 38px; }

/* ---------- Meu perfil ---------- */
.profile-card { max-width: 480px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.profile-card form { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.spacer { flex: 1; }
.status { font-size: 13px; color: var(--muted); min-height: 18px; }
.status.saved { color: var(--success); font-weight: 600; }
.status.err { color: var(--danger); font-weight: 600; }

/* ---------- Grid ---------- */
.table-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-card { overflow-x: auto; }
table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
.grid thead th {
  position: sticky; top: 0; z-index: 3; background: #f1f2f6; color: var(--ink);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 9px 8px; border-bottom: 1px solid var(--border-strong); border-right: 1px solid var(--border);
}
.grid .head-sub th { top: 34px; font-size: 10px; color: var(--muted); }
.grid tbody td { padding: 0; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; }
.grid tbody tr:hover td { background: var(--primary-lighter); }
.grid tbody tr.weekend td { background: var(--weekend); }
.grid tbody tr.weekend:hover td { background: #ece7db; }
.cell-dia { font-weight: 700; font-variant-numeric: tabular-nums; width: 44px; color: var(--ink); }
.cell-sem { font-size: 11px; color: var(--muted); text-transform: uppercase; width: 46px; }
.cell-total { font-family: var(--mono); font-variant-numeric: tabular-nums; width: 64px; color: var(--primary-dark); font-weight: 600; }
.cell-total.zero { color: var(--border-strong); font-weight: 500; }
.grid input { width: 100%; border: none; background: transparent; font: inherit; text-align: center; padding: 9px 4px; color: var(--ink); font-variant-numeric: tabular-nums; }
.grid input.time { width: 66px; font-family: var(--mono); font-size: 13px; }
.grid td.txt { text-align: left; }
.grid td.txt input { text-align: left; padding-left: 10px; }
.grid input:focus { background: rgba(36,81,201,.09); box-shadow: inset 0 -2px 0 var(--primary); }
.grid input.invalid { background: var(--danger-bg); box-shadow: inset 0 -2px 0 var(--danger); }
.col-ativ { min-width: 250px; } .col-obs { min-width: 190px; }

/* ---------- Usuários ---------- */
.users-grid tbody td { text-align: left; padding: 12px 14px; font-size: 14px; }
.users-grid thead th { text-align: left; padding: 11px 14px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid; }
.badge-admin { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary-border); }
.badge-consultant { background: #eef1f6; color: var(--ink-2); border-color: var(--border-strong); }
.badge-on { background: var(--success-bg); color: #166534; border-color: var(--success-border); }
.badge-off { background: #f3f4f6; color: var(--muted); border-color: var(--border-strong); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.link-btn { background: none; border: none; color: var(--primary); font-weight: 600; cursor: pointer; font-size: 13.5px; font-family: var(--sans); padding: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,25,40,.5); display: grid; place-items: center; z-index: 50; padding: 20px; backdrop-filter: blur(2px); }
.modal { width: 100%; max-width: 460px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 26px; }
.modal h2 { font-size: 24px; margin-bottom: 18px; }
.modal form { display: flex; flex-direction: column; gap: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; transition: opacity .2s, transform .2s; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }
  .sidebar-nav { flex-direction: row; flex: 1 1 100%; order: 3; }
  .sidebar-foot { border-top: none; padding-top: 0; flex-direction: row; align-items: center; }
  .cards-row { grid-template-columns: 1fr 1fr; }
  .meta-fields { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
}
