@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --ds-indigo-50:  #fcfdfe;
  --ds-indigo-100: #eef1f7;
  --ds-indigo-200: #d8dee9;
  --ds-indigo-400: #9397bf;
  --ds-indigo-500: #5f649a;
  --ds-indigo-600: #3f4383;
  --ds-indigo-700: #232766;
  --ds-indigo-800: #000050;
  --ds-indigo-900: #00053c;
  --ds-rose-500:   #e6393a;
  --ds-rose-700:   #b3142d;

  --ds-success:        #166534;
  --ds-success-bg:     #f0fdf4;
  --ds-success-border: #bbf7d0;
  --ds-error:          #b91c1c;
  --ds-error-bg:       #fef2f2;
  --ds-error-border:   #fecaca;

  --ds-text-primary:   #000050;
  --ds-text-secondary: #232766;
  --ds-text-tertiary:  #5f649a;
  --ds-text-muted:     #9397bf;
  --ds-text-body:      #374151;
  --ds-text-label:     #6b7280;
  --ds-text-white:     #ffffff;

  --ds-surface-white:     #ffffff;
  --ds-surface-base:      #f7fafc;
  --ds-surface-secondary: #eef1f7;

  --ds-border-default:   #edf2f7;
  --ds-border-component: #d8dee9;

  --ds-sidebar-width:  240px;
  --ds-header-height:  44px;
  --ds-toc-width:      220px;

  --ds-nav-active-bg:    rgba(230, 57, 58, 0.09);
  --ds-nav-active-color: #e6393a;
  --ds-nav-hover-bg:     #f4f6fb;
  --ds-nav-text:         #000050;
  --ds-nav-section-text: #9397bf;
  --ds-nav-sub-indent:   28px;

  --ds-font-family: 'Inter', system-ui, sans-serif;

  --ds-radius-xs:   4px;
  --ds-radius-sm:   6px;
  --ds-radius-md:   8px;
  --ds-radius-lg:   12px;
  --ds-radius-xl:   16px;
  --ds-radius-full: 9999px;

  --ds-shadow-card-hover: 0 4px 12px -2px rgba(0,0,80,0.10);
  --ds-shadow-menu:       0 8px 24px -4px rgba(0,0,80,0.12), 0 2px 8px -2px rgba(0,0,0,0.06);

  --ds-sp-1:  4px;
  --ds-sp-2:  8px;
  --ds-sp-3:  12px;
  --ds-sp-4:  16px;
  --ds-sp-5:  20px;
  --ds-sp-6:  24px;
  --ds-sp-8:  32px;
  --ds-sp-10: 40px;
  --ds-sp-12: 48px;

  --ds-header-gradient: linear-gradient(90deg, #000050 0%, #1E1A8C 40%, #0A0660 100%);
}

/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--ds-font-family);
  background: var(--ds-surface-base);
  color: var(--ds-text-body);
  overflow: hidden;
  height: 100vh;
}

/* ── Scrollbar ──────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ds-border-component); border-radius: var(--ds-radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--ds-indigo-400); }

/* ═══════════ SHELL ═══════════ */
.ds-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--ds-surface-base);
}

/* ═══════════ SIDEBAR ═══════════ */
.ds-sidebar {
  width: var(--ds-sidebar-width);
  min-width: var(--ds-sidebar-width);
  background: var(--ds-surface-white);
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--ds-border-default);
  overflow: hidden;
  flex-shrink: 0;
}

.ds-sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--ds-sp-3);
  padding: var(--ds-sp-2) var(--ds-sp-3);
  height: var(--ds-header-height);
  border-bottom: 1px solid var(--ds-border-default);
  flex-shrink: 0;
  text-decoration: none;
}

.ds-sidebar-logo-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--ds-radius-md);
  background: var(--ds-rose-500);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ds-text-white);
  font-size: 14px;
  font-weight: 800;
  flex-shrink: 0;
}

.ds-sidebar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.ds-sidebar-logo-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ds-text-primary);
  letter-spacing: -0.01em;
}

.ds-sidebar-logo-subtitle {
  font-size: 9px;
  font-weight: 600;
  color: var(--ds-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ds-sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px var(--ds-sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--ds-sp-3);
}

.ds-sidebar-footer {
  padding: var(--ds-sp-3);
  border-top: 1px solid var(--ds-border-default);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  font-size: 12px;
  color: var(--ds-text-muted);
}

.ds-sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  flex: 1;
  min-width: 0;
}

