/* ═══════════════════════════════════════════
   EstoqueObras — styles.css
   ═══════════════════════════════════════════ */

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

:root {
  --bg:       #0f1117;
  --surface:  #181c27;
  --surface2: #1f2435;
  --border:   #2a3048;
  --accent:   #f0a500;
  --accent2:  #f5541a;
  --green:    #2ecc71;
  --red:      #e74c3c;
  --blue:     #3498db;
  --purple:   #9b59b6;
  --text:     #f5f6f8;
  --muted:    #7a82a0;
  --fd: 'Barlow Condensed', sans-serif;
  --fb: 'Barlow', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--fb); font-size: 15px; overflow: hidden; }

/* ══ SETUP SCREEN ══ */
#setup-screen {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; flex-direction: column; gap: 0;
}
.setup-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; width: 520px; max-width: 96vw;
  overflow: hidden; box-shadow: 0 40px 100px rgba(0,0,0,.6);
}
.setup-top {
  background: linear-gradient(135deg, #1a2040, #0f1117);
  padding: 36px 36px 28px; border-bottom: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.setup-top::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.setup-logo { font-family: var(--fd); font-size: 28px; font-weight: 800; color: var(--accent); }
.setup-title { font-family: var(--fd); font-size: 20px; font-weight: 700; margin-top: 18px; }
.setup-desc  { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.setup-body  { padding: 28px 36px; display: flex; flex-direction: column; gap: 18px; }
.setup-steps { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.setup-step  {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px;
  display: flex; gap: 14px; align-items: flex-start;
}
.setup-step-num {
  background: var(--accent); color: #000;
  font-family: var(--fd); font-size: 15px; font-weight: 800;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.setup-step-text { font-size: 13px; line-height: 1.5; color: #b0b8d0; }
.setup-step-text a { color: var(--accent); text-decoration: none; }
.setup-step-text a:hover { text-decoration: underline; }
.setup-step-text code {
  background: rgba(240,165,0,.12); color: var(--accent);
  padding: 1px 6px; border-radius: 3px; font-size: 12px;
}
.setup-footer { padding: 20px 36px 28px; border-top: 1px solid var(--border); }

/* ══ LAYOUT ══ */
.app { display: flex; height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.sidebar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.logo { padding: 24px 20px 20px; border-bottom: 1px solid var(--border); }
.logo-title { font-family: var(--fd); font-size: 22px; font-weight: 800; letter-spacing: 1px; color: var(--accent); line-height: 1; }
.logo-sub   { font-size: 11px; color: var(--muted); margin-top: 4px; letter-spacing: 2px; text-transform: uppercase; }
.logo-sync  { margin-top: 8px; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.sync-dot   { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

nav { flex: 1; padding: 16px 0; }
.nav-section { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); padding: 12px 20px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--muted); transition: all .18s;
  border-left: 3px solid transparent; user-select: none;
  text-decoration: none;
}
.nav-item:hover  { color: var(--text); background: var(--surface2); }
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(240,165,0,.07); }
.nav-item .icon  { font-size: 18px; width: 22px; text-align: center; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.sidebar-config-btn {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted);
  cursor: pointer; padding: 5px 0; transition: color .15s;
}
.sidebar-config-btn:hover { color: var(--accent); }

.main  { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; flex-shrink: 0;
}
.page-title    { font-family: var(--fd); font-size: 24px; font-weight: 700; letter-spacing: .5px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.sync-status   { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.content { flex: 1; overflow-y: auto; padding: 28px; }

/* ══ LOADING OVERLAY ══ */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(15,17,23,.8);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.loading-overlay.show { opacity: 1; pointer-events: all; }
.loading-spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ BUTTONS ══ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 6px; border: none;
  font-family: var(--fb); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; letter-spacing: .3px;
}
.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { background: #ffc233; }
.btn-danger  { background: var(--red); color: #fff; }
.btn-danger:hover  { background: #c0392b; }
.btn-success { background: var(--green); color: #000; }
.btn-success:hover { background: #27ae60; }
.btn-ghost   { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover   { background: var(--border); }
.btn-sm   { padding: 5px 12px; font-size: 12px; }
.btn-icon {
  padding: 7px; border-radius: 6px; background: var(--surface2);
  border: 1px solid var(--border); cursor: pointer; color: var(--muted);
  font-size: 16px; transition: all .15s;
}
.btn-icon:hover { color: var(--text); background: var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ══ CARDS ══ */
.cards-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px; position: relative; overflow: hidden;
}
.card::after { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.card.c-yellow::after { background: var(--accent); }
.card.c-green::after  { background: var(--green); }
.card.c-red::after    { background: var(--red); }
.card.c-blue::after   { background: var(--blue); }
.card-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 8px; }
.card-value { font-family: var(--fd); font-size: 42px; font-weight: 800; line-height: 1; }
.card-sub   { font-size: 12px; color: var(--muted); margin-top: 6px; }
.card-icon  { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 36px; opacity: .12; }

/* ══ TABLES ══ */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.table-title { font-family: var(--fd); font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 12px;
}
.search-box input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 13px; font-family: var(--fb); width: 180px;
}
.search-box input::placeholder { color: var(--muted); }

table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface2); }
th { padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); white-space: nowrap; }
td { padding: 13px 16px; font-size: 13px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,.025); }
.empty-row td { text-align: center; color: var(--muted); font-style: italic; padding: 40px; }

/* ══ BADGES ══ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green  { background: rgba(46,204,113,.15);  color: var(--green); }
.badge-red    { background: rgba(231,76,60,.15);   color: var(--red); }
.badge-yellow { background: rgba(240,165,0,.15);   color: var(--accent); }
.badge-blue   { background: rgba(52,152,219,.15);  color: var(--blue); }
.badge-purple { background: rgba(155,89,182,.15);  color: var(--purple); }

/* ══ MODALS ══ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; width: 480px; max-width: 94vw; max-height: 90vh; overflow-y: auto;
  transform: scale(.95) translateY(10px); transition: transform .2s;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-top {
  padding: 22px 24px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: var(--fd); font-size: 20px; font-weight: 700; }
.modal-body  { padding: 22px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Forms ── */
.form-group  { display: flex; flex-direction: column; gap: 6px; }
.form-label  { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.form-control {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; padding: 10px 13px; color: var(--text);
  font-family: var(--fb); font-size: 14px; outline: none; transition: border-color .15s; width: 100%;
}
.form-control:focus   { border-color: var(--accent); }
.form-control option  { background: var(--surface2); }
.form-control[readonly] { opacity: .65; cursor: default; }

/* ══ SALDO BAR ══ */
.saldo-bar      { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.saldo-bar-track{ background: var(--surface2); border-radius: 3px; height: 5px; overflow: hidden; }
.saldo-bar-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.saldo-bar-text { font-size: 11px; color: var(--muted); }

/* ══ PAGES ══ */
.page { display: none; }
.page.active { display: block; }

/* ══ DASHBOARD ══ */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.activity-list { display: flex; flex-direction: column; }
.activity-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.activity-dot  { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.activity-item:last-child { border-bottom: none; }
.activity-text { font-size: 13px; line-height: 1.5; }
.activity-date { font-size: 11px; color: var(--muted); margin-top: 2px; }
.alerts-wrap   { display: flex; flex-direction: column; gap: 10px; }
.alert-item    { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 13px 16px; display: flex; align-items: center; gap: 12px; }
.alert-text    { font-size: 13px; flex: 1; }
.alert-text strong { color: var(--accent); }
.alert-qty     { font-family: var(--fd); font-size: 22px; font-weight: 800; color: var(--red); }

/* ══ TOAST ══ */
.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 13px 18px; font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.3);
  display: flex; align-items: center; gap: 10px; animation: slideIn .25s ease; min-width: 260px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ══ UTILS ══ */
.grid-2       { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.actions-cell { display: flex; gap: 6px; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
