/* =============================================
   TUPÃ COMUNICAÇÃO — PORTAL SISTEMA
   Versão: 2.0 — Identidade Visual Oficial
   Fonte: Inter | Cor principal: #a10f14
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── VARIÁVEIS ──────────────────────────────── */
:root {
  /* Cores principais */
  --primary:        #0a0a0a;
  --secondary:      #111111;
  --surface:        #161616;
  --card-bg:        #1a1a1a;
  --input-bg:       #0f0f0f;

  /* Marca Tupã */
  --accent:         #a10f14;
  --accent-dark:    #7f0b10;
  --accent-light:   rgba(161,15,20,0.12);
  --accent-glow:    rgba(161,15,20,0.25);

  /* Feedback */
  --success:        #27ae60;
  --danger:         #e74c3c;
  --warning:        #f39c12;
  --info:           #2980b9;

  /* Texto */
  --text:           #f0f0f0;
  --text-muted:     #7a7a8a;
  --text-soft:      #b0b0c0;
  --white:          #ffffff;

  /* Bordas e sombras */
  --border:         #2a2a2a;
  --border-soft:    #222222;
  --shadow:         0 4px 32px rgba(0,0,0,0.6);
  --shadow-accent:  0 4px 24px rgba(161,15,20,0.2);
  --shadow-card:    0 2px 16px rgba(0,0,0,0.4);

  /* Tipografia */
  --font:           'Inter', system-ui, -apple-system, sans-serif;

  /* Espaçamentos e bordas */
  --radius:         12px;
  --radius-sm:      8px;
  --radius-xs:      6px;
  --transition:     all 0.22s ease;
}

/* ─── RESET ──────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--primary);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover { color: var(--accent-dark); }

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: var(--font);
}

/* ─── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--primary); }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── SELEÇÃO ────────────────────────────────── */
::selection {
  background: var(--accent);
  color: var(--white);
}

/* =============================================
   LOGIN PAGE
   ============================================= */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 70% 20%, rgba(161,15,20,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 20% 80%, rgba(161,15,20,0.04) 0%, transparent 50%),
    var(--primary);
  padding: 24px;
}

.login-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 52px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* Linha decorativa topo */
.login-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.login-logo {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo img {
  height: 52px;
  margin: 0 auto 14px;
  object-fit: contain;
}

/* Fallback se não tiver logo */
.logo-text-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 14px;
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -1px;
  margin: 0 auto 14px;
}

.login-logo .brand-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.login-logo .brand-name span {
  color: var(--accent);
}

.login-logo .brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-top: 5px;
}

.login-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 5px;
  line-height: 1.3;
}

.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.4;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 7px;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--accent);
  background: #111;
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder {
  color: #3a3a3a;
  font-size: 13px;
}

