/* ==========================================================================
   HS ERP — TEMA (base LAYOUT PADRÃO Travimo · marca HS grafite + âmbar)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; }

:root {
  --hs-graphite: #1B1B1D; --hs-graphite-2: #2A2A2E; --hs-steel: #3A3A40;
  --accent-primary: #F5A623; --accent-hover: #D98E12; --accent-soft: #FEF4E1;
  --bg-app: #f8fafc; --bg-gray: #F2F4F7; --bg-surface: #fff; --bg-surface-hover: #f1f5f9;
  --text-main: #1e293b; --text-primary: #0f172a; --text-secondary: #475569;
  --text-muted: #64748b; --text-tertiary: #94a3b8;
  --accent-success: #10b981; --accent-danger: #E11D2A; --accent-info: #2563eb;
  --sidebar-width: 260px; --border-color: #cbd5e1; --border-soft: #e2e8f0;
  --radius-md: 10px; --radius-lg: 20px;
  --shadow-sm: 0 4px 6px -1px rgba(0,0,0,.05); --shadow-md: 0 10px 25px -5px rgba(0,0,0,.1);
}

body { background: var(--bg-gray); color: var(--text-main); height: 100vh; width: 100vw; overflow: hidden; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }

/* ============ HEADER ============ */
.main-header { width: 100%; height: 80px; background: var(--hs-graphite); display: flex; align-items: center; justify-content: space-between; padding: 0 30px; box-shadow: 0 4px 12px rgba(0,0,0,.15); z-index: 100; }
.header-left { display: flex; align-items: center; gap: 16px; }
.logo-img { height: 62px; width: auto; filter: brightness(0) invert(1); }
.divider-red { width: 2px; height: 35px; background: var(--accent-primary); margin: 0 12px; border-radius: 2px; }
.system-tag { color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px; opacity: .85; }
.header-right { display: flex; align-items: center; gap: 16px; }
.company-switch { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 14px; padding: 6px 14px; cursor: pointer; transition: all .2s; }
.company-switch:hover { background: rgba(255,255,255,.16); }
.company-switch select { background: transparent; border: none; color: #fff; font-weight: 800; font-size: 13px; outline: none; cursor: pointer; }
.company-switch select option { color: #1e293b; }
.search-container { display: flex; align-items: center; background: rgba(255,255,255,.10); border-radius: 20px; padding: 5px 15px; width: 240px; border: 1px solid rgba(255,255,255,.18); transition: all .3s; }
.search-container:focus-within { background: rgba(255,255,255,.18); width: 300px; }
.search-input { background: transparent; border: none; color: #fff; padding: 8px 10px; width: 100%; outline: none; font-size: .9rem; }
.search-input::placeholder { color: rgba(255,255,255,.6); }
.user-profile { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 15px; cursor: pointer; transition: background .2s; }
.user-profile:hover { background: rgba(255,255,255,.12); }
.user-info { text-align: right; color: #fff; }
.user-name { font-size: 14px; font-weight: 700; display: block; }
.user-role { font-size: 10px; font-weight: 600; text-transform: uppercase; opacity: .85; }
.avatar { width: 46px; height: 46px; background: var(--accent-primary); color: var(--hs-graphite); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 18px; border: 3px solid #fff; }
.btn-icon-white { background: var(--accent-primary); border: none; color: var(--hs-graphite); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .2s; position: relative; }
.btn-icon-white:hover { background: #fff; }
.notif-badge { position: absolute; top: -2px; right: -2px; background: var(--accent-danger); color: #fff; font-size: .65rem; font-weight: 900; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--hs-graphite); }
.btn-logout { background: var(--accent-primary); color: var(--hs-graphite); border: none; padding: 12px 26px; border-radius: 15px; font-weight: 800; font-size: 14px; cursor: pointer; transition: all .2s; }
.btn-logout:hover { filter: brightness(1.05); transform: translateY(-1px); }

/* ============ SIDEBAR ============ */
.app-body { flex: 1; display: flex; overflow: hidden; }
.sidebar { width: var(--sidebar-width); background: #fff; margin: 20px 0 20px 20px; border-radius: 30px; border: 1px solid var(--border-color); display: flex; flex-direction: column; padding: 20px 15px; z-index: 10; }
.nav-list { list-style: none; flex: 1; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 13px 18px; color: var(--text-muted); text-decoration: none; font-weight: 500; font-size: 14px; border-radius: 18px; margin-bottom: 4px; cursor: pointer; transition: all .2s; user-select: none; }
.nav-item:hover { background: var(--bg-surface-hover); color: var(--hs-graphite); }
.nav-item.active { background: var(--accent-soft); color: var(--hs-graphite); font-weight: 800; box-shadow: inset 3px 0 0 var(--accent-primary); }
.nav-item i { width: 18px; height: 18px; color: inherit; display: inline-flex; align-items: center; justify-content: center; }
.nav-emoji { font-size: 18px; }
.sidebar-footer { border-top: 1px solid var(--border-color); padding-top: 15px; display: flex; flex-direction: column; gap: 10px; }
.btn-support { width: 100%; padding: 12px; background: var(--bg-surface-hover); border: none; border-radius: 15px; color: var(--text-muted); font-weight: 700; font-size: 12px; cursor: pointer; }
.btn-support:hover { background: var(--hs-graphite); color: #fff; }

/* ============ CONTENT ============ */
.content-area { flex: 1; padding: 36px 40px; overflow-y: auto; }
.page-content { animation: fadeIn .35s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-header { margin-bottom: 26px; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 27px; font-weight: 800; color: var(--text-primary); }
.page-subtitle { color: var(--text-tertiary); font-weight: 500; font-size: 15px; margin-top: 4px; }
.phase-badge { display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 20px; background: var(--hs-graphite); color: var(--accent-primary); font-size: 11px; font-weight: 800; letter-spacing: .5px; }

/* ============ BOTÕES ============ */
.btn { border: none; border-radius: 12px; padding: 11px 20px; font-weight: 800; font-size: 14px; cursor: pointer; transition: all .18s; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent-primary); color: var(--hs-graphite); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-dark { background: var(--hs-graphite); color: #fff; }
.btn-light { background: var(--bg-surface-hover); color: var(--text-secondary); }
.btn-light:hover { background: var(--border-soft); }
.btn-danger { background: var(--accent-danger); color: #fff; }
.btn-success { background: var(--accent-success); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: 9px; }
.btn-icon-close { background: #f1f5f9; color: #64748b; border: none; width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.btn-icon-close:hover { background: var(--accent-danger); color: #fff; }
.icon-btn { background: transparent; border: 1px solid var(--border-soft); color: var(--text-muted); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all .15s; }
.icon-btn:hover { background: var(--bg-surface-hover); color: var(--hs-graphite); }
.icon-btn.danger:hover { background: var(--accent-danger); color: #fff; border-color: var(--accent-danger); }

/* ============ KPIs ============ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 18px; margin-bottom: 26px; }
.kpi { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 5px; box-shadow: var(--shadow-sm); }
.kpi-accent { border-left: 5px solid var(--accent-primary); }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 25px; font-weight: 900; color: var(--text-primary); }
.kpi-sub { font-size: 12px; font-weight: 700; }
.up { color: var(--accent-success); } .down { color: var(--accent-danger); } .neutral { color: var(--text-tertiary); }

/* ============ CARDS ============ */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px,1fr)); gap: 22px; }
.card { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 30px 22px; display: flex; flex-direction: column; align-items: flex-start; cursor: pointer; transition: all .3s cubic-bezier(.34,1.56,.64,1); box-shadow: var(--shadow-sm); }
.card:hover { transform: translateY(-8px); box-shadow: var(--shadow-md); border-color: var(--accent-primary); }
.card-icon-box { width: 66px; height: 66px; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 32px; margin-bottom: 18px; }
.card-title { font-size: 18px; font-weight: 800; color: var(--text-primary); margin-bottom: 7px; }
.card-desc { font-size: 13px; color: var(--text-muted); font-weight: 500; line-height: 1.5; }
.bg-blue { background: #eff6ff; } .bg-green { background: #f0fdf4; } .bg-purple { background: #faf5ff; }
.bg-orange { background: #fff7ed; } .bg-amber { background: var(--accent-soft); } .bg-gray { background: #f1f5f9; }

/* ============ PANEL / TOOLBAR ============ */
.panel { background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel + .panel { margin-top: 22px; }
.panel-head { padding: 18px 22px; border-bottom: 1px solid var(--border-soft); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.panel-title { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .field { margin: 0; }
.filter-select, .filter-input { padding: 9px 12px; border: 1px solid var(--border-color); border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-secondary); background: #fff; outline: none; }
.filter-select:focus, .filter-input:focus { border-color: var(--accent-primary); }

/* ============ TABELAS ============ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: var(--bg-surface-hover); padding: 13px 15px; font-size: .74rem; color: var(--text-secondary); text-align: left; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
.data-table td { padding: 13px 15px; border-bottom: 1px solid var(--border-soft); font-size: .88rem; color: var(--text-main); white-space: nowrap; }
.data-table tbody tr:hover { background: #fbfcfe; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .strong { font-weight: 800; color: var(--text-primary); }
.empty-state { padding: 50px 20px; text-align: center; color: var(--text-tertiary); }
.empty-state .em { font-size: 40px; display: block; margin-bottom: 10px; }
.empty-state .em i { width: 40px; height: 40px; margin: 0 auto; opacity: .5; display: inline-block; }

/* pílulas de status / tipo */
.pill { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 800; letter-spacing: .3px; }
.pill-open { background: #fff7ed; color: #c2410c; } .pill-partial { background: #eff6ff; color: #1d4ed8; }
.pill-done { background: #f0fdf4; color: #047857; } .pill-late { background: #fef2f2; color: #b91c1c; }
.pill-in { background: #ecfdf5; color: #047857; } .pill-out { background: #fef2f2; color: #b91c1c; }
.pill-mut { background: #f1f5f9; color: #475569; }
.val-pos { color: var(--accent-success); font-weight: 800; } .val-neg { color: var(--accent-danger); font-weight: 800; }

/* ============ FORMULÁRIOS / MODAL ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.8); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: 10000; }
.modal-container { background: var(--bg-app); width: 95%; display: flex; flex-direction: column; overflow: hidden; border-radius: 26px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.35); }
.modal-header { padding: 18px 30px; background: var(--bg-surface); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.modal-content { flex: 1; overflow-y: auto; padding: 26px 30px; }
.modal-footer { padding: 16px 30px; background: var(--bg-surface); border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid .col-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); }
.field label .req { color: var(--accent-danger); }
.input-control { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 10px; width: 100%; font-size: .9rem; background: #fff; transition: all .2s; }
.input-control:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(245,166,35,.15); }
textarea.input-control { resize: vertical; min-height: 74px; }
.form-section-title { font-size: 12px; font-weight: 800; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .5px; margin: 6px 0 2px; grid-column: span 2; }

/* DRE */
.dre-table { width: 100%; border-collapse: collapse; }
.dre-table td { padding: 9px 14px; font-size: .88rem; border-bottom: 1px solid var(--border-soft); }
.dre-table .g-row td { background: var(--bg-surface-hover); font-weight: 800; color: var(--text-primary); text-transform: uppercase; font-size: .8rem; letter-spacing: .3px; }
.dre-table .sub td { color: var(--text-secondary); padding-left: 30px; }
.dre-table .total-row td { background: var(--hs-graphite); color: #fff; font-weight: 900; font-size: .92rem; }
.dre-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============ MOBILE ============ */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -320px; transition: left .3s; height: calc(100vh - 40px); }
  .sidebar.mobile-open { left: 0; box-shadow: var(--shadow-md); }
  .cards-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .col-2 { grid-column: span 1; }
  .modal-container { width: 100vw; height: 100vh; border-radius: 0; max-height: 100vh; }
  .search-container { width: 120px; } .company-switch, .brand-tag, .system-tag, .divider-red { display: none; }
  .content-area { padding: 22px 16px; }
}

/* LOADER */
.page-loader { position: fixed; inset: 0; background: var(--hs-graphite); display: flex; align-items: center; justify-content: center; z-index: 999999; transition: opacity .5s; }
.loader-hidden { opacity: 0; visibility: hidden; }

.login-screen { position: fixed; inset: 0; z-index: 999998; display: none; align-items: center; justify-content: center; background: var(--hs-graphite) radial-gradient(circle at 30% 20%, var(--hs-graphite-2), var(--hs-graphite) 60%); }
.login-card { width: 380px; max-width: 90vw; background: #fff; border-radius: 30px; padding: 40px 34px 34px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 25px 60px -15px rgba(0,0,0,.5); animation: fadeIn .25s; }
.login-logo { height: 70px; width: auto; margin: 0 auto 6px; display: block; }
.login-card h1 { font-size: 21px; font-weight: 800; color: var(--text-primary); text-align: center; }
.login-sub { font-size: 13px; color: var(--text-tertiary); text-align: center; margin-top: -10px; margin-bottom: 6px; font-weight: 600; }
.login-card .field { display: flex; flex-direction: column; gap: 6px; }
.login-btn { width: 100%; justify-content: center; padding: 13px; font-size: 15px; margin-top: 6px; }
.login-erro { display: none; background: #FEF2F2; color: var(--accent-danger); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 700; text-align: center; }
.login-erro.show { display: block; }
@keyframes loaderMove { 0% { left: -40%; } 100% { left: 140%; } }

/* ACTION BUTTONS ALIGNMENT */
.action-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

/* Dropdown de Notificações */
.notif-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 12px;
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.notif-header .clear-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.notif-header .clear-btn:hover {
  background: rgba(0,0,0,0.05);
}

.notif-list {
  max-height: 280px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s ease;
  text-decoration: none;
}

.notif-item:hover {
  background: var(--bg-surface-hover);
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-icon {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.notif-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-primary);
}

.notif-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notif-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
}

