/* ============================================================
   Gestão de Lojas — Design System
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f9;
  --border: #e4e8f0;
  --border-strong: #d2d8e4;
  --text: #1a2233;
  --text-soft: #5a6478;
  --text-mut: #8b94a7;
  --primary: #4f46e5;
  --primary-soft: #eef0fe;
  --primary-strong: #4338ca;
  --accent: #0ea5e9;
  --green: #16a34a;
  --green-soft: #e7f6ec;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #d97706;
  --amber-soft: #fdf3e3;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --purple: #7c3aed;
  --purple-soft: #f0eafe;
  --shadow-sm: 0 1px 2px rgba(20, 27, 45, 0.05);
  --shadow: 0 4px 16px rgba(20, 27, 45, 0.08);
  --shadow-lg: 0 18px 50px rgba(20, 27, 45, 0.18);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --sidebar-w: 256px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #161b25;
  --surface-2: #1b212d;
  --surface-3: #222a38;
  --border: #283042;
  --border-strong: #38415a;
  --text: #e8ecf4;
  --text-soft: #a4adc2;
  --text-mut: #6b7488;
  --primary: #7c80ff;
  --primary-strong: #9396ff;
  --primary-soft: #20223c;
  --green-soft: #14271c;
  --red-soft: #2a1717;
  --amber-soft: #2a2113;
  --blue-soft: #15203a;
  --purple-soft: #211a3a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.6);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-mut); }

/* ---------- Animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============================================================
   LOGIN
   ============================================================ */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0ea5e9 100%);
  padding: 24px;
}
.login-screen::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.18), transparent 45%),
              radial-gradient(circle at 80% 70%, rgba(255,255,255,0.12), transparent 40%);
}
.login-card {
  position: relative; width: 100%; max-width: 410px;
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 40px 36px; box-shadow: var(--shadow-lg);
  animation: scaleIn 0.5s var(--ease);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 24px; text-align: center; }
.login-logo-img { width: 100%; max-width: 360px; height: auto; display: block; }
.login-brand-text h1 { margin-top: 2px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 13px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px;
}
.login-brand h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; }
.login-brand p { font-size: 12.5px; color: var(--text-mut); }
.login-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.4px; }
.login-card .sub { color: var(--text-soft); margin-bottom: 26px; font-size: 13.5px; }
.login-error {
  background: var(--red-soft); color: var(--red); padding: 10px 14px;
  border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px;
  display: none; animation: fadeIn 0.3s;
}
.login-hint {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-mut); text-align: center; line-height: 1.7;
}
.login-hint code { background: var(--surface-3); padding: 2px 7px; border-radius: 5px; color: var(--text-soft); font-size: 12px; }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field label .req { color: var(--red); }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; font-size: 14px; font-family: inherit;
  background: var(--surface-2); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-mut); }
.textarea { resize: vertical; min-height: 80px; }
.select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238b94a7' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.field-hint { font-size: 11.5px; color: var(--text-mut); margin-top: 5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px; font-size: 13.5px; font-weight: 600; border: none;
  border-radius: var(--radius-sm); background: var(--surface-3); color: var(--text);
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, filter 0.2s;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(79,70,229,0.32); }
.btn-primary:hover { background: var(--primary-strong); filter: brightness(1.04); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.07); background: var(--green); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.07); background: var(--red); }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 14.5px; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn .ti { font-size: 17px; }

.icon-btn {
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-soft); border-radius: 9px;
  transition: background 0.2s, color 0.2s, transform 0.15s; font-size: 18px;
}
.icon-btn:hover { background: var(--surface-3); color: var(--primary); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.danger { color: var(--red); opacity: 0.85; }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); opacity: 1; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: none; min-height: 100vh; }
.app.active { display: block; }

