/* ==========================================================================
   EXECUTA — design system
   Identidade: grafite de obra + laranja de sinalização + concreto claro.
   ========================================================================== */
:root {
  --ink-950: #0e151c;
  --ink-900: #141d26;
  --ink-800: #1b2631;
  --ink-700: #283647;
  --ink-600: #3a4a5c;
  --steel-500: #2f6690;
  --steel-100: #e3eef6;
  --brand: #f28a1b;
  --brand-600: #d9740a;
  --brand-100: #fdecd6;
  --bg: #f3f1ed;
  --card: #ffffff;
  --line: #e4e0d9;
  --line-strong: #cfc9bf;
  --text: #1b2631;
  --muted: #6b7683;
  --green: #1e8e5a;   --green-bg: #e0f3ea;
  --red: #c73e3e;     --red-bg: #fbe4e4;
  --amber: #a86a08;   --amber-bg: #fdf0d2;
  --blue: #2f6690;    --blue-bg: #e3eef6;
  --gray: #5b6672;    --gray-bg: #ebe9e4;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20,29,38,.06), 0 4px 14px rgba(20,29,38,.05);
  --shadow-lg: 0 12px 40px rgba(14,21,28,.28);
  --sidebar-w: 252px;
  --topbar-h: 60px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--steel-500); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .mt-0 { margin-top: 0; }
.flex { display: flex; } .gap { gap: .75rem; } .between { justify-content: space-between; } .items-center { align-items: center; } .wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mono { font-variant-numeric: tabular-nums; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); }

