/* ============================================================
   VIZZU ARQUITETURA — ERP SYSTEM
   Dark Textured Theme — Black & White Only
   ============================================================ */

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

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

:root {
  --black:       #080808;
  --black-2:     #0F0F0F;
  --black-3:     #161616;
  --black-4:     #1E1E1E;
  --black-5:     #282828;
  --white:       #FFFFFF;
  --white-90:    rgba(255,255,255,0.90);
  --white-70:    rgba(255,255,255,0.70);
  --white-50:    rgba(255,255,255,0.50);
  --white-30:    rgba(255,255,255,0.30);
  --white-15:    rgba(255,255,255,0.15);
  --white-08:    rgba(255,255,255,0.08);
  --white-04:    rgba(255,255,255,0.04);
  --border:      rgba(255,255,255,0.10);
  --border-bold: rgba(255,255,255,0.20);
  --glass-bg:    rgba(255,255,255,0.05);
  --glass-hover: rgba(255,255,255,0.09);
  --sidebar-w:   260px;
  --topbar-h:    64px;
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   28px;
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.6);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.7);
  --shadow-lg:   0 20px 60px rgba(0,0,0,0.8);
  --font-main:   'Inter', sans-serif;
  --font-display:'Space Grotesk', sans-serif;
  --transition:  all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-main);
  background-color: var(--black);
  color: var(--white-90);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── TEXTURE: grain noise overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 180px 180px;
}

/* ── TEXTURE: dot grid ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  background-image: radial-gradient(circle, rgba(255,255,255,0.6) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ── TYPOGRAPHY ── */
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }
p  { line-height: 1.7; color: var(--white-70); }
a  { color: inherit; text-decoration: none; }
small { font-size: 0.82rem; color: var(--white-50); }

/* ============================================================
   LAYOUT — SIDEBAR + CONTENT
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--black-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: var(--transition);
  overflow: hidden;
}

/* sidebar subtle diagonal lines texture */
.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background: repeating-linear-gradient(
    -45deg,
    rgba(255,255,255,0.5) 0px,
    rgba(255,255,255,0.5) 1px,
    transparent 1px,
    transparent 14px
  );
}

.sidebar-brand {
  padding: 28px 24px 22px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.sidebar-brand img {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
}

.sidebar-brand-sub {
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--white-30);
  margin-top: 6px;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--white-15) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--white-15); border-radius: 2px; }

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--white-30);
  padding: 16px 24px 8px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  margin: 1px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  color: var(--white-50);
  font-weight: 500;
  font-size: 0.9rem;
  position: relative;
}

.nav-item:hover {
  background: var(--white-08);
  color: var(--white-90);
}

.nav-item.active {
  background: var(--white-15);
  color: var(--white);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--white);
  border-radius: 0 3px 3px 0;
}

.nav-item svg, .nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-badge {
  margin-left: auto;
  background: var(--white-15);
  color: var(--white-70);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-user {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--white-15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--white);
  flex-shrink: 0;
  border: 1px solid var(--border-bold);
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--white-90); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.70rem; color: var(--white-40); text-transform: uppercase; letter-spacing: 0.10em; }

.sidebar-logout {
  color: var(--white-30);
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  flex-shrink: 0;
}
.sidebar-logout:hover { color: var(--white-80); background: var(--white-08); }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: rgba(8,8,8,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--white-90);
}

.topbar-breadcrumb {
  font-size: 0.80rem;
  color: var(--white-40);
  margin-top: 1px;
}

.topbar-spacer { flex: 1; }

.topbar-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--white);
  color: var(--black);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}
.topbar-action:hover { background: var(--white-90); transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.topbar-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--white-08);
  color: var(--white-70);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.topbar-btn:hover { background: var(--white-15); color: var(--white); border-color: var(--border-bold); }

/* ── PAGE CONTENT ── */
.page-content {
  padding: 32px;
  flex: 1;
}

/* ── FLASH MESSAGES ── */
.flash-container {
  padding: 0 32px;
  margin-top: 16px;
}

.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  animation: slideDown 0.3s ease;
}