.ds-sidebar-footer-avatar {
  width: 26px;
  height: 26px;
  border-radius: var(--ds-radius-full);
  background: var(--ds-indigo-100);
  color: var(--ds-text-primary);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ds-sidebar-footer-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--ds-text-label);
}

.ds-sidebar-footer-logout {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ds-text-muted);
  padding: var(--ds-sp-1);
  border-radius: var(--ds-radius-sm);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ds-sidebar-footer-logout:hover {
  background: var(--ds-nav-hover-bg);
  color: var(--ds-rose-700);
}

/* ═══════════ NAV SECTIONS ═══════════ */
.ds-nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ds-nav-section-label {
  padding: 0 var(--ds-sp-2) var(--ds-sp-2);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ds-nav-section-text);
}

.ds-nav-item {
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  padding: var(--ds-sp-2);
  height: 36px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ds-nav-text);
  border-radius: var(--ds-radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.ds-nav-item:hover {
  background: var(--ds-nav-hover-bg);
  color: var(--ds-nav-text);
  text-decoration: none;
}

.ds-nav-item.active {
  border-left: 3px solid var(--ds-nav-active-color);
  background: var(--ds-nav-active-bg);
  color: var(--ds-nav-active-color);
  font-weight: 600;
  padding-left: calc(var(--ds-sp-2) - 3px);
}

.ds-nav-item.active svg { color: var(--ds-nav-active-color); }
.ds-nav-item svg { flex-shrink: 0; width: 18px; height: 18px; color: var(--ds-indigo-600); }

/* toggle com submenu */
.ds-nav-toggle {
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  padding: var(--ds-sp-2);
  height: 36px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ds-nav-text);
  border-radius: var(--ds-radius-md);
  cursor: pointer;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: background-color 0.15s ease;
}

.ds-nav-toggle:hover { background: var(--ds-nav-hover-bg); }
.ds-nav-toggle svg:first-child { flex-shrink: 0; width: 18px; height: 18px; color: var(--ds-indigo-600); }

.ds-nav-chevron {
  margin-left: auto;
  width: 14px;
  height: 14px;
  color: var(--ds-text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.ds-nav-toggle--open .ds-nav-chevron { transform: rotate(180deg); }

.ds-nav-sub {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.ds-nav-sub--open { max-height: 600px; }

.ds-nav-sub-item {
  display: flex;
  align-items: center;
  gap: var(--ds-sp-2);
  padding: 7px var(--ds-sp-2) 7px var(--ds-nav-sub-indent);
  height: 32px;
  font-size: 13px;
  color: var(--ds-text-body);
  border-radius: var(--ds-radius-md);
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.ds-nav-sub-item:hover { background: var(--ds-nav-hover-bg); color: var(--ds-text-primary); text-decoration: none; }
.ds-nav-sub-item.active { color: var(--ds-nav-active-color); font-weight: 600; }

/* ═══════════ MAIN + HEADER ═══════════ */
.ds-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.ds-header {
  height: var(--ds-header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--ds-sp-6);
  gap: 10px;
  background: var(--ds-header-gradient);
  flex-shrink: 0;
}

.ds-header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ds-text-white);
  flex: 1;
}

.ds-header-badge {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.15);
  color: var(--ds-text-white);
  padding: 2px 8px;
  border-radius: var(--ds-radius-full);
  border: 1px solid rgba(255,255,255,0.2);
}

/* ═══════════ CONTENT AREA ═══════════ */
.ds-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.ds-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--ds-sp-8) var(--ds-sp-10);
  background: var(--ds-surface-base);
  min-width: 0;
}

/* ── TOC lateral (seção dev) ──────────────────── */
.ds-toc {
  width: var(--ds-toc-width);
  min-width: var(--ds-toc-width);
  flex-shrink: 0;
  overflow-y: auto;
  padding: var(--ds-sp-8) var(--ds-sp-4) var(--ds-sp-8) 0;
  border-left: 1px solid var(--ds-border-default);
  background: var(--ds-surface-white);
}

.ds-toc-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ds-text-muted);
  margin-bottom: var(--ds-sp-3);
  padding-left: var(--ds-sp-4);
}

.ds-toc nav { padding-left: var(--ds-sp-4); }
.ds-toc nav ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.ds-toc nav ul ul { padding-left: var(--ds-sp-4); }

.ds-toc nav a {
  display: block;
  font-size: 12.5px;
  color: var(--ds-text-label);
  text-decoration: none;
  padding: 3px 0;
  line-height: 1.4;
  transition: color 0.15s;
}

