/* ── Painko Método — Design System ─────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'IBM Plex Sans', system-ui, sans-serif; background: #fbfaf7; color: #293847; }

/* TOP NAV — páginas públicas */
nav { background: #293847; color: #f5f0e8; padding: 0 32px;
      display: flex; align-items: center; height: 56px; gap: 32px; }
nav .brand { font-size: 16px; font-weight: 700; letter-spacing: 1px; color: #b28420; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 220px;
  background: #293847; display: flex; flex-direction: column;
  z-index: 200; overflow-y: auto;
}
.sb-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 6px; flex-shrink: 0;
}
.sb-brand .sb-name { color: #b28420; font-weight: 700; font-size: 13px; line-height: 1.3; }
.sb-brand .sb-sub  { color: rgba(245,240,232,.35); font-size: 10px; margin-top: 2px; }
.sb-section { padding: 4px 0; }
.sb-section + .sb-section {
  border-top: 1px solid rgba(255,255,255,.07); margin-top: 4px; padding-top: 8px;
}
.sb-label {
  padding: 8px 16px 4px; font-size: 10px; font-weight: 700;
  letter-spacing: .8px; color: rgba(255,255,255,.28); text-transform: uppercase;
}
.sidebar a.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 14px; color: rgba(245,240,232,.62);
  text-decoration: none; font-size: 13px; font-weight: 500;
  border-left: 3px solid transparent; transition: all .15s;
}
.sidebar a.sb-item:hover {
  background: rgba(255,255,255,.07); color: rgba(245,240,232,.95);
  border-left-color: rgba(178,132,32,.45);
}
.sidebar a.sb-item.active {
  background: rgba(178,132,32,.13); color: #b28420;
  border-left-color: #b28420; font-weight: 600;
}
.sidebar a.sb-item .sb-ic { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

/* Grupos colapsáveis */
.sb-group-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px 9px 14px; color: rgba(245,240,232,.75);
  font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  cursor: pointer; border-left: 3px solid transparent;
  transition: all .15s; user-select: none;
}
.sb-group-hd:hover  { background: rgba(255,255,255,.06); color: #f5f0e8; }
.sb-group-hd.open   { color: #f5f0e8; }
.sb-chevron         { margin-left: auto; font-size: 10px; opacity: .4; transition: transform .2s; }
.sb-group-hd.open .sb-chevron { transform: rotate(90deg); opacity: .7; }
.sb-subitems        { display: none; padding-bottom: 4px; }
.sb-subitems.open   { display: block; }
.sidebar a.sb-item.sb-sub { padding-left: 36px; font-size: 12.5px; }

.sb-footer {
  margin-top: auto; border-top: 1px solid rgba(255,255,255,.08);
  padding: 8px 0; flex-shrink: 0;
}
.sb-user {
  padding: 12px 16px 4px; display: flex; flex-direction: column; gap: 3px;
}
.sb-user-name { color: rgba(245,240,232,.85); font-size: 13px; font-weight: 600; }
.sb-user-role {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 8px; border-radius: 99px;
  background: rgba(178,132,32,.18); color: #b28420; margin-top: 2px;
}

/* ── LAYOUT ── */
body:has(.sidebar) { padding-left: 220px; }
.page { max-width: 1100px; margin: 32px auto; padding: 0 32px; }

/* Sidebar brand como link para home */
.sb-brand a.sb-home {
  text-decoration: none; display: flex; align-items: center; gap: 10px;
  border-radius: 6px; padding: 4px 6px; margin: -4px -6px;
  transition: background .15s;
}
.sb-brand a.sb-home:hover { background: rgba(255,255,255,.09); }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.page-sub   { color: #5a6672; font-size: 14px; margin-bottom: 24px; }

/* ── CARDS ── */
.card { background: white; border-radius: 10px; padding: 24px;
        box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 20px; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px;
              color: #293847; border-bottom: 2px solid #f0f0ec; padding-bottom: 10px; }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ── STAT BOXES ── */
.stat { background: white; border-radius: 10px; padding: 20px; text-align: center;
        box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.stat .label { font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 6px; color: #293847;
               font-family: 'JetBrains Mono', ui-monospace, monospace; }
.stat.green  .value { color: #16a34a; }
.stat.blue   .value { color: #2563eb; }
.stat.orange .value { color: #ea580c; }
.stat.purple .value { color: #7c3aed; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=password], input[type=email], select {
  width: 100%; padding: 10px 12px; border: 1.5px solid #dcd6ca;
  border-radius: 6px; font-size: 14px; transition: border .2s;
  background: #fafaf8; font-family: 'IBM Plex Sans', system-ui, sans-serif;
}
input:focus, select:focus {
  outline: none; border-color: #b28420;
  background: white; box-shadow: 0 0 0 3px rgba(178,132,32,.15);
}

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px;
       padding: 10px 20px; border-radius: 6px; border: none;
       font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
       text-decoration: none; font-family: 'IBM Plex Sans', system-ui, sans-serif; }
.btn-primary { background: #b28420; color: #1e2c38; }
.btn-primary:hover { background: #96700f; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-dark { background: #293847; color: #f5f0e8; }
.btn-dark:hover { background: #1e2c38; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: white; color: #293847; border: 1.5px solid #dcd6ca; }
.btn-outline:hover { border-color: #b28420; color: #96700f; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-green { background: #16a34a; color: white; }
.btn-green:hover { background: #15803d; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: #293847; color: #f5f0e8; padding: 10px 14px;
     text-align: left; font-size: 12px; text-transform: uppercase;
     letter-spacing: .5px; font-family: 'JetBrains Mono', ui-monospace, monospace; }
td { padding: 10px 14px; border-bottom: 1px solid #f0f0ec; }
tr:hover td { background: #fafaf8; }
.badge { display: inline-flex; align-items: center; gap: 5px;
         font-family: 'JetBrains Mono', ui-monospace, monospace;
         font-size: 11px; font-weight: 600; letter-spacing: .06em;
         text-transform: uppercase; padding: 4px 9px; border-radius: 4px; }
.badge-mdo  { background: rgba(86,130,128,.14);  color: #3f6260; }
.badge-eqp  { background: rgba(41,56,71,.12);    color: #293847; }
.badge-mat  { background: rgba(178,132,32,.16);  color: #8a6516; }
.badge-out  { background: rgba(122,116,104,.16); color: #6b6457; }
.badge-obra { background: rgba(86,130,128,.14);  color: #3f6260; }

/* ── OBRA CARDS ── */
.obra-card { background: white; border-radius: 10px; padding: 20px 24px;
             box-shadow: 0 1px 4px rgba(0,0,0,.08);
             border-left: 4px solid #b28420; cursor: pointer;
             transition: all .2s; text-decoration: none; color: inherit; display: block; }
.obra-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }
.obra-card .obra-cod  { font-size: 12px; color: #888; }
.obra-card .obra-nome { font-size: 18px; font-weight: 700; margin: 4px 0 8px; }
.obra-card .obra-info { font-size: 13px; color: #5a6672; }

/* ── CPU TABLE ROW COLORS ── */
.row-mdo      td { background: rgba(86,130,128,.06); }
.row-eqp      td { background: rgba(41,56,71,.05); }
.row-mat      td { background: rgba(178,132,32,.06); }
.row-out      td { background: rgba(122,116,104,.06); }
.row-total    td { background: #293847 !important; color: #f5f0e8; font-weight: 700; }
.row-subtotal td { background: #eeeae3; font-weight: 600; }

/* ── TABS ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #dcd6ca; margin-bottom: 24px; }
.tab  { padding: 10px 20px; cursor: pointer; font-size: 14px; font-weight: 600;
        color: #888; border-bottom: 3px solid transparent; margin-bottom: -2px;
        transition: all .2s; }
.tab.active { color: #b28420; border-bottom-color: #b28420; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #15803d; border-left: 4px solid #16a34a; }
.alert-error   { background: #fee2e2; color: #dc2626; border-left: 4px solid #dc2626; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border-left: 4px solid #2563eb; }

/* ── EMPTY STATE ── */
.empty { text-align: center; padding: 48px; color: #aaa; }
.empty .icon { font-size: 48px; margin-bottom: 12px; }
.empty p { font-size: 15px; }

/* ── INLINE ROW ── */
.row { display: flex; gap: 12px; align-items: flex-end; }
.row .form-group { flex: 1; margin-bottom: 0; }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid #dcd6ca; margin: 20px 0; }

/* ── BACK LINK ── */
.back { display: inline-flex; align-items: center; gap: 6px;
        padding: 6px 14px; border-radius: 6px; border: 1.5px solid #dcd6ca;
        background: white; color: #5a6672; text-decoration: none;
        font-size: 13px; font-weight: 600; margin-bottom: 20px; transition: all .2s; }
.back:hover { border-color: #b28420; color: #96700f; background: white; }

/* ── TIPOGRAFIA ── */
.mono  { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.money { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 600; color: #b28420; }
.eyebrow { font-family: 'JetBrains Mono', ui-monospace, monospace;
           font-size: 11px; font-weight: 500; letter-spacing: .18em;
           text-transform: uppercase; color: #568280; }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ── Toast animation ── */
@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Msg flash estático (escondido quando JS exibe como Toast) ── */
.msg-flash-static { transition: opacity .2s; }

/* ── 4.2 Mobile sidebar ── */
.sb-toggle-btn {
  display: none;
  position: fixed;
  top: 12px; left: 12px; z-index: 201;
  background: #293847; color: #f5f0e8;
  border: none; border-radius: 6px;
  padding: 8px 11px; font-size: 20px;
  line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.sb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}
.sb-overlay.sb-open { display: block; }

@media (max-width: 768px) {
  body:has(.sidebar) { padding-left: 0; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.sb-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.3);
  }
  .sb-toggle-btn { display: block; }
  .page { padding: 16px; margin-top: 56px; }
}

/* ── 4.1 Breadcrumb ── */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: #94a3b8; margin-bottom: 16px; flex-wrap: wrap;
}
.breadcrumb a { color: #5a6672; text-decoration: none; }
.breadcrumb a:hover { color: #b28420; }
.breadcrumb .bc-sep { color: #cbd5e1; font-size: 11px; }
.breadcrumb .bc-current { color: #293847; font-weight: 600; }

/* ── 4.3 Tooltip de siglas ── */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: #293847; color: #f5f0e8;
  font-size: 11px; font-weight: 400; letter-spacing: 0;
  text-transform: none; white-space: nowrap;
  padding: 4px 10px; border-radius: 5px;
  pointer-events: none; opacity: 0;
  transition: opacity .15s; z-index: 500;
}
[data-tip]:hover::after { opacity: 1; }
