@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --ink-950: #070c18;
  --ink-900: #0b1220;
  --ink-800: #101a2e;
  --ink-700: #18233c;
  --ink-600: #243050;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e7e9ee;
  --border-2: #d9dde6;

  --text: #0d1526;
  --text-muted: #5c6675;
  --text-faint: #8a93a3;
  --on-ink: #cdd6e6;
  --on-ink-dim: #7f8aa3;

  --accent: #2f6bff;
  --accent-600: #1f55e0;
  --accent-700: #1a46bd;
  --accent-soft: #eaf0ff;
  --accent-ring: rgba(47, 107, 255, 0.28);

  --teal: #0fb5a6;
  --teal-soft: #e0f6f3;
  --amber: #c2740c;
  --amber-soft: #fdf1df;
  --rose: #dc2f52;
  --rose-soft: #fde8ed;
  --emerald: #0f9d6e;
  --emerald-soft: #e2f5ee;

  --r-xs: 6px;
  --r-sm: 8px;
  --r: 11px;
  --r-lg: 14px;
  --r-xl: 20px;
  --pill: 999px;

  --sh-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --sh-2: 0 6px 20px rgba(16, 24, 40, 0.07);
  --sh-3: 0 22px 60px rgba(11, 18, 32, 0.28);

  --sidebar-w: 264px;
  --topbar-h: 64px;
  --t: 180ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.018em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.num { font-family: var(--font-mono); font-feature-settings: 'tnum'; letter-spacing: -0.02em; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--ink-900), var(--ink-950));
  color: var(--on-ink); overflow: hidden auto;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 16px; margin-bottom: 6px;
}
.brand-mark {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), #6f5cff);
  color: #fff; box-shadow: 0 6px 18px rgba(47, 107, 255, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: -0.02em; }
.brand-tag { font-size: 11px; color: var(--on-ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { padding: 6px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  padding: 16px 12px 7px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--on-ink-dim);
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm);
  color: var(--on-ink); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background var(--t), color var(--t);
}
.nav-item .ico { flex: none; width: 18px; height: 18px; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(47, 107, 255, 0.34); }
.nav-item.active .ico { opacity: 1; }
.nav-item .lock { margin-left: auto; opacity: 0.6; width: 15px; height: 15px; }
.nav-item[aria-disabled='true'] { color: var(--on-ink-dim); cursor: not-allowed; }
.nav-item[aria-disabled='true']:hover { background: transparent; }

.sidebar-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.userchip {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--r); background: rgba(255, 255, 255, 0.05);
}
.userchip .avatar { width: 34px; height: 34px; border-radius: 9px; }
.userchip .meta { min-width: 0; }
.userchip .u-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userchip .u-role { font-size: 11px; color: var(--on-ink-dim); }

.avatar {
  display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, #3a4a6b, #22304d);
  color: #fff; font-size: 12px; font-weight: 700; border-radius: 9px;
}

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); display: flex; align-items: center; gap: 14px;
  padding: 0 22px; background: rgba(244, 246, 249, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-crumb { font-size: 12px; color: var(--text-faint); }
.topbar-spacer { flex: 1; }

.search {
  position: relative; width: min(340px, 40vw);
}
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 35px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); font-size: 13.5px; color: var(--text);
  transition: border var(--t), box-shadow var(--t);
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.iconbtn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface);
  color: var(--text-muted); cursor: pointer; transition: var(--t);
}
.iconbtn:hover { color: var(--text); border-color: var(--border-2); background: var(--surface-2); }
.iconbtn svg { width: 18px; height: 18px; }
.menu-toggle { display: none; }

.content { padding: 26px 22px 60px; }
.container { max-width: 1180px; margin: 0 auto; }

/* ---------- Headings ---------- */
.page-head { margin-bottom: 22px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.h1 { font-size: 25px; font-weight: 800; margin-top: 4px; }
.sub { margin-top: 5px; font-size: 14px; color: var(--text-muted); max-width: 62ch; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl);
  padding: 26px 26px 24px; margin-bottom: 22px;
  background: linear-gradient(120deg, var(--ink-900), #16264a 55%, #1d3a6b);
  color: #fff; box-shadow: var(--sh-2);
}
.hero::after {
  content: ''; position: absolute; right: -80px; top: -90px; width: 340px; height: 340px;
  background: radial-gradient(closest-side, rgba(47, 107, 255, 0.55), transparent 70%);
}
.hero::before {
  content: ''; position: absolute; right: 40px; bottom: -120px; width: 300px; height: 300px;
  background: radial-gradient(closest-side, rgba(15, 181, 166, 0.35), transparent 70%);
}
.hero-inner { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 20px; justify-content: space-between; }
.hero h2 { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; }
.hero p { margin-top: 6px; color: rgba(255, 255, 255, 0.72); font-size: 14px; }
.hero .chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 16px 15px; box-shadow: var(--sh-1);
}
.stat-label { font-size: 12px; color: var(--text-faint); font-weight: 600; }
.stat-value { margin-top: 7px; font-size: 22px; font-weight: 800; letter-spacing: -0.03em; }
.stat-sub { margin-top: 3px; font-size: 12px; color: var(--text-muted); }

