/* ============================================================
   DevDesk — identidade visual própria
   "Sala de controle de engenharia": grafite profundo, acento
   dourado GoldenSat, mono para códigos e números. Denso.
   ============================================================ */

:root {
  --bg: #0D1117;
  --bg-raise: #11161E;
  --surface: #161D27;
  --surface-2: #1C2530;
  --surface-3: #232E3C;
  --line: #232C38;
  --line-strong: #313D4D;
  --text: #DEE5EE;
  --text-dim: #8B96A5;
  --text-faint: #5C6675;
  --gold: #E8B84B;
  --gold-bright: #F5CD6B;
  --gold-dim: rgba(232, 184, 75, 0.14);
  --red: #F0635C;
  --green: #4FC98B;
  --blue: #7A9BF0;
  --purple: #C58BE8;
  --font-ui: 'Archivo', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; }
::selection { background: var(--gold-dim); color: var(--gold-bright); }

/* scrollbars discretas */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

button { font-family: inherit; }
input, textarea, select { font-family: inherit; }

.mono { font-family: var(--font-mono); }

/* ============ Shell ============ */
.dd-shell { display: flex; min-height: 100vh; }
.dd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.dd-scroll { flex: 1; overflow-y: auto; min-height: 0; }

/* ---- Sidebar ---- */
.dd-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-raise);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}
.dd-logo {
  padding: 18px 18px 14px;
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.dd-logo .gold { color: var(--gold); }
.dd-logo .cursor {
  display: inline-block;
  width: 8px; height: 15px;
  background: var(--gold);
  margin-left: 4px;
  align-self: center;
  animation: dd-blink 1.2s steps(1) infinite;
}
@media (prefers-reduced-motion: reduce) { .dd-logo .cursor { animation: none; } }
@keyframes dd-blink { 50% { opacity: 0; } }
.dd-logo small {
  margin-left: auto;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}

/* sprint widget */
.dd-sprintbox {
  margin: 14px 14px 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.dd-sprintbox .sb-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dd-sprintbox .sb-name { font-weight: 700; font-size: 13px; white-space: nowrap; }
.dd-sprintbox .sb-dates { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.dd-sprintbox .sb-day { font-family: var(--font-mono); font-size: 10px; color: var(--gold); white-space: nowrap; }
.dd-sprintbox .sb-track { height: 4px; background: var(--surface-3); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.dd-sprintbox .sb-fill { height: 100%; background: var(--gold); border-radius: 2px; }

.dd-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.dd-nav-label {
  padding: 14px 18px 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.dd-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 1px 8px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.dd-nav-item:hover { background: var(--surface); color: var(--text); }
.dd-nav-item.active { background: var(--gold-dim); color: var(--gold-bright); }
.dd-nav-item.active svg { color: var(--gold); }
.dd-nav-item svg { flex-shrink: 0; color: var(--text-faint); }
.dd-nav-item:hover svg { color: var(--text-dim); }
.dd-nav-item .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 1px 7px;
}
.dd-nav-item.active .count { background: rgba(232,184,75,0.18); color: var(--gold); }

.dd-sidebar-foot { border-top: 1px solid var(--line); padding: 10px 14px 14px; }
.dd-rolelabel { font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }
.dd-roleswitch { display: flex; gap: 4px; margin-bottom: 10px; }
.dd-roleswitch button {
  flex: 1;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-dim);
  border-radius: var(--r-sm);
  cursor: pointer;
}
.dd-roleswitch button.on { background: var(--gold-dim); border-color: rgba(232,184,75,0.4); color: var(--gold-bright); }
.dd-userline { display: flex; align-items: center; gap: 9px; }
.dd-userline .u-nome { font-weight: 600; font-size: 12px; white-space: nowrap; }
.dd-userline .u-papel { font-size: 10px; color: var(--text-dim); }
.dd-userline .sair {
  margin-left: auto;
  background: none; border: 0; color: var(--text-faint);
  font-size: 11px; cursor: pointer; padding: 4px;
}
.dd-userline .sair:hover { color: var(--red); }

/* ---- Topbar ---- */
.dd-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  height: 52px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg-raise);
}
.dd-topbar h1 { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.dd-topbar .sub { font-size: 11px; color: var(--text-dim); }
.dd-topbar .spacer { flex: 1; }

/* sino */
.dd-bell { position: relative; }
.dd-bellbtn {
  position: relative;
  background: transparent; border: 1px solid var(--line);
  border-radius: var(--r-sm); color: var(--text-dim);
  width: 30px; height: 30px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.dd-bellbtn:hover { color: var(--text); border-color: var(--line-strong); }
.dd-bellcount {
  position: absolute; top: -5px; right: -5px;
  background: var(--red); color: #fff;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}
.dd-pop {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 380px; max-height: 400px; overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  z-index: 300;
}
.dd-pop-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 12px;
}
.dd-pop-head button { background: none; border: 0; color: var(--gold); font-size: 11px; cursor: pointer; }
.dd-notif { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.dd-notif:last-child { border-bottom: 0; }
.dd-notif:hover { background: var(--surface-3); }
.dd-notif .dot { width: 6px; height: 6px; border-radius: 3px; margin-top: 6px; flex-shrink: 0; background: transparent; }
.dd-notif.unread .dot { background: var(--gold); }
.dd-notif .n-texto { font-size: 12px; color: var(--text); }
.dd-notif.lida .n-texto { color: var(--text-dim); }
.dd-notif .n-quando { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); margin-left: auto; flex-shrink: 0; }

/* ============ Primitivas ============ */
.dd-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  color: #0D1117;
}
.av-sm { width: 20px; height: 20px; font-size: 8px; }
.av-md { width: 26px; height: 26px; font-size: 10px; }
.av-lg { width: 36px; height: 36px; font-size: 13px; }
.dd-avstack { display: inline-flex; }
.dd-avstack .dd-avatar { border: 2px solid var(--surface); }
.dd-avstack .dd-avatar + .dd-avatar { margin-left: -6px; }

.dd-code { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.02em; }

.dd-pts {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  min-width: 20px; height: 18px; padding: 0 4px;
  border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-dim);
  border: 1px solid var(--line-strong);
}
.dd-pts.lock { color: var(--gold); border-color: rgba(232,184,75,0.35); }

.dd-state {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 20px;
  background: var(--surface-3);
}
.dd-state .sdot { width: 6px; height: 6px; border-radius: 3px; }

.dd-epicchip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 600;
  padding: 1px 7px; border-radius: var(--r-sm);
  border: 1px solid var(--line);
  color: var(--text-dim);
  max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dd-epicchip .edot { width: 6px; height: 6px; border-radius: 2px; flex-shrink: 0; }

.dd-prio { font-family: var(--font-mono); font-size: 10px; font-weight: 700; }
.dd-prio.P1 { color: var(--red); }
.dd-prio.P2 { color: var(--gold); }
.dd-prio.P3 { color: var(--text-faint); }

/* botões */
.dd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px;
  font-size: 12px; font-weight: 600;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.dd-btn:hover { background: var(--surface-3); border-color: var(--text-faint); }
.dd-btn.primary { background: var(--gold); border-color: var(--gold); color: #1A1407; }
.dd-btn.primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.dd-btn.danger { color: var(--red); border-color: rgba(240,99,92,0.4); background: transparent; }
.dd-btn.danger:hover { background: rgba(240,99,92,0.1); }
.dd-btn.ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.dd-btn.ghost:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.dd-btn.sm { padding: 3px 9px; font-size: 11px; }
.dd-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* inputs */
.dd-input, .dd-textarea, .dd-select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 12.5px;
  padding: 7px 10px;
  outline: none;
}
.dd-input:focus, .dd-textarea:focus, .dd-select:focus { border-color: var(--gold); }
.dd-textarea { resize: vertical; min-height: 60px; line-height: 1.5; }
.dd-field-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); margin: 0 0 5px; display: block; }

