/* LAFEX v1.15: interface acolhedora e responsiva, sem dependências externas */
:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#19324a;background:#f4f7fb;font-size:15px;font-synthesis:none;-webkit-font-smoothing:antialiased}
*{box-sizing:border-box}body{margin:0;line-height:1.5}button,input,select,textarea{font:inherit}button{transition:background-color .14s ease,box-shadow .14s ease,transform .14s ease;border:0;border-radius:11px;background:#176c97;color:#fff;padding:11px 17px;cursor:pointer;font-weight:650;min-height:43px}button:hover{background:#115778;box-shadow:0 4px 12px #164c7020}button:active{transform:translateY(1px)}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #8dd0f2;outline-offset:2px}button:disabled{opacity:.55;cursor:not-allowed}button.active{background:#123750}button.secondary{background:#eaf2f7;color:#23465e}button.secondary:hover{background:#dbeaf3}button.danger{background:#a73740}
header{background:linear-gradient(105deg,#102d46,#164d68);color:white;padding:18px max(24px,calc((100vw - 1200px)/2));display:flex;justify-content:space-between;align-items:center;gap:16px;box-shadow:0 3px 14px #132e4420}header strong{font-size:18px;letter-spacing:-.35px}header small{font-size:12px;color:#c1d7e5;font-weight:500}#identity{display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:13px}
main{max-width:1200px;margin:28px auto;padding:0 18px}.notice{background:#fff6dd;color:#745620;border:1px solid #f7e9b8;padding:15px 18px;border-radius:13px;margin-bottom:22px;font-size:14px}section,.panel{background:white;border:1px solid #e1e9f0;border-radius:17px;padding:24px;margin-bottom:18px;box-shadow:0 4px 22px #1d47610b}#app{padding:18px}#content>.panel{box-shadow:none;border-color:#e2eaf1}nav{display:flex;gap:9px;flex-wrap:wrap;margin-bottom:19px}nav button{padding:11px 18px}.subnav{border-bottom:1px solid #e5edf3;padding-bottom:15px;margin-bottom:20px}.subnav button{background:#edf3f8;color:#294c65}.subnav button.active{background:#176c97;color:white}
h2{font-size:24px;letter-spacing:-.65px;margin:0 0 18px;font-weight:750}h3{font-size:18px;letter-spacing:-.35px;margin:0 0 13px}p{line-height:1.6}form{border:1px solid #e1e9f1;padding:19px;border-radius:14px;margin:16px 0;background:#fff}label{display:flex;flex-direction:column;gap:7px;font-weight:650;font-size:13px;color:#27445b}input,select,textarea{border:1px solid #c9d7e3;border-radius:9px;padding:11px 12px;width:100%;background:#fff;color:#1b344a;min-height:44px;transition:border-color .15s ease,box-shadow .15s ease}input:focus,select:focus,textarea:focus{border-color:#3d96c3;box-shadow:0 0 0 3px #3d96c31a}textarea{min-height:105px}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:16px;margin-bottom:16px}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(165px,1fr));gap:15px;margin:16px 0 24px}.card{background:linear-gradient(140deg,#f5fafe,#ecf5fa);border:1px solid #dcebf4;padding:19px;border-radius:14px}.card strong{display:block;font-size:29px;letter-spacing:-1px;margin-top:7px;color:#16577a}.scroll{overflow-x:auto;border:1px solid #e7edf3;border-radius:11px}table{width:100%;border-collapse:collapse;font-size:13px}td,th{padding:12px 13px;text-align:left;border-bottom:1px solid #e9eef3;vertical-align:top}th{background:#f2f7fb;color:#35556d;font-weight:750}tbody tr:hover{background:#f8fbfe}tbody tr:last-child td{border-bottom:0}.actions{display:flex;gap:8px;flex-wrap:wrap}.actions button{min-height:36px;padding:7px 11px;font-size:12px}.muted,.hint{color:#627b8f;font-size:13px}.status{font-size:12px;padding:4px 9px;border-radius:30px;background:#e7f0f6;display:inline-block}#message{color:#a23939;font-weight:600;white-space:pre-wrap}pre{white-space:pre-wrap;word-break:break-word;font-size:12px}[hidden]{display:none!important}
.loading-panel{min-height:230px;animation:appear .15s ease}.loading-line{height:16px;width:60%;background:linear-gradient(90deg,#eaf1f6,#f6f9fc,#eaf1f6);background-size:200% 100%;border-radius:8px;margin:17px 0;animation:shimmer 1.2s linear infinite}.loading-line.wide{width:34%;height:26px}.loading-line.short{width:78%}@keyframes shimmer{to{background-position:-200% 0}}@keyframes appear{from{opacity:.5}to{opacity:1}}
@media(max-width:700px){header{padding:15px 18px;align-items:flex-start}main{margin:18px auto;padding:0 12px}#app,section,.panel{padding:15px}h2{font-size:21px}nav button{padding:9px 13px;min-height:40px}td,th{padding:9px}button{padding:10px 13px}.grid{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}

/* v1.18 — seletor acessível de perfil */
.role-dialog{border:1px solid #d7e0eb;border-radius:16px;padding:24px;max-width:min(440px,calc(100vw - 32px));width:100%;box-shadow:0 20px 60px #12213b44;background:#fff;color:#17253b}
.role-dialog::backdrop{background:#0b183a88}
.role-dialog form{margin:0}
.role-dialog select{display:block;width:100%;margin-top:8px}
.role-dialog .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px}

/* v1.19: navegação adaptativa, hierarquia visual e acessibilidade */
:root{--primary:#176c97;--ink:#19324a;--line:#e4ebf2;--bg:#f5f8fb}
body{background:var(--bg)}main{max-width:1440px}header{position:sticky;top:0;z-index:30;min-height:70px}header strong{white-space:nowrap}#identity{justify-content:flex-end;text-align:right}
.notice{font-size:12px;padding:9px 13px;margin-bottom:14px;background:#fffaf0}
#app{display:grid;grid-template-columns:204px minmax(0,1fr);gap:22px;align-items:start;border:0;background:transparent;box-shadow:none;padding:0}
#tabs{position:sticky;top:92px;display:flex;flex-direction:column;gap:5px;padding:12px;background:#fff;border:1px solid var(--line);border-radius:15px;margin:0}
#tabs button{width:100%;text-align:left;border-radius:9px;background:transparent;color:#36536a;box-shadow:none;font-size:14px;font-weight:600;padding:11px 14px}
#tabs button:hover{background:#f0f5f9}#tabs button.active{background:#e6f3fa;color:#115f88;box-shadow:inset 3px 0 #197aa9}
#content{min-width:0;background:#fff;border:1px solid var(--line);border-radius:16px;padding:24px;min-height:360px}
#content>.panel{border:0;box-shadow:none;padding:0;margin:0}#content form{background:#fafcff;border:1px solid #e8edf3;box-shadow:none}
#content .subnav{display:flex;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:thin;gap:3px;padding:0 0 8px;margin-bottom:20px}
.subnav button{white-space:nowrap;background:transparent;color:#4b6477;border-radius:7px;min-height:38px;padding:8px 12px;box-shadow:none}
.subnav button.active{background:#e7f3fa;color:#12658e;box-shadow:none}
button{font-weight:650}button.positive{background:#16734a;color:#fff}button.positive:hover{background:#0f5c3b}button.danger{background:#b42332;color:white}button.danger:hover{background:#8f1926}
.actions button{white-space:nowrap}.actions{gap:5px}input[type=checkbox],input[type=radio]{width:17px;height:17px;min-height:0;padding:0;flex:none;accent-color:#176c97;vertical-align:middle}
label:has(>input[type=checkbox]),label:has(>input[type=radio]){display:flex;flex-direction:row;align-items:flex-start;gap:9px;font-weight:500;line-height:1.5}
input[type=file]{padding:7px;background:#fff;min-height:46px}input[type=file]::file-selector-button{background:#e7f2f9;border:0;border-radius:7px;color:#195c80;padding:8px 12px;margin-right:12px;cursor:pointer;font-weight:650}
.status{font-weight:700;white-space:nowrap;border:1px solid transparent}.status-good{background:#e5f6ec;color:#17663b;border-color:#c4e9d1}.status-wait{background:#fff2d5;color:#805312;border-color:#f3dba3}.status-bad{background:#fde9eb;color:#9b2631;border-color:#f4c9ce}.status-neutral{background:#edf2f7;color:#536779}
.page-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.page-heading h2{margin:0}#project-create{margin-bottom:20px}#project-create details{background:#f8fbfd;padding:14px;border:1px solid var(--line);border-radius:12px;margin-bottom:10px}#project-create summary{cursor:pointer}
@media(max-width:800px){header{padding:11px 14px;flex-wrap:wrap;gap:5px;min-height:65px}header strong{font-size:15px}header small{font-size:11px}#identity{font-size:12px;gap:7px}#identity button{min-height:32px;padding:5px 10px}main{padding:0 10px;margin:12px auto 88px}.notice{margin-bottom:10px;font-size:11px;padding:7px 10px}#app{display:block}#content{padding:15px 12px;min-height:320px}#tabs{position:fixed;top:auto;bottom:0;left:0;right:0;z-index:40;display:flex;flex-direction:row;justify-content:space-around;gap:0;border-radius:13px 13px 0 0;padding:7px 3px calc(7px + env(safe-area-inset-bottom));box-shadow:0 -6px 22px #17395116}#tabs button{width:auto;flex:1;text-align:center;padding:9px 2px;font-size:clamp(10px,2.5vw,12px);min-height:46px}#tabs button.active{box-shadow:inset 0 3px #197aa9}.scroll{border:0;overflow:visible}table,tbody,tr,td{display:block;width:100%}thead{display:none}tbody{display:grid;gap:11px}tbody tr{background:white;border:1px solid var(--line);border-radius:12px;padding:9px 12px;box-shadow:0 2px 9px #19324a09}tbody tr td{display:flex;justify-content:space-between;gap:12px;padding:8px 2px;border-bottom:1px solid #edf1f5;align-items:flex-start;overflow-wrap:anywhere;text-align:right}tbody tr td::before{content:attr(data-label);font-size:12px;font-weight:750;color:#60768a;text-align:left;flex:0 0 35%}tbody tr td:last-child{border:0}tbody tr td .actions{justify-content:flex-end}.empty-row td{display:block;text-align:left}.empty-row td::before{display:none}.page-heading{flex-wrap:wrap}.grid{grid-template-columns:1fr}}

.booking-calendar{border:1px solid #cddfe8;border-radius:12px;padding:14px;margin:12px 0;background:#f8fbfd}.calendar-event{border-left:4px solid #2177a2;padding:8px 12px;background:#edf5fa;border-radius:6px;margin:7px 0}.booking-calendar input[type=date]{max-width:240px}

.calendar-slots{display:grid;grid-template-columns:repeat(auto-fit,minmax(185px,1fr));gap:8px}.calendar-slot{border-radius:8px;padding:9px;display:flex;flex-direction:column;font-size:.85rem}.slot-free{background:#e8f7ed;color:#205c36}.slot-busy{background:#ffe8e3;color:#823a27}.slot-blocked{background:#f1f1f1;color:#666}

/* v1.21: mensagens no topo, confirmação explícita para bloqueios e erros */
#message[hidden],.app-notice[hidden]{display:none!important}
.app-notice{position:fixed;z-index:1000;top:84px;right:20px;max-width:min(430px,calc(100vw - 32px));width:max-content;display:flex;align-items:flex-start;gap:16px;padding:15px 17px;border-radius:12px;box-shadow:0 12px 38px #112c4350;border:1px solid #a9ddc3;background:#effbf4;color:#145a37;font-size:14px;line-height:1.45}
.app-notice-warning{background:#fff5e9;color:#7a3c0c;border-color:#f1c48d}
.app-notice-close{flex:none;min-width:28px;min-height:28px;padding:0 6px;background:transparent;color:inherit;box-shadow:none;font-size:22px;line-height:1}
.app-notice-close:hover{background:#0000000d}
.app-alert{width:min(480px,calc(100vw - 32px));max-width:calc(100vw - 32px);border:1px solid #f1d0ca;border-top:5px solid #ba3b35;border-radius:16px;padding:24px;background:#fff;color:#21374a;box-shadow:0 24px 80px #0b23384d}
.app-alert::backdrop{background:#0b233888;backdrop-filter:blur(2px)}
.app-alert h2{font-size:20px;margin:0 0 12px;color:#9b302d}
.app-alert p{line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere;margin:0 0 24px}
.app-alert form{display:flex;justify-content:flex-end;margin:0}
@media(max-width:800px){.app-notice{top:76px;left:12px;right:12px;width:auto}.app-alert{padding:20px}}

/* v1.25: dashboard de consumo de IA */
.ai-cost-cards .card strong{overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.ai-budget{margin:1rem 0 1.5rem}.ai-budget-bar{height:12px;border-radius:10px;background:#e5edf3;overflow:hidden}.ai-budget-bar span{display:block;height:100%;background:#1680a6;transition:width .2s}.ai-budget .muted{font-size:.9rem}

.work-dialog{box-sizing:border-box;max-height:calc(100dvh - 32px);overflow:auto}
.work-dialog .dialog-fields{display:grid;gap:12px}
.work-dialog .dialog-fields :is(input,textarea){box-sizing:border-box;display:block;width:100%;margin-top:6px}
.work-dialog textarea{resize:vertical}
.work-dialog .dialog-error{color:#a11d2b}
.work-dialog .dialog-error:empty{display:none}
.work-dialog .dialog-text{max-height:55vh;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere}

.decision-panel{margin-block:12px 18px}
.decision-panel h4{margin-block:16px 8px}
.project-section{margin-block:20px;padding-block-start:12px;border-top:1px solid var(--line)}
.project-section h3{margin-block:0 10px}
.inline-form{margin-block:8px 12px}
.inline-form>summary{display:inline-flex;align-items:center;min-height:40px;padding:0 12px;border:1px solid var(--line);border-radius:8px;background:#fff;color:var(--primary);font-weight:650;cursor:pointer}
.inline-form>summary:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.inline-form[open]>summary{margin-block-end:8px}

.dashboard-items{margin-top:20px}

body.qr-label{font:15px system-ui,Arial,sans-serif;text-align:center;max-width:370px;margin:35px auto;padding:12px;background:#fff;color:#163e57}
.qr-label img{display:block;margin:0 auto;image-rendering:pixelated}
.qr-label-details{white-space:pre-line}
.qr-label-status{font-size:13px}
.qr-label-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
@media print{
 .qr-label-actions,.qr-label-status{display:none}
 body.qr-label{margin:0 auto}
}

.dashboard-notice{border-left:3px solid var(--primary);padding:12px 16px;margin:12px 0;background:#f3f8fb;border-radius:8px}
.dashboard-notice h4,.dashboard-notice p{margin:0 0 8px}
.dashboard-notice p{white-space:pre-wrap;overflow-wrap:anywhere}
.dashboard-notice small{display:block;margin-bottom:8px}

.dashboard-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: clamp(12px, 2vw, 24px);
  padding: clamp(14px, 3vw, 30px);
  border: 1px solid #dde6e8;
  border-radius: 14px;
  background: radial-gradient(circle, #b8c5cd 0.8px, transparent 1px) 0 0 / 17px 17px, #f4f7f7;
}

button.dashboard-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  min-height: 142px;
  padding: 18px;
  border: 1px solid transparent;
  border-radius: 3px 3px 12px 3px;
  background: var(--paper);
  color: #20313f;
  text-align: left;
  line-height: 1.25;
  box-shadow: 0 5px 5px -4px #18334260, 0 8px 16px -12px #18334275;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.dashboard-card[data-id="projects"] { --paper: #b9def6; }
.dashboard-card[data-id="goals_pending"] { --paper: #fae89c; }
.dashboard-card[data-id="deliverables"] { --paper: #bce6c9; }
.dashboard-card[data-id="late"] { --paper: #f5b9b6; }
.dashboard-card[data-id="pending_review"] { --paper: #dcd0fa; }

.dashboard-card strong {
  font-size: clamp(30px, 3.8vw, 44px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

button.dashboard-card:hover {
  background: var(--paper);
  transform: translateY(-2px);
  box-shadow: 0 9px 12px -7px #18334290;
}

button.dashboard-card[aria-pressed="true"] {
  border-color: currentColor;
  box-shadow: inset 0 0 0 1px currentColor;
}

button.dashboard-card:focus-visible {
  outline: 2px solid #175774;
  outline-offset: 3px;
}

@media (max-width: 480px) {
  .dashboard-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  button.dashboard-card { min-height: 110px; padding: 11px; font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  button.dashboard-card { transition: none; }
  button.dashboard-card:hover { transform: none; }
}

.dashboard-card[data-id="bookings_pending"] { --paper: #f7cfaa; }
#dashboard-weekly summary,.row-menu summary { cursor:pointer; font-weight:650; }
.weekly-content { margin-top:12px; }
.weekly-content pre { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; }
#planning-filters { margin:12px 0; }
.goal-progress { display:flex; gap:6px; align-items:center; justify-content:center; font-variant-numeric:tabular-nums; }
.goal-progress progress { width:64px; min-width:0; height:9px; accent-color:#197396; }
.deadline-badge { display:block; width:max-content; max-width:100%; margin:4px auto 0; padding:2px 6px; border-radius:6px; background:#fff1cf; color:#79500a; font-size:0.8rem; white-space:nowrap; }
.row-menu summary { list-style:none; width:max-content; color:var(--ink); background:#edf4f7; border-radius:7px; padding:6px 9px; }
.row-menu summary::-webkit-details-marker { display:none; }
.row-menu-items { display:grid; gap:4px; margin-top:5px; }
.row-menu-items button { text-align:center; }
.scroll tr:has(td[data-label="Alertas"] .status-wait) > td { background:#fff8e7; }
.scroll tr:has(td[data-label="Alertas"] .status-bad) > td { background:#fff0ee; }
td[data-label="Alertas"] .status { margin:2px; }

.curisco-brand{display:flex;align-items:center;gap:8px;min-width:0}
.curisco-brand img{display:block;width:clamp(135px,24vw,210px);max-width:100%;height:auto;background:#fff;border-radius:6px}
.curisco-brand small{white-space:nowrap}

.project-overview { margin: 0 0 1.25rem; }
.project-cost-summary { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .8rem; }
.project-cost-summary summary { cursor: pointer; font-weight: 700; }
.project-cost-summary .scroll { margin-top: .85rem; }
.scroll, #content { min-width: 0; max-width: 100%; }
.scroll td, .scroll th { vertical-align: middle; text-align: center; overflow-wrap: anywhere; }
.scroll .actions { justify-content: center; }
@media (min-width: 801px) {
 .scroll table { table-layout: fixed; }
 .scroll td, .scroll th { padding-inline: clamp(4px, .7vw, 13px); }
 .scroll td[data-label="Ações"] button { max-width: 100%; white-space: normal; }
}
@media (max-width: 800px) {
 .scroll tbody tr td { align-items: center; }
 .scroll tbody tr td:has(.actions) .actions { justify-content: center; }
}

@media (min-width: 801px) {
 .scroll table:has(.goal-progress) th:nth-child(2) { width: 28%; }
}

.materials-scroll-hint { margin: 0 0 8px; color: #35556d; font-size: .875rem; font-weight: 650; }
#materials-table { overflow-x: auto; border: 1px solid #e7edf3; }
#materials-table:focus-visible { outline: 2px solid #197aa9; outline-offset: 2px; }
#materials-table table { display: table; table-layout: auto; min-width: 100%; }
#materials-table thead { display: table-header-group; }
#materials-table tbody { display: table-row-group; }
#materials-table tr { display: table-row; border: 0; box-shadow: none; }
#materials-table td, #materials-table th {
 display: table-cell;
 width: auto;
 padding: 12px;
 text-align: center;
 vertical-align: middle;
 white-space: nowrap;
 overflow-wrap: normal;
}
#materials-table td::before { content: none; }
#materials-table td[data-label="Ações"] button { white-space: nowrap; }
#materials-table .actions { flex-wrap: nowrap; }

.storage-location { min-width: 0; }
.storage-location-editor .actions { margin-top: 6px; }
