/* ──────────────────────────────────────────────────────────────────
   Modê — Sistema (app autenticado)
   Editorial / Paper × Ink × Terracotta
   ────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT@0,9..144,300..700,0..100;1,9..144,300..700,0..100&family=Inter+Tight:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* Reset */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

:root {
  /* ── Design system (new) ── */
  --paper: #F4EFE7;
  --paper-2: #EAE3D5;
  --canvas: #FFFFFF;
  --ink: #141414;
  --ink-2: #5C544A;
  --ink-3: #8C8478;
  --rule: #1A1A1A;
  --rule-soft: #D6CDB9;
  --accent: #C2451E;
  --accent-2: #9D3719;
  --accent-soft: rgba(194, 69, 30, 0.08);

  --serif: 'Fraunces', 'Times New Roman', serif;
  --sans: 'Inter Tight', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'IBM Plex Mono', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  --sidebar-w: 264px;
  --header-h: 64px;

  /* ── Legacy aliases (preserve compatibility with inline-styled templates) ── */
  --orange-500: #C2451E;
  --orange-600: #9D3719;
  --orange-700: #7A2A12;

  --navy-900: #141414;
  --navy-800: #2A2A2A;
  --navy-700: #3D3D3D;

  --gray-50: #FAF8F4;
  --gray-100: #F4EFE7;
  --gray-200: #EAE3D5;
  --gray-300: #D6CDB9;
  --gray-400: #B5A993;
  --gray-500: #8C8478;
  --gray-600: #5C544A;
  --gray-700: #3D372F;
  --gray-800: #1F1B16;
  --gray-900: #141414;

  --green-100: #D5E8DE;
  --green-500: #047857;

  --red-500: #B91C1C;
  --red-600: #991B1B;

  --blue-500: #3D5B7B;
  --blue-600: #2A4259;
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--ink); color: var(--paper); }

/* ──────────────────────────────────────────────────────────────────
   LAYOUT — Sidebar + main content
   ────────────────────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR — editorial paper-deep with ink type */
.sidebar {
  width: var(--sidebar-w);
  background: var(--paper-2);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
  border-right: 1px solid var(--rule);
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  color: var(--ink);
  cursor: pointer;
}

.sidebar-logo {
  padding: 1.5rem 1.4rem 1.1rem;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid var(--rule-soft);
}
.sidebar-logo::before {
  content: "Modê";
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.8rem;
  font-weight: 380;
  font-variation-settings: "opsz" 144, "SOFT" 80;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.sidebar-logo::after {
  content: "®";
  font-size: 0.55rem;
  vertical-align: super;
  color: var(--ink-2);
  margin-left: 0.15em;
}
.sidebar-logo img { display: none; } /* legacy logo image — hidden, replaced by ::before */

.sidebar-logo-icon, .sidebar-logo-text { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.55rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--rule-soft); border-radius: 3px; }

.sidebar-nav ul { list-style: none; padding: 0; }

.sidebar-divider {
  padding: 1.1rem 0.85rem 0.4rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

/* Itens = pills arredondados, recuados das bordas (sem retângulos sangrando) */
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.85rem;
  margin: 0.13rem 0;
  border-radius: var(--r-md);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  position: relative;
}
.sidebar-nav a:hover {
  background: rgba(20, 20, 20, 0.05);
  color: var(--ink);
  transform: translateX(2px);
}
/* Ativo = botão de tinta flutuante, com marcador terracota e sombra suave */
.sidebar-nav a.active {
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(20, 20, 20, 0.18);
}
.sidebar-nav a.active:hover { transform: none; }
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 1.4rem;
  border-radius: var(--r-pill);
  background: var(--accent);
}
.sidebar-nav a svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  color: var(--ink-3);
  stroke-width: 1.7;
  transition: color 0.18s ease;
}
.sidebar-nav a.active svg { color: var(--accent); }
.sidebar-nav a:hover svg { color: var(--ink); }

.sidebar-separator {
  list-style: none;
  height: 1px;
  margin: 0.45rem 0.85rem;
  background: var(--rule-soft);
}

/* User pinned at bottom */
.sidebar-user {
  flex-shrink: 0;
  border-top: 1px solid var(--rule-soft);
  padding: 0.75rem;
}
.sidebar-user-btn {
  width: 100%;
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background 0.15s;
  text-align: left;
}
.sidebar-user-btn:hover { background: rgba(20, 20, 20, 0.05); }
.sidebar-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-email {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-role {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-2);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(20, 20, 20, 0.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* MAIN CONTENT */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100vh;
  background: var(--paper);
}

.main-header {
  height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 0 2rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.main-header h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 380;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  width: 36px; height: 36px;
  cursor: pointer;
  color: var(--ink);
  margin-right: 0.5rem;
}
.mobile-menu-btn svg { width: 24px; height: 24px; }

.user-menu { display: flex; align-items: center; gap: 0.85rem; }
.user-info { text-align: right; }
.user-email {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.user-role {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.content {
  flex: 1;
  padding: 2rem;
  overflow-y: visible;
}

.footer {
  padding: 1rem 2rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-top: 1px solid var(--rule-soft);
}

/* Sidebar mobile */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: block; }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
}

/* ──────────────────────────────────────────────────────────────────
   TYPOGRAPHY
   ────────────────────────────────────────────────────────────────── */

.content-title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 400;
  font-variation-settings: "opsz" 144, "SOFT" 30;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.5rem;
}
.content-title em { font-style: italic; color: var(--accent); font-variation-settings: "opsz" 144, "SOFT" 100; }