.flash-success { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); }
.flash-error   { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.12); }
.flash-info    { background: var(--glass-bg); }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   GLASS CARDS
   ============================================================ */

.card {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--white-15), transparent);
}

.card:hover {
  border-color: var(--border-bold);
  background: var(--glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-body { padding: 24px; }
.card-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 1rem; font-weight: 700; font-family: var(--font-display); }
.card-subtitle { font-size: 0.80rem; color: var(--white-40); margin-top: 2px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── STAT CARDS ── */
.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--white-20), transparent);
}

.stat-card:hover {
  border-color: var(--border-bold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 44px;
  height: 44px;
  background: var(--white-08);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--white-40);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.stat-change {
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--white-50);
}

/* ── STAT CARD ACCENT VARIANTS ── */
.stat-card-accent {
  border-color: var(--white-15);
  background: linear-gradient(135deg, var(--white-08) 0%, var(--white-04) 100%);
}

/* ============================================================
   GRIDS
   ============================================================ */

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }

@media (max-width: 1400px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ============================================================
   TABLE
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--glass-bg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.table thead th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--white-40);
  border-bottom: 1px solid var(--border);
  background: var(--white-04);
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.table tbody tr:last-child { border-bottom: none; }

.table tbody tr:hover { background: var(--white-04); }

.table tbody td {
  padding: 14px 20px;
  color: var(--white-80);
  vertical-align: middle;
}

.table-actions { display: flex; gap: 8px; align-items: center; }

/* ============================================================
   BADGES & PILLS
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 1px solid;
}

.badge-white  { background: var(--white-15); color: var(--white); border-color: var(--white-30); }
.badge-dim    { background: var(--white-08); color: var(--white-50); border-color: var(--border); }
.badge-ok     { background: rgba(255,255,255,0.12); color: var(--white-90); border-color: var(--white-25); }
.badge-warn   { background: rgba(255,255,255,0.06); color: var(--white-60); border-color: var(--border); }
.badge-alert  { background: rgba(255,255,255,0.04); color: var(--white-40); border-color: var(--border); }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-main);
}

.btn-primary {
  background: var(--white);
  color: var(--black);
}
.btn-primary:hover {
  background: var(--white-90);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255,255,255,0.12);
}

.btn-secondary {
  background: var(--white-08);
  color: var(--white-80);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--white-15);
  color: var(--white);
  border-color: var(--border-bold);
}

.btn-ghost {
  background: transparent;
  color: var(--white-60);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--white-08);
  color: var(--white-80);
}

.btn-danger {
  background: rgba(255,255,255,0.06);
  color: var(--white-50);
  border: 1px solid var(--border);
}
.btn-danger:hover {
  background: rgba(255,255,255,0.12);
  color: var(--white-80);
  border-color: var(--border-bold);
}

.btn-sm { padding: 6px 12px; font-size: 0.78rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 14px 28px; font-size: 0.95rem; }
.btn-icon { padding: 8px; width: 36px; height: 36px; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */

.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--white-50);
  margin-bottom: 8px;
}

.form-control {
  width: 100%;
  background: var(--white-04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 16px;
  color: var(--white-90);
  font-family: var(--font-main);
  font-size: 0.90rem;
  transition: var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-control:focus {
  background: var(--white-08);
  border-color: var(--white-30);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}

.form-control::placeholder { color: rgba(255,255,255,0.22); font-style: italic; }

.form-control option {
  background: var(--black-3);
  color: var(--white-90);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--white-30);
  margin-top: 5px;
}

.form-error {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 700px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }

/* Input with icon */
.input-wrapper { position: relative; }
.input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--white-30);
  pointer-events: none;
}
.input-wrapper .form-control { padding-left: 42px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */

.progress-bar {
  height: 6px;
  background: var(--white-08);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  background: var(--white);
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 40px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
}

.progress-lg { height: 10px; }
.progress-text {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--white-50);
}

/* ============================================================
   TIMELINE / ETAPAS
   ============================================================ */

.timeline { position: relative; padding-left: 24px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-bottom: 28px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--border-bold);
  background: var(--black-2);
  transition: var(--transition);
}

.timeline-dot.done {
  background: var(--white);
  border-color: var(--white);
}