textarea.form-control {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

select.form-control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a7a8a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

select.form-control option {
  background: var(--card-bg);
  color: var(--white);
}

/* =============================================
   BOTÕES
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: 0.2px;
  line-height: 1;
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }

/* Primário — Vermelho Tupã */
.btn-primary {
  background: var(--accent);
  color: var(--white);
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
  width: 100%;
  padding: 14px;
  font-size: 14px;
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 6px 28px rgba(161,15,20,0.35);
  transform: translateY(-1px);
}

/* Secundário */
.btn-secondary {
  background: var(--border);
  color: var(--text-soft);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: #333;
  color: var(--white);
}

/* Sucesso */
.btn-success {
  background: var(--success);
  color: var(--white);
  border-color: var(--success);
}
.btn-success:hover { background: #219a52; border-color: #219a52; }

/* Perigo */
.btn-danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
.btn-danger:hover { background: #c0392b; border-color: #c0392b; }

/* Aviso */
.btn-warning {
  background: var(--warning);
  color: #111;
  border-color: var(--warning);
}
.btn-warning:hover { background: #d68910; border-color: #d68910; }

/* Info */
.btn-info {
  background: var(--info);
  color: var(--white);
  border-color: var(--info);
}
.btn-info:hover { background: #2471a3; }

/* Outline */
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-soft);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Outline accent */
.btn-outline-accent {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn-outline-accent:hover {
  background: var(--accent);
  color: var(--white);
}

/* Tamanhos */
.btn-sm {
  padding: 6px 13px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 15px;
}

/* Ícone */
.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--border);
  border: 1px solid var(--border-soft);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

/* =============================================
   PORTAL LAYOUT
   ============================================= */

.portal-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: 250px;
  min-width: 250px;
  background: var(--secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  margin-bottom: 6px;
}

.sidebar-logo img {
  height: 32px;
  object-fit: contain;
}

.sidebar-brand {
  font-size: 17px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.sidebar-brand span {
  color: var(--accent);
}

.sidebar-role {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Navegação */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--white);
  font-weight: 600;
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.nav-icon { font-size: 15px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
  line-height: 1.6;
}

.nav-badge.badge-new {
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* Rodapé sidebar */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.user-info { flex: 1; overflow: hidden; }

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.sidebar-logout {
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.sidebar-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: rgba(231,76,60,0.06);
}

/* ─── MAIN CONTENT ───────────────────────────── */
.main-content {
  flex: 1;
  margin-left: 250px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--primary);
}

/* ─── TOPBAR ─────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── PAGE CONTENT ───────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1400px;
  width: 100%;
}

/* ─── SECTION ────────────────────────────────── */
.section { display: none; }
.section.active,
.section[style*="display: block"] { display: block; }

/* ─── CARDS ──────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.card:hover {
  border-color: #333;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* ─── STATS GRID ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
}

.stat-card:hover {
  border-color: rgba(161,15,20,0.3);
  transform: translateY(-1px);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.red    { background: rgba(161,15,20,0.15); }
.stat-icon.yellow { background: rgba(243,156,18,0.12); }
.stat-icon.green  { background: rgba(39,174,96,0.12); }
.stat-icon.blue   { background: rgba(41,128,185,0.12); }
.stat-icon.purple { background: rgba(142,68,173,0.12); }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.3;
}

/* ─── TABELAS ────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-soft);
  vertical-align: middle;
  line-height: 1.4;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* ─── BADGES / STATUS ────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.5;
}

.badge-pending  { background: rgba(243,156,18,0.15);  color: var(--warning); }
.badge-approved { background: rgba(39,174,96,0.15);   color: var(--success); }
.badge-revision { background: rgba(41,128,185,0.15);  color: var(--info);    }
.badge-rejected { background: rgba(231,76,60,0.15);   color: var(--danger);  }
.badge-new      { background: rgba(161,15,20,0.15);   color: var(--accent);  }
.badge-done     { background: rgba(39,174,96,0.12);   color: var(--success); }
.badge-open     { background: rgba(243,156,18,0.12);  color: var(--warning); }

/* ─── TABS ───────────────────────────────────── */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 8px 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--white);
  border-color: #444;
}

.tab-btn.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* ─── MATERIAL GRID ──────────────────────────── */
.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.material-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.material-card:hover {
  border-color: rgba(161,15,20,0.35);
  transform: translateY(-2px);
  box-shadow: var(--shadow-accent);
}

.material-preview {
  background: #0f0f0f;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  border-bottom: 1px solid var(--border);
}

.material-body { padding: 16px; }

.material-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
  line-height: 1.3;
}

.material-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.material-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── PROPOSTA CARD ──────────────────────────── */
.proposal-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
  margin-bottom: 18px;
}

.proposal-card:last-child { margin-bottom: 0; }

.proposal-card:hover {
  border-color: rgba(161,15,20,0.3);
}

.proposal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.proposal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

.proposal-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

.proposal-items {
  list-style: none;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.proposal-items li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.proposal-items li::before {
  content: '✓';
  color: var(--success);
  font-weight: 800;
  font-size: 12px;
  flex-shrink: 0;
}

/* ─── ORDER CARD ─────────────────────────────── */
.order-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  transition: var(--transition);
  margin-bottom: 14px;
}

.order-card:last-child { margin-bottom: 0; }

.order-card:hover { border-color: #333; }

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  gap: 12px;
}

.order-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
}

.order-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}

/* ─── PROGRESS BAR ───────────────────────────── */
.progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #d41219);
  border-radius: 10px;
  transition: width 0.7s ease;
}

/* ─── TIMELINE ───────────────────────────────── */
.timeline-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-top: 16px;
}

.tl-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tl-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: var(--transition);
}

.tl-step.done .tl-dot {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
}

.tl-step.active .tl-dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
  box-shadow: 0 0 12px rgba(161,15,20,0.4);
}

.tl-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  max-width: 70px;
  line-height: 1.3;
}

.tl-step.done .tl-label,
.tl-step.active .tl-label { color: var(--text-soft); }

