:root {
    --navy: #315d78;
    --navy-dark: #234963;
    --cyan: #2397b5;
    --page: #eef5f8;
    --line: #c9d8e1;
    --text: #17364a;
    --muted: #607789;
    --danger: #a83636;
    --success: #176a49;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f7fbfd 0%, var(--page) 100%);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
}

.topbar, .bottombar { background: var(--navy); color: white; }
.topbar {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 22px;
    gap: 24px;
}
.brand-logo { width: 184px; height: 42px; object-fit: contain; object-position: left center; }
.topbar-label { font-weight: 600; }
.bottombar { min-height: 58px; display: grid; place-items: center; padding: 12px; font-size: 14px; }

.page-center, .setup-wrap, .dashboard-wrap {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 48px 20px;
}
.card, .welcome-card {
    position: relative;
    width: min(100%, 460px);
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(31, 65, 86, .13);
    padding: 38px 36px 32px;
}
.card-accent { position: absolute; inset: 0 0 auto; height: 5px; border-radius: 8px 8px 0 0; background: var(--cyan); }
h1 { margin: 0 0 8px; font-size: clamp(27px, 5vw, 36px); text-align: center; }
h2 { margin: 8px 0; }
.subtitle { margin: 0 0 26px; color: var(--muted); text-align: center; }
label { display: block; margin: 17px 0 7px; font-weight: 700; }
input, select {
    width: 100%;
    min-height: 45px;
    border: 1px solid #b9cbd6;
    border-radius: 5px;
    padding: 10px 12px;
    background: white;
    color: var(--text);
    font: inherit;
}
input:focus, select:focus { outline: 3px solid rgba(35,151,181,.18); border-color: var(--cyan); }
button, .button-link {
    width: 100%;
    min-height: 47px;
    margin-top: 24px;
    border: 0;
    border-radius: 5px;
    background: var(--cyan);
    color: white;
    font: 700 16px/1 "Segoe UI", Arial, sans-serif;
    cursor: pointer;
    text-decoration: none;
    display: inline-grid;
    place-items: center;
}
button:hover, .button-link:hover { background: #167f9d; }
.test-note { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid #dbe5eb; color: var(--muted); text-align: center; font-size: 13px; }
.message { margin: 18px 0; border-radius: 5px; padding: 12px 14px; font-weight: 600; }
.message.error { background: #fff0f0; border: 1px solid #ecc5c5; color: var(--danger); }
.message.success { background: #eefaf4; border: 1px solid #bfe1cf; color: var(--success); }
.privacy-note { margin: 18px 0; padding: 14px; border-left: 4px solid var(--cyan); background: #f1f7fa; color: var(--muted); }

.user-summary { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 22px; font-size: 14px; }
.welcome-card { width: min(100%, 900px); padding: 46px; text-align: center; }
.status-pill { display: inline-block; margin-bottom: 20px; padding: 7px 12px; border-radius: 20px; color: var(--success); background: #eaf8f1; font-weight: 700; }
.eyebrow { color: var(--cyan); font-weight: 800; letter-spacing: .15em; font-size: 12px; }
.welcome-card > p:not(.eyebrow) { color: var(--muted); }
.identity-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 34px; text-align: left; }
.identity-grid div { min-height: 90px; padding: 18px; border: 1px solid #d6e2e9; background: #f8fbfc; border-radius: 6px; }
.identity-grid small { display: block; margin-bottom: 8px; color: var(--muted); }
.identity-grid strong { word-break: break-word; }
.logout-form { max-width: 230px; margin: 10px auto 0; }
.secondary-button { background: var(--navy); }

.setup-wrap { align-items: start; }
.setup-card { width: min(100%, 920px); }
.setup-card h1 { margin-bottom: 24px; }
.progress-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 28px; }
.progress-grid div { display: flex; justify-content: space-between; padding: 16px; background: #f3f8fa; border: 1px solid #d4e1e8; border-radius: 6px; }
fieldset { margin: 26px 0 0; border: 1px solid #cbdbe4; border-radius: 7px; padding: 20px; }
legend { padding: 0 8px; font-weight: 800; color: var(--navy); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.complete-state { padding: 22px 0 8px; text-align: center; }
.complete-icon { width: 72px; height: 72px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: #e8f8f0; color: var(--success); font-size: 38px; font-weight: 800; }
.complete-state .button-link { max-width: 260px; }

@media (max-width: 720px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .topbar-label { align-self: flex-end; margin-top: -34px; }
    .user-summary { width: 100%; justify-content: flex-start; padding: 4px 0; }
    .identity-grid, .form-grid, .progress-grid { grid-template-columns: 1fr; }
    .card, .welcome-card { padding: 34px 22px 28px; }
}

/* Painel principal do appSmart */
.app-shell-body {
    height: 100vh;
    min-height: 640px;
    overflow: hidden;
    background: #f7f9fb;
}

.app-header {
    min-height: 54px;
    display: flex;
    align-items: center;
    color: white;
    background: var(--navy-dark);
    box-shadow: 0 2px 8px rgba(24, 53, 72, .22);
    z-index: 30;
}

.app-brand {
    width: 245px;
    height: 54px;
    padding: 7px 18px;
    display: flex;
    align-items: center;
    border-right: 1px solid rgba(255,255,255,.12);
}

.app-brand img {
    width: 168px;
    height: 40px;
    object-fit: contain;
    object-position: left center;
}

.header-nav {
    height: 54px;
    margin-left: auto;
    display: flex;
    align-items: stretch;
}

.header-nav a {
    padding: 0 18px;
    display: flex;
    align-items: center;
    color: rgba(255,255,255,.9);
    border-left: 1px solid rgba(255,255,255,.1);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.header-nav a:hover,
.header-nav a.active { background: rgba(255,255,255,.09); color: white; }

.header-account {
    min-width: 335px;
    padding: 5px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 12px;
    align-items: center;
    border-left: 1px solid rgba(255,255,255,.12);
    font-size: 12px;
}

.account-company { font-weight: 700; }
.account-user { grid-column: 1; opacity: .78; font-size: 11px; }
.header-account form { grid-column: 2; grid-row: 1 / span 2; }

.header-logout,
.sidebar-toggle,
.new-record {
    width: auto;
    min-height: 34px;
    margin: 0;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 13px;
}

.header-logout { background: transparent; border: 1px solid rgba(255,255,255,.45); }
.header-logout:hover { background: rgba(255,255,255,.1); }

.app-toolbar {
    min-height: 52px;
    padding: 7px 14px;
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 250px 260px;
    gap: 10px;
    align-items: center;
    background: white;
    border-bottom: 1px solid #cbd9e1;
    box-shadow: 0 2px 8px rgba(29, 63, 84, .08);
    z-index: 20;
}

.app-toolbar input,
.app-toolbar select {
    min-height: 38px;
    margin: 0;
    padding: 7px 11px;
    border-radius: 3px;
}

.sidebar-toggle { display: none; background: var(--navy); }
.new-record { min-height: 38px; background: var(--cyan); font-weight: 700; }

.app-layout {
    min-height: 0;
    flex: 1;
    display: flex;
    overflow: hidden;
}

.app-sidebar {
    width: 245px;
    min-width: 245px;
    overflow-y: auto;
    background: #f3f6f8;
    border-right: 1px solid #cfdae1;
}

.sidebar-title {
    height: 47px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    background: var(--navy-dark);
    font-weight: 700;
}

.app-sidebar nav { padding: 9px 9px 18px; }
.app-sidebar nav a {
    min-height: 37px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 4px;
    color: #345469;
    text-decoration: none;
    font-size: 14px;
}

.app-sidebar nav a:hover { background: #e5edf2; }
.app-sidebar nav a.sidebar-active { background: #d8e8f1; color: #174d6f; font-weight: 700; }
.menu-icon { width: 21px; color: #6b8291; text-align: center; font-size: 12px; }
.sidebar-divider { height: 1px; margin: 9px 5px; background: #d7e0e5; }
.module-pending { cursor: default; }

.app-main {
    min-width: 0;
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px 34px;
    background: white;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
}

.app-main .page-heading h1 {
    margin: 0;
    color: var(--navy-dark);
    font-size: 25px;
    line-height: 1.2;
    text-align: left;
}

.page-heading p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.heading-status { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.heading-status > span {
    padding: 6px 10px;
    border: 1px solid #d4e0e7;
    border-radius: 16px;
    color: #557083;
    background: #fafcfd;
    font-size: 11px;
}
.heading-status .online-chip { color: var(--success); border-color: #bfe0cd; background: #effaf4; }

.demo-warning {
    margin: 17px 0 12px;
    padding: 9px 12px;
    border-left: 4px solid #e2a626;
    background: #fff9e9;
    color: #745514;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(155px, 1fr));
    gap: 10px;
}

.metric-card {
    min-height: 112px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid #d4e0e7;
    background: #fff;
}

.metric-card > span { color: #4e6c80; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.metric-card strong { margin: 11px 0 5px; color: #1f536f; font-size: 25px; line-height: 1; }
.metric-card small { color: #879aa7; font-size: 11px; }

.dashboard-panel { margin-top: 14px; border: 1px solid #d4e0e7; background: white; }
.panel-heading {
    min-height: 47px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #dbe5ea;
}
.app-main .panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading > span { color: #8295a2; font-size: 11px; }

.quick-grid { padding: 13px; display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 11px; }
.quick-grid article { min-height: 88px; padding: 15px; border: 1px solid #d7e2e8; background: #fbfcfd; }
.quick-grid strong { color: #245c7c; }
.quick-grid p { margin: 7px 0 0; color: #6d8290; font-size: 12px; line-height: 1.4; }

.indicator-list { padding: 13px; display: flex; flex-wrap: wrap; gap: 8px; }
.indicator-list span { padding: 7px 11px; border: 1px solid #d3e0e7; border-radius: 16px; color: #587184; background: #fafcfd; font-size: 11px; }

.app-statusbar {
    min-height: 30px;
    padding: 5px 14px;
    display: flex;
    align-items: center;
    gap: 22px;
    color: white;
    background: var(--navy);
    font-size: 11px;
    z-index: 30;
}
.app-statusbar span:first-child { color: #7cf2af; font-weight: 800; }

@media (max-width: 1180px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(155px, 1fr)); }
    .quick-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
    .header-account { min-width: 280px; }
}

@media (max-width: 820px) {
    .app-shell-body { overflow: auto; }
    .app-header { min-height: 58px; }
    .app-brand { width: auto; min-width: 155px; border-right: 0; }
    .app-brand img { width: 138px; }
    .header-nav { display: none; }
    .header-account { min-width: 0; margin-left: auto; border-left: 0; }
    .account-company, .account-user { display: none; }
    .app-toolbar { grid-template-columns: 42px 1fr; }
    .app-toolbar select, .new-record { display: none; }
    .sidebar-toggle { display: inline-grid; place-items: center; }
    .app-layout { overflow: visible; }
    .app-sidebar {
        position: fixed;
        inset: 110px auto 30px 0;
        transform: translateX(-105%);
        transition: transform 180ms ease;
        box-shadow: 12px 0 30px rgba(26,55,74,.2);
        z-index: 50;
    }
    .sidebar-open .app-sidebar { transform: translateX(0); }
    .app-main { overflow: visible; padding: 20px 13px 30px; }
    .page-heading { flex-direction: column; }
    .heading-status { justify-content: flex-start; }
    .metric-grid { grid-template-columns: repeat(2, minmax(135px, 1fr)); }
    .quick-grid { grid-template-columns: 1fr; }
    .app-statusbar { position: sticky; bottom: 0; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 480px) {
    .header-account { padding-left: 4px; }
    .app-toolbar { padding: 7px 9px; }
    .metric-grid { grid-template-columns: 1fr; }
    .app-main .page-heading h1 { font-size: 22px; }
}
