/* ============================================
   DESIGN TOKENS
   ============================================ */
:root {
    color-scheme: light;
    --bg: #f4f6fb;
    --bg-alt: #eef1f7;
    --surface: #ffffff;
    --surface-soft: #f8f9fb;
    --text: #1f2937;
    --text-muted: #6b7280;
    --primary: #5b6cff;
    --primary-strong: #3f4fff;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e5e7eb;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --sidebar-width: 235px;
    --sidebar-collapsed: 88px;
    --topbar-height: 72px;
}

body.dark-mode {
    color-scheme: dark;
    --bg: #0f172a;
    --bg-alt: #111c32;
    --surface: #0b1224;
    --surface-soft: #0f1b35;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #7c8cff;
    --primary-strong: #9aa6ff;
    --border: #1f2a44;
    --shadow: 0 10px 30px rgba(2, 6, 23, 0.5);
}

/* ============================================
   BASE
   ============================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
}

a {
    color: inherit;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
}

.form-control::placeholder {
    color: var(--text);
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    background: var(--surface);
    color: var(--text);
}

.card-body {
    padding: 1.25rem;
}

.alert {
    border-radius: 14px;
}

.btn {
    border-radius: 12px;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
}

.btn-ghost {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
}

.btn-icon i {
    font-size: 20px;
}

.badge {
    border-radius: 999px;
    padding: 0.35rem 0.6rem;
}

.text-muted {
    color: var(--text-muted) !important;
}

.form-control,
.form-select {
    border-radius: 12px;
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(91, 108, 255, 0.2);
}

/* ============================================
   LOGIN
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at top, rgba(91, 108, 255, 0.35), transparent 55%),
        linear-gradient(135deg, #1f2b62 0%, #0f172a 100%);
}

.login-container .card {
    max-width: 420px;
    width: 100%;
}

.login-logo {
    max-width: 180px;
    height: auto;
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    min-height: var(--topbar-height);
    padding: 0.5rem 0;
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.04);
    z-index: 1040;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(91, 108, 255, 0.15);
    color: var(--primary);
    margin-right: 0.5rem;
    font-size: 20px;
}

.brand-text {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

/* ============================================
   LAYOUT
   ============================================ */
.app-shell {
    display: flex;
    min-height: calc(100vh - var(--topbar-height));
    gap: 0;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    transition: width 0.2s ease;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
}

.sidebar-inner {
    padding: 1.25rem 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-badge {
    background: rgba(91, 108, 255, 0.15);
    color: var(--primary);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.sidebar .nav-link {
    color: var(--text-muted);
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.sidebar .nav-link:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.sidebar .nav-link.active {
    background: rgba(91, 108, 255, 0.15);
    color: var(--primary);
}

.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
}

.sidebar-collapsed .sidebar .nav-link span,
.sidebar-collapsed .sidebar .sidebar-title,
.sidebar-collapsed .sidebar .sidebar-badge {
    display: none;
}

.sidebar-collapsed .sidebar .nav-link {
    justify-content: center;
}

.main-content {
    padding: 2rem;
    max-width: 1080px;
    width: 100%;
}

@media (max-width: 991px) {
    .main-content {
        padding: 1.5rem;
        max-width: 100%;
    }
}

/* ============================================
   DASHBOARD
   ============================================ */
.avatar-circle {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: rgba(91, 108, 255, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

.menu-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    color: var(--text);
    cursor: pointer;
    border: 1px solid var(--border);
}

.menu-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.menu-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
}

.bg-purple {
    background: #7c3aed;
}

/* ============================================
   FATURA CARD
   ============================================ */
.fatura-card {
    border-left: 4px solid var(--primary);
    margin-bottom: 12px;
    cursor: pointer;
    transition: box-shadow 0.15s;
}

.fatura-card:hover {
    box-shadow: var(--shadow);
}

.badge-vencido {
    background: var(--danger);
}

.badge-emdia {
    background: var(--success);
}

/* ============================================
   SERVIÇO / CHAMADO
   ============================================ */
.servico-card,
.chamado-card {
    margin-bottom: 12px;
}

.chamado-card {
    cursor: pointer;
}

.chamado-card:hover {
    box-shadow: var(--shadow);
}

/* ============================================
   CONTATO CARD
   ============================================ */
.contato-card {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--text);
    background: var(--surface-soft);
    margin-bottom: 10px;
    transition: background 0.2s;
}

.contato-card:hover {
    background: var(--bg-alt);
    color: var(--text);
}

.contato-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

/* ============================================
   INFO LIST
   ============================================ */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-size: 14px;
}

.info-value {
    font-weight: 600;
    text-align: right;
}

/* ============================================
   OFFCANVAS (MOBILE)
   ============================================ */
.offcanvas {
    background: var(--surface);
    color: var(--text);
}

.mobile-nav .nav-link {
    padding: 0.8rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.mobile-nav .nav-link.active,
.mobile-nav .nav-link:hover {
    background: rgba(91, 108, 255, 0.15);
    color: var(--primary);
}

/* ============================================
   DARK MODE TWEAKS
   ============================================ */
body.dark-mode .btn-ghost,
body.dark-mode .btn-icon {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

body.dark-mode .menu-card {
    color: var(--text);
}

body.dark-mode .menu-card:hover {
    color: var(--text);
}

body.dark-mode .modal-content {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

body.dark-mode .form-check-input {
    background-color: var(--surface);
    border-color: var(--border);
}

body.dark-mode .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}