.tl-line {
  flex: 1;
  min-width: 28px;
  height: 2px;
  background: var(--border);
  margin-top: 15px;
  transition: background 0.4s;
}

.tl-line.done   { background: var(--success); }
.tl-line.active { background: var(--accent); }

/* ─── CHAT / FEEDBACK ────────────────────────── */
.chat-wrap {
  min-height: 300px;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}

.chat-msg { display: flex; }
.chat-msg.mine    { justify-content: flex-end; }
.chat-msg.theirs  { justify-content: flex-start; }

.chat-bubble {
  max-width: 68%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
}

.chat-msg.mine .chat-bubble {
  background: var(--accent-light);
  border-color: rgba(161,15,20,0.25);
}

.chat-sender {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.chat-bubble p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
}

.chat-bubble small {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 5px;
}

.chat-input-area {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chat-input-area input {
  flex: 1;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--white);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.chat-input-area input:focus { border-color: var(--accent); }
.chat-input-area input::placeholder { color: #3a3a3a; }

/* ─── EMPTY STATE ────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 14px;
  display: block;
  opacity: 0.4;
}

.empty-state p {
  font-size: 13px;
  line-height: 1.5;
}

/* ─── MODAL ──────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  position: relative;
}

/* Linha topo modal */
.modal-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: 16px 16px 0 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  line-height: 1;
}

.modal-close:hover {
  color: var(--white);
  background: var(--border);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ─── TOAST ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--white);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 340px;
  animation: toastIn 0.3s ease forwards;
  pointer-events: auto;
}

.toast.out { animation: toastOut 0.3s ease forwards; }

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger);  }
.toast.info    { border-left: 3px solid var(--info);    }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(110%); opacity: 0; }
}

/* ─── DETALHES / BLOCOS ADMIN ────────────────── */
.detail-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
}

.detail-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.detail-block-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
}

/* ─── FORMULÁRIO GRID ────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* ─── DIVIDER ────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ─── INFO ROW ───────────────────────────────── */
.info-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 13px;
}

.info-row:last-child { border-bottom: none; }

.info-label {
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 120px;
  font-size: 12px;
}

.info-value {
  color: var(--text-soft);
  flex: 1;
}

/* ─── UPLOAD AREA ────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.upload-area:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.upload-icon { font-size: 36px; margin-bottom: 10px; opacity: 0.5; }
.upload-area p { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.upload-area small { font-size: 11px; color: var(--text-muted); opacity: 0.7; }

/* ─── ALERT ──────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error   { background: rgba(231,76,60,0.1); border: 1px solid rgba(231,76,60,0.25); color: #e74c3c; }
.alert-success { background: rgba(39,174,96,0.1); border: 1px solid rgba(39,174,96,0.25); color: #27ae60; }
.alert-info    { background: rgba(41,128,185,0.1); border: 1px solid rgba(41,128,185,0.25); color: #2980b9; }
.alert-warning { background: rgba(243,156,18,0.1); border: 1px solid rgba(243,156,18,0.25); color: #f39c12; }

/* ─── TOGGLE MENU (mobile) ───────────────────── */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text);
  padding: 7px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition);
}

.menu-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0,0,0,0.6);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .page-content {
    padding: 18px 16px;
    gap: 18px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card { padding: 16px; }

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .card { padding: 18px 16px; }

  .proposal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-box {
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    align-self: flex-end;
    margin: 0 -20px -20px;
    width: calc(100% + 40px);
    max-width: 100%;
  }

  .modal-overlay { align-items: flex-end; }

  .material-grid {
    grid-template-columns: 1fr;
  }

  .chat-bubble { max-width: 85%; }

  .login-box {
    padding: 36px 24px;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 22px; }
  .topbar-title { font-size: 14px; }
  .tabs { gap: 4px; }
  .tab-btn { padding: 7px 11px; font-size: 11px; }
  .table-wrapper { overflow-x: auto; }
  table { min-width: 580px; }
}

/* ─── OVERLAY (mobile sidebar) ───────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* ─── UTILITÁRIOS ────────────────────────────── */
.d-flex     { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px;  }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8   { margin-top: 8px;  }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-muted { color: var(--text-muted); }
.text-white { color: var(--white); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.font-bold { font-weight: 700; }
.font-sm   { font-size: 12px; }
.font-xs   { font-size: 11px; }