/* =====================================================================
   Edi Brunetti · Ateliê — design system
   Paleta derivada da logo: petróleo #1F4E5A + dourado #D4A24C sobre linho.
   ===================================================================== */
:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Montserrat', var(--font-ui);

  --bg: #F3EFE8;
  --bg-2: #EBE6DD;
  --surface: #FFFFFF;
  --surface-2: #FAF8F4;
  --sidebar: #FBF9F5;

  --ink: #1B2A30;
  --ink-2: #4E5F66;
  --muted: #86959B;
  --line: #E6E0D6;
  --line-2: #D8D0C3;

  --brand: #1F4E5A;
  --brand-2: #173E48;
  --brand-3: #0F2F37;
  --brand-soft: #E4EEF0;
  --brand-soft-2: #CFE0E4;
  --brand-ring: rgba(31, 78, 90, .22);

  --gold: #D4A24C;
  --gold-2: #B8862B;
  --gold-soft: #F8EED9;

  --success: #2E7D4F; --success-soft: #E3F1E8;
  --warning: #B9770E; --warning-soft: #FBF0DB;
  --danger:  #B5423F; --danger-soft:  #F8E4E3;
  --info:    #3B6EA8; --info-soft:    #E3ECF7;
  --teal:    #2A8C7A; --teal-soft:    #E0F1EE;
  --dark:    #4A4A4A; --dark-soft:    #ECEAE6;

  --chart-1: #0B8FA6;
  --chart-2: #B8862B;
  --chart-grid: #ECE7DE;
  --chart-axis: #86959B;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(27, 42, 48, .05);
  --shadow: 0 1px 2px rgba(27, 42, 48, .04), 0 10px 30px -14px rgba(27, 42, 48, .16);
  --shadow-lg: 0 30px 70px -30px rgba(27, 42, 48, .35);
  --sidebar-w: 268px;
  --topbar-h: 68px;
}