/* ---------- Cards ---------- */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 0 14px; }
.section-title h3 { font-size: 15px; font-weight: 700; }
.section-title span { font-size: 12.5px; color: var(--text-faint); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--sh-1);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
a.card { cursor: pointer; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: var(--border-2); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-600); flex: none;
}
.card-icon svg { width: 21px; height: 21px; }
.card-title { margin-top: 16px; font-size: 15.5px; font-weight: 700; }
.card-desc { margin-top: 5px; font-size: 13.5px; color: var(--text-muted); flex: 1; }
.card-foot {
  margin-top: 16px; display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--accent);
}
.card-foot svg { width: 15px; height: 15px; transition: transform var(--t); }
a.card:hover .card-foot svg { transform: translateX(3px); }
.card.locked { opacity: 0.62; }
.card.locked .card-icon { background: var(--surface-2); color: var(--text-faint); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--sh-1); overflow: hidden;
}
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 14px; }
.panel-body { padding: 20px; }

/* ---------- Badges/chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.primary { background: var(--accent-soft); color: var(--accent-700); }
.badge.teal { background: var(--teal-soft); color: #0a7a70; }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.rose { background: var(--rose-soft); color: var(--rose); }
.badge.emerald { background: var(--emerald-soft); color: var(--emerald); }
.badge.neutral { background: #eef0f4; color: var(--text-muted); }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px;
  border-radius: var(--pill); font-size: 12.5px; font-weight: 600;
  background: rgba(255, 255, 255, 0.1); color: #eaf1ff; border: 1px solid rgba(255, 255, 255, 0.14);
}
.chip svg { width: 14px; height: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: var(--r);
  font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  transition: var(--t);
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px rgba(47, 107, 255, 0.26); }
.btn-primary:hover { background: var(--accent-600); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn-block { width: 100%; }
.link { color: var(--accent); font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.req { color: var(--rose); }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 13px;
  border: 1px solid var(--border-2); border-radius: var(--r); background: var(--surface);
  font-size: 14px; color: var(--text); transition: border var(--t), box-shadow var(--t);
}
textarea.input { height: auto; padding: 11px 13px; resize: vertical; }
.input::placeholder { color: var(--text-faint); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input:disabled { background: var(--surface-2); color: var(--text-faint); cursor: not-allowed; }
.helper { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert.error { background: var(--rose-soft); color: #9f1239; border-color: #f6cdd8; }
.alert.warn { background: var(--amber-soft); color: var(--amber); border-color: #f3ddb4; }
.alert.ok { background: var(--emerald-soft); color: var(--emerald); border-color: #bfe8d8; }

.check {
  display: flex; align-items: flex-start; gap: 11px; padding: 13px 14px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); cursor: pointer;
}
.check input { margin-top: 2px; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.check span { font-size: 13.5px; color: var(--text-muted); }
.check strong { color: var(--text); }

/* ---------- Auth (login/cadastro) ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside {
  position: relative; overflow: hidden; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(155deg, var(--ink-900), #0e1b34 60%, #17335f);
  color: #fff;
}
.auth-aside::after {
  content: ''; position: absolute; left: -120px; bottom: -140px; width: 420px; height: 420px;
  background: radial-gradient(closest-side, rgba(47, 107, 255, 0.5), transparent 70%);
}
.auth-aside::before {
  content: ''; position: absolute; right: -100px; top: -80px; width: 320px; height: 320px;
  background: radial-gradient(closest-side, rgba(15, 181, 166, 0.35), transparent 70%);
}
.auth-aside .inner { position: relative; z-index: 1; }
.auth-lede { font-size: 27px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.24; max-width: 22ch; }
.auth-lede em { font-style: normal; color: #7fa6ff; }
.auth-features { margin-top: 30px; display: grid; gap: 13px; }
.auth-feature { display: flex; align-items: center; gap: 11px; font-size: 14px; color: rgba(255, 255, 255, 0.82); }
.auth-feature .fi {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(255, 255, 255, 0.12); flex: none;
}
.auth-feature .fi svg { width: 16px; height: 16px; }
.auth-foot { position: relative; z-index: 1; font-size: 12.5px; color: var(--on-ink-dim); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 23px; font-weight: 800; }
.auth-card .lead { margin-top: 6px; font-size: 14px; color: var(--text-muted); }
.auth-form { margin-top: 26px; }
.auth-mobile-mark { display: none; }

/* ---------- Empty / skeleton ---------- */
.empty {
  display: grid; place-items: center; text-align: center; gap: 6px;
  border: 1px dashed var(--border-2); border-radius: var(--r-lg);
  background: var(--surface); padding: 56px 28px;
}
.empty .ei {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent-600); margin-bottom: 6px;
}
.empty .ei svg { width: 26px; height: 26px; }
.empty h3 { font-size: 16px; font-weight: 700; }
.empty p { font-size: 13.5px; color: var(--text-muted); max-width: 46ch; }

.skeleton {
  background: linear-gradient(90deg, #eceef2 25%, #f5f6f9 37%, #eceef2 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--r);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.loading-screen { display: grid; gap: 14px; padding: 8px 0; }
.sk-card { height: 150px; }

.scrim { position: fixed; inset: 0; background: rgba(11, 18, 32, 0.5); z-index: 40; opacity: 0; pointer-events: none; transition: opacity var(--t); }
.scrim.open { opacity: 1; pointer-events: auto; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; width: var(--sidebar-w);
    transform: translateX(-100%); transition: transform var(--t); box-shadow: var(--sh-3);
  }
  .sidebar.open { transform: none; }
  .menu-toggle { display: grid; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-mobile-mark { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
  .auth-mobile-mark .brand-name { color: var(--text); }
  .auth-mobile-mark .brand-tag { color: var(--text-faint); }
}
@media (max-width: 620px) {
  .content { padding: 18px 14px 48px; }
  .topbar { padding: 0 14px; gap: 8px; }
  .search { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 22px 18px; }
  .h1 { font-size: 22px; }
}