.timeline-dot.active {
  background: var(--white-30);
  border-color: var(--white);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.08);
}

.timeline-content { padding-top: 1px; }
.timeline-title { font-weight: 600; font-size: 0.92rem; color: var(--white-80); }
.timeline-sub { font-size: 0.78rem; color: var(--white-40); margin-top: 2px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

/* Large geometric accent */
.login-page::before {
  content: '';
  position: fixed;
  top: -30%;
  right: -20%;
  width: 70vw;
  height: 70vw;
  border-radius: 50%;
  border: 1px solid var(--border);
  pointer-events: none;
  z-index: 0;
}

.login-page::after {
  content: '';
  position: fixed;
  bottom: -20%;
  left: -15%;
  width: 50vw;
  height: 50vw;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.04);
  pointer-events: none;
  z-index: 0;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  position: relative;
  z-index: 1;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: var(--shadow-lg);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--white-20), transparent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.login-logo img {
  height: 44px;
  filter: brightness(0) invert(1);
}

.login-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
  font-family: var(--font-display);
}

.login-sub {
  text-align: center;
  font-size: 0.82rem;
  color: var(--white-40);
  margin-bottom: 32px;
}

.login-submit {
  width: 100%;
  justify-content: center;
  padding: 13px 20px;
  font-size: 0.92rem;
  margin-top: 8px;
}

.login-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--white-25);
  margin-top: 28px;
}

/* ============================================================
   SECTION HEADER
   ============================================================ */

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.section-title { font-size: 1.6rem; font-weight: 800; font-family: var(--font-display); }
.section-desc  { font-size: 0.82rem; color: var(--white-40); margin-top: 4px; }
.section-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── DIVIDER ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--white-30);
}
.empty-state svg { opacity: 0.2; margin-bottom: 16px; }
.empty-state p { font-size: 0.88rem; }

/* ── SEARCH BAR ── */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 320px;
}
.search-bar input {
  width: 100%;
  background: var(--white-04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 16px 9px 38px;
  color: var(--white-80);
  font-size: 0.86rem;
  outline: none;
  transition: var(--transition);
  font-family: var(--font-main);
}
.search-bar input:focus {
  border-color: var(--white-25);
  background: var(--white-06);
}
.search-bar svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--white-30);
  pointer-events: none;
}

/* ── AVATAR INITIALS ── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white-12);
  border: 1px solid var(--border-bold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--white-80);
  flex-shrink: 0;
}

/* ── RATING STARS ── */
.stars { letter-spacing: 2px; font-size: 0.9rem; }

/* ============================================================
   PORTAL SPECIFIC
   ============================================================ */

.portal-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.portal-header {
  background: var(--black-2);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.portal-header img {
  height: 30px;
  filter: brightness(0) invert(1);
}

.portal-header .divider-v {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.portal-header-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--white-50);
}

.portal-header-spacer { flex: 1; }

.portal-content { padding: 40px; flex: 1; }

.portal-welcome {
  margin-bottom: 40px;
}

.portal-welcome-title {
  font-size: 2rem;
  font-weight: 900;
  font-family: var(--font-display);
}

.portal-welcome-sub {
  font-size: 0.90rem;
  color: var(--white-40);
  margin-top: 6px;
}

/* Project card for portal */
.project-card {
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--white-20), transparent);
}

.project-card:hover {
  border-color: var(--border-bold);
  background: var(--glass-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.project-card-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.project-card-addr {
  font-size: 0.82rem;
  color: var(--white-40);
  margin-bottom: 20px;
}

/* ============================================================
   FINANCIAL CHART AREA
   ============================================================ */

.chart-placeholder {
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 16px;
}

.chart-bar {
  flex: 1;
  background: var(--white-12);
  border-radius: 4px 4px 0 0;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  min-height: 8px;
}
.chart-bar:hover { background: var(--white-25); }
.chart-bar span {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--white-30);
  white-space: nowrap;
}

/* ============================================================
   SCROLLBAR GLOBAL
   ============================================================ */

::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--white-12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--white-25); }

/* ============================================================
   UTILITIES
   ============================================================ */