/* ------------------------------------------------------------------ shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink-900); color: #c9d2dc; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; border-right: 1px solid var(--ink-950); z-index: 40;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1.1rem 1rem; color: #fff; text-decoration: none !important; }
.brand-mark { width: 38px; height: 38px; flex: none; }
.brand-name { font-weight: 800; letter-spacing: .14em; font-size: 1.05rem; }
.brand-sub { display: block; font-size: .64rem; letter-spacing: .18em; color: var(--brand); font-weight: 600; text-transform: uppercase; margin-top: -2px; }
.hazard { height: 5px; background: repeating-linear-gradient(-45deg, var(--brand) 0 9px, var(--ink-950) 9px 18px); opacity: .9; }
.nav { padding: .6rem .6rem 1rem; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: #6f7f90; padding: .9rem .75rem .3rem; }
.nav a {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: var(--radius-sm);
  color: #c9d2dc; text-decoration: none; font-weight: 500; position: relative;
}
.nav a:hover { background: var(--ink-800); color: #fff; }
.nav a.active { background: var(--ink-700); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -.6rem; top: 7px; bottom: 7px; width: 4px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav a .icon { opacity: .85; } .nav a.active .icon { color: var(--brand); opacity: 1; }
.nav .count { margin-left: auto; background: var(--brand); color: var(--ink-950); font-size: .7rem; font-weight: 700; border-radius: 99px; padding: 0 .45rem; min-width: 20px; text-align: center; }
.sidebar-foot { margin-top: auto; padding: .9rem 1.1rem; font-size: .75rem; color: #6f7f90; border-top: 1px solid var(--ink-800); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center;
  gap: .75rem; padding: 0 1.5rem; position: sticky; top: 0; z-index: 30;
}
.topbar .burger { display: none; }
.global-search { position: relative; flex: 1; max-width: 460px; }
.global-search input { width: 100%; padding: .5rem .8rem .5rem 2.2rem; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); font: inherit; }
.global-search input:focus { outline: 2px solid var(--brand); border-color: transparent; background: #fff; }
.global-search .icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); max-height: 70vh; overflow: auto; z-index: 60; display: none;
}
.search-results.open { display: block; }
.search-results .grp { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: .5rem .8rem .2rem; }
.search-results a { display: flex; flex-direction: column; padding: .45rem .8rem; color: var(--text); text-decoration: none; }
.search-results a:hover, .search-results a.hl { background: var(--brand-100); }
.search-results a small { color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .4rem; }
.icon-btn { background: none; border: 0; padding: .5rem; border-radius: 50%; cursor: pointer; color: var(--ink-600); position: relative; display: inline-flex; }
.icon-btn:hover { background: var(--bg); }
.icon-btn .dot { position: absolute; top: 4px; right: 3px; background: var(--red); color: #fff; font-size: .62rem; font-weight: 700; min-width: 16px; height: 16px; line-height: 16px; border-radius: 99px; text-align: center; padding: 0 3px; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .35rem; display: none; z-index: 70;
}
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .5rem .7rem; border: 0; background: none; font: inherit; color: var(--text);
  text-align: left; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); }
.dropdown-menu .sep { height: 1px; background: var(--line); margin: .3rem 0; }
.dropdown-menu .head { padding: .55rem .7rem; font-size: .8rem; color: var(--muted); }
.notif-list { max-height: 360px; overflow: auto; }
.notif-list a { align-items: flex-start; }
.notif-list .ico { margin-top: 2px; }
.user-chip { display: flex; align-items: center; gap: .55rem; padding: .25rem .5rem .25rem .25rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink-800); color: var(--brand); font-weight: 700; display: grid; place-items: center; font-size: .8rem; }

.content { padding: 1.5rem; max-width: 1480px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { display: flex; align-items: center; gap: .6rem; }
.crumbs { font-size: .8rem; color: var(--muted); margin-bottom: .35rem; display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.crumbs a { color: var(--muted); } .crumbs .icon { opacity: .6; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.footer { padding: 1rem 1.5rem; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1.5rem; }
.credit { color: var(--muted); font-size: .78rem; }
.credit a { color: inherit; font-weight: 600; text-decoration: none; }
.credit a:hover { color: var(--brand-600); text-decoration: underline; }
.credit-guest { text-align: center; margin: 0; padding: 1.25rem 0 1.5rem; }

/* ------------------------------------------------------------------ components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: .5rem; }
.card-body { padding: 1.1rem; }
.card-body.flush { padding: 0; }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.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); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .5rem .95rem; font: inherit; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #fff; color: var(--text); cursor: pointer; text-decoration: none !important;
  line-height: 1.2; transition: background .12s, border-color .12s, box-shadow .12s; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn:focus-visible { outline: 3px solid rgba(242,138,27,.45); outline-offset: 1px; }
.btn-primary { background: var(--brand); border-color: var(--brand-600); color: var(--ink-950); }
.btn-primary:hover { background: #f79a35; }
.btn-dark { background: var(--ink-800); border-color: var(--ink-900); color: #fff; }
.btn-dark:hover { background: var(--ink-700); }
.btn-danger { background: #fff; border-color: #e3b1b1; color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: inline-flex; gap: .4rem; flex-wrap: wrap; }

.badge { display: inline-block; padding: .12rem .6rem; border-radius: 99px; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.badge-green { background: var(--green-bg); color: var(--green); } .badge-red { background: var(--red-bg); color: var(--red); }
.badge-amber { background: var(--amber-bg); color: var(--amber); } .badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-gray { background: var(--gray-bg); color: var(--gray); }

.alert { padding: .7rem .95rem; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 1rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert-info { background: var(--blue-bg); border-color: #b8d3e6; color: #1f4a69; }
.alert-warning { background: var(--amber-bg); border-color: #efd18a; color: #6f4605; }
.alert-error { background: var(--red-bg); border-color: #eeb5b5; color: #8e2a2a; }
.alert-success { background: var(--green-bg); border-color: #a9dcc3; color: #145d3a; }
.pending-tag { display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--amber-bg); color: var(--amber); border: 1px dashed #d9b061; padding: .05rem .5rem; border-radius: 4px; }

/* KPI cards */
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-bottom: 1rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kpi, var(--brand)); }
.kpi .label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; gap: .4rem; }
.kpi .value { font-size: 1.55rem; font-weight: 750; margin-top: .25rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.kpi.green { --kpi: var(--green); } .kpi.red { --kpi: var(--red); } .kpi.blue { --kpi: var(--steel-500); } .kpi.dark { --kpi: var(--ink-700); }
a.kpi { color: inherit; text-decoration: none; } a.kpi:hover { border-color: var(--line-strong); box-shadow: 0 4px 18px rgba(20,29,38,.1); }

/* tabelas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: #faf9f6; white-space: nowrap; }
.table td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fcfbf8; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .title { font-weight: 600; color: var(--text); }
.table .title a { color: inherit; }
.table tr.row-muted { opacity: .6; }
.loading-overlay { position: relative; } .loading-overlay.is-loading { opacity: .5; pointer-events: none; transition: opacity .15s; }

/* filtros */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); background: #faf9f6; border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { margin: 0; min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }
.search-box { position: relative; }
.search-box .icon { position: absolute; left: .65rem; bottom: 12px; color: var(--muted); pointer-events: none; }
.search-box input[type=search], .search-box input[type=text] { padding-left: 2.2rem; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1.1rem; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.pagination .pages { display: flex; gap: .25rem; }
.pagination a, .pagination span.cur { padding: .25rem .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--text); text-decoration: none; background: #fff; }
.pagination a:hover { background: var(--bg); }
.pagination span.cur { background: var(--ink-800); color: #fff; border-color: var(--ink-800); }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .icon { color: var(--line-strong); width: 44px; height: 44px; margin-bottom: .5rem; }
.empty h3 { color: var(--text); margin-bottom: .25rem; }

/* formulários */
.form-grid { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.form-grid > .field, .form-grid > .span { grid-column: span 12; }
.col-2 { grid-column: span 2 !important; } .col-3 { grid-column: span 3 !important; } .col-4 { grid-column: span 4 !important; } .col-5 { grid-column: span 5 !important; }
.col-6 { grid-column: span 6 !important; } .col-7 { grid-column: span 7 !important; } .col-8 { grid-column: span 8 !important; } .col-9 { grid-column: span 9 !important; } .col-12 { grid-column: span 12 !important; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field label { font-weight: 600; font-size: .84rem; color: var(--ink-600); }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=tel], input[type=url], input[type=search], input[type=time], select, textarea {
  width: 100%; padding: .55rem .7rem; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); min-height: 40px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
input[readonly] { background: #f6f4f0; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); background: #fffafa; }
small.hint { color: var(--muted); font-size: .78rem; } small.error { color: var(--red); font-size: .8rem; font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-600); }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.section-title { grid-column: 1 / -1; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; padding-top: .5rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; margin-top: .4rem; }
.input-group { display: flex; } .input-group > * { border-radius: 0; } .input-group > :first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); } .input-group > :last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-addon { display: inline-flex; align-items: center; padding: 0 .7rem; background: var(--gray-bg); border: 1px solid var(--line-strong); border-left: 0; color: var(--muted); font-size: .85rem; }

/* lookup / autocomplete */
.lookup { position: relative; }
.lookup-list { position: absolute; z-index: 80; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 280px; overflow: auto; display: none; min-width: 260px; }
.lookup-list.open { display: block; }
.lookup-list div { padding: .5rem .75rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.lookup-list div:last-child { border-bottom: 0; }
.lookup-list div:hover, .lookup-list div.hl { background: var(--brand-100); }
.lookup-list small { display: block; color: var(--muted); }

/* abas */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); overflow-x: auto; padding: 0 .5rem; background: #faf9f6; border-radius: var(--radius) var(--radius) 0 0; }
.tab { padding: .75rem 1rem; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; display: inline-flex; gap: .4rem; align-items: center; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--brand); }
.tab .count { background: var(--gray-bg); border-radius: 99px; padding: 0 .45rem; font-size: .72rem; }
.tab-panel { display: none; } .tab-panel.active { display: block; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(14,21,28,.6); display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 100; backdrop-filter: blur(2px); }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 2rem); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal.lg { max-width: 820px; } .modal.sm { max-width: 420px; }
.modal-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.25rem; overflow: auto; }
.modal-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; background: #faf9f6; border-radius: 0 0 14px 14px; flex-wrap: wrap; }