.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 40;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; transition: transform 0.35s var(--ease);
}
.sidebar-brand {
  display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding: 16px 18px 14px;
}
.sidebar-logo-img { width: 100%; height: auto; display: block; border-radius: 8px; }
.sidebar-logo {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 19px;
}
.sidebar-brand .name { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.2; }
.sidebar-brand .tag { font-size: 11px; color: var(--text-mut); }
.nav { flex: 1; overflow-y: auto; padding: 8px 14px 14px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-mut); padding: 14px 12px 7px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 2px;
  border-radius: 10px; color: var(--text-soft); font-size: 13.5px; font-weight: 500;
  transition: background 0.2s, color 0.2s; position: relative; cursor: pointer;
}
.nav-item .ti { font-size: 19px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.user-chip {
  display: flex; align-items: center; gap: 11px; padding: 9px; border-radius: 11px;
  transition: background 0.2s; cursor: pointer;
}
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.user-chip .info { flex: 1; min-width: 0; }
.user-chip .info .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .info .rl { font-size: 11px; color: var(--text-mut); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; transition: margin 0.35s var(--ease); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 30px; background: rgba(244,246,251,0.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .topbar { background: rgba(13,17,23,0.82); }
.topbar .menu-toggle { display: none; }
.page-title h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; }
.page-title p { font-size: 12.5px; color: var(--text-mut); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.content { padding: 26px 30px 60px; }
.view { animation: fadeUp 0.45s var(--ease); }

/* ============================================================
   CARDS / KPI
   ============================================================ */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; }
.card-head .ti { color: var(--text-mut); font-size: 18px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 20px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.kpi .kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi .kpi-ic { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 21px; }
.kpi .kpi-label { font-size: 12.5px; color: var(--text-soft); font-weight: 500; }
.kpi .kpi-val { font-size: 26px; font-weight: 800; letter-spacing: -0.8px; line-height: 1.1; margin-top: 2px; }
.kpi .kpi-foot { font-size: 12px; color: var(--text-mut); margin-top: 7px; display: flex; align-items: center; gap: 5px; }
.kpi .trend-up { color: var(--green); font-weight: 600; }
.kpi .trend-down { color: var(--red); font-weight: 600; }
.ic-green { background: var(--green-soft); color: var(--green); }
.ic-red { background: var(--red-soft); color: var(--red); }
.ic-blue { background: var(--blue-soft); color: var(--blue); }
.ic-purple { background: var(--purple-soft); color: var(--purple); }
.ic-amber { background: var(--amber-soft); color: var(--amber); }
.ic-primary { background: var(--primary-soft); color: var(--primary); }

.grid-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px; align-items: start; }
.grid-cols { display: grid; gap: 20px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; padding: 12px 16px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-mut);
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-mut); }

.empty {
  text-align: center; padding: 50px 20px; color: var(--text-mut);
}
.empty .ti { font-size: 46px; opacity: 0.4; margin-bottom: 12px; display: block; }
.empty p { font-size: 14px; margin-bottom: 4px; color: var(--text-soft); }
.empty span { font-size: 12.5px; }

/* ---------- Badges / pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px;
  font-size: 11.5px; font-weight: 600; border-radius: 30px; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-purple { background: var(--purple-soft); color: var(--purple); }
.pill-gray { background: var(--surface-3); color: var(--text-soft); }

/* ============================================================
   TOOLBAR / SEARCH / TABS
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search-box .ti { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-mut); font-size: 17px; pointer-events: none; }
.search-box input { padding-left: 40px; }
.toolbar .spacer { flex: 1; }

.tabs { display: flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 11px; }
.tab {
  padding: 8px 16px; font-size: 13px; font-weight: 600; border: none; background: transparent;
  color: var(--text-soft); border-radius: 8px; transition: background 0.2s, color 0.2s;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.seg { display: inline-flex; background: var(--surface-3); padding: 3px; border-radius: 9px; }
.seg button { padding: 6px 13px; font-size: 12.5px; font-weight: 600; border: none; background: transparent; color: var(--text-soft); border-radius: 7px; transition: 0.2s; }
.seg button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 120; background: rgba(15,20,35,0.5);
  backdrop-filter: blur(4px); display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto; opacity: 0; pointer-events: none;
  transition: opacity 0.3s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 560px;
  box-shadow: var(--shadow-lg); transform: scale(0.95) translateY(14px); opacity: 0;
  transition: transform 0.35s var(--ease), opacity 0.3s; margin: auto;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); opacity: 1; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 16px; }
.modal-head .m-ic { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.modal-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }
.modal-head p { font-size: 12.5px; color: var(--text-mut); }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 4px 24px 8px; max-height: 64vh; overflow-y: auto; }
.modal-foot { padding: 16px 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 13px 17px; min-width: 280px; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); animation: slideIn 0.4s var(--ease); font-size: 13.5px; font-weight: 500;
}
.toast .ti { font-size: 21px; flex-shrink: 0; }
.toast.success .ti { color: var(--green); }
.toast.error .ti { color: var(--red); }
.toast.info .ti { color: var(--blue); }
.toast.warn .ti { color: var(--amber); }
.toast.out { animation: fadeIn 0.3s reverse forwards; }

/* ============================================================
   MISC
   ============================================================ */