/* segmented control */
.dd-seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 2px; gap: 2px; }
.dd-seg button, .dd-seg a {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; background: transparent;
  color: var(--text-dim);
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 3px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.dd-seg button.on, .dd-seg a.on { background: var(--surface-3); color: var(--text); }

/* progress */
.dd-track { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.dd-fill { height: 100%; border-radius: 2px; background: var(--green); }

/* toast (QA D1) — canto inferior-direito, teto de 3, entra/sai com transição */
.dd-toasts { position: fixed; bottom: 18px; right: 18px; z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.dd-toast {
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 9px 16px;
  font-size: 12px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex; align-items: center; gap: 8px;
  max-width: 360px; cursor: pointer; pointer-events: auto;
}
.dd-toast.erro { border-color: rgba(240,99,92,0.5); color: #F8B4B0; }
.dd-toast.ok { border-color: rgba(79,201,139,0.4); }
/* estados de transição (x-transition no template) */
.dd-toast-trans { transition: opacity 0.22s ease, transform 0.22s ease; }
.dd-toast-off { opacity: 0; transform: translateX(16px); }
.dd-toast-on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .dd-toast-trans { transition: none; } }

/* modal */
.dd-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(5, 8, 12, 0.65);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.dd-modal {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  width: 480px; max-width: 92vw; max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  padding: 20px;
}
.dd-modal h3 { margin: 0 0 4px; font-size: 15px; }
.dd-modal .m-sub { color: var(--text-dim); font-size: 12px; margin-bottom: 14px; }

/* drawer (detalhe da task) */
.dd-drawer-veil { position: fixed; inset: 0; z-index: 350; background: rgba(5,8,12,0.55); }
.dd-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 360;
  width: 760px; max-width: 94vw;
  background: var(--bg-raise);
  border-left: 1px solid var(--line-strong);
  box-shadow: -24px 0 80px rgba(0,0,0,0.55);
  display: flex; flex-direction: column;
  animation: dd-drawer-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes dd-drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dd-drawer { animation: none; } }

/* markdown render */
.dd-md { font-size: 13px; line-height: 1.6; color: var(--text); }
.dd-md h2 { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin: 16px 0 6px; }
.dd-md h2:first-child { margin-top: 0; }
.dd-md p { margin: 0 0 8px; }
.dd-md ul, .dd-md ol { margin: 0 0 8px; padding-left: 18px; }
.dd-md li { margin-bottom: 3px; }
.dd-md code { font-family: var(--font-mono); font-size: 11px; background: var(--surface-3); border-radius: 3px; padding: 1px 5px; color: var(--gold-bright); }
.dd-md strong { color: #fff; }

/* tabelas densas */
.dd-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dd-table th {
  text-align: left;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.dd-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dd-table tbody tr { cursor: pointer; }
.dd-table tbody tr:hover { background: var(--surface); }

/* cards / painéis */
.dd-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.dd-panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.dd-panel-head h2 { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); margin: 0; }
.dd-panel-body { padding: 16px; }

/* kpi */
.dd-kpi { padding: 14px 16px; }
.dd-kpi .k-label { font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.dd-kpi .k-valor { font-family: var(--font-mono); font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-top: 4px; }
.dd-kpi .k-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.dd-kpi .up { color: var(--green); }
.dd-kpi .down { color: var(--red); }

/* login */
.dd-login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}
.dd-login-left {
  position: relative;
  background:
    radial-gradient(1100px 500px at -10% 110%, rgba(232,184,75,0.13), transparent 60%),
    var(--bg-raise);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px 48px;
  overflow: hidden;
}
.dd-login-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(800px 600px at 30% 40%, rgba(0,0,0,0.55), transparent 75%);
  pointer-events: none;
}
.dd-login-right { display: flex; align-items: center; justify-content: center; padding: 40px; }
.dd-login-card { width: 360px; }

@media (max-width: 900px) {
  .dd-login { grid-template-columns: 1fr; }
  .dd-login-left { display: none; }
}