/* toasts */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 200; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--ink-900); color: #fff; padding: .75rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; gap: .6rem; align-items: flex-start; border-left: 4px solid var(--brand); animation: slidein .2s ease-out; }
.toast.success { border-left-color: #35c486; } .toast.error { border-left-color: #ff6b6b; } .toast.warning { border-left-color: var(--brand); }
@keyframes slidein { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* listas de detalhe */
.dl { display: grid; grid-template-columns: 170px 1fr; gap: .45rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: .85rem; font-weight: 600; } .dl dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 1rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: -1.38rem; top: .4rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-strong); }
.timeline .when { color: var(--muted); font-size: .78rem; }
.progress { height: 8px; background: var(--gray-bg); border-radius: 99px; overflow: hidden; } .progress > i { display: block; height: 100%; background: var(--brand); }
.tag-list { display: flex; flex-wrap: wrap; gap: .35rem; }
.stat-row { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px dashed var(--line); } .stat-row:last-child { border-bottom: 0; }
.totals { margin-left: auto; min-width: 300px; }
.totals .stat-row.total { font-size: 1.2rem; font-weight: 750; border-top: 2px solid var(--ink-800); border-bottom: 0; margin-top: .3rem; padding-top: .6rem; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.thumb { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 110px; object-fit: cover; display: block; cursor: zoom-in; }
.thumb .cap { padding: .35rem .5rem; font-size: .78rem; }
.thumb .rm { position: absolute; top: 4px; right: 4px; background: rgba(14,21,28,.75); color: #fff; border: 0; border-radius: 50%; width: 26px; height: 26px; cursor: pointer; display: grid; place-items: center; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 1.2rem; text-align: center; color: var(--muted); cursor: pointer; background: #fcfbf8; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-100); }

/* gráficos */
.chart { width: 100%; } .chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .5rem; font-size: .8rem; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; }
.chart-tip { position: fixed; pointer-events: none; background: var(--ink-900); color: #fff; padding: .35rem .6rem; border-radius: 6px; font-size: .78rem; z-index: 300; display: none; white-space: nowrap; }

/* editor de itens (orçamento/venda/compra) */
.items-editor { width: 100%; border-collapse: separate; border-spacing: 0; }
.items-editor th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.items-editor td { padding: .4rem .3rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.items-editor input, .items-editor select { min-height: 36px; padding: .35rem .5rem; }
.items-editor .col-sub { text-align: right; font-weight: 650; padding-top: .75rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.type-pill { font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .1rem .45rem; border-radius: 4px; display: inline-block; margin-bottom: .2rem; }
.type-pill.product { background: var(--blue-bg); color: var(--blue); } .type-pill.service { background: var(--brand-100); color: var(--brand-600); }

/* auth / guest */
.guest-wrap { min-height: calc(100vh - 4rem); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.guest-hero {
  background: var(--ink-900); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
  background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 36px 36px;
}
.guest-hero::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: repeating-linear-gradient(-45deg, var(--brand) 0 14px, var(--ink-950) 14px 28px); }
.guest-hero h1 { font-size: 2.1rem; max-width: 18ch; line-height: 1.15; }
.guest-hero ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .6rem; color: #b6c2cf; }
.guest-hero li { display: flex; gap: .6rem; align-items: center; } .guest-hero li .icon { color: var(--brand); }
.guest-form { display: grid; place-items: center; padding: 2rem 1.25rem; }
.guest-card { width: 100%; max-width: 420px; }
.guest-card h2 { font-size: 1.4rem; margin-bottom: .25rem; }
.guest-simple { min-height: calc(100vh - 4rem); display: grid; place-items: center; padding: 1.5rem; }

/* link público */
.public-wrap { max-width: 920px; margin: 0 auto; padding: 1rem; }
.public-head { background: var(--ink-900); color: #fff; padding: 1rem 1.25rem; border-radius: var(--radius) var(--radius) 0 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 5px solid var(--brand); }

/* ------------------------------------------------------------------ responsivo */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 86vw); transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(14,21,28,.55); z-index: 35; }
  .topbar { padding: 0 .75rem; } .topbar .burger { display: inline-flex; }
  .content { padding: 1rem .85rem 5rem; }
  .guest-wrap { grid-template-columns: 1fr; } .guest-hero { display: none; }
  .form-grid > .field, .form-grid [class*=col-] { grid-column: span 12 !important; }
  .form-grid .col-2, .form-grid .col-3, .form-grid .col-4 { grid-column: span 6 !important; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 0; } .dl dt { margin-top: .6rem; }
  .totals { min-width: 0; width: 100%; }
  .global-search { display: none; }
  .global-search.show { display: block; position: fixed; top: 8px; left: 56px; right: 56px; z-index: 90; max-width: none; }
  .btn { padding: .6rem 1rem; }
  .form-actions { position: sticky; bottom: 0; background: #fff; margin: 1rem -1.1rem -1.1rem; padding: .75rem 1.1rem; box-shadow: 0 -4px 12px rgba(20,29,38,.08); z-index: 5; }
  .modal-backdrop { align-items: flex-end; padding: 0; } .modal, .modal.lg, .modal.sm { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; }
  .user-chip .uname { display: none; }
  .filters .field { flex: 1 1 calc(50% - .6rem); min-width: 130px; } .filters .field.grow { flex-basis: 100%; }
  /* tabelas viram cartões */
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { border-bottom: 8px solid var(--bg); padding: .5rem .25rem; }
  table.responsive td { border: 0; padding: .3rem .9rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  table.responsive td::before { content: attr(data-label); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; text-align: left; flex: none; padding-top: .15rem; }
  table.responsive td[data-label="Item"], table.responsive td[data-label="Cliente"], table.responsive td[data-label="Serviço"], table.responsive td[data-label="Produto"], table.responsive td[data-label="Descrição"] { display: block; text-align: left; }
  table.responsive td[data-label="Item"]::before, table.responsive td[data-label="Cliente"]::before, table.responsive td[data-label="Serviço"]::before, table.responsive td[data-label="Produto"]::before, table.responsive td[data-label="Descrição"]::before { display: block; margin-bottom: .15rem; }
  table.responsive td.actions { justify-content: flex-end; } table.responsive td.actions::before, table.responsive td[data-label=""]::before { display: none; }
  /* editor de itens empilhado */
  .items-editor thead { display: none; }
  .items-editor, .items-editor tbody, .items-editor tr, .items-editor td { display: block; width: 100%; }
  .items-editor tr { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; margin-bottom: .75rem; background: #fcfbf8; }
  .items-editor td { border: 0; padding: .25rem 0; }
  .items-editor td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: .15rem; }
  .items-editor .col-sub { text-align: left; padding-top: .25rem; }
}
@media (max-width: 480px) {
  h1 { font-size: 1.25rem; } .kpi .value { font-size: 1.35rem; }
  .form-grid .col-2, .form-grid .col-3, .form-grid .col-4 { grid-column: span 12 !important; }
  .page-actions { width: 100%; } .page-actions .btn { flex: 1; }
}
@media print {
  .sidebar, .topbar, .footer, .credit-guest, .page-actions, .no-print, .toasts { display: none !important; }
  .app { display: block; } body { background: #fff; } .content { padding: 0; } .card { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
