:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #162033;
    --muted: #6b7280;
    --line: #d9e1ee;
    --primary: #195f9f;
    --primary-dark: #114873;
    --danger: #b42318;
    --success-bg: #e9f8ef;
    --success-text: #146c2e;
    --error-bg: #fff0f0;
    --error-text: #b42318;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 16px 50px rgba(22,32,51,.08); }
.brand { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.brand-mark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: var(--primary); font-weight: 700; }
.brand h1 { margin: 0; font-size: 22px; }
.brand p, .muted { color: var(--muted); margin: 4px 0 0; }
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #10243b; color: #fff; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.sidebar-brand { font-size: 20px; font-weight: 700; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar a, .sidebar .link-button { color: #fff; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.08); border: 0; text-align: left; font: inherit; cursor: pointer; }
.sidebar a:hover, .sidebar .link-button:hover { background: rgba(255,255,255,.16); text-decoration: none; }
.tenant-sidebar { background: #17304f; }
.main-content { padding: 28px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 26px; }
.pill { background: #e8eef7; color: #243b53; border-radius: 999px; padding: 8px 12px; font-size: 14px; }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: #bfe9c9; }
.alert-error { background: var(--error-bg); color: var(--error-text); border-color: #ffd0d0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: 0 6px 20px rgba(22,32,51,.04); }
.card strong { display: block; font-size: 32px; }
.card span { color: var(--muted); }
.panel { margin-bottom: 18px; }
.panel h2 { margin-top: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.actions-bar { margin-bottom: 14px; display: flex; gap: 10px; }
.stack, .grid-form { display: grid; gap: 14px; }
.grid-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-form h2, .grid-form .form-actions { grid-column: 1 / -1; }
.narrow { max-width: 860px; }
.inline-form { display: grid; grid-template-columns: 120px 1fr 260px auto; gap: 12px; align-items: end; }
label { display: grid; gap: 6px; font-weight: 600; }
label small { font-weight: 400; color: var(--muted); }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font: inherit; background: #fff; }
textarea { resize: vertical; }
.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; }
button, .button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 10px; padding: 11px 14px; font: inherit; cursor: pointer; text-decoration: none; }
button.primary, .button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
button.primary:hover, .button.primary:hover { background: var(--primary-dark); text-decoration: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8fafc; font-size: 14px; }
tfoot th { background: #eef4fb; }
.row-actions { display: flex; gap: 12px; align-items: center; }
.row-actions form { margin: 0; }
.link-danger { background: transparent; border: 0; padding: 0; color: var(--danger); }
code { background: #eef2f7; padding: 2px 6px; border-radius: 6px; }
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .inline-form, .grid-form { grid-template-columns: 1fr; }
    .panel-header { display: grid; }
}
.compact { margin-bottom: 0; flex-wrap: wrap; justify-content: flex-end; }
.alert-warning { background: #fff8e6; color: #8a5a00; border-color: #f5d88a; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; background: #eef2f7; font-size: 12px; }
.card-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0 18px; }
.stat-card { background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat-card strong { display: block; font-size: 24px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: minmax(160px, 220px) 1fr auto; gap: 12px; align-items: end; margin: 16px 0; }
.align-end { align-self: end; }
.log-debug { background: #eef2f7; color: #334155; }
.log-info { background: #e8eef7; color: #243b53; }
.log-warning { background: #fff8e6; color: #8a5a00; }
.log-error, .log-critical { background: #fff0f0; color: #b42318; }
.log-json { white-space: pre-wrap; overflow-x: auto; background: #0f172a; color: #e5e7eb; border-radius: 14px; padding: 16px; }
.details-grid { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; }
.details-grid dt { font-weight: 700; color: var(--muted); }
.details-grid dd { margin: 0; }
@media (max-width: 900px) {
    .card-header, .form-grid { display: grid; grid-template-columns: 1fr; }
    .details-grid { grid-template-columns: 1fr; }
}
.warning-panel { border-color: #f5d88a; background: #fffdf5; }
.pill.danger { background: #ffe4e2; color: var(--danger); }
.details-grid.compact { grid-template-columns: max-content 1fr; gap: 6px 14px; }

.grid-form .span-2, .span-2 { grid-column: 1 / -1; }
.info-panel { border-color: #cfe0f5; background: #fbfdff; }
.pill.success { background: var(--success-bg); color: var(--success-text); }
.row-actions .link-button { background: transparent; border: 0; padding: 0; color: var(--primary); }
.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.filter-form { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(5, minmax(120px, 1fr)); gap: 12px; align-items: end; margin: 14px 0 18px; }
.filter-actions { display: flex; gap: 8px; align-items: end; }
.pagination { display: flex; gap: 12px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.split-actions { justify-content: space-between; align-items: center; }
.split-actions > div { display: flex; gap: 10px; flex-wrap: wrap; }
.w-order { width: 110px; }
.w-people { width: 190px; }
td input[type="checkbox"], th input[type="checkbox"] { width: auto; }
@media (max-width: 1100px) {
    .two-columns, .filter-form { grid-template-columns: 1fr; }
    .split-actions { display: grid; justify-content: stretch; }
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.notification-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 8px 12px; background: #e8eef7; color: #243b53; font-weight: 700; }
.notification-pill.has-unread { background: #fff8e6; color: #8a5a00; border: 1px solid #f5d88a; }
.notification-card { border-left: 6px solid #cbd5e1; }
.notification-card.notification-danger { border-left-color: var(--danger); background: #fffafa; }
.notification-card.notification-warning { border-left-color: #d89216; background: #fffdf5; }
.notification-card.notification-success { border-left-color: var(--success-text); background: #fbfffc; }
.notification-card.notification-info { border-left-color: var(--primary); }
.notification-card.notification-read { opacity: .82; }
.notification-badge-info { background: #e8eef7; color: #243b53; }
.notification-badge-success { background: var(--success-bg); color: var(--success-text); }
.notification-badge-warning { background: #fff8e6; color: #8a5a00; }
.notification-badge-danger { background: #ffe4e2; color: var(--danger); }
.notification-unread { background: var(--primary); color: #fff; }
.log-sent { background: var(--success-bg); color: var(--success-text); }
.log-failed { background: #fff0f0; color: var(--danger); }
.log-skipped { background: #eef2f7; color: #334155; }

/* v17 - acabamento operacional e manual interno */
.hero-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-color: #cfe0f5; background: linear-gradient(135deg, #fbfdff 0%, #f1f7ff 100%); }
.hero-panel h2 { margin: 8px 0; font-size: 28px; }
.hero-panel p { max-width: 820px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.progress-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 68px; height: 42px; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 700; }
.workflow-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.dashboard-workflow { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.workflow-item { display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.workflow-item p { margin: 5px 0 8px; color: var(--muted); }
.workflow-item.done { border-color: #bfe9c9; background: #fbfffc; }
.workflow-item.pending { border-color: #f5d88a; background: #fffdf5; }
.workflow-number { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #e8eef7; color: #243b53; }
.workflow-item.done .workflow-number { background: var(--success-bg); color: var(--success-text); }
.workflow-item.pending .workflow-number { background: #fff8e6; color: #8a5a00; }
.quick-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.quick-action { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; color: var(--text); }
.quick-action:hover { text-decoration: none; border-color: #aac5e6; background: #fbfdff; }
.quick-action span { color: var(--muted); }
.checklist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.checklist-item { display: grid; grid-template-columns: 36px 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; }
.checklist-item p { margin: 5px 0 8px; color: var(--muted); }
.checklist-item.done { border-color: #bfe9c9; background: #fbfffc; }
.checklist-item.pending.required { border-color: #f5d88a; background: #fffdf5; }
.checklist-item.pending.optional { border-color: #d9e1ee; background: #f8fafc; }
.checklist-status { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; font-weight: 800; background: #eef2f7; color: #334155; }
.checklist-item.done .checklist-status { background: var(--success-bg); color: var(--success-text); }
.checklist-item.pending.required .checklist-status { background: #fff8e6; color: #8a5a00; }
.help-list { margin: 10px 0 16px; padding-left: 20px; }
.help-list li { margin: 7px 0; }
button[disabled], .button.disabled { opacity: .55; cursor: not-allowed; }
@media (max-width: 900px) {
    .hero-panel { display: grid; }
    .hero-actions { justify-content: stretch; }
    .hero-actions .button { width: 100%; }
}

.input-short{width:90px}
.install-card-wide{width:min(980px,100%)}


/* v24 - Saúde do sistema */
.health-hero { border-width: 2px; }
.health-score { min-width: 150px; min-height: 106px; display: grid; place-items: center; text-align: center; border-radius: 18px; background: #fff; border: 1px solid var(--line); padding: 16px; }
.health-score span { width: 42px; height: 42px; border-radius: 999px; display: grid; place-items: center; font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.health-score strong { display: block; }
.health-ok { border-color: #bfe9c9; background: #fbfffc; }
.health-warning { border-color: #f5d88a; background: #fffdf5; }
.health-critical { border-color: #ffd0d0; background: #fffafa; }
.health-badge.health-ok, .health-score .health-ok, .health-ok .health-score span { background: var(--success-bg); color: var(--success-text); }
.health-badge.health-warning, .health-warning .health-score span { background: #fff8e6; color: #8a5a00; }
.health-badge.health-critical, .health-critical .health-score span { background: #ffe4e2; color: var(--danger); }
.health-section { overflow: hidden; }
.health-details { margin-top: 8px; }
.health-details summary { cursor: pointer; color: var(--primary); }
.health-details pre { white-space: pre-wrap; overflow-x: auto; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
@media (max-width: 900px) {
    .health-score { min-width: 100%; }
}


/* v31 - entrada pública sem simplificação */
.auth-card.auth-card-wide { width: min(980px, 100%); }
.public-entry { display: grid; gap: 18px; }
.public-hero { margin-bottom: 0; }
.public-login-grid { margin-bottom: 0; }
.public-access-card { margin-bottom: 0; }
.public-access-card h2 { margin: 8px 0; }
.public-help-panel { margin-bottom: 0; }
@media (max-width: 900px) {
    .auth-card.auth-card-wide { width: min(520px, 100%); }
}
