/* ─── Toby — TI & CIA — CSS Base Compartilhado ───────────────────────────────
   Usado por todos os portais. Cada portal tem seu próprio arquivo CSS adicional
   com as cores de destaque e componentes específicos.
────────────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: #F5F5F5;
    min-height: 100vh;
    color: #1a1a1a;
    -webkit-font-smoothing: antialiased;
}

/* ── Login ────────────────────────────────────────────────────────────────── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--login-gradient, linear-gradient(135deg, #000000 0%, #245A91 100%));
}

.login-box {
    background: white;
    padding: 44px 40px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
    max-width: 400px;
    width: calc(100% - 32px);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.login-logo svg {
    flex-shrink: 0;
}

.login-box h1 {
    font-size: 22px;
    font-weight: 800;
    color: #000000;
    letter-spacing: -0.5px;
}

.login-box .subtitle {
    color: #6B7280;
    margin-bottom: 32px;
    font-size: 13px;
    margin-top: 2px;
}

.login-box input {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.login-box input:focus {
    outline: none;
    border-color: var(--cor-destaque, #245A91);
    box-shadow: 0 0 0 3px rgba(36, 90, 145, 0.15);
}

.login-box input::placeholder {
    color: #9CA3AF;
}

.login-box button[type="submit"] {
    width: 100%;
    padding: 13px;
    background: #000000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    margin-top: 4px;
    letter-spacing: 0.2px;
}

.login-box button[type="submit"]:hover {
    background: var(--cor-destaque, #245A91);
    color: var(--cor-destaque-texto, #000000);
}

.error-message, .error-msg {
    background: #FEF2F2;
    color: #B91C1C;
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid #FECACA;
    display: none;
}

.success-message, .success-msg {
    background: #F0FDF4;
    color: #15803D;
    padding: 10px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid #BBF7D0;
    display: none;
}

.forgot-password {
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
}

.forgot-password a {
    color: var(--cor-destaque, #245A91);
    text-decoration: none;
    font-weight: 500;
}

.forgot-password a:hover {
    text-decoration: underline;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.header {
    background: #111111;
    color: #fff;
    padding: 0 32px;
    height: 58px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.2px;
}

.header .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-logout {
    background: transparent;
    color: #AAAAAA;
    padding: 7px 14px;
    border: 1px solid #333333;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: #555;
}

/* ── Botões base ──────────────────────────────────────────────────────────── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: #111827;
    color: white;
}

.btn-primary:hover {
    background: var(--cor-destaque, #245A91);
    color: var(--cor-destaque-texto, #000000);
}

.btn-success {
    background: #16a34a;
    color: white;
}

.btn-success:hover {
    background: #15803d;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-secondary {
    background: #F3F4F6;
    color: #374151;
    border: 1.5px solid #E5E7EB;
}

.btn-secondary:hover {
    background: #E5E7EB;
}

/* ── Modal base ───────────────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15,23,42,0.6);
    z-index: 1000;
    overflow-y: auto;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    max-width: 800px;
    margin: 48px auto;
    padding: 40px;
    position: relative;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #F3F4F6;
    color: #374151;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 13px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #111827;
    color: white;
}

.modal h2 {
    margin-bottom: 28px;
    color: #000000;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--cor-destaque, #245A91);
    font-size: 18px;
    font-weight: 700;
}

/* ── Utilitários ──────────────────────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 48px;
    color: #9CA3AF;
    font-size: 14px;
}

.no-data {
    text-align: center;
    padding: 48px;
    color: #9CA3AF;
    font-size: 14px;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 14px;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--cor-destaque, #245A91);
    box-shadow: 0 0 0 3px rgba(36, 90, 145, 0.15);
}

/* ── Tabela base ──────────────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #F9FAFB;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #6B7280;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid #E5E7EB;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #F3F4F6;
    font-size: 14px;
    color: #374151;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #F9FAFB;
}

/* ── Layout com Sidebar ───────────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: calc(100vh - 58px);
}

.sidebar {
    width: 220px;
    min-width: 220px;
    background: #111111;
    display: flex;
    flex-direction: column;
    padding: 16px 0;
    position: sticky;
    top: 58px;
    height: calc(100vh - 58px);
    max-height: calc(100vh - 58px);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #AAAAAA;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-right: none;
    border-bottom: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    border-radius: 0 6px 6px 0;
    margin: 1px 0;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.08);
    color: #FFFFFF;
}

.sidebar-item.active {
    background: rgba(36, 90, 145, 0.25);
    color: #fff;
    border-left-color: var(--cor-destaque, #245A91);
    font-weight: 600;
}

.sidebar-icon {
    font-size: 15px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid #2a2a2a;
    margin: 8px 14px;
}

.sidebar-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555555;
    padding: 14px 16px 4px;
}

/* Grupos colapsáveis */
.sidebar-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 4px;
    color: #555555;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: color 0.15s;
}

.sidebar-group:hover {
    color: #777777;
}

.sidebar-group-arrow {
    font-size: 9px;
    transition: transform 0.2s;
    color: #555555;
}

.sidebar-group.open .sidebar-group-arrow {
    transform: rotate(90deg);
}

.sidebar-group-items {
    display: none;
}

.sidebar-group-items.open {
    display: block;
}

.main-content {
    flex: 1;
    overflow-x: hidden;
    padding: 28px 32px;
}

.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* ── Responsivo ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }

    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: unset;
        height: auto;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        padding: 8px;
        gap: 4px;
        top: 0;
        max-height: none;
    }

    .sidebar-item {
        padding: 8px 12px;
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: 12px;
        border-radius: 6px;
    }

    .sidebar-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--cor-destaque, #245A91);
    }

    .sidebar-divider, .sidebar-label { display: none; }

    .main-content {
        padding: 16px;
    }
}
