@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700&display=swap');

:root {
  --bg: #f7f6f3; --surface: #fff; --surface-soft: #fbfaf7; --ink: #302e2a;
  --muted: #777168; --gold: #c4a15d; --gold-deep: #8d7549; --gold-soft: #eee0c2;
  --dark: #191b22; --dark-soft: #242731; --line: #e7e0d5; --danger: #a33a3a;
  --success: #327154; --warning: #9a6d26; --sidebar: 264px; --sidebar-mini: 78px;
  --shadow: 0 14px 40px rgba(49, 42, 31, .07); --radius: 16px;
  font-family: "DM Sans", system-ui, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
a { color: var(--gold-deep); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, .button, input[type="submit"] { cursor: pointer; }
:focus-visible { outline: 3px solid rgba(196, 161, 93, .38); outline-offset: 2px; }
h1, h2, h3 { font-family: Manrope, "DM Sans", sans-serif; letter-spacing: -.025em; color: var(--ink); }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); margin: 0 0 .35rem; }
h2 { font-size: 1.15rem; margin-top: 0; }
p { line-height: 1.6; }

.app-shell { min-height: 100vh; padding-left: var(--sidebar); transition: padding-left .25s ease; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); display: flex; flex-direction: column; color: #f8f4ea; background: linear-gradient(180deg, #1b1d24 0%, #15171c 100%); border-right: 1px solid #2f3036; transition: width .25s ease, transform .25s ease; }
.sidebar-brand { height: 92px; display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand > a { min-width: 0; flex: 1; display: flex; align-items: center; gap: 11px; color: white; text-decoration: none; overflow: hidden; }
.sidebar-brand img { width: 52px; height: 52px; flex: 0 0 auto; object-fit: cover; border-radius: 10px; }
.sidebar-brand span { display: grid; white-space: nowrap; letter-spacing: .12em; }
.sidebar-brand strong { font-size: .95rem; }
.sidebar-brand small { color: #c7a967; font-size: .55rem; letter-spacing: .28em; }
.sidebar-toggle { width: 28px; height: 28px; padding: 0; flex: 0 0 auto; color: #e7d3a6; background: #292b32; border: 1px solid #3a3c44; border-radius: 50%; font-size: 1.25rem; line-height: 1; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px 24px; scrollbar-width: thin; }
.nav-section { margin: 20px 12px 7px; color: #8f9096; font-size: .62rem; font-weight: 700; letter-spacing: .16em; line-height: 1; text-transform: uppercase; white-space: nowrap; }
.sidebar-nav a { position: relative; display: flex; align-items: center; min-height: 43px; margin: 2px 0; padding: 8px 12px; gap: 12px; color: #c9c9cc; border-radius: 10px; text-decoration: none; font-size: .88rem; font-weight: 500; white-space: nowrap; transition: .16s ease; }
.sidebar-nav a:hover { color: white; background: rgba(255,255,255,.06); }
.sidebar-nav a.active { color: #fff6df; background: linear-gradient(90deg, rgba(196,161,93,.25), rgba(196,161,93,.08)); }
.sidebar-nav a.active::before { content: ""; position: absolute; left: 0; width: 3px; height: 22px; background: var(--gold); border-radius: 0 4px 4px 0; }
.nav-icon { width: 24px; flex: 0 0 24px; text-align: center; color: #d1b776; font-size: 1.25rem; line-height: 1; }
.sidebar-account { min-height: 78px; display: flex; align-items: center; gap: 10px; padding: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.user-avatar { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; color: #28231b; background: var(--gold-soft); border-radius: 50%; font-weight: 700; }
.account-copy { min-width: 0; flex: 1; display: grid; }
.account-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.account-copy small { color: #9fa0a5; font-size: .68rem; }
.account-settings { color: #c9c9cc; text-decoration: none; }
.sidebar-collapsed { padding-left: var(--sidebar-mini); }
.sidebar-collapsed .sidebar { width: var(--sidebar-mini); }
.sidebar-collapsed .sidebar-brand { padding-inline: 13px; }
.sidebar-collapsed .sidebar-brand span, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-section, .sidebar-collapsed .account-copy, .sidebar-collapsed .account-settings { opacity: 0; width: 0; overflow: hidden; pointer-events: none; }
.sidebar-collapsed .sidebar-brand img { width: 44px; height: 44px; }
.sidebar-collapsed .sidebar-toggle { position: absolute; left: 64px; top: 34px; }
.sidebar-collapsed .sidebar-nav a { justify-content: center; padding-inline: 8px; }
.sidebar-collapsed .sidebar-account { justify-content: center; padding-inline: 8px; }

.app-frame { min-height: 100vh; }
.app-header { position: sticky; top: 0; z-index: 20; min-height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 12px clamp(18px, 3vw, 42px); background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.app-header > div:first-of-type { display: grid; }
.app-header strong { font-size: .9rem; }
.eyebrow { color: var(--gold-deep); font-size: .6rem; font-weight: 700; letter-spacing: .2em; }
.header-actions, .header-actions form { display: flex; align-items: center; gap: 12px; margin: 0; }
.header-user { color: var(--muted); font-size: .82rem; }
.quiet-button { padding: 8px 13px; color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 9px; }
.quiet-button:hover { border-color: var(--gold); }
.mobile-menu, .sidebar-overlay { display: none; }
.app-content { width: min(1440px, 100%); margin: 0 auto; padding: clamp(24px, 4vw, 48px); }

.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.page-heading p { margin: 4px 0 0; color: var(--muted); }
.page-kicker { display: block; margin-bottom: 7px; color: var(--gold-deep); font-size: .65rem; font-weight: 700; letter-spacing: .16em; }
.button.secondary { color: var(--gold-deep); background: white; border-color: var(--gold-soft); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 4px 0 0; font-size: 1.25rem; }
.section-heading a { font-size: .8rem; font-weight: 600; text-decoration: none; }
.overview-card { margin-bottom: 30px; }
.quick-section { margin-top: 30px; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 13px; }
.quick-grid > a { min-height: 88px; display: flex; align-items: center; gap: 14px; padding: 17px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; transition: .16s ease; }
.quick-grid > a:hover { border-color: var(--gold); box-shadow: var(--shadow); transform: translateY(-2px); }
.quick-grid > a > span { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; color: var(--gold-deep); background: #f5ecda; border-radius: 12px; font-size: 1.3rem; }
.quick-grid > a > div { min-width: 0; flex: 1; display: grid; gap: 3px; }
.quick-grid small { color: var(--muted); }
.quick-grid b { color: var(--gold); }
.empty-home { display: flex; align-items: center; gap: 16px; }
.empty-home > span { font-size: 2rem; color: var(--gold); }
.empty-home h2, .empty-home p { margin: 0; }
.card, .table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(255,255,255,.8); }
.card { padding: clamp(18px, 2.5vw, 28px); }
.card + .card { margin-top: 18px; }
.card.compact { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; }
.button, button, input[type="submit"] { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 10px 16px; color: white; background: var(--dark); border: 1px solid var(--dark); border-radius: 10px; font-weight: 600; text-decoration: none; transition: transform .15s ease, background .15s ease; }
.button:hover, button:hover, input[type="submit"]:hover { background: var(--dark-soft); transform: translateY(-1px); }
input, select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; color: var(--ink); background: white; border: 1px solid #d8cdbc; border-radius: 10px; }
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 7px; margin: 14px 0; color: #504b44; font-size: .83rem; font-weight: 600; }
fieldset { margin: 20px 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
legend { padding: 0 8px; font-weight: 700; }
.check { display: flex; align-items: center; gap: 8px; }
.check input, input[type="checkbox"], input[type="radio"] { width: 17px; min-height: 17px; accent-color: var(--gold-deep); }
.form-grid, .module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.search, .inline-form, .sales-actions, .metrics, .actions, .actions form, .category-list .card span, .category-list form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search { margin: 0 0 22px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; }
.search input, .search select { width: auto; min-width: 180px; flex: 1; }
.search .check { min-height: 42px; margin: 0; padding: 0 8px; white-space: nowrap; }
.inline-form { align-items: end; }
.inline-form label { flex: 1; min-width: 180px; }
.actions a { font-weight: 600; font-size: .82rem; }
.actions input, .actions select { width: auto; min-width: 130px; }
.actions button { min-height: 36px; padding: 7px 11px; font-size: .78rem; }
.sales-actions { align-items: end; }
.sales-actions form { display: flex; flex-wrap: wrap; gap: 9px; align-items: end; }
.sales-actions > a, .sales-actions > form > button, .sales-actions > form > input { min-height: 42px; }
.sales-actions .cancel-sale { margin-left: auto; }
.catalog-conversion { flex: 1; }
.catalog-conversion label { min-width: 280px; margin: 0; }
.catalog-pending { margin-bottom: 28px; border-color: var(--gold-soft); }
.catalog-pending .table-wrap { margin-bottom: 0; }
.receivable-actions > form { padding: 16px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }

.table-wrap { overflow-x: auto; margin: 14px 0 24px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #eee9e1; vertical-align: middle; }
th { color: #70695f; background: var(--surface-soft); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
tbody tr:hover { background: #fdfbf7; }
tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge.active { color: #245b43; background: #e1f2e8; }
.badge.inactive { color: #8b3030; background: #f7dfdf; }
.message { margin-bottom: 18px; padding: 13px 16px; border: 1px solid; border-radius: 11px; }
.message.error { color: #8f3030; background: #fff1f1; border-color: #efcaca; }
.message.success { color: #225e43; background: #edf8f1; border-color: #cbe8d6; }
small { color: var(--muted); }
label small, .form-grid small { color: var(--danger); }
.hint { color: #665c4d; background: #f3eee4; padding: 12px 14px; border-radius: 10px; }
.category-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

.metrics { align-items: stretch; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.metrics > div { position: relative; display: grid; gap: 7px; min-height: 102px; padding: 18px; background: var(--surface-soft); border: 1px solid #eee7dc; border-radius: 13px; }
.metrics > div::before { content: ""; position: absolute; top: 0; left: 18px; width: 34px; height: 3px; background: var(--gold); border-radius: 0 0 4px 4px; }
.metrics small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.metrics strong { align-self: end; font: 700 1.18rem Manrope, sans-serif; }
.report-kpis, .report-rankings { margin: 18px 0; }
.bar-list > div { display: grid; grid-template-columns: minmax(140px, 1fr) 3fr auto; gap: 12px; align-items: center; margin: 11px 0; }
.bar-track { height: 9px; background: #ebe5da; border-radius: 99px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--gold); }
.mini-bars { min-width: 130px; display: grid; gap: 4px; }
.mini-bars span { display: block; height: 7px; border-radius: 99px; }
.mini-bars .revenue { background: var(--success); }
.mini-bars .expense { background: var(--danger); }
.dre-table th, .dre-table td { white-space: nowrap; }
.dre-table .indent { padding-left: 32px; }
.dre-total { font-weight: 700; background: #f5f0e7; }
.dre-result { font-weight: 700; background: var(--dark); color: white; }
.cash-comparison, .sales-checkout, .sales-actions { margin-top: 18px; }

.guest-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 42%) 1fr; background: var(--surface); }
.guest-brand { position: relative; display: grid; place-items: center; min-height: 100vh; overflow: hidden; background: radial-gradient(circle at 48% 36%, #f7e7c4 0 13%, #d4ab60 13.2% 24%, #b88945 24.2% 31%, #1b1c22 31.2% 100%); }
.guest-brand::after { content: ""; position: absolute; inset: 24px; border: 1px solid rgba(255,255,255,.16); }
.guest-brand img { position: relative; z-index: 1; width: min(260px, 55%); aspect-ratio: 1; object-fit: cover; border-radius: 18px; box-shadow: var(--shadow); }
.guest-content { width: min(480px, calc(100% - 40px)); align-self: center; justify-self: center; padding: 36px 0; }
.login-card { padding: 0; border: 0; box-shadow: none; }
.login-card::before { content: "ACESSO SEGURO"; display: block; margin-bottom: 12px; color: var(--gold-deep); font-size: .68rem; font-weight: 700; letter-spacing: .18em; }
.login-card h1 { margin-bottom: 24px; }
.login-card button, .login-card input[type="submit"] { width: 100%; margin-top: 8px; }

@media (max-width: 980px) {
  .app-shell, .sidebar-collapsed { padding-left: 0; }
  .sidebar, .sidebar-collapsed .sidebar { width: min(292px, 88vw); transform: translateX(-105%); box-shadow: 18px 0 50px rgba(0,0,0,.22); }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-toggle { display: none; }
  .sidebar-collapsed .sidebar-brand span, .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-section, .sidebar-collapsed .account-copy, .sidebar-collapsed .account-settings { opacity: 1; width: auto; pointer-events: auto; }
  .sidebar-collapsed .sidebar-nav a { justify-content: flex-start; padding-inline: 12px; }
  .sidebar-collapsed .sidebar-account { justify-content: flex-start; padding-inline: 14px; }
  .mobile-menu { display: inline-grid; place-items: center; width: 42px; height: 42px; padding: 0; color: var(--ink); background: white; border-color: var(--line); }
  .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 25; padding: 0; opacity: 0; visibility: hidden; background: rgba(10,10,12,.48); border: 0; border-radius: 0; transition: .2s; }
  .sidebar-open .sidebar-overlay { opacity: 1; visibility: visible; }
  .app-header { justify-content: flex-start; gap: 14px; }
  .header-actions { margin-left: auto; }
}
@media (max-width: 720px) {
  .app-content { padding: 24px 16px 40px; }
  .app-header { min-height: 64px; padding-inline: 14px; }
  .app-header > div:first-of-type, .header-user { display: none; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { align-self: flex-start; }
  .form-grid, .module-grid, .metrics { grid-template-columns: 1fr; }
  .search { align-items: stretch; flex-direction: column; }
  .search input, .search select { width: 100%; }
  .bar-list > div { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; }
  .guest-shell { display: block; min-height: 100vh; }
  .guest-brand { min-height: 180px; background: var(--dark); }
  .guest-brand::after { inset: 12px; }
  .guest-brand img { width: 120px; }
  .guest-content { padding: 36px 0 60px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