.text-white   { color: var(--white) !important; }
.text-dim     { color: var(--white-50) !important; }
.text-muted   { color: var(--white-30) !important; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.fw-bold      { font-weight: 700; }
.fw-medium    { font-weight: 500; }
.mt-4         { margin-top: 4px; }
.mt-8         { margin-top: 8px; }
.mt-12        { margin-top: 12px; }
.mt-16        { margin-top: 16px; }
.mt-24        { margin-top: 24px; }
.mt-32        { margin-top: 32px; }
.mb-4         { margin-bottom: 4px; }
.mb-8         { margin-bottom: 8px; }
.mb-16        { margin-bottom: 16px; }
.mb-24        { margin-bottom: 24px; }
.mb-32        { margin-bottom: 32px; }
.gap-8        { gap: 8px; }
.gap-12       { gap: 12px; }
.gap-16       { gap: 16px; }
.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1       { flex: 1; }
.w-100        { width: 100%; }
.mono         { font-size: 0.85em; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap       { white-space: nowrap; }

/* ── SEPARATOR LINE ── */
.section-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
  color: var(--white-25);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.section-sep::before, .section-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── ANIMATIONS ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.pulse { animation: pulse 2s infinite; }

/* ── TOOLTIP ── */
[data-tooltip] { position: relative; cursor: default; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--black-4);
  color: var(--white-80);
  font-size: 0.72rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  border: 1px solid var(--border);
  z-index: 999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── INFO ROW ── */
.info-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.info-row:last-child { border-bottom: none; }
.info-row-label {
  min-width: 140px;
  color: var(--white-40);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 1px;
}
.info-row-value { color: var(--white-80); flex: 1; }

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */

/* Botão hambúrguer (hidden no desktop) */
.sidebar-toggle {
  display: none;
  width: 38px;
  height: 38px;
  background: var(--white-08);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--white-80);
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--white-15); }
.sidebar-toggle .icon-close { display: none !important; }
.sidebar-toggle.sidebar-open-state .icon-open  { display: none !important; }
.sidebar-toggle.sidebar-open-state .icon-close { display: block !important; }

/* Overlay escuro atrás do sidebar aberto */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 150;
}

@media (max-width: 768px) {

  /* ── Hambúrguer ── */
  .sidebar-toggle { display: flex; }

  /* ── Sidebar vira off-canvas ── */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 200;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,.5);
  }
  .sidebar-overlay.sidebar-open { display: block; }

  /* ── Main content ocupa tela toda ── */
  .main-content { margin-left: 0; }

  /* ── Topbar ── */
  .topbar {
    padding: 0 14px;
    gap: 10px;
  }
  .topbar-title { font-size: 0.90rem; }
  .topbar-breadcrumb { display: none; }

  /* Botões da topbar: só ícone */
  .topbar-action, .topbar-btn {
    padding: 7px 10px;
    gap: 0;
  }
  .topbar-action span,
  .topbar-btn span { display: none; }

  /* ── Página ── */
  .page-content { padding: 14px; }
  .flash-container { padding: 0 14px; }
  .mb-32 { margin-bottom: 14px; }
  .mb-24 { margin-bottom: 12px; }

  /* ── Cards ── */
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  /* ── Stat cards ── */
  .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 1.5rem; }
  .stat-icon { width: 36px; height: 36px; margin-bottom: 10px; }

  /* ── Grids já colapsam em 900px, garantir aqui ── */
  .grid-3, .grid-2 { grid-template-columns: 1fr; gap: 12px; }

  /* ── Tabelas: scroll horizontal ── */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
  }
  .table { min-width: 600px; }

  /* ── Section header ── */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .section-actions { width: 100%; }
  .search-bar { width: 100%; }
  .search-bar input { width: 100%; }

  /* ── Modais full-width ── */
  #vModalBox, .v-modal {
    width: 95vw !important;
    padding: 20px !important;
  }

  /* ── Kanban: scroll horizontal ── */
  .kb-board {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
  }

  /* ── Info rows empilham ── */
  .info-row { flex-direction: column; gap: 2px; }
  .info-row-label { min-width: unset; }

  /* ── Timeline ── */
  .timeline-content { padding-left: 10px; }

  /* ── Table actions botões sempre visíveis ── */
  .table-actions { gap: 6px; }

  /* ── Footer botão imprimir ── */
  .btn-print {
    bottom: 16px;
    right: 16px;
    padding: 10px 16px;
    font-size: 0.80rem;
  }
}

