/* ============================================================================
   devcontrol — estilo clean & moderno
   ============================================================================ */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --border: #e6e8ec;
  --border-strong: #d5d8de;
  --text: #1a1d24;
  --text-soft: #5b6472;
  --text-faint: #949cab;
  --accent: #f06820;         /* laranja da marca Albanet */
  --accent-soft: #fdeee3;
  --accent-hover: #d9560f;
  --ok: #16a34a; --ok-soft: #e7f6ec;
  --warn: #d97706; --warn-soft: #fdf1de;
  --danger: #dc2626; --danger-soft: #fdeaea;
  --info: #0891b2; --info-soft: #e2f4f8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.10);
  /* Segoe UI e a fonte da identidade Albanet (ja instalada em qualquer Windows) */
  --font: "Segoe UI", "Inter", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1d212a;
    --border: #262b35; --border-strong: #333a46;
    --text: #e8eaed; --text-soft: #a2abba; --text-faint: #6b7484;
    --accent: #ff7d3a; --accent-soft: #2c1b0f; --accent-hover: #ff9157;
    --ok-soft: #12271a; --warn-soft: #2a2011; --danger-soft: #2a1414; --info-soft: #0f2229;
    --shadow: 0 1px 3px rgba(0,0,0,.4); --shadow-lg: 0 12px 34px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

/* ---------- LOGIN ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 32px;
}
.brand { display: flex; align-items: center; gap: 9px; margin-bottom: 24px; }
/* logotipo Albanet — troca automatica claro/escuro */
.brand-logo { display: block; width: 172px; max-width: 64%; height: auto; margin-bottom: 26px; }
.brand-mark-img { width: 24px; height: 26px; object-fit: contain; flex: none; }
.so-escuro { display: none; }
@media (prefers-color-scheme: dark) {
  .so-claro { display: none; }
  .so-escuro { display: block; }
}
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent);
  display: grid; place-items: center; color: #fff; flex: none; }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.login-card h1 { font-size: 20px; letter-spacing: -.02em; margin-bottom: 4px; }