.content-subtitle {
  font-size: 0.95rem;
  color: var(--ink-2);
  line-height: 1.55;
  margin-bottom: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.015em;
}

/* ──────────────────────────────────────────────────────────────────
   CARDS / SURFACES
   ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--canvas);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-md);
  padding: 1.5rem;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--ink-2); }

/* ──────────────────────────────────────────────────────────────────
   BUTTONS
   ────────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.25rem;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: var(--accent); }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn-secondary:hover { background: var(--ink); color: var(--paper); }

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
}

.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* Botão "perigo" */
.btn-danger {
  background: var(--red-500);
  color: var(--paper);
}
.btn-danger:hover { background: var(--red-600); }

/* ──────────────────────────────────────────────────────────────────
   FORMS
   ────────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 1.25rem; }

.form-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.form-input,
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="datetime-local"],
input[type="search"], input[type="url"], input[type="tel"],
textarea, select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20, 20, 20, 0.06);
}
textarea { resize: vertical; min-height: 100px; font-family: inherit; }
select { cursor: pointer; }

input::placeholder, textarea::placeholder { color: var(--ink-3); }

/* ──────────────────────────────────────────────────────────────────
   ALERTS / MESSAGES
   ────────────────────────────────────────────────────────────────── */

.alert {
  padding: 0.85rem 1rem;
  border-left: 3px solid var(--ink-2);
  background: var(--paper-2);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  color: var(--ink);
}
.alert.alert-success { border-left-color: var(--green-500); background: rgba(4, 120, 87, 0.06); }
.alert.alert-error, .alert.alert-danger { border-left-color: var(--red-500); background: rgba(185, 28, 28, 0.06); }
.alert.alert-warning { border-left-color: var(--accent); background: var(--accent-soft); }
.alert.alert-info { border-left-color: var(--blue-500); background: rgba(61, 91, 123, 0.06); }

/* ──────────────────────────────────────────────────────────────────
   TABLES
   ────────────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
thead { background: var(--paper-2); }
thead th {
  text-align: left;
  padding: 0.7rem 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
  border-bottom: 1px solid var(--rule);
}
tbody tr { border-bottom: 1px solid var(--rule-soft); }
tbody tr:hover { background: rgba(20, 20, 20, 0.02); }
tbody td { padding: 0.85rem 1rem; vertical-align: middle; color: var(--ink); }

/* ──────────────────────────────────────────────────────────────────
   BADGES / CHIPS
   ────────────────────────────────────────────────────────────────── */

.badge, .chip, .tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 600;
  background: var(--paper-2);
  color: var(--ink);
  border-radius: var(--r-pill);
  border: 1px solid var(--rule-soft);
}
.badge-success { background: rgba(4, 120, 87, 0.12); color: #047857; border-color: rgba(4, 120, 87, 0.2); }
.badge-warning { background: var(--accent-soft); color: var(--accent); border-color: rgba(194, 69, 30, 0.2); }
.badge-error   { background: rgba(185, 28, 28, 0.08); color: var(--red-500); border-color: rgba(185, 28, 28, 0.2); }
.badge-info    { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ──────────────────────────────────────────────────────────────────
   UTILITIES
   ────────────────────────────────────────────────────────────────── */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--ink-2); }

.flex { display: flex; }
.grid { display: grid; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 1rem; }
.gap-lg { gap: 1.5rem; }

.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mb-xl { margin-bottom: 2rem; }

.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }
.mt-lg { margin-top: 1.5rem; }
.mt-xl { margin-top: 2rem; }

.divider {
  height: 1px;
  background: var(--rule-soft);
  margin: 1.5rem 0;
}

/* Editorial divider */
.divider-editorial {
  display: flex; align-items: center; gap: 1rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 2rem 0;
}
.divider-editorial::before, .divider-editorial::after {
  content: ""; flex: 1; height: 1px; background: var(--rule-soft);
}

/* ──────────────────────────────────────────────────────────────────
   LEGACY login-* classes (still used by some templates)
   ────────────────────────────────────────────────────────────────── */

.login-container {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  padding: 2rem;
}
.login-card {
  background: var(--canvas);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-lg);
  padding: 3rem;
  max-width: 460px;
  width: 100%;
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-title {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--ink);
}
.login-subtitle {
  text-align: center;
  color: var(--ink-2);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}
.login-copyright {
  margin-top: 2rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ──────────────────────────────────────────────────────────────────
   PRINT-STYLE NUMBERS (editorial accent)
   ────────────────────────────────────────────────────────────────── */

.meta-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.ed-num {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
  font-variation-settings: "opsz" 144, "SOFT" 100;
  line-height: 0.9;
}

/* ──────────────────────────────────────────────────────────────────
   SCROLLBAR (subtle)
   ────────────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-soft); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* ──────────────────────────────────────────────────────────────────
   STATS / DASHBOARD METRICS
   ────────────────────────────────────────────────────────────────── */

.stat-card {
  background: var(--canvas);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-md);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.stat-card .meta-num { margin-bottom: 0.4rem; }
.stat-card .stat-value {
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 380;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  font-variation-settings: "opsz" 144, "SOFT" 30;
}
.stat-card .stat-value em { font-style: italic; color: var(--accent); font-variation-settings: "opsz" 144, "SOFT" 100; }
.stat-card .stat-label {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-2);
}

/* ──────────────────────────────────────────────────────────────────
   EMPTY STATES
   ────────────────────────────────────────────────────────────────── */

.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--ink-2);
}
.empty-state-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 0.5rem;
}
.empty-state-desc {
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
  max-width: 36ch;
  margin-left: auto; margin-right: auto;
}