@media (max-width: 420px) {
  .grid-4 { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.25rem; }
  .topbar-title { font-size: 0.82rem; }
  .page-content { padding: 10px; }
}

/* ============================================================
   MISSING ROOT VARIABLES (extended palette)
   ============================================================ */
:root {
  --white-80:  rgba(255,255,255,0.80);
  --white-60:  rgba(255,255,255,0.60);
  --white-40:  rgba(255,255,255,0.40);
  --white-35:  rgba(255,255,255,0.35);
  --white-25:  rgba(255,255,255,0.25);
  --white-20:  rgba(255,255,255,0.20);
  --white-12:  rgba(255,255,255,0.12);
  --white-06:  rgba(255,255,255,0.06);
  --surface:   #141414;
}

/* ============================================================
   SIDEBAR THEME TOGGLE BUTTON
   ============================================================ */
.sidebar-theme-toggle {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  background: var(--white-04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white-50);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-main);
  text-align: left;
}
.theme-toggle-btn:hover {
  background: var(--white-08);
  color: var(--white-70);
}

/* Dark mode: show sun (click → go light) */
.theme-toggle-btn .icon-light { display: block; }
.theme-toggle-btn .icon-dark  { display: none;  }

/* Light mode: show moon (click → go dark) */
[data-theme="light"] .theme-toggle-btn .icon-light { display: none;  }
[data-theme="light"] .theme-toggle-btn .icon-dark  { display: block; }

/* ============================================================
   LIGHT THEME OVERRIDES  [data-theme="light"]
   ============================================================ */
[data-theme="light"] {
  /* Structural backgrounds (inverted palette) */
  --black:       #F5F3EE;
  --black-2:     #EDEAE4;
  --black-3:     #E5E1DA;
  --black-4:     #DAD7CF;
  --black-5:     #CFCCC4;

  /* Text & icon colours (dark on light) */
  --white:       #141414;
  --white-90:    rgba(20,20,20,0.88);
  --white-80:    rgba(20,20,20,0.78);
  --white-70:    rgba(20,20,20,0.68);
  --white-60:    rgba(20,20,20,0.60);
  --white-50:    rgba(20,20,20,0.50);
  --white-40:    rgba(20,20,20,0.40);
  --white-35:    rgba(20,20,20,0.35);
  --white-30:    rgba(20,20,20,0.30);
  --white-25:    rgba(20,20,20,0.25);
  --white-20:    rgba(20,20,20,0.20);
  --white-15:    rgba(20,20,20,0.15);
  --white-12:    rgba(20,20,20,0.12);
  --white-08:    rgba(20,20,20,0.08);
  --white-06:    rgba(20,20,20,0.06);
  --white-04:    rgba(20,20,20,0.04);

  /* Borders & surfaces */
  --border:      rgba(20,20,20,0.11);
  --border-bold: rgba(20,20,20,0.22);
  --glass-bg:    rgba(20,20,20,0.04);
  --glass-hover: rgba(20,20,20,0.07);
  --surface:     #F0EDE7;

  /* Shadows become softer */
  --shadow-sm:   0 2px 8px rgba(0,0,0,0.10);
  --shadow-md:   0 8px 32px rgba(0,0,0,0.12);
  --shadow-lg:   0 20px 60px rgba(0,0,0,0.16);
}

/* Body background */
[data-theme="light"] body {
  background-color: var(--black);
  color: var(--white-90);
}

/* Grain noise overlay — darker on light bg */
[data-theme="light"] body::before {
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
}

/* Dot grid — dark dots on light bg */
[data-theme="light"] body::after {
  opacity: 0.07;
  background-image: radial-gradient(circle, rgba(20,20,20,0.5) 1px, transparent 1px);
}

