/* HB Gestão de Obras — linguagem visual do modelo de referência:
   superfícies navy, painéis translúcidos, acentos de status vivos, cards e dados compactos. */
:root {
  --deep: #121215; --panel: #1E1F23; --panel-a: rgba(30, 31, 36, .74); --panel-b: rgba(40, 42, 48, .62);
  --blue: #F57A1E; --cyan: #C4C7CC; --violet: #8C97A6; --green: #2DDAAB; --amber: #F2C14E; --red: #FF5A6E;
  --text: #F4F5F7; --muted: #A7ABB3; --dim: #767B85;
  --line: rgba(200, 205, 215, .18); --line-2: rgba(200, 205, 215, .30);
  --r: 14px; --r-sm: 10px; --shadow: 0 10px 30px rgba(0, 0, 0, .28);
  --grad: linear-gradient(90deg, #F57A1E 0%, #D9560B 100%);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sidebar: 252px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--deep); font-size: 14px; line-height: 1.45;
  background-image:
    radial-gradient(900px 500px at 8% -10%, rgba(245, 122, 30, .13), transparent 60%),
    radial-gradient(700px 520px at 100% 10%, rgba(140, 151, 166, .12), transparent 60%),
    radial-gradient(800px 600px at 60% 110%, rgba(196, 199, 204, .07), transparent 60%);
  background-attachment: fixed; -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.pos { color: var(--green) !important; } .neg { color: var(--red) !important; } .warn { color: var(--amber) !important; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .gap { gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; gap: 18px; padding: 18px; min-height: 100vh; }
.panel {
  background: var(--panel-a); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.05);
}
.sidebar { position: sticky; top: 18px; height: calc(100vh - 36px); display: flex; flex-direction: column; padding: 18px 14px; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 16px; border-bottom: 1px solid var(--line); }
.brand-logo { width: 42px; height: 42px; flex-shrink: 0; }
.brand.marca { flex-direction: column; align-items: stretch; gap: 6px; padding: 0 0 14px; }
.brand-img { display: block; width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.brand.marca .brand-sub { text-align: center; letter-spacing: .32em; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: .16em; background: linear-gradient(90deg, #C4C7CC, #F57A1E); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.1; }
.brand-sub { font-size: 9.5px; letter-spacing: .38em; color: var(--muted); text-transform: uppercase; margin-top: 3px; }
.menu-label { font-size: 11px; letter-spacing: .22em; color: var(--dim); text-align: center; margin: 14px 0 8px; text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px 2px 8px; scrollbar-width: thin; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px; color: #E3E5E9; font-weight: 500; font-size: 13.5px;
  border: 1px solid var(--line); background: rgba(255,255,255,.025); transition: background .15s, border-color .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); border-color: var(--line-2); }
.nav a.active { background: var(--grad); border-color: rgba(255,255,255,.35); color: #fff; box-shadow: 0 6px 18px rgba(245,122,30,.35); }
.nav a .badge-n { margin-left: auto; }
.nav .sep { font-size: 10.5px; letter-spacing: .18em; color: var(--dim); text-transform: uppercase; margin: 10px 4px 2px; }
.user-card { margin-top: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-b); display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--grad); flex-shrink: 0; }
.user-card .nm { font-weight: 600; font-size: 14px; } .user-card .rl { font-size: 11.5px; color: var(--muted); }
.online { color: var(--green); } .online::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--green); margin-left: 4px; vertical-align: middle; }
.main { min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* Cabeçalho */
.topbar { display: flex; align-items: center; gap: 12px 16px; padding: 14px 18px; flex-wrap: wrap; position: relative; z-index: 42; } /* acima do conteúdo e do botão "+", para a janela de notificações sobrepor tudo */
.topbar .titles { flex: 1 1 280px; min-width: 240px; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.topbar .sub { color: #CFD2D7; font-size: 13px; margin-top: 3px; }
.topbar .titles { min-width: 0; flex: 1; }
.search { position: relative; width: 260px; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(10,10,12,.55); outline: none; }
.search input:focus { border-color: var(--blue); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.icon-btn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(255,255,255,.06); cursor: pointer; flex-shrink: 0; }
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn .dot { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--deep); }
.obra-select { max-width: 270px; }
.hamb { display: none; }

/* ---------- Botões e formulários ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(255,255,255,.05); cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; color: var(--text); }
.btn:hover { background: rgba(255,255,255,.10); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(245,122,30,.35); }
.btn.primary:hover { background: #FF8E3A; }
.btn.grad { background: var(--grad); border-color: transparent; color: #fff; }
.btn.danger { border-color: rgba(255,90,110,.5); color: #FF8796; }
.btn.danger:hover { background: rgba(255,90,110,.15); }
.btn.success { background: rgba(45,218,171,.16); border-color: rgba(45,218,171,.5); color: var(--green); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; } .btn.sm svg { width: 14px; height: 14px; }
.btn.icon { padding: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(10,10,12,.6); color: var(--text); outline: none;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(245,122,30,.18); }
select.input option { background: var(--panel); }
textarea.input { min-height: 76px; resize: vertical; }
.input[type=date] { color-scheme: dark; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; font-weight: 500; }
.field .help { font-size: 11.5px; color: var(--dim); margin-top: 4px; }
.field.req label::after { content: ' *'; color: var(--amber); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 13px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--grad); color: #fff; }

/* ---------- Cards de KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { padding: 16px; position: relative; overflow: hidden; min-height: 118px; }
.kpi::before { content: ''; position: absolute; inset: 0; background: radial-gradient(240px 120px at 0% 0%, var(--kc, transparent), transparent 70%); opacity: .22; pointer-events: none; }
.kpi .top { display: flex; align-items: center; gap: 12px; }
.kpi .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--kc, var(--blue)); box-shadow: 0 6px 16px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.35); flex-shrink: 0; }
.kpi .ico svg { color: #fff; width: 22px; height: 22px; }
.kpi .lbl { font-size: 13px; color: #E3E5E9; font-weight: 500; line-height: 1.25; }
.kpi .val { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .val.md { font-size: 23px; }
.kpi .foot { font-size: 12.5px; margin-top: 6px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kpi .foot svg { width: 14px; height: 14px; }
.kpi .foot .prog { flex: 1; margin-top: 4px; }
.kpi .pill { position: absolute; top: 14px; right: 14px; }
.kpi.mini { min-height: 0; padding: 13px 14px; }
.kpi.mini .ico { width: 36px; height: 36px; border-radius: 10px; } .kpi.mini .ico svg { width: 18px; height: 18px; }
.kpi.mini .val { font-size: 21px; margin-top: 6px; }
.kpi.click { cursor: pointer; } .kpi.click:hover { border-color: var(--line-2); }
.c-blue { --kc: #F57A1E; } .c-cyan { --kc: #8E939B; } .c-violet { --kc: #6B7686; } .c-green { --kc: #18C495; } .c-amber { --kc: #DDA92E; } .c-red { --kc: #F0435A; }

/* ---------- Painéis de conteúdo ---------- */
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.card { padding: 16px 18px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.card-h h3 { font-size: 15.5px; }
.card-h .sp { flex: 1; }
.chip-sel { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: rgba(255,255,255,.05); font-size: 12.5px; }
.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 200px; } .chart-box.lg { height: 300px; }
.legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { white-space: nowrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.legend i.ln { width: 14px; height: 2px; border-radius: 2px; vertical-align: 3px; }
.mt-s { margin-top: 8px; }
/* Rosca + legenda com valores */
.donut-wrap { display: flex; align-items: center; gap: 14px; }
.chart-box.donut { width: 44%; min-width: 130px; max-width: 190px; height: 180px; flex: none; }
.leg-list { flex: 1; min-width: 0; font-size: 12.5px; }
.leg-item { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto 46px; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(200,205,215,.07); }
.leg-item:last-child { border-bottom: 0; }
.leg-item i { width: 9px; height: 9px; border-radius: 3px; }
.leg-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.leg-item .vl { color: var(--muted); font-variant-numeric: tabular-nums; }
.leg-item b { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .donut-wrap { flex-direction: column; align-items: stretch; } .chart-box.donut { width: 100%; max-width: none; } }

/* Lista estilo "Recent Transactions" */
.list { display: flex; flex-direction: column; gap: 9px; }
.li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-b); cursor: default; }
.li.click { cursor: pointer; } .li.click:hover { border-color: var(--line-2); background: rgba(48,50,56,.65); }
.li .li-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--line-2); flex-shrink: 0; color: var(--amber); }
.li .t { font-weight: 600; font-size: 13.5px; } .li .s { font-size: 12px; color: var(--muted); }
.li .amt { font-weight: 700; font-size: 15px; white-space: nowrap; }
.empty { padding: 26px 14px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 12px; }
.empty svg { width: 30px; height: 30px; color: var(--dim); margin-bottom: 6px; }
.empty .btn { margin-top: 10px; }