.ds-toc nav a:hover { color: var(--ds-text-primary); }

/* ═══════════ TYPOGRAPHY ═══════════ */
.doc-content h1 { font-size: 1.75rem; font-weight: 700; color: var(--ds-text-primary); margin-bottom: var(--ds-sp-4); line-height: 1.25; }
.doc-content h2 { font-size: 1.2rem; font-weight: 600; color: var(--ds-text-secondary); margin: var(--ds-sp-8) 0 var(--ds-sp-3); border-bottom: 1px solid var(--ds-border-default); padding-bottom: var(--ds-sp-2); }
.doc-content h3 { font-size: 1rem; font-weight: 600; color: var(--ds-text-secondary); margin: var(--ds-sp-6) 0 var(--ds-sp-2); }
.doc-content p { line-height: 1.7; color: var(--ds-text-body); margin-bottom: var(--ds-sp-4); }
.doc-content a { color: var(--ds-indigo-600); text-decoration: none; }
.doc-content a:hover { text-decoration: underline; }
.doc-content strong { font-weight: 600; color: var(--ds-text-secondary); }

.doc-content ul, .doc-content ol { padding-left: var(--ds-sp-6); margin-bottom: var(--ds-sp-4); }
.doc-content li { line-height: 1.7; margin-bottom: var(--ds-sp-1); }

.doc-content table { width: 100%; border-collapse: collapse; margin-bottom: var(--ds-sp-6); font-size: 13.5px; }
.doc-content th { background: var(--ds-surface-secondary); color: var(--ds-text-primary); font-weight: 600; text-align: left; padding: var(--ds-sp-2) var(--ds-sp-3); border: 1px solid var(--ds-border-component); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.doc-content td { padding: var(--ds-sp-2) var(--ds-sp-3); border: 1px solid var(--ds-border-default); color: var(--ds-text-body); }
.doc-content tr:hover td { background: var(--ds-surface-base); }

.doc-content code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85em;
  background: var(--ds-surface-secondary);
  color: var(--ds-indigo-700);
  padding: 2px 5px;
  border-radius: var(--ds-radius-xs);
  border: 1px solid var(--ds-border-component);
}

.doc-content pre {
  background: var(--ds-indigo-900);
  border-radius: var(--ds-radius-md);
  padding: var(--ds-sp-4);
  overflow-x: auto;
  margin-bottom: var(--ds-sp-6);
}

.doc-content pre code {
  background: none;
  border: none;
  color: #e2e8f0;
  font-size: 0.875rem;
  padding: 0;
}

.doc-content blockquote {
  border-left: 3px solid var(--ds-indigo-400);
  padding: var(--ds-sp-3) var(--ds-sp-4);
  background: var(--ds-indigo-50);
  border-radius: 0 var(--ds-radius-md) var(--ds-radius-md) 0;
  margin-bottom: var(--ds-sp-4);
  color: var(--ds-text-secondary);
}

.doc-content hr { border: none; border-top: 1px solid var(--ds-border-default); margin: var(--ds-sp-8) 0; }

/* ═══════════ CARD GRID (home / list) ═══════════ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--ds-sp-4);
  margin-top: var(--ds-sp-6);
}

.card {
  background: var(--ds-surface-white);
  border: 1px solid var(--ds-border-default);
  border-radius: var(--ds-radius-lg);
  padding: var(--ds-sp-5);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
  display: block;
}

.card:hover {
  box-shadow: var(--ds-shadow-card-hover);
  border-color: var(--ds-indigo-200);
  text-decoration: none;
}

.card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ds-text-primary);
  margin-bottom: var(--ds-sp-2);
}

.card p { font-size: 0.85rem; color: var(--ds-text-label); margin: 0; line-height: 1.5; }

/* ═══════════ MOBILE ═══════════ */
.ds-mobile-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ds-text-white);
  padding: var(--ds-sp-1);
}

.ds-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
}

@media (max-width: 768px) {
  body { overflow: auto; }
  .ds-shell { flex-direction: column; height: auto; min-height: 100vh; overflow: visible; }

  .ds-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .ds-sidebar--open { transform: translateX(0); }
  .ds-mobile-overlay--visible { display: block; }

  .ds-main { height: 100vh; overflow: auto; }
  .ds-mobile-hamburger { display: flex; }
  .ds-body { flex-direction: column; }
  .ds-toc { display: none; }
  .ds-content { padding: var(--ds-sp-6) var(--ds-sp-4); }
}