/* Sidebar diagonal texture — use dark stripes */
[data-theme="light"] .sidebar::before {
  opacity: 0.03;
  background: repeating-linear-gradient(
    -45deg,
    rgba(0,0,0,0.5) 0px,
    rgba(0,0,0,0.5) 1px,
    transparent 1px,
    transparent 14px
  );
}

/* Logo: remove white invert in light mode */
[data-theme="light"] .sidebar-brand img {
  filter: brightness(0);
}
[data-theme="light"] .login-logo img {
  filter: brightness(0);
}

/* Topbar */
[data-theme="light"] .topbar {
  background: rgba(245,243,238,0.90);
}

/* Cards — slightly elevated appearance */
[data-theme="light"] .card {
  background: #FAFAF8;
  border-color: rgba(20,20,20,0.10);
}

/* Stat cards do dashboard */
.stat-card {
  background: var(--white-04);
}
.stat-card:hover {
  background: var(--white-08);
}
[data-theme="light"] .stat-card {
  background: #FAFAF8;
  border-color: rgba(20,20,20,0.10);
}
[data-theme="light"] .stat-card:hover {
  background: #F0EDE7;
}

/* Stat cards */
[data-theme="light"] .stat-card {
  background: #FAFAF8;
  border-color: rgba(20,20,20,0.10);
}

/* Progress fill — dark bar */
[data-theme="light"] .progress-fill {
  background: #141414;
}
[data-theme="light"] .progress-fill::after {
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.25));
}

/* Tables */
[data-theme="light"] .table thead th {
  background: rgba(20,20,20,0.05);
}
[data-theme="light"] .table tbody tr:hover td {
  background: rgba(20,20,20,0.04);
}

/* Badges — invert for legibility */
[data-theme="light"] .badge {
  background: rgba(20,20,20,0.10);
  color: rgba(20,20,20,0.70);
  border-color: rgba(20,20,20,0.15);
}

/* Buttons — primary stays dark for contrast */
[data-theme="light"] .btn-primary {
  background: #141414;
  border-color: #141414;
  color: #FFFFFF;
}
[data-theme="light"] .btn-primary:hover {
  background: #2a2a2a;
  border-color: #2a2a2a;
}

/* Topbar action button */
[data-theme="light"] .topbar-action {
  background: #141414;
  color: #FFFFFF;
}
[data-theme="light"] .topbar-action:hover {
  background: #2a2a2a;
}

/* Avatar */
[data-theme="light"] .avatar {
  background: rgba(20,20,20,0.12);
  border-color: rgba(20,20,20,0.22);
  color: rgba(20,20,20,0.80);
}

/* Modal */
[data-theme="light"] .v-modal {
  background: #FAFAF8;
  border-color: rgba(20,20,20,0.14);
  box-shadow: 0 24px 64px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
}

/* Form controls */
[data-theme="light"] .form-control {
  background: #FAFAF8;
  border-color: rgba(20,20,20,0.18);
  color: var(--white-90);
}
[data-theme="light"] .form-control:focus {
  border-color: rgba(20,20,20,0.40);
  background: #FFFFFF;
}

/* Input placeholder */
[data-theme="light"] ::placeholder {
  color: rgba(20,20,20,0.25) !important;
}

/* Timeline dots */
[data-theme="light"] .timeline-dot.done {
  background: #141414;
  border-color: #141414;
}
[data-theme="light"] .timeline-dot.active {
  background: rgba(20,20,20,0.30);
  border-color: #141414;
  box-shadow: 0 0 0 4px rgba(20,20,20,0.08);
}

/* Scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(20,20,20,0.18);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(20,20,20,0.32);
}

/* Kanban columns */
[data-theme="light"] .kb-col {
  background: #EDEAE4;
  border-color: rgba(20,20,20,0.10);
}
[data-theme="light"] .kb-card {
  background: #FAFAF8;
  border-color: rgba(20,20,20,0.10);
}
[data-theme="light"] .kb-card:hover {
  border-color: rgba(20,20,20,0.25);
  background: #FFFFFF;
}

/* Stat card accent (payments overdue) */
[data-theme="light"] .stat-card-accent {
  border-color: rgba(239,68,68,0.4);
}