.alert-item {
  display: flex; align-items: flex-start; gap: 13px; padding: 13px 16px; border-radius: var(--radius-sm);
  background: var(--surface-2); margin-bottom: 9px; transition: background 0.2s; cursor: pointer;
}
.alert-item:hover { background: var(--surface-3); }
.alert-item .a-ic { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.alert-item .a-body { flex: 1; min-width: 0; }
.alert-item .a-title { font-size: 13px; font-weight: 600; }
.alert-item .a-desc { font-size: 12px; color: var(--text-mut); }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.doc-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
  position: relative; cursor: pointer;
}
.doc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.doc-ic { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 23px; margin-bottom: 12px; }
.doc-name { font-size: 13.5px; font-weight: 600; word-break: break-word; line-height: 1.35; margin-bottom: 3px; }
.doc-meta { font-size: 11.5px; color: var(--text-mut); }
.doc-actions { display: flex; gap: 4px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }

.darf-doc {
  background: #fff; color: #111; font-family: 'Courier New', monospace; padding: 28px;
  border: 1px solid #ccc; border-radius: 8px; font-size: 13px; line-height: 1.5;
}
.darf-doc h2 { text-align: center; font-size: 16px; margin-bottom: 4px; color: #111; }
.darf-doc .darf-row { display: flex; border-bottom: 1px dashed #bbb; padding: 6px 0; }
.darf-doc .darf-row .lbl { flex: 1; color: #555; }
.darf-doc .darf-row .val { font-weight: bold; text-align: right; }
.darf-doc .darf-total { background: #f0f0f0; padding: 10px; margin-top: 10px; border-radius: 6px; display: flex; justify-content: space-between; font-size: 15px; font-weight: bold; }

.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 36px 20px;
  text-align: center; color: var(--text-mut); transition: border-color 0.25s, background 0.25s; cursor: pointer;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.dropzone .ti { font-size: 38px; margin-bottom: 8px; }

.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }

.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-mut { color: var(--text-mut); }
.text-soft { color: var(--text-soft); }
.fw-700 { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.pos { color: var(--green); font-weight: 700; }
.neg { color: var(--red); font-weight: 700; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.5px; margin: 4px 0 12px; }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 200px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bar-stack { width: 100%; display: flex; flex-direction: column-reverse; gap: 3px; align-items: center; height: 100%; justify-content: flex-end; }
.bar { width: 60%; max-width: 34px; border-radius: 5px 5px 0 0; transition: height 0.7s var(--ease); min-height: 2px; }
.bar.in { background: var(--green); }
.bar.out { background: var(--red); opacity: 0.85; }
.bar-label { font-size: 11px; color: var(--text-mut); font-weight: 600; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-soft); }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }

.progress { height: 7px; background: var(--surface-3); border-radius: 10px; overflow: hidden; }
.progress .fill { height: 100%; border-radius: 10px; transition: width 0.8s var(--ease); }

.mini-stat { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--border); }
.mini-stat:last-child { border-bottom: none; }
.mini-stat .ms-label { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-soft); }
.mini-stat .ms-val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.backdrop { display: none; }
@media (max-width: 980px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar .menu-toggle { display: inline-flex; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 39; animation: fadeIn 0.3s; }
  .content { padding: 20px 16px 50px; }
  .topbar { padding: 14px 16px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .modal-foot, .no-print { display: none !important; }
  .main { margin: 0; }
  .modal-overlay { position: static; background: none; padding: 0; }
  .modal { box-shadow: none; max-width: 100%; }
}

/* ---------- Calendário / Agenda ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-head { margin-bottom: 6px; gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-mut); padding: 4px 0; }
.cal-cell { min-height: 92px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: border-color .15s, background .15s; overflow: hidden; }
.cal-cell:hover { border-color: var(--primary); background: var(--surface-3); }
.cal-cell.empty { background: transparent; border: none; cursor: default; }
.cal-cell.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-num { font-size: 12.5px; font-weight: 700; color: var(--text-soft); }
.cal-cell.today .cal-num { color: var(--primary); }
.cal-evs { display: flex; flex-direction: column; gap: 3px; }
.cal-ev { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-more { font-size: 10.5px; color: var(--text-mut); padding-left: 2px; }
@media (max-width: 720px) {
  .cal-grid { gap: 3px; }
  .cal-cell { min-height: 64px; border-radius: 8px; padding: 4px; }
  .cal-ev { font-size: 9.5px; padding: 1px 4px; }
  .cal-num { font-size: 11px; }
}

/* ---------- Índices econômicos ---------- */
.ix-row { display: flex; align-items: center; gap: 10px; padding: 7px 2px; border-bottom: 1px solid var(--border); }
.ix-row:last-child { border-bottom: none; }
.ix-mes { min-width: 78px; font-size: 12.5px; font-weight: 600; color: var(--text-soft); }
.ix-bar-wrap { flex: 1; height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.ix-bar { height: 100%; border-radius: 6px; }
.ix-bar.pos { background: var(--green); }
.ix-bar.neg { background: var(--red); }
.ix-val { min-width: 92px; text-align: right; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.ix-val.pos { color: var(--green); }
.ix-val.neg { color: var(--red); }

/* ---------- Explorador de arquivos ---------- */
.fx-path { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: 13.5px; }
.fx-crumb { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--text-soft); }
.fx-crumb:hover { background: var(--surface-3); color: var(--primary); }
.fx-folder { cursor: pointer; transition: transform .12s, border-color .12s, box-shadow .12s; }
.fx-folder:hover { border-color: var(--amber); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
/* Cores sólidas (glifo branco) — alto contraste em tema claro e escuro */
.sc-amber { background: var(--amber); color: #fff; }
.sc-blue { background: var(--blue); color: #fff; }
.sc-green { background: var(--green); color: #fff; }
.sc-red { background: var(--red); color: #fff; }
.sc-purple { background: var(--purple); color: #fff; }
.sc-primary { background: var(--primary); color: #fff; }
.fx-swatch { width: 38px; height: 38px; border-radius: 9px; border: 2px solid transparent; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; cursor: pointer; color: #fff; transition: transform .1s; }
.fx-swatch:hover { transform: scale(1.08); }
.fx-swatch.sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.fx-icon { width: 42px; height: 42px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface-3); color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; transition: all .12s; }
.fx-icon:hover { border-color: var(--primary); color: var(--primary); }
.fx-icon.sel { border-color: var(--primary); background: var(--primary); color: #fff; }
/* Estilo "Drive" */
.fx-sep { font-size: 14px; color: var(--text-mut); margin: 0 1px; }
.dr-section { font-size: 12px; font-weight: 700; letter-spacing: .02em; color: var(--text-soft); text-transform: uppercase; margin: 4px 2px 10px; }
.dr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 20px; }
.dr-grid-files { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.dr-folder { display: flex; align-items: center; gap: 10px; padding: 9px 6px 9px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; transition: background .12s, box-shadow .12s, border-color .12s; }
.dr-folder:hover { background: var(--surface-3); box-shadow: var(--shadow-sm); }
.dr-fi { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.dr-name { flex: 1; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-menu { flex-shrink: 0; opacity: 0; transition: opacity .12s; }
.dr-folder:hover .dr-menu, .dr-file:hover .dr-menu { opacity: 1; }
.dr-file { position: relative; display: flex; flex-direction: column; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; transition: background .12s, box-shadow .12s; }
.dr-file:hover { background: var(--surface-3); box-shadow: var(--shadow-sm); }
.dr-file-ic { height: 96px; display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--text-soft); background: var(--surface-3); }
.dr-file:hover .dr-file-ic { color: var(--primary); }
.dr-file-name { padding: 9px 11px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-file .dr-menu { position: absolute; top: 6px; right: 6px; background: var(--surface); border-radius: 8px; }
.dr-over { outline: 2px dashed var(--primary); outline-offset: 1px; background: var(--primary-soft) !important; }
.dr-folder.dr-over .dr-fi, .dr-over .dr-name { color: var(--primary); }
.dr-dragging { opacity: .4; }
.fx-crumb.dr-over { color: var(--primary); }

/* Menu de contexto (botão direito) */
.ctx-menu { position: fixed; z-index: 2000; min-width: 188px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; animation: scaleIn .12s ease; }
.ctx-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; border: none; background: transparent; color: var(--text); font-size: 13.5px; font-weight: 500; border-radius: 8px; cursor: pointer; text-align: left; }
.ctx-item:hover { background: var(--surface-3); }
.ctx-item i { font-size: 17px; color: var(--text-soft); width: 18px; text-align: center; }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger i { color: var(--red); }
.ctx-sep { height: 1px; background: var(--border); margin: 5px 6px; }