/* ------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0 0 .75em; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
img { max-width: 100%; display: block; }
strong, b { font-weight: 600; }
small { font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; }
::selection { background: var(--brand-soft-2); }

.ico { flex: none; vertical-align: -3px; }

/* ------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky; top: 0; height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 40;
}
.brand { display: block; padding: 22px 24px 14px; }
.brand img { height: 46px; width: auto; }
.nav { flex: 1; overflow-y: auto; padding: 6px 14px 14px; scrollbar-width: thin; }
.nav-section {
  display: block; margin: 16px 12px 6px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 2px 0;
  border-radius: 10px;
  color: var(--ink-2); font-weight: 500; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--bg-2); color: var(--ink); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(31, 78, 90, .6); }
.nav-item.active .ico { color: var(--gold); }
.nav-item .count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px;
  border-radius: 999px; background: var(--bg-2); color: var(--ink-2);
  font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
}
.nav-item.active .count { background: rgba(255, 255, 255, .18); color: #fff; }
.nav-item .count.hot { background: var(--gold-soft); color: var(--gold-2); }
.nav-footer { border-top: 1px solid var(--line); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.nav-footer .who { flex: 1; min-width: 0; }
.nav-footer .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-footer .who span { font-size: 12px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 32px;
  position: sticky; top: 0; z-index: 30;
  background: rgba(243, 239, 232, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date { font-size: 13px; color: var(--muted); }
.sidebar-toggle { display: none; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(27, 42, 48, .45); z-index: 35; }

.content { padding: 8px 32px 48px; max-width: 1480px; width: 100%; }

/* ------------------------------------------------------------- page head */
.page-head { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin: 12px 0 22px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-title { font-size: 28px; font-weight: 600; line-height: 1.15; }
.page-title::after { content: ''; display: block; width: 44px; height: 3px; border-radius: 3px; background: var(--gold); margin-top: 10px; }
.page-sub { color: var(--ink-2); margin-top: 8px; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }

/* ------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid rgba(31, 78, 90, .08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 0; flex-wrap: wrap; }
.card-head .grow { flex: 1; }
.card-title { font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .ico { color: var(--brand); }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 18px 22px 22px; }
.card-head + .card-body { padding-top: 14px; }
.card-foot { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card.flush .card-body { padding: 0; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.brand { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-3) 100%); color: #fff; border: 0; }
.card.brand .card-title, .card.brand h1, .card.brand h2, .card.brand h3 { color: #fff; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span-2 { grid-column: span 2; }

/* ------------------------------------------------------------- stat tiles */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid rgba(31, 78, 90, .08); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px; min-height: 112px;
}
.stat-label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat-label .ico { color: var(--brand); opacity: .8; }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.stat-value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stat-hero { background: linear-gradient(135deg, var(--brand) 0%, var(--brand-3) 100%); color: #fff; border: 0; }
.stat-hero .stat-label, .stat-hero .stat-foot { color: rgba(255, 255, 255, .78); }
.stat-hero .stat-label .ico { color: var(--gold); opacity: 1; }
.stat-hero .stat-value { font-size: 34px; color: #fff; }
.stat-hero::after { content: ''; position: absolute; right: -30px; bottom: -50px; width: 160px; height: 160px; border-radius: 50%; background: rgba(212, 162, 76, .18); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12.5px; padding: 2px 8px; border-radius: 999px; }
.delta.up { color: var(--success); background: var(--success-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--ink-2); background: var(--bg-2); }
.stat-hero .delta.up { background: rgba(255, 255, 255, .16); color: #CFEFD9; }
.stat-hero .delta.down { background: rgba(255, 255, 255, .16); color: #FFD3D0; }
.stat-hero .delta.flat { background: rgba(255, 255, 255, .16); color: #fff; }
.stat.alert { border-color: rgba(181, 66, 63, .35); }
.stat.alert .stat-value { color: var(--danger); }

/* ------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-ring); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px rgba(31, 78, 90, .7); }
.btn-primary:hover { background: var(--brand-2); color: #fff; }
.btn-gold { background: var(--gold); color: #2B2410; }
.btn-gold:hover { background: #C9963F; color: #2B2410; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #256641; color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 9px; }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 50; display: none;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: 8px; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-2); }
.dropdown-menu .ico { color: var(--brand); }
.dropdown-sep { height: 1px; background: var(--line); margin: 6px 0; }

/* ------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap;
}
.badge-muted   { background: var(--bg-2); color: var(--ink-2); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-gold    { background: var(--gold-soft); color: var(--gold-2); }
.badge-teal    { background: var(--teal-soft); color: var(--teal); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-dark    { background: var(--dark-soft); color: var(--dark); }
.badge-brand   { background: var(--brand-soft); color: var(--brand); }
.badge-outline { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }

/* ------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FCFBF8; }
.table tr.row-link { cursor: pointer; }
.table .t-right, .table .t-num { text-align: right; }
.table .t-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .t-center { text-align: center; }
.table .t-nowrap { white-space: nowrap; }
.table .t-actions { text-align: right; white-space: nowrap; width: 1%; }
.table .t-actions .btn { opacity: .55; }
.table tr:hover .t-actions .btn { opacity: 1; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 2px solid var(--line-2); }
.table .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.table .cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.table .cell-main .txt { min-width: 0; }
.table .cell-main .txt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.table.compact th, .table.compact td { padding: 8px 10px; }
.table.no-head thead { display: none; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 22px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 22px; }

/* ------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 16px; }
.field { grid-column: span 12; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.c-1 { grid-column: span 1; } .c-2 { grid-column: span 2; } .c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; }
.c-5 { grid-column: span 5; } .c-6 { grid-column: span 6; } .c-7 { grid-column: span 7; } .c-8 { grid-column: span 8; }
.c-9 { grid-column: span 9; } .c-10 { grid-column: span 10; } .c-12 { grid-column: span 12; }
label, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.req::after { content: ' *'; color: var(--danger); }
.input, select, textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2386959B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input:focus, select:focus, textarea:focus, .combo-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.input::placeholder, textarea::placeholder { color: #A9B3B7; }
.input.is-invalid, select.is-invalid { border-color: var(--danger); }
.input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.input-sm, select.input-sm { height: 34px; font-size: 13px; border-radius: 8px; }
.input-group { display: flex; align-items: stretch; }
.input-group > .prefix, .input-group > .suffix { display: flex; align-items: center; padding: 0 11px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.input-group > .prefix { border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > .suffix { border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group > .input { border-radius: 0; flex: 1; min-width: 0; }
.input-group > .input:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group > .input:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-group > .prefix + .input:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.help { font-size: 12px; color: var(--muted); }
.error { font-size: 12px; color: var(--danger); font-weight: 500; }
.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink); cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 40px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--brand-ring); }
.form-section { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section-title { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.form-actions .left { margin-right: auto; }
.upload-box { display: flex; gap: 16px; align-items: center; }
.upload-box .preview { width: 96px; height: 96px; border-radius: 12px; border: 1px dashed var(--line-2); background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; flex: none; }
.upload-box .preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-box input[type=file] { font-size: 13px; }

/* combo (select pesquisável) */
.combo { position: relative; }
.combo-input { width: 100%; height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); font: inherit; font-size: 14px; color: var(--ink); }
.combo-input.input-sm { height: 34px; font-size: 13px; border-radius: 8px; }
.combo::after { content: ''; position: absolute; right: 12px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; display: none; padding: 4px; }
.combo.open .combo-list { display: block; }
.combo-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.combo-item .sub { font-size: 12px; color: var(--muted); }
.combo-item:hover, .combo-item.active { background: var(--brand-soft); }
.combo-item.group { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); cursor: default; padding-top: 10px; }
.combo-item.group:hover { background: none; }
.combo-empty { padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }

/* ------------------------------------------------------------- filters */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters .input, .filters select { height: 38px; }
.filters .search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.filters .search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filters .search .input { padding-left: 38px; }
.filters select { width: auto; min-width: 150px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .count { font-size: 11.5px; opacity: .8; }

/* ------------------------------------------------------------- pagination */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.pagination a:hover { background: var(--bg-2); color: var(--ink); }
.pagination .current { background: var(--brand); color: #fff; }
.pagination .dots { color: var(--muted); }
.pager-info { font-size: 13px; color: var(--muted); margin-right: auto; }

/* ------------------------------------------------------------- avatar / thumbs */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; letter-spacing: .02em; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.xl { width: 104px; height: 104px; font-size: 34px; }
.avatar.gold { background: var(--gold-soft); color: var(--gold-2); }
.thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); overflow: hidden; flex: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.lg { width: 72px; height: 72px; border-radius: 14px; }
.thumb.xl { width: 100%; aspect-ratio: 4 / 3; height: auto; border-radius: var(--radius); }

/* ------------------------------------------------------------- product cards */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.pcard { background: var(--surface); border: 1px solid rgba(31, 78, 90, .08); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; color: inherit; }
.pcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.pcard-img { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); position: relative; overflow: hidden; }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.pcard-img .badge { position: absolute; top: 10px; left: 10px; }
.pcard-img .star { position: absolute; top: 10px; right: 10px; color: var(--gold); background: #fff; border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.pcard-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.pcard-cat { font-size: 12px; color: var(--muted); }
.pcard-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: auto; }
.price { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.price small { font-weight: 500; color: var(--muted); font-size: 12px; }
.meter { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--brand); }
.meter-fill.success { background: var(--success); }
.meter-fill.warning { background: var(--warning); }
.meter-fill.danger { background: var(--danger); }
.meter-fill.gold { background: var(--gold); }

/* ------------------------------------------------------------- lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); color: inherit; }
.list-item:last-child { border-bottom: 0; }
.list-item:first-child { padding-top: 0; }
a.list-item:hover .list-title { color: var(--brand); }
.list-body { flex: 1; min-width: 0; }
.list-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-right { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; max-width: 45%; }
.list-right b { display: block; font-size: 14px; white-space: nowrap; }
.list-right span { font-size: 12px; color: var(--muted); }
.day-badge { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex: none; }
.day-badge b { font-size: 17px; }
.day-badge span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }
.day-badge.late { background: var(--danger-soft); color: var(--danger); }
.day-badge.today { background: var(--gold-soft); color: var(--gold-2); }

/* ------------------------------------------------------------- key/value */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.kv.stack { grid-template-columns: 1fr; gap: 12px; }
.kv.stack dt { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }

/* ------------------------------------------------------------- cost breakdown */
.cost-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.cost-line { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 14px; gap: 12px; }
.cost-line span { color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.cost-line b { font-variant-numeric: tabular-nums; }
.cost-line.total { border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 12px; font-size: 15px; }
.cost-line.total b { font-size: 18px; }
.cost-line.sale { color: var(--brand); }
.cost-line.sale b { color: var(--brand); font-size: 20px; }
.margin-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.margin-pill.success { background: var(--success-soft); color: var(--success); }
.margin-pill.warning { background: var(--warning-soft); color: var(--warning); }
.margin-pill.danger { background: var(--danger-soft); color: var(--danger); }
.hint-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--gold-soft); color: #5E4712; font-size: 13px; border: 1px solid #F0DDB0; }
.hint-box .ico { color: var(--gold-2); flex: none; margin-top: 1px; }
.hint-box.info { background: var(--info-soft); color: #23466E; border-color: #C9D9EE; }
.hint-box.info .ico { color: var(--info); }
.hint-box.danger { background: var(--danger-soft); color: #7A2825; border-color: #EEC9C7; }
.hint-box.danger .ico { color: var(--danger); }
.hint-box.success { background: var(--success-soft); color: #1F5536; border-color: #C6E3D1; }
.hint-box.success .ico { color: var(--success); }

/* ------------------------------------------------------------- steps (status do pedido) */
.steps { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 4px 0; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.step .n { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; background: var(--surface); flex: none; }
.step.done { color: var(--ink-2); }
.step.done .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.step.current { color: var(--brand); font-weight: 600; }
.step.current .n { border-color: var(--gold); background: var(--gold); color: #2B2410; box-shadow: 0 0 0 4px var(--gold-soft); }
.step-sep { flex: 1; min-width: 20px; height: 2px; background: var(--line-2); margin: 0 8px; }
.step-sep.done { background: var(--brand); }

/* ------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; font-weight: 500; font-size: 14px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ------------------------------------------------------------- modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(27, 42, 48, .5); backdrop-filter: blur(3px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop.open { display: flex; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: calc(100vh - 40px); display: flex; flex-direction: column; animation: pop .16s ease-out; }
.modal.lg { max-width: 760px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 24px 0; }
.modal-head h3 { flex: 1; font-size: 17px; }
.modal-body { padding: 16px 24px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); }

/* ------------------------------------------------------------- toasts */
.toasts { position: fixed; top: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 380px; }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast .ico { flex: none; margin-top: 1px; }
.toast.success { border-left: 4px solid var(--success); } .toast.success .ico { color: var(--success); }
.toast.danger  { border-left: 4px solid var(--danger); }  .toast.danger .ico  { color: var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); } .toast.warning .ico { color: var(--warning); }
.toast.info    { border-left: 4px solid var(--info); }    .toast.info .ico    { color: var(--info); }
.toast .close { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; }

/* ------------------------------------------------------------- empty */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ico { color: var(--line-2); margin-bottom: 8px; }
.empty h3 { color: var(--ink-2); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13.5px; margin-bottom: 14px; }

/* ------------------------------------------------------------- chart */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 220px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(160deg, var(--brand) 0%, var(--brand-3) 100%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; background: rgba(212, 162, 76, .14); right: -160px; bottom: -200px; }
.auth-side::after { content: ''; position: absolute; width: 300px; height: 300px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .12); left: -80px; top: 120px; }
.auth-side .logo-box { background: #fff; border-radius: 16px; padding: 16px 22px; display: inline-block; align-self: flex-start; }
.auth-side .logo-box img { height: 54px; }
.auth-side h1 { font-size: 36px; color: #fff; line-height: 1.15; max-width: 480px; font-weight: 500; }
.auth-side h1 em { font-style: normal; color: var(--gold); }
.auth-side p { color: rgba(255, 255, 255, .75); max-width: 440px; font-size: 15px; }
.auth-side .feats { display: grid; gap: 12px; margin-top: 24px; }
.auth-side .feat { display: flex; gap: 12px; align-items: center; font-size: 14px; color: rgba(255, 255, 255, .9); }
.auth-side .feat .ico { color: var(--gold); }
.auth-side .foot { font-size: 12.5px; color: rgba(255, 255, 255, .5); position: relative; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-2); margin-bottom: 26px; }
.auth-card .field { margin-bottom: 16px; }

/* ------------------------------------------------------------- utilities */
.flex { display: flex; } .between { justify-content: space-between; } .center { align-items: center; } .wrap { flex-wrap: wrap; }
.col { flex-direction: column; } .grow { flex: 1; min-width: 0; } .end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 24px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; } .mt-6 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.text-muted { color: var(--muted); } .text-2 { color: var(--ink-2); } .text-brand { color: var(--brand); } .text-gold { color: var(--gold-2); }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; } .text-lg { font-size: 16px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.t-right { text-align: right; } .t-center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.w-100 { width: 100%; }
.hidden { display: none !important; }
.muted-link { color: var(--ink-2); } .muted-link:hover { color: var(--brand); }
.pre { white-space: pre-wrap; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------- documento (orçamento impresso) */
.doc-page { background: #fff; max-width: 820px; margin: 24px auto; padding: 48px 56px; border-radius: 12px; box-shadow: var(--shadow); color: #1B2A30; font-size: 13.5px; }
.doc-toolbar { max-width: 820px; margin: 20px auto 0; display: flex; gap: 8px; justify-content: flex-end; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 20px; border-bottom: 2px solid var(--gold); }
.doc-head img { height: 58px; }
.doc-head .atelie { font-size: 12.5px; color: var(--ink-2); line-height: 1.5; margin-top: 8px; }
.doc-kind { text-align: right; }
.doc-kind h1 { font-size: 22px; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); font-weight: 600; }
.doc-kind .num { font-size: 15px; color: var(--ink-2); margin-top: 4px; }
.doc-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 22px 0; }
.doc-meta h4 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.doc-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc-table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.doc-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc-table .t-right { text-align: right; }
.doc-totals { margin-left: auto; width: 300px; margin-top: 12px; }
.doc-totals .cost-line { padding: 5px 0; }
.doc-totals .grand { border-top: 2px solid var(--brand); margin-top: 6px; padding-top: 10px; font-size: 16px; }
.doc-totals .grand b { font-size: 20px; color: var(--brand); }
.doc-notes { margin-top: 26px; padding: 16px 18px; background: var(--surface-2); border-radius: 10px; font-size: 13px; }
.doc-foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 20px; }
.doc-sign { margin-top: 48px; display: flex; gap: 60px; }
.doc-sign div { flex: 1; text-align: center; font-size: 12px; color: var(--ink-2); padding-top: 8px; border-top: 1px solid var(--ink-2); }

@media print {
  body { background: #fff; }
  .doc-toolbar, .sidebar, .topbar, .toasts { display: none !important; }
  .doc-page { box-shadow: none; margin: 0; padding: 0; max-width: none; border-radius: 0; }
  .doc-kind h1 { color: #1F4E5A; }
  @page { margin: 18mm 16mm; }
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .grid-main, .grid-side, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  body.sidebar-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-toggle { display: inline-flex; }
  .topbar, .content { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .stats, .grid-2 { grid-template-columns: 1fr; }
  .page-title { font-size: 23px; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .content { padding-bottom: 32px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 16px; }
  .card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 16px; }
  .field[class*="c-"] { grid-column: span 12; }
  .field.c-6, .field.c-4, .field.c-3 { grid-column: span 6; }
  .field.c-2 { grid-column: span 4; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .hide-sm { display: none !important; }
  .modal { max-width: none; }
  .doc-page { padding: 24px 18px; }
  .doc-meta { grid-template-columns: 1fr; }
  .doc-totals { width: 100%; }
}