.login-card p.sub { color: var(--text-soft); margin-bottom: 22px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13.5px; transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-subtle { background: var(--surface-2); border-color: var(--border); color: var(--text-soft); }
.btn-subtle:hover { background: var(--border); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 4px; min-height: 18px; }

/* ---------- LAYOUT APP ---------- */
.shell { display: grid; grid-template-columns: 300px 1fr; height: 100vh; }
.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.sidebar-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; }
.sidebar-list { overflow-y: auto; padding: 12px; flex: 1; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.user-meta { flex: 1; min-width: 0; }
.user-meta .n { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta .r { color: var(--text-faint); font-size: 11.5px; text-transform: capitalize; }

.proj-item {
  padding: 12px 13px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent; margin-bottom: 4px; transition: background .12s, border-color .12s;
}
.proj-item:hover { background: var(--surface-2); }
.proj-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.proj-item .t { font-weight: 600; letter-spacing: -.01em; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-item .m { display: flex; align-items: center; gap: 8px; color: var(--text-faint); font-size: 12px; }
.mini-bar { height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; margin-top: 8px; }
.mini-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* separador do histórico (projetos concluídos) */
.hist-sep { display: flex; align-items: center; gap: 6px; padding: 12px 13px 6px; margin-top: 6px;
  border-top: 1px solid var(--border); font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-faint); cursor: pointer; user-select: none; }
.hist-sep:hover { color: var(--text-soft); }
.hist-sep .chev { margin-left: auto; }

/* alternador de vista (Lista / Por pessoa) */
.seg-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 2px; }
.seg-toggle button { border: none; background: transparent; color: var(--text-soft); font-weight: 600;
  font-size: 12.5px; padding: 5px 12px; border-radius: 6px; }
.seg-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* dashboard por pessoa — barras de estado */
.pp-legenda { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 12px 16px; font-size: 12px; color: var(--text-soft); }
.pp-legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.pp-linha { padding: 12px; border-top: 1px solid var(--border); }
.pp-linha:first-of-type { border-top: none; }
.pp-cab { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.pp-nome { font-weight: 600; letter-spacing: -.01em; }
.pp-barra { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--border); }
.pp-barra .seg { min-width: 4px; transition: flex .3s; }
.pp-barra .seg + .seg { box-shadow: -1px 0 0 var(--surface); }

/* tabela do registo de acessos */
.tabela-acessos { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela-acessos th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.tabela-acessos td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tabela-acessos tbody tr:hover { background: var(--surface-2); }

/* rodapé fixo em baixo à direita */
.app-footer { position: fixed; right: 12px; bottom: 8px; z-index: 6; font-size: 11px;
  color: var(--text-faint); letter-spacing: .02em; pointer-events: none;
  background: color-mix(in srgb, var(--bg) 70%, transparent); padding: 2px 8px; border-radius: 6px; }

.main { overflow-y: auto; }
.topbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
  padding: 16px 28px; display: flex; align-items: center; gap: 14px; }
.topbar h1 { font-size: 18px; letter-spacing: -.02em; }
.topbar .spacer { flex: 1; }
.content { padding: 24px 28px 60px; max-width: 1200px; }

.muted { color: var(--text-soft); }
.faint { color: var(--text-faint); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.empty-state svg { width: 44px; height: 44px; opacity: .4; margin-bottom: 12px; }

/* ---------- KPIs ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; }
.kpi .value small { font-size: 14px; font-weight: 600; color: var(--text-faint); }
.kpi .foot { font-size: 12px; color: var(--text-soft); margin-top: 6px; }
.progress { height: 8px; border-radius: 5px; background: var(--border); overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; border-radius: 5px; background: var(--accent); transition: width .4s; }
.progress.over > span { background: var(--danger); }

/* ---------- CARDS / SECTIONS ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 20px; overflow: hidden; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; }
.card-head h2 { font-size: 15px; letter-spacing: -.01em; }
.card-head .spacer { flex: 1; }
.card-body { padding: 6px 8px; }
.card-pad { padding: 18px; }

/* ---------- TÓPICOS (lista) ---------- */
.topico-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s; }
.topico-row:hover { background: var(--surface-2); }
.topico-row .tipo-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.topico-row .tt { flex: 1; min-width: 0; }
.topico-row .tt .titulo { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topico-row .tt .sub { font-size: 12px; color: var(--text-faint); }
.topico-row .horas { font-size: 12.5px; color: var(--text-soft); white-space: nowrap; }

/* ---------- BADGES ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge.gray { background: var(--surface-2); color: var(--text-soft); border: 1px solid var(--border); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* ---------- DRAWER (painel do tópico) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.35); z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: 480px; max-width: 94vw;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  z-index: 41; transform: translateX(100%); transition: transform .25s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
.drawer-head .x { margin-left: auto; background: transparent; border: none; color: var(--text-faint); font-size: 22px; line-height: 1; }
.drawer-body { overflow-y: auto; padding: 20px; flex: 1; }
.drawer-section { margin-bottom: 24px; }
.drawer-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint);
  margin-bottom: 10px; font-weight: 700; }

.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.meta-item .k { font-size: 11.5px; color: var(--text-faint); font-weight: 600; }
.meta-item .v { font-weight: 600; margin-top: 2px; }

.timeline-item { border-left: 2px solid var(--border); padding: 0 0 16px 14px; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item .when { font-size: 11.5px; color: var(--text-faint); }

.list-line { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--border); }
.list-line:last-child { border-bottom: none; }
.list-line .spacer { flex: 1; }

/* ---------- MODAL ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 50;
  display: grid; place-items: center; padding: 20px; }
.modal { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal-head { padding: 18px 20px 4px; }
.modal-head h2 { font-size: 17px; letter-spacing: -.02em; }
.modal-body { padding: 14px 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- misc ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.spin { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: sp .7s linear infinite; margin: 60px auto; }
@keyframes sp { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600;
  font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; transition: all .25s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); color: #fff; }

/* ---------- ALERTAS / severidade de atraso ---------- */
.sev-1 { --sev: #ca8a04; --sev-bg: #fdf6e3; }
.sev-2 { --sev: #ea580c; --sev-bg: #fff1e8; }
.sev-3 { --sev: #dc2626; --sev-bg: #fdeaea; }
@media (prefers-color-scheme: dark) {
  .sev-1 { --sev: #eab308; --sev-bg: #241f0a; }
  .sev-2 { --sev: #fb7130; --sev-bg: #26160c; }
  .sev-3 { --sev: #f0555a; --sev-bg: #271012; }
}
.alerta { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius-sm);
  margin-bottom: 8px; cursor: pointer; border-left: 3px solid var(--sev); background: var(--sev-bg); transition: filter .12s; }
.alerta:hover { filter: brightness(.97); }
.alerta .ai { min-width: 0; }
.alerta .titulo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dias { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; white-space: nowrap;
  color: var(--sev); background: var(--sev-bg); border: 1px solid var(--sev); }
.sev-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; font-size: 12px; color: var(--text-soft); }
.sev-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.sev-dot-1 { background: #ca8a04; } .sev-dot-2 { background: #ea580c; } .sev-dot-3 { background: #dc2626; }

/* sino de notificações */
.bell { position: relative; }
.bell .count { position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; font-size: 10.5px; font-weight: 700; color: #fff; display: inline-grid; place-items: center;
  border: 2px solid var(--surface); }
.sev-badge-1 { background: #ca8a04; } .sev-badge-2 { background: #ea580c; } .sev-badge-3 { background: #dc2626; }
.clip { color: var(--text-faint); display: inline-grid; place-items: center; flex: none; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-100%);
    transition: transform .25s; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
}
