:root {
    --navy: #0f2f57;
    --navy-2: #123d70;
    --blue: #1f6fbf;
    --green: #23866a;
    --gold: #b88418;
    --red: #b74444;
    --ink: #243447;
    --muted: #6c7a89;
    --line: #dfe6ee;
    --surface: #ffffff;
    --background: #f3f6fa;
}

.tutorial-grid{display:grid;gap:1rem;grid-template-columns:repeat(auto-fit,minmax(260px,1fr))}
.tutorial-card{background:#fff;border:1px solid var(--line,#d7e0ea);border-radius:8px;box-shadow:0 8px 22px rgba(16,43,78,.06);display:grid;gap:1rem;grid-template-columns:54px 1fr;padding:1rem}
.tutorial-card-icon{align-items:center;background:#edf4fb;border-radius:8px;color:var(--blue,#0d6efd);display:flex;height:54px;justify-content:center;width:54px}
.tutorial-card h2,.tutorial-step h2{color:var(--navy,#003b71);font-size:1.05rem;font-weight:850;margin:0}
.tutorial-card p{color:var(--muted,#667085);margin:.35rem 0 .8rem}
.tutorial-profile{background:#e8f2ff;border-radius:999px;color:#145da0;display:inline-flex;font-size:.72rem;font-weight:850;margin-bottom:.35rem;padding:.2rem .55rem;text-transform:uppercase}
.tutorial-progress{display:grid;gap:.45rem;margin:.65rem 0}
.tutorial-progress-head{align-items:center;color:var(--muted,#667085);display:flex;font-size:.82rem;justify-content:space-between}
.tutorial-progress .progress{height:.55rem}
.tutorial-timeline{display:grid;gap:1rem}
.tutorial-step{background:#fff;border:1px solid var(--line,#d7e0ea);border-radius:8px;box-shadow:0 8px 22px rgba(16,43,78,.05);display:grid;gap:1rem;grid-template-columns:44px 1fr;padding:1rem}
.tutorial-step.done{background:#fbfffd;border-color:#b7e3cc}
.tutorial-step-number{align-items:center;background:var(--navy,#003b71);border-radius:999px;color:#fff;display:flex;font-weight:850;height:38px;justify-content:center;width:38px}
.tutorial-step-head{align-items:center;display:flex;flex-wrap:wrap;gap:.6rem;justify-content:space-between}
.tutorial-step dl{display:grid;gap:.35rem;margin:.7rem 0}
.tutorial-step dt{color:var(--navy,#003b71);font-size:.78rem;font-weight:850;text-transform:uppercase}
.tutorial-step dd{color:var(--muted,#667085);margin:0 0 .45rem}
.tutorial-summary{display:grid;gap:.5rem}
@media(max-width:767.98px){.tutorial-card,.tutorial-step{grid-template-columns:1fr}.tutorial-card-icon,.tutorial-step-number{height:44px;width:44px}}

* {
    letter-spacing: 0;
}

body {
    color: var(--ink);
    font-size: 13px;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    text-decoration: none;
}

.btn,
.form-control,
.form-select,
.input-group-text {
    font-size: 13px;
}

.btn-primary {
    --bs-btn-bg: var(--blue);
    --bs-btn-border-color: var(--blue);
    --bs-btn-hover-bg: #195fA5;
    --bs-btn-hover-border-color: #195fA5;
    border-radius: 8px;
}

.btn-outline-primary {
    --bs-btn-color: var(--blue);
    --bs-btn-border-color: var(--blue);
    --bs-btn-hover-bg: var(--blue);
    --bs-btn-hover-border-color: var(--blue);
    border-radius: 8px;
}

.public-page {
    background: linear-gradient(135deg, #eef4f9 0%, #ffffff 48%, #eaf1f7 100%);
    min-height: 100vh;
}

.public-hero h1 {
    color: var(--navy);
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    font-weight: 800;
    line-height: 1.02;
    margin: 1rem 0 1.25rem;
    max-width: 900px;
}

.public-hero .lead {
    color: #526475;
    font-size: 1.2rem;
    max-width: 720px;
}

.public-badge {
    align-items: center;
    background: #e6eff8;
    border: 1px solid #c7d8ea;
    border-radius: 999px;
    color: var(--navy);
    display: inline-flex;
    font-size: .88rem;
    font-weight: 700;
    gap: .5rem;
    padding: .45rem .85rem;
}

.public-panel {
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(15, 47, 87, .14);
    padding: 1.25rem;
}

.public-panel-top {
    background: var(--navy);
    border-radius: 6px;
    height: 64px;
    margin-bottom: 1rem;
}

.public-stat {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 1rem;
    margin-top: .85rem;
    padding: 1rem;
}

.public-stat i {
    align-items: center;
    background: #eaf3fb;
    border-radius: 8px;
    color: var(--blue);
    display: inline-flex;
    flex: 0 0 42px;
    height: 42px;
    justify-content: center;
}

.public-stat strong,
.public-stat span {
    display: block;
}

.public-stat span {
    color: var(--muted);
    font-size: .9rem;
}

.login-page {
    background: radial-gradient(circle at top left, #dbe8f4, transparent 38%), var(--background);
    min-height: 100vh;
}

.login-shell {
    align-items: center;
    display: grid;
    gap: 2rem;
    grid-template-columns: 1.1fr .9fr;
    min-height: 100vh;
    padding: 2rem 0;
}

.login-brand h1 {
    color: var(--navy);
    font-size: clamp(2rem, 4vw, 4rem);
    font-weight: 800;
    line-height: 1.05;
    margin: 1rem 0;
}

.login-brand p {
    color: #526475;
    font-size: 1.08rem;
    max-width: 680px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 22px 55px rgba(15, 47, 87, .14);
    padding: 2rem;
}

.login-icon {
    align-items: center;
    background: var(--navy);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    height: 56px;
    justify-content: center;
    margin-bottom: 1rem;
    width: 56px;
}

.input-group-text {
    background: #eef4f9;
    border-color: #d7e1ec;
    color: var(--navy);
}

.form-control {
    border-color: #d7e1ec;
    min-height: 44px;
}

.app-page {
    background: var(--background);
    min-height: 100vh;
}

.topbar {
    align-items: center;
    background: var(--navy);
    box-shadow: 0 8px 26px rgba(15, 47, 87, .18);
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 72px;
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar-brand,
.topbar-actions {
    align-items: center;
    display: flex;
    gap: .9rem;
}

.topbar-brand strong,
.topbar-brand span {
    display: block;
}

.topbar-brand strong {
    font-size: .95rem;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-brand span {
    color: #cbd9e8;
    font-size: .78rem;
    max-width: 520px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-mark,
.menu-toggle {
    align-items: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.menu-toggle {
    display: none;
}

.user-chip {
    align-items: center;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    display: flex;
    gap: .5rem;
    max-width: 280px;
    padding: .45rem .8rem;
}

.user-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-dropdown { position: relative; }
.notification-button {
    align-items: center;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    height: 40px;
    justify-content: center;
    position: relative;
    width: 40px;
}
.notification-button span {
    align-items: center;
    background: #d9534f;
    border-radius: 999px;
    display: inline-flex;
    font-size: .68rem;
    font-weight: 800;
    height: 18px;
    justify-content: center;
    min-width: 18px;
    padding: 0 .25rem;
    position: absolute;
    right: -6px;
    top: -6px;
}
.notification-menu {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 45px rgba(15,47,87,.18);
    color: var(--ink);
    display: none;
    min-width: 330px;
    position: absolute;
    right: 0;
    top: calc(100% + .5rem);
    z-index: 30;
}
.notification-dropdown:hover .notification-menu,
.notification-dropdown:focus-within .notification-menu { display: block; }
.notification-menu-head {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    padding: .85rem;
}
.notification-menu-head a { color: var(--blue); font-weight: 800; }
.notification-menu-empty { color: var(--muted); padding: 1rem; }
.notification-menu-item {
    align-items: center;
    border-bottom: 1px solid #eef2f6;
    color: var(--ink);
    display: flex;
    gap: .75rem;
    padding: .75rem .85rem;
}
.notification-menu-item.unread { background: #f2f8ff; }
.notification-menu-item i { color: var(--blue); }
.notification-menu-item strong,
.notification-menu-item small { display: block; }
.notification-menu-item small { color: var(--muted); }

.app-body {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: calc(100vh - 72px);
}

.sidebar {
    background: #e8eef5;
    border-right: 1px solid #d5dfeb;
    padding: 1.25rem;
}

.sidebar-title {
    color: var(--navy);
    font-size: .82rem;
    font-weight: 800;
    margin-bottom: .85rem;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: .72rem;
}

.sidebar-card {
    align-items: center;
    background: var(--surface);
    border: 1px solid #dce5ef;
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(15, 47, 87, .06);
    color: var(--ink);
    display: grid;
    gap: .1rem .75rem;
    grid-template-columns: 38px 1fr;
    min-height: 64px;
    padding: .75rem;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.sidebar-card i {
    align-items: center;
    background: #edf4fb;
    border-radius: 8px;
    color: var(--blue);
    display: inline-flex;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.sidebar-card span {
    font-size: .9rem;
    font-weight: 700;
}

.sidebar-card small {
    color: var(--muted);
    font-size: .75rem;
    grid-column: 2;
}

.sidebar-card:hover,
.sidebar-card.active {
    border-color: #9fc0e2;
    box-shadow: 0 12px 28px rgba(15, 47, 87, .1);
    color: var(--navy);
    transform: translateY(-1px);
}

.sidebar-card.active {
    background: #f7fbff;
}

.main-content {
    min-width: 0;
    padding: 1.5rem;
}

.dashboard-header {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.dashboard-header h1,
.module-placeholder h1 {
    color: var(--navy);
    font-size: 1.45rem;
    font-weight: 800;
    margin: .15rem 0;
}

.dashboard-header p,
.module-placeholder p {
    color: var(--muted);
    font-size: .9rem;
    margin: 0;
}

.section-kicker {
    color: var(--blue);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.dashboard-user-card {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: .75rem;
    min-width: 240px;
    padding: .9rem;
}

.dashboard-user-card i {
    color: var(--gold);
    font-size: 1.35rem;
}

.dashboard-user-card strong,
.dashboard-user-card span {
    display: block;
}

.dashboard-user-card span {
    color: var(--muted);
    font-size: .82rem;
}

.stats-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 1.25rem;
}

.info-card,
.content-panel,
.module-placeholder {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 47, 87, .06);
}

.info-card {
    align-items: center;
    display: flex;
    gap: .85rem;
    min-height: 104px;
    padding: 1rem;
}

.info-card span,
.info-card strong {
    display: block;
}

.info-card span {
    color: var(--muted);
    font-size: .84rem;
}

.info-card strong {
    color: var(--navy);
    font-size: .98rem;
}

.info-icon {
    align-items: center;
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 48px;
    height: 48px;
    justify-content: center;
}

.bg-blue { background: var(--blue); }
.bg-green { background: var(--green); }
.bg-gold { background: var(--gold); }
.bg-red { background: var(--red); }

.content-panel {
    min-width: 0;
    margin-bottom: 1.25rem;
    padding: 1.25rem;
}

.panel-heading {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.panel-heading h2 {
    color: var(--navy);
    font-size: 1.05rem;
    font-weight: 800;
    margin: .15rem 0 0;
}

.panel-heading > i {
    color: #9aaabd;
    font-size: 1.4rem;
}

.planned-grid {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.planned-item {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: flex;
    gap: .8rem;
    min-height: 82px;
    padding: .9rem;
    transition: background .18s ease, border-color .18s ease;
}

.planned-item:hover {
    background: #f7fbff;
    border-color: #b7d0ea;
}

.planned-item i {
    color: var(--blue);
    font-size: 1.2rem;
}

.planned-item strong,
.planned-item span {
    display: block;
}

.planned-item span {
    color: var(--muted);
    font-size: .84rem;
}

.chart-panel {
    min-height: 280px;
}

.reports-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 1.25rem;
}

.chart-card {
    min-height: 0;
    padding: 1rem;
}

.chart-card canvas {
    display: block;
    height: 210px !important;
    max-height: 210px;
    width: 100% !important;
}

.chart-card h2 {
    color: var(--navy);
    font-size: .98rem;
    font-weight: 800;
    margin: 0 0 .75rem;
}

.chart-card .panel-heading {
    margin-bottom: .75rem;
}

.module-placeholder {
    margin: 2rem auto;
    max-width: 760px;
    padding: 2.5rem;
    text-align: center;
}

.placeholder-icon {
    align-items: center;
    background: #eaf3fb;
    border-radius: 8px;
    color: var(--blue);
    display: inline-flex;
    font-size: 1.5rem;
    height: 62px;
    justify-content: center;
    margin-bottom: 1rem;
    width: 62px;
}

.app-footer {
    align-items: center;
    background: #13283f;
    color: #cbd9e8;
    display: flex;
    font-size: .86rem;
    gap: 1rem;
    justify-content: space-between;
    padding: .85rem 1.5rem;
}

.app-footer a {
    color: #fff;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 1100px) {
    .stats-grid,
    .planned-grid,
    .reports-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 860px) {
    .login-shell,
    .app-body {
        grid-template-columns: 1fr;
    }

    .login-shell {
        min-height: auto;
        padding: 2rem 0;
    }

    .topbar {
        align-items: flex-start;
        gap: .75rem;
        padding: .85rem;
    }

    .topbar-actions {
        align-items: flex-end;
        flex-direction: column;
        gap: .5rem;
    }

    .topbar-brand strong {
        font-size: .95rem;
    }

    .brand-mark {
        display: none;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .sidebar {
        display: none;
        padding: .85rem;
    }

    .sidebar.open {
        display: block;
    }

    .main-content {
        padding: 1rem;
    }

    .dashboard-header {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-user-card {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .stats-grid,
    .planned-grid,
    .reports-grid {
        grid-template-columns: 1fr;
    }

    .public-panel,
    .login-card,
    .content-panel,
    .module-placeholder {
        padding: 1rem;
    }

    .chart-card canvas {
        height: 180px !important;
        max-height: 180px;
    }

    .topbar {
        flex-direction: column;
    }

    .topbar-actions,
    .topbar-actions form,
    .topbar-actions .btn,
    .user-chip,
    .notification-dropdown,
    .notification-button {
        width: 100%;
    }

    .notification-menu {
        left: 0;
        min-width: 0;
        right: 0;
        width: 100%;
    }

    .topbar-actions .btn {
        min-height: 40px;
    }

    .app-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: .25rem;
    }
}

/* Login inspirado no modelo corporativo solicitado */
.login-page {
    background: #f4f7fb;
    min-height: 100vh;
    overflow-x: hidden;
}

.login-stage {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
}

.login-diagonal {
    background: #174c7f;
    clip-path: polygon(0 0, 70% 0, 26% 100%, 0 100%);
    inset: 0;
    position: fixed;
    z-index: 0;
}

.login-stage .login-shell {
    display: block;
    min-height: 0;
    padding: 0;
    position: relative;
    width: min(440px, 100%);
    z-index: 1;
}

.login-stage .login-card {
    background: #fff;
    border: 1px solid #d8e1ea;
    border-radius: 7px;
    box-shadow: 0 24px 70px rgba(20, 52, 85, .18);
    padding: 1.9rem;
}

.login-card-header {
    align-items: center;
    display: flex;
    gap: 1rem;
    margin-bottom: 1.65rem;
}

.login-card-header h1 {
    color: #102f53;
    font-size: 1.28rem;
    font-weight: 800;
    line-height: 1.15;
    margin: 0 0 .25rem;
}

.login-card-header p {
    color: #66758a;
    margin: 0;
}

.login-stage .login-icon {
    align-items: center;
    background: #15558e;
    border-radius: 7px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 58px;
    font-size: 1.55rem;
    height: 58px;
    justify-content: center;
    margin: 0;
    width: 58px;
}

.login-stage .form-label {
    color: #102f53;
    font-weight: 800;
    margin-bottom: .55rem;
}

.login-stage .input-group {
    border-radius: 6px;
}

.login-stage .input-group-text {
    background: #f8fafc;
    border-color: #d5e0eb;
    border-radius: 6px 0 0 6px;
    color: #17293d;
    justify-content: center;
    width: 40px;
}

.login-stage .form-control {
    border-color: #d5e0eb;
    border-radius: 0 6px 6px 0;
    min-height: 46px;
}

.login-stage .form-control:focus {
    border-color: #7da7cf;
    box-shadow: 0 0 0 .2rem rgba(21, 85, 142, .12);
}

.btn-login {
    --bs-btn-bg: #174c7f;
    --bs-btn-border-color: #174c7f;
    --bs-btn-hover-bg: #103c66;
    --bs-btn-hover-border-color: #103c66;
    --bs-btn-active-bg: #0e3458;
    --bs-btn-active-border-color: #0e3458;
    border-radius: 7px;
    color: #fff;
    font-weight: 800;
    min-height: 48px;
}

.login-stage .alert {
    border-radius: 7px;
    font-size: .92rem;
}

@media (max-width: 760px) {
    .login-stage {
        padding: 1rem;
    }

    .login-diagonal {
        clip-path: polygon(0 0, 100% 0, 100% 34%, 0 62%);
    }

    .login-stage .login-card {
        padding: 1.35rem;
    }

    .login-card-header h1 {
        font-size: 1.08rem;
    }
}

.companies-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.companies-search {
    align-items: end;
    display: grid;
    gap: .85rem;
    grid-template-columns: minmax(240px, 1fr) auto auto auto;
}

.users-search {
    align-items: end;
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.users-stats {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.search-field {
    min-width: 0;
}

.companies-table {
    font-size: 13px;
}

.companies-table thead th {
    background: #f5f8fb;
    color: var(--navy);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.companies-table td {
    vertical-align: middle;
}

.status-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: .75rem;
    font-weight: 800;
    padding: .32rem .62rem;
}

.status-active {
    background: #e5f6ef;
    color: #17684f;
}

.status-inactive {
    background: #f1f3f5;
    color: #7b3333;
}

.status-warning {
    background: #fff5d8;
    color: #8a5b00;
}

.notification-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    padding: .28rem .58rem;
}
.notification-info { background: #eaf3fb; color: #195fA5; }
.notification-warning { background: #fff4cf; color: #8a5b00; }
.notification-alert { background: #ffead8; color: #a14f00; }
.notification-urgent { background: #fde5e5; color: #a83232; }
.notification-system { background: #eeeafb; color: #5c4a94; }
.notification-list {
    display: grid;
    gap: .75rem;
}
.notification-list.compact { gap: .55rem; }
.notification-item {
    align-items: flex-start;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: grid;
    gap: .75rem;
    grid-template-columns: 42px 1fr auto;
    padding: .85rem;
}
.notification-item.unread {
    background: #f7fbff;
    border-color: #b7d0ea;
}
.notification-item-icon {
    align-items: center;
    background: #edf4fb;
    border-radius: 8px;
    color: var(--blue);
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}
.notification-item-body h3 {
    color: var(--navy);
    font-size: .98rem;
    font-weight: 800;
    margin: .35rem 0;
}
.notification-item-body p {
    color: var(--muted);
    margin: 0;
}
.notification-item-head,
.notification-meta {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.notification-item-head small,
.notification-meta {
    color: var(--muted);
    font-size: .78rem;
}
.notification-actions { align-self: center; }

.ticket-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    padding: .28rem .58rem;
}
.ticket-open { background: #eaf3fb; color: #195fA5; }
.ticket-progress { background: #e5f6ef; color: #17684f; }
.ticket-waiting { background: #fff4cf; color: #8a5b00; }
.ticket-resolved { background: #e8f7ee; color: #23744f; }
.ticket-closed { background: #f1f3f5; color: #46515f; }
.ticket-canceled { background: #fde5e5; color: #a83232; }
.priority-low { background: #eef4f9; color: #526475; }
.priority-normal { background: #eaf3fb; color: #195fA5; }
.priority-high { background: #fff4cf; color: #8a5b00; }
.priority-urgent { background: #fde5e5; color: #a83232; }
.ticket-timeline {
    display: grid;
    gap: .85rem;
}
.ticket-message {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .9rem;
}
.ticket-message.own { border-color: #b7d0ea; background: #f7fbff; }
.ticket-message.system { background: #f3f5f7; }
.ticket-message strong,
.ticket-message span { display: block; }
.ticket-message span {
    color: var(--muted);
    font-size: .78rem;
}
.ticket-message p {
    margin: .65rem 0 0;
}
.ticket-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .75rem;
}
.ticket-attachments span {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    display: inline-flex;
    font-size: .78rem;
    gap: .35rem;
    padding: .3rem .6rem;
}

.agenda-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    margin: .1rem;
    padding: .28rem .58rem;
}
.agenda-scheduled { background: #eaf3fb; color: #195fA5; }
.agenda-progress { background: #fff4cf; color: #8a5b00; }
.agenda-done { background: #e5f6ef; color: #17684f; }
.agenda-canceled { background: #fde5e5; color: #a83232; }
.agenda-type-reuniao, .agenda-type-evento { background: #eaf3fb; color: #195fA5; }
.agenda-type-visita { background: #eeeafb; color: #5c4a94; }
.agenda-type-tarefa, .agenda-type-outro { background: #eef4f9; color: #526475; }
.agenda-type-cobranca { background: #fde5e5; color: #a83232; }
.agenda-type-retorno, .agenda-type-lembrete { background: #fff4cf; color: #8a5b00; }
.agenda-type-atendimento, .agenda-type-servico { background: #e5f6ef; color: #17684f; }
.calendar-grid {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.kanban-board {
    align-items: flex-start;
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 100%;
    min-width: 0;
    overflow-x: visible;
    padding-bottom: .5rem;
    width: 100%;
}
.kanban-column {
    background: #f7fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
    padding: .75rem;
}
.kanban-column header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: .75rem;
}
.kanban-column header strong {
    color: var(--muted);
    font-size: .85rem;
}
.kanban-column-body {
    display: grid;
    gap: .75rem;
}
.task-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(16, 43, 78, .06);
    display: grid;
    gap: .6rem;
    padding: .85rem;
}
.task-card:hover {
    border-color: #b7d0ea;
    box-shadow: 0 14px 28px rgba(16, 43, 78, .1);
}
.task-card-head,
.task-card-actions,
.task-move-form {
    align-items: center;
    display: flex;
    gap: .5rem;
    justify-content: space-between;
}
.task-card h3 {
    color: var(--navy);
    font-size: .98rem;
    font-weight: 800;
    line-height: 1.25;
    margin: 0;
}
.task-card-meta {
    color: var(--muted);
    display: grid;
    font-size: .8rem;
    gap: .3rem;
}
.task-card-progress,
.task-progress {
    display: grid;
    gap: .35rem;
}
.task-card-progress > div:first-child,
.task-progress-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
}
.task-card-progress span,
.task-progress small {
    color: var(--muted);
    font-size: .78rem;
}
.task-card-progress strong,
.task-progress-head span {
    color: var(--navy);
    font-size: .8rem;
}
.task-progress .progress,
.task-card-progress .progress {
    background: #e9eff6;
    border-radius: 999px;
    height: .55rem;
    overflow: hidden;
}
.task-progress .progress-bar,
.task-card-progress .progress-bar {
    background: var(--blue);
}
.checklist-list,
.task-comments-list {
    display: grid;
    gap: .75rem;
    margin-top: 1rem;
}
.checklist-item {
    align-items: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    grid-template-columns: auto 1fr auto;
    padding: .85rem;
}
.checklist-item.done {
    background: #f7fbf9;
}
.checklist-item.done .checklist-content strong {
    color: var(--muted);
    text-decoration: line-through;
}
.checklist-toggle {
    align-items: center;
    background: #edf4fb;
    border: 1px solid #cfe0f2;
    border-radius: 8px;
    color: var(--blue);
    display: inline-flex;
    height: 34px;
    justify-content: center;
    width: 34px;
}
.checklist-item.done .checklist-toggle {
    background: #e5f6ef;
    border-color: #bde5d2;
    color: #17684f;
}
.checklist-content p,
.task-comment p {
    color: var(--ink);
    margin: .25rem 0;
    white-space: normal;
    word-break: break-word;
}
.checklist-content small {
    color: var(--muted);
    font-size: .78rem;
}
.task-inline-form {
    align-items: end;
    display: grid;
    gap: .75rem;
    grid-template-columns: 1fr 1fr auto;
}
.task-comment {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .9rem;
}
.task-comment.mine {
    background: #f7fbff;
    border-color: #b7d0ea;
}
.task-comment.removed {
    background: #f8f9fb;
}
.task-comment-head {
    align-items: flex-start;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
}
.task-comment-head strong {
    color: var(--navy);
    display: block;
}
.task-comment-head span {
    color: var(--muted);
    display: block;
    font-size: .78rem;
}
.comment-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .65rem;
}
.task-attachment {
    align-items: center;
    background: #edf4fb;
    border-radius: 999px;
    color: var(--navy);
    display: inline-flex;
    font-size: .8rem;
    gap: .35rem;
    padding: .35rem .65rem;
    text-decoration: none;
}
.task-attachment:hover {
    color: var(--blue);
    text-decoration: none;
}
.document-badge {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    gap: .25rem;
    padding: .2rem .55rem;
    text-transform: uppercase;
}
.document-category {
    background: #e8f2ff;
    color: #145da0;
}
.document-visibility {
    background: #eef1f6;
    color: #475467;
}
.document-preview {
    background: #f7fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: .75rem;
}
.document-preview img {
    border-radius: 6px;
    display: block;
    max-height: 360px;
    max-width: 100%;
    object-fit: contain;
}
.document-card {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    grid-template-columns: 42px 1fr auto;
    padding: .85rem;
}
.document-card > i {
    align-items: center;
    background: #edf4fb;
    border-radius: 8px;
    color: var(--blue);
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}
.document-card strong {
    color: var(--navy);
    display: block;
}
.document-card span {
    color: var(--muted);
    font-size: .82rem;
}
.proposal-badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    padding: .2rem .55rem;
    text-transform: uppercase;
}
.proposal-draft { background:#eef1f6; color:#475467; }
.proposal-sent { background:#e8f2ff; color:#145da0; }
.proposal-negotiation { background:#fff4cf; color:#8a5b00; }
.proposal-approved { background:#e5f6ef; color:#17684f; }
.proposal-refused,.proposal-canceled { background:#fde7e9; color:#b42318; }
.proposal-converted { background:#e6eef8; color:#003b71; }
.proposal-summary .detail-item:last-child strong {
    color: var(--blue);
    font-size: 1.25rem;
}
.task-badge {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: .72rem;
    font-weight: 800;
    gap: .25rem;
    padding: .2rem .55rem;
    text-transform: uppercase;
}
.task-column-new,
.task-priority-low {
    background: #eef1f6;
    color: #475467;
}
.task-column-progress,
.task-status-active,
.task-priority-normal {
    background: #e8f2ff;
    color: #145da0;
}
.task-column-waiting,
.task-priority-high {
    background: #fff4cf;
    color: #8a5b00;
}
.task-column-done,
.task-status-done {
    background: #e5f6ef;
    color: #17684f;
}
.task-column-canceled,
.task-status-canceled,
.task-priority-urgent {
    background: #fde7e9;
    color: #b42318;
}
.calendar-head {
    color: var(--navy);
    font-size: .78rem;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}
.calendar-day {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    min-height: 116px;
    padding: .55rem;
}
.calendar-day.muted {
    background: #f8fafc;
    color: var(--muted);
}
.calendar-day.today {
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(31, 111, 191, .12);
}
.calendar-day strong {
    color: var(--navy);
    display: block;
    margin-bottom: .35rem;
}
.calendar-day a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    gap: .35rem;
    justify-content: flex-end;
}

.table-actions form {
    margin: 0;
}

.empty-state {
    align-items: center;
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    text-align: center;
}

.empty-state h3 {
    color: var(--navy);
    font-size: 1.25rem;
    font-weight: 800;
    margin: .5rem 0;
}

.empty-state p {
    color: var(--muted);
}

.company-form {
    margin-bottom: 1.25rem;
}

.form-section {
    margin-bottom: 1rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: flex-end;
}

.company-detail .detail-grid {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-item {
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .85rem;
}

.detail-item span,
.detail-notes span {
    color: var(--muted);
    display: block;
    font-size: .78rem;
    font-weight: 800;
    margin-bottom: .25rem;
    text-transform: uppercase;
}

.detail-item strong {
    color: var(--ink);
    display: block;
    overflow-wrap: anywhere;
}

.detail-notes {
    border-top: 1px solid var(--line);
    margin-top: 1rem;
    padding-top: 1rem;
}

.detail-notes p {
    margin-bottom: 0;
    white-space: normal;
}

.permissions-table .form-check-input {
    cursor: pointer;
    height: 1.15rem;
    width: 1.15rem;
}

.permission-category {
    margin-bottom: 1rem;
}

@media (max-width: 1100px) {
    .companies-search,
    .users-search,
    .form-grid,
    .company-detail .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .kanban-board {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .companies-stats,
    .companies-search,
    .users-search,
    .form-grid,
    .company-detail .detail-grid {
        grid-template-columns: 1fr;
    }

    .companies-search .btn,
    .users-search .btn,
    .form-actions .btn {
        width: 100%;
    }

    .form-span-2 {
        grid-column: auto;
    }

    .form-actions,
    .table-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .notification-item {
        grid-template-columns: 42px 1fr;
    }

    .notification-actions {
        grid-column: 1 / -1;
    }

    .calendar-grid {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        grid-template-columns: 1fr;
        overflow-x: visible;
    }

    .task-card-actions,
    .task-move-form {
        align-items: stretch;
        flex-direction: column;
    }

    .checklist-item,
    .task-inline-form,
    .document-card {
        grid-template-columns: 1fr;
    }

    .calendar-head {
        display: none;
    }

    .table-actions .btn {
        min-width: 42px;
    }
}