/* Tags / badges */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.t-blue { background: rgba(245,122,30,.18); color: #FF9A50; } .t-cyan { background: rgba(196,199,204,.16); color: #D7DADF; }
.t-violet { background: rgba(140,151,166,.2); color: #B3BCC8; } .t-green { background: rgba(45,218,171,.16); color: #4FE6BC; }
.t-amber { background: rgba(242,193,78,.18); color: #F5D27A; } .t-red { background: rgba(255,90,110,.18); color: #FF8796; }
.t-gray { background: rgba(167,171,179,.14); color: #BFC3C9; }
.badge-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: rgba(255,255,255,.16); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.badge-n.red { background: var(--red); color: #fff; }

/* Barras de progresso */
.prog { height: 7px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.prog > span { display: block; height: 100%; border-radius: 4px; background: var(--grad); }
.prog.green > span { background: linear-gradient(90deg, #18C495, #2DDAAB); } .prog.amber > span { background: linear-gradient(90deg, #DDA92E, #F5D27A); }
.prog.red > span { background: linear-gradient(90deg, #F0435A, #FF8796); } .prog.cyan > span { background: linear-gradient(90deg, #8E939B, #C4C7CC); }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 4px 10px; align-items: center; margin-bottom: 10px; font-size: 12.5px; }
.bar-row .nm { grid-column: 1 / -1; color: #E3E5E9; display: flex; justify-content: space-between; gap: 8px; }

/* Tabela */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: rgba(255,255,255,.035); }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; }
.tbl .acts { white-space: nowrap; text-align: right; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 150px; }
.toolbar .search { width: 240px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 9px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-color: var(--cyan); }

/* ---------- Kanban (Pendências) ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.lane { padding: 12px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(30,31,36,.55); min-height: 200px; display: flex; flex-direction: column; gap: 10px; }
.lane.over { border-color: var(--blue); background: rgba(245,122,30,.10); }
.lane-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.lane-h .ring { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--rc, var(--blue)); }
.lane-h .ring.full { background: var(--rc); border-color: var(--rc); }
.kcard { background: #F4F5F7; color: #1E1F22; border-radius: 11px; padding: 11px 12px; box-shadow: 0 4px 14px rgba(0,0,0,.22); cursor: pointer; border-left: 4px solid var(--pc, #A7ABB3); }
.kcard[draggable=true] { cursor: grab; }
.kcard .kt { font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.kcard .km { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 11.5px; color: #555A63; margin-top: 7px; }
.kcard .km svg { width: 13px; height: 13px; }
.kcard .tag { font-size: 10.5px; }
.kcard .t-blue { background: #FFE5D2; color: #C2530A; } .kcard .t-violet { background: #E4E8EE; color: #4E5A6B; } .kcard .t-red { background: #FFE1E5; color: #D3243D; }
.kcard .t-amber { background: #FFF3CF; color: #8A6400; } .kcard .t-cyan { background: #E9EAEC; color: #5A5F68; } .kcard .t-green { background: #D6F7EE; color: #0B8F69; } .kcard .t-gray { background: #E7E9EC; color: #555A63; }
.kcard.venc .kd { color: #D3243D; font-weight: 700; }

/* Comando rápido */
.quick-box { display: flex; gap: 10px; align-items: stretch; }
.quick-box .input { font-size: 15px; padding: 11px 13px; }
.parse-preview { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Cronograma (Gantt) ---------- */
.gantt { overflow-x: auto; }
.gantt-in { min-width: 760px; }
.g-head, .g-row { display: grid; grid-template-columns: 230px 1fr; align-items: center; }
.g-head { font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line-2); }
.g-months { position: relative; height: 30px; }
.g-months span { position: absolute; top: 8px; transform: translateX(4px); white-space: nowrap; text-transform: uppercase; letter-spacing: .05em; }
.g-row { border-bottom: 1px solid var(--line); min-height: 44px; }
.g-row .g-name { padding: 8px 10px 8px 0; font-size: 13px; }
.g-row .g-name small { display: block; color: var(--muted); font-size: 11px; }
.g-track { position: relative; height: 44px; }
.g-bar { position: absolute; top: 12px; height: 20px; border-radius: 6px; background: rgba(245,122,30,.25); border: 1px solid rgba(245,122,30,.6); overflow: hidden; cursor: pointer; }
.g-bar > i { position: absolute; inset: 0 auto 0 0; background: var(--grad); }
.g-bar.late { border-color: var(--red); background: rgba(255,90,110,.22); } .g-bar.late > i { background: linear-gradient(90deg, #F0435A, #FF8796); }
.g-bar.done { border-color: var(--green); background: rgba(45,218,171,.22); } .g-bar.done > i { background: linear-gradient(90deg, #18C495, #2DDAAB); }
.g-bar.sub { top: 15px; height: 13px; opacity: .85; }
.g-bar b { position: relative; font-size: 10.5px; padding: 0 6px; line-height: 18px; color: #fff; white-space: nowrap; }
.g-grid { position: absolute; top: 0; bottom: 0; border-left: 1px dashed rgba(200,205,215,.12); }
.g-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--amber); z-index: 2; }
.g-today::after { content: 'HOJE'; position: absolute; top: -1px; left: 3px; font-size: 9px; color: var(--amber); font-weight: 700; }

/* ---------- Fotos ---------- */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.photo { border-radius: 11px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-b); cursor: pointer; position: relative; }
.photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #141417; }
.photo .cap { padding: 7px 9px; font-size: 12px; }
.photo .cap .s { color: var(--muted); font-size: 11px; }
.photo.sel { outline: 3px solid var(--cyan); }
.photo .pick { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 6px; background: rgba(10,10,12,.7); border: 1px solid #fff; display: grid; place-items: center; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line-2); }
.tl-item { position: relative; margin-bottom: 22px; }
.tl-item::before { content: ''; position: absolute; left: -21px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(196,199,204,.2); }
.tl-date { font-weight: 700; margin-bottom: 8px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare img { width: 100%; border-radius: 10px; max-height: 60vh; object-fit: contain; background: #000; }
.viewer img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 10px; }

/* Upload */
.drop { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; }
.drop.over { border-color: var(--blue); background: rgba(245,122,30,.08); }

/* ---------- Modal, toast, menu rápido ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(5,5,7,.68); backdrop-filter: blur(3px); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 760px; background: #1B1C20; border: 1px solid var(--line-2); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.modal.sm { max-width: 460px; } .modal.lg { max-width: 1000px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-b { padding: 18px 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-f .left { margin-right: auto; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border-radius: 12px; background: #26272C; border: 1px solid var(--line-2); box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; animation: tin .2s ease-out; cursor: pointer; }
.toast.ok { border-color: rgba(45,218,171,.6); } .toast.err { border-color: rgba(255,90,110,.7); } .toast.info { border-color: rgba(196,199,204,.6); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
.fab { display: none; position: fixed; right: 18px; bottom: 18px; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; box-shadow: 0 10px 26px rgba(245,122,30,.5); z-index: 40; cursor: pointer; place-items: center; }
.fab svg { width: 26px; height: 26px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick-grid button { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 16px 8px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-b); cursor: pointer; font-weight: 600; font-size: 13px; text-align: center; }
.quick-grid button:hover { border-color: var(--blue); }
.quick-grid .qi { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--kc); }
.quick-grid .qi svg { color: #fff; }
.dropdown { position: absolute; right: 0; top: 46px; width: min(400px, 92vw); max-height: 70vh; overflow-y: auto; z-index: 45; padding: 10px; background: #1B1C20; }
.alert { padding: 11px 14px; border-radius: 11px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; margin-bottom: 10px; }
.alert.critico { border-color: rgba(255,90,110,.55); background: rgba(255,90,110,.10); } .alert.critico svg { color: var(--red); }
.alert.atencao { border-color: rgba(242,193,78,.55); background: rgba(242,193,78,.10); } .alert.atencao svg { color: var(--amber); }
.alert.info { border-color: rgba(196,199,204,.5); background: rgba(196,199,204,.08); } .alert.info svg { color: var(--cyan); }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 7px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.obra-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.obra-card { padding: 16px; cursor: pointer; transition: border-color .15s; }
.obra-card:hover { border-color: var(--line-2); }
.obra-card h3 { margin: 6px 0 2px; font-size: 16px; }
.obra-card .nums { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; font-size: 12.5px; }
.obra-card .nums b { display: block; font-size: 15px; }
.hist { font-size: 12.5px; }
.hist .hi { padding: 8px 0; border-bottom: 1px solid var(--line); }
.hist .hi .s { color: var(--muted); font-size: 11.5px; }

/* ---------- Telas de acesso ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .panel { width: 100%; max-width: 420px; padding: 28px; }
.auth h1 { font-size: 24px; margin: 18px 0 4px; }
.auth .field { margin-top: 14px; }
.auth .btn.primary { width: 100%; margin-top: 20px; padding: 11px; }

/* ---------- Responsivo (celular / tablet) ---------- */
@media (max-width: 1280px) { .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } .search { width: 200px; } }
@media (max-width: 1100px) {
  .g-main, .g3 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; padding: 10px; gap: 12px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; width: 270px; z-index: 60; transform: translateX(-105%); transition: transform .2s; border-radius: 0 var(--r) var(--r) 0; background: #17181B; }
  body.menu-open .sidebar { transform: none; }
  body.menu-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
  .hamb { display: grid; }
  .topbar { flex-wrap: wrap; padding: 12px; gap: 10px; }
  .topbar h1 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .titles { order: 1; flex: 1 1 0; min-width: 0; }
  .topbar .sub { display: none; }
  .topbar .hamb { order: 0; }
  .topbar .tb-actions { order: 2; }
  .topbar .search, .topbar .obra-select { order: 3; flex: 1 1 100%; width: 100%; max-width: none; }
  .topbar .btn-quick { display: none; }
  .fab { display: grid; bottom: calc(18px + env(safe-area-inset-bottom)); }
  .app { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .g2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; }
  .kanban { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; } .lane { scroll-snap-align: start; }
  .modal-bg { padding: 0; } .modal { border-radius: 0; min-height: 100vh; }
  .toasts { bottom: 86px; }
  /* tabelas viram cartões */
  table.tbl.resp thead { display: none; }
  table.tbl.resp, .tbl.resp tbody, .tbl.resp tr, .tbl.resp td { display: block; width: 100%; }
  .tbl.resp tr { border: 1px solid var(--line); border-radius: 11px; margin-bottom: 10px; padding: 6px 4px; background: var(--panel-b); }
  .tbl.resp td { border: 0; padding: 4px 10px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tbl.resp td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; }
  .tbl.resp td.acts::before, .tbl.resp td:first-child::before { content: none; }
  .tbl.resp td:first-child { font-weight: 700; text-align: left; justify-content: flex-start; }
  .tbl.resp tfoot { display: block; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .compare { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .kpis, .kpis.six, .kpis.three { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px; min-height: 0; } .kpi .ico { width: 34px; height: 34px; border-radius: 10px; } .kpi .ico svg { width: 17px; height: 17px; }
  .kpi .val { font-size: 19px; } .kpi .val.md { font-size: 17px; } .kpi .lbl { font-size: 12px; }
  .card { padding: 14px; }
  .toolbar .input, .toolbar .search { flex: 1 1 100%; width: 100%; }
}
