/* ============================================================
   DocSystem - Sistema de Documentação Corporativa
   Design System Premium
   ============================================================ */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
    /* Primary Palette */
    --primary: #2563eb;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-900: #1e3a8a;

    /* Secondary & Accent */
    --secondary: #0ea5a4;
    --accent: #f59e0b;
    --accent-light: #fbbf24;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Neutral Palette */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Sidebar */
    --sidebar-width: 278px;
    --sidebar-bg: linear-gradient(175deg, #081a32 0%, #0c2b4f 48%, #0a2747 100%);
    --sidebar-text: #b9cee8;
    --sidebar-text-hover: #eff6ff;
    --sidebar-active-bg: linear-gradient(90deg, rgba(37, 99, 235, 0.26), rgba(14, 165, 164, 0.2));
    --sidebar-border: rgba(148, 163, 184, 0.18);

    /* Layout */
    --header-height: 65px;
    --content-bg: #eff5fc;
    --card-bg: #ffffff;
    --card-shadow: 0 8px 24px -18px rgba(15, 23, 42, 0.55), 0 3px 10px -8px rgba(15, 23, 42, 0.2);
    --card-shadow-hover: 0 18px 42px -22px rgba(15, 23, 42, 0.55), 0 8px 24px -16px rgba(37, 99, 235, 0.35);
    --card-radius: 18px;

    /* Typography */
    --font-heading: 'Sora', 'Manrope', 'Segoe UI', sans-serif;
    --font-body: 'Manrope', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    /* Animations */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background:
        radial-gradient(1200px 560px at -12% -18%, rgba(37, 99, 235, 0.1), transparent 56%),
        radial-gradient(900px 500px at 105% 8%, rgba(14, 165, 164, 0.1), transparent 52%),
        linear-gradient(180deg, #eef4fb 0%, #f8fbff 40%, #f2f8ff 100%);
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

::selection {
    background: rgba(37, 99, 235, 0.18);
    color: #0f172a;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Scrollbar Custom --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #051428 0%, #0b2f59 52%, #0b4f70 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(37, 99, 235, 0.18) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 20%, rgba(14, 165, 164, 0.16) 0%, transparent 50%),
                radial-gradient(ellipse at 60% 80%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
    animation: loginBgShift 15s ease-in-out infinite alternate;
}

@keyframes loginBgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-3%, -3%) rotate(3deg); }
}

.login-card {
    position: relative;
    width: 100%;
    max-width: 440px;
    padding: 56px 48px;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    box-shadow: 0 34px 90px rgba(1, 10, 27, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.13);
    animation: loginCardIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary), #0d9488);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
}

.login-logo .logo-icon i {
    font-size: 28px;
    color: white;
}

.login-logo h1 {
    font-size: 26px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-top: 6px;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
}

.login-card .form-control {
    width: 100%;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-family: var(--font-body);
    transition: all var(--transition);
    outline: none;
}

/* Fix browser autofill colors on login form */
.login-card .form-control:-webkit-autofill,
.login-card .form-control:-webkit-autofill:hover, 
.login-card .form-control:-webkit-autofill:focus, 
.login-card .form-control:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #0b2f59 inset !important;
    -webkit-text-fill-color: white !important;
    transition: background-color 5000s ease-in-out 0s;
}

.login-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-card .form-control:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.login-card .btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary), #0d9488);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.login-card .btn-login::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1d4ed8, #0f766e);
    opacity: 0;
    transition: opacity var(--transition);
}

.login-card .btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(29, 78, 216, 0.45);
}

.login-card .btn-login:hover::before {
    opacity: 1;
}

.login-card .btn-login span {
    position: relative;
    z-index: 1;
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
    transition: transform var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 24px 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand .brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(145deg, var(--primary), #0d9488);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 10px 28px -14px rgba(37, 99, 235, 0.75);
}

.sidebar-brand .brand-icon.company-logo {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(191, 219, 254, 0.55);
    box-shadow: 0 12px 26px -18px rgba(15, 23, 42, 0.7);
    padding: 4px;
}

.sidebar-brand .brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 9px;
}

.sidebar-brand .brand-icon i {
    font-size: 20px;
    color: white;
}

.sidebar-brand .brand-text h2 {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 800;
    color: white;
    letter-spacing: -0.35px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 176px;
}

.sidebar-brand .brand-text span {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: var(--sidebar-text);
    opacity: 0.85;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.sidebar-nav .nav-section {
    margin-bottom: 24px;
}

.sidebar-nav .nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--sidebar-text);
    opacity: 0.4;
    padding: 0 14px;
    margin-bottom: 8px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 600;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
    border: 1px solid transparent;
}

.sidebar-nav .nav-link i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-hover);
    border-color: rgba(191, 219, 254, 0.26);
    transform: translateX(2px);
}

.sidebar-nav .nav-link:hover i {
    opacity: 1;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active-bg);
    color: white;
    font-weight: 600;
    border-color: rgba(191, 219, 254, 0.3);
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: #93c5fd;
    border-radius: 0 4px 4px 0;
    box-shadow: 2px 0 12px rgba(147, 197, 253, 0.6);
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
    color: #bfdbfe;
}

.sidebar-nav .nav-link .badge {
    margin-left: auto;
    background: rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}

/* Sidebar User */
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user .user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #0d9488);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-user .user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-info .user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-info .user-role {
    font-size: 11px;
    color: var(--sidebar-text);
    opacity: 0.6;
    text-transform: capitalize;
}

.sidebar-user .btn-logout {
    color: var(--sidebar-text);
    opacity: 0.5;
    font-size: 18px;
    transition: all var(--transition-fast);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
}

.sidebar-user .btn-logout:hover {
    opacity: 1;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.profile-card .profile-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 22px;
    align-items: center;
    margin-bottom: 24px;
}

.profile-card .profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    font-weight: 700;
    overflow: hidden;
}

.profile-card .profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card .profile-role {
    margin: 8px 0 0;
    color: var(--primary);
    font-weight: 600;
}

.profile-card .profile-meta {
    margin: 10px 0 0;
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 14px;
}

.profile-card .profile-section {
    margin-bottom: 20px;
}

.profile-card .profile-section h4 {
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
}

.profile-card .profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.profile-card .profile-grid div {
    padding: 14px;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    background: var(--white);
}

/* --- Main Content Area --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Top Header --- */
.top-header {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 10px 30px -26px rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.top-header .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-header .header-left .btn-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background var(--transition-fast);
}

.top-header .header-left .btn-sidebar-toggle:hover {
    background: var(--gray-100);
}

.page-title-header h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-title-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 1px;
}

.top-header .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search Box */
.search-box {
    position: relative;
}

.search-box input {
    width: 280px;
    padding: 9px 16px 9px 40px;
    background: #f4f8ff;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
}

.search-box input::placeholder {
    color: var(--gray-400);
}

.search-box input:focus {
    background: var(--white);
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    width: 340px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 15px;
}

.search-box .search-shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- Content Area --- */
.content-area {
    flex: 1;
    padding: 30px clamp(16px, 2vw, 34px);
}

.app-main-footer {
    padding: 12px clamp(16px, 2vw, 34px) 20px;
    font-size: 12px;
    color: var(--gray-500);
    text-align: center;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.65) 0%, rgba(245, 250, 255, 0.9) 100%);
}

/* ============================================================
   COMPONENTS
   ============================================================ */

/* --- Cards --- */
@keyframes surfaceIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: var(--card-shadow);
    transition: all var(--transition);
    overflow: hidden;
    animation: surfaceIn 420ms ease both;
}

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

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, rgba(248, 251, 255, 0.9) 0%, rgba(245, 249, 255, 0.8) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

/* --- Stat Cards (Dashboard) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--card-radius);
    padding: 24px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: flex-start;
    gap: 18px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    animation: surfaceIn 450ms ease both;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    border-radius: 0 0 0 100%;
    opacity: 0.06;
    transition: opacity var(--transition);
}

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

.stat-card:hover::after {
    opacity: 0.1;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card .stat-icon.primary {
    background: var(--primary-50);
    color: var(--primary);
}

.stat-card .stat-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-card .stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-card .stat-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.stat-card .stat-icon.accent {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent);
}

.stat-card .stat-icon.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.stat-card .stat-info h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-card .stat-info .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-card .stat-info .stat-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-card .stat-info .stat-change.up {
    color: var(--success);
}

.stat-card .stat-info .stat-change.down {
    color: var(--danger);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    min-height: 40px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn i {
    font-size: 16px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #1e40af);
    color: white;
    box-shadow: 0 8px 20px -12px rgba(37, 99, 235, 0.8);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-2px);
    box-shadow: 0 15px 28px -18px rgba(30, 64, 175, 0.8);
    color: white;
}

.btn-secondary {
    background: #eef4fb;
    color: var(--text-secondary);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: #e3edf9;
    color: var(--text-primary);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #0f766e);
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 8px;
    min-height: 34px;
}

.btn-sm i {
    font-size: 14px;
}

.btn-lg {
    padding: 13px 24px;
    font-size: 15px;
    border-radius: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.btn-icon i {
    margin: 0;
}

/* --- Tables --- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: var(--white);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    padding: 14px 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: #f4f8ff;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 16px 20px;
    font-size: 13.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: #f8fbff;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .td-title {
    font-weight: 600;
    color: var(--text-primary);
}

.data-table .td-title a {
    color: var(--text-primary);
}

.data-table .td-title a:hover {
    color: var(--primary);
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary-100);
    color: var(--primary-dark);
}

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

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

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

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* --- Status Badges --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.published {
    background: #dcfce7;
    color: #166534;
}

.status-badge.published::before {
    background: var(--success);
}

.status-badge.draft {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.draft::before {
    background: var(--warning);
}

.status-badge.archived {
    background: #e2e8f0;
    color: #334155;
}

.status-badge.archived::before {
    background: var(--gray-400);
}

/* --- Forms --- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: #fbfdff;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    font-size: 14px;
    font-family: var(--font-body);
    color: var(--text-primary);
    transition: all var(--transition);
    outline: none;
}

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

.form-control:focus {
    border-color: var(--primary);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-control:disabled {
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.55);
    outline-offset: 2px;
}

.form-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* --- Alert / Flash Messages --- */
.alert {
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    animation: alertIn 0.3s ease-out;
    position: relative;
}

@keyframes alertIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.alert .alert-close {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity var(--transition-fast);
    color: inherit;
}

.alert .alert-close:hover {
    opacity: 1;
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header .page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.page-header .page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.page-header .page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-secondary.disabled,
.btn-secondary.disabled:hover,
.btn-secondary.disabled:focus {
    background: var(--gray-200);
    color: var(--gray-500);
    border-color: transparent;
    cursor: not-allowed;
    opacity: 1;
}

/* --- Breadcrumb --- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
    list-style: none;
}

.breadcrumb a {
    color: var(--text-muted);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .separator {
    font-size: 10px;
    opacity: 0.5;
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 600;
}

/* --- Grid Layouts --- */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* --- Sector Cards --- */
.sector-card {
    background: var(--white);
    border-radius: var(--card-radius);
    border: 1px solid var(--gray-200);
    padding: 24px;
    transition: all var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.sector-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-accent, var(--primary));
    opacity: 0;
    transition: opacity var(--transition);
}

.sector-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: transparent;
}

.sector-card:hover::before {
    opacity: 1;
}

.sector-card .sector-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 16px;
}

.sector-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.sector-card p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
}

.sector-card .sector-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.sector-card .sector-meta i {
    font-size: 14px;
    margin-right: 4px;
}

/* --- Document Cards --- */
.doc-card {
    background: var(--white);
    border-radius: var(--card-radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    animation: surfaceIn 460ms ease both;
}

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

.doc-card .doc-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.doc-card .doc-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.doc-card .doc-card-title a {
    color: var(--text-primary);
}

.doc-card .doc-card-title a:hover {
    color: var(--primary);
}

.doc-card .doc-card-excerpt {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
}

.doc-card .doc-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.doc-card .doc-card-tags .tag {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--primary-100);
    color: var(--primary-dark);
    border-radius: 6px;
    font-weight: 500;
}

.doc-card .doc-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid var(--gray-100);
    font-size: 12px;
    color: var(--text-muted);
}

.doc-card .doc-card-footer .doc-author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-card .doc-card-footer .doc-views {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --- Document View --- */
.doc-view {
    max-width: 900px;
    margin: 0 auto;
}

.doc-view .doc-view-header {
    margin-bottom: 32px;
}

.doc-view .doc-view-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.3;
    margin-bottom: 16px;
}

.doc-view .doc-view-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-muted);
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray-200);
}

.doc-view .doc-view-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.doc-view .doc-view-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.doc-view .doc-view-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 32px 0 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-200);
}

.doc-view .doc-view-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.doc-view .doc-view-content p {
    margin-bottom: 16px;
}

.doc-view .doc-view-content img {
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    margin: 16px 0;
}

.doc-view .doc-view-content pre {
    background: var(--gray-900);
    color: #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 16px 0;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
}

.doc-view .doc-view-content code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--primary-dark);
}

.doc-view .doc-view-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.doc-view .doc-view-content ul,
.doc-view .doc-view-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.doc-view .doc-view-content li {
    margin-bottom: 6px;
}

.doc-view .doc-view-content blockquote {
    border-left: 4px solid var(--primary);
    padding: 12px 20px;
    margin: 16px 0;
    background: #eff6ff;
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
}

/* --- Steps Component --- */
.steps-container {
    margin: 24px 0;
}

.step-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    position: relative;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 19px;
    top: 60px;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
    z-index: 1;
}

.step-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.step-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 56px;
    color: var(--gray-300);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 28px;
    list-style: none;
}

.pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--white);
    border: 1px solid var(--gray-200);
    transition: all var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.pagination .page-link:hover {
    background: var(--primary-50);
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .page-link.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination .page-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 18, 35, 0.48);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-box {
    background: var(--white);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 30px 80px -28px rgba(15, 23, 42, 0.8);
    transform: scale(0.9) translateY(20px);
    transition: transform var(--transition);
    overflow: hidden;
}

.modal-overlay.active .modal-box {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- Tags Input --- */
.tags-input-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    background: var(--white);
    min-height: 44px;
    align-items: center;
    cursor: text;
    transition: all var(--transition);
}

.tags-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tags-input-wrapper .tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--primary-50);
    color: var(--primary);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.tags-input-wrapper .tag-chip .tag-remove {
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.tags-input-wrapper .tag-chip .tag-remove:hover {
    opacity: 1;
}

.tags-input-wrapper input {
    border: none;
    outline: none;
    font-size: 13px;
    font-family: var(--font-body);
    flex: 1;
    min-width: 100px;
    background: transparent;
    color: var(--text-primary);
}

/* --- Chart Container --- */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* --- Activity Feed --- */
.activity-feed {
    list-style: none;
}

.activity-feed .activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
}

.activity-feed .activity-item:last-child {
    border-bottom: none;
}

.activity-feed .activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-feed .activity-icon.create {
    background: var(--success-light);
    color: var(--success);
}

.activity-feed .activity-icon.update {
    background: var(--info-light);
    color: var(--info);
}

.activity-feed .activity-icon.delete {
    background: var(--danger-light);
    color: var(--danger);
}

.activity-feed .activity-icon.login {
    background: var(--primary-50);
    color: var(--primary);
}

.activity-feed .activity-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.activity-feed .activity-text strong {
    color: var(--text-primary);
}

.activity-feed .activity-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- Color Picker Swatches --- */
.color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--text-primary);
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar .filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-bar select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--font-body);
    color: var(--text-secondary);
    background: var(--white);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394a3b8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    transition: all var(--transition);
}

.filter-bar select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* --- Actions Dropdown --- */
.actions-group {
    display: flex;
    gap: 6px;
}

/* --- Install Page --- */
.install-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #081a32 0%, #0f3a63 50%, #166485 100%);
    padding: 20px;
}

.install-card {
    background: var(--white);
    border-radius: 24px;
    padding: 48px;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: loginCardIn 0.6s ease-out;
}

.install-card h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.install-card .install-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.install-step {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
}

.install-step .step-check {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.install-step .step-check.ok {
    background: var(--success-light);
    color: var(--success);
}

.install-step .step-check.fail {
    background: var(--danger-light);
    color: var(--danger);
}

.install-step .step-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.install-step .step-info p {
    font-size: 13px;
    color: var(--text-muted);
}

.install-credentials {
    background: var(--gray-900);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    color: #e2e8f0;
}

.install-credentials h4 {
    font-size: 14px;
    color: var(--primary-light);
    margin-bottom: 12px;
}

.install-credentials p {
    font-size: 13px;
    font-family: var(--font-mono);
    margin-bottom: 6px;
}

.install-credentials strong {
    color: var(--accent-light);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
    }

    .main-content {
        margin-left: 0;
    }

    .top-header .header-left .btn-sidebar-toggle {
        display: block;
    }

    .content-area {
        padding: 20px 16px;
    }

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

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-box input {
        width: 200px;
    }

    .search-box input:focus {
        width: 220px;
    }

    .top-header {
        padding: 0 16px;
    }

    .doc-view .doc-view-header h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
        border-radius: 20px;
        margin: 16px;
    }

    .search-box {
        display: none;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar select {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* --- Sidebar overlay for mobile --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* --- Document Content Images --- */
.doc-view .doc-view-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

/* --- TinyMCE Container Override --- */
.tox-tinymce {
    border-radius: 10px !important;
    border-color: var(--gray-300) !important;
}

/* --- Loading Spinner --- */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Tooltip --- */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--gray-900);
    color: white;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 100;
    pointer-events: none;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* --- Utilities --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }

/* ============================================================
   TICKETS MODULE STYLES
   ============================================================ */

/* Tickets Status Bar (Dashboard/Index) */
.ticket-status-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.ticket-status-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.ticket-status-chip:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

.ticket-status-chip.active {
    background: var(--primary-50);
    color: var(--primary-dark);
    border-color: var(--primary-200);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
}

.ticket-status-chip .chip-count {
    background: var(--gray-100);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.ticket-status-chip.active .chip-count {
    background: var(--primary);
    color: var(--white);
}

/* Priority Tags */
.ticket-priority {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
}

.ticket-priority.priority-baixa { color: var(--success); background: var(--success-light); }
.ticket-priority.priority-media { color: var(--warning); background: var(--warning-light); }
.ticket-priority.priority-alta { color: var(--info); background: var(--info-light); }
.ticket-priority.priority-critica { color: var(--danger); background: var(--danger-light); }

/* Status Badges */
.ticket-status-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
}

.ticket-status-badge.status-aberto { background: var(--success-light); color: var(--success); }
.ticket-status-badge.status-em_andamento { background: var(--info-light); color: var(--info); }
.ticket-status-badge.status-aguardando { background: var(--warning-light); color: var(--warning); }
.ticket-status-badge.status-resolvido { background: var(--primary-50); color: var(--primary-dark); }
.ticket-status-badge.status-fechado { background: var(--gray-200); color: var(--gray-700); }

/* Ticket View Layout */
.ticket-view-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
}

.ticket-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 24px);
}

.ticket-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.ticket-meta-item {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Chat Bubbles */
.ticket-chat {
    background: #f8fafc;
    border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.chat-timeline {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-message {
    display: flex;
    gap: 16px;
    max-width: 85%;
}

.chat-own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-support .chat-bubble {
    background: var(--white);
    border: 1px solid var(--primary-100);
}

.chat-own .chat-bubble {
    background: var(--info-light);
    border: 1px solid var(--info-light);
}

.chat-internal .chat-bubble {
    background: var(--warning-light);
    border: 1px dashed var(--warning);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--gray-400), var(--gray-500));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.chat-support .chat-avatar { background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.chat-own .chat-avatar { background: linear-gradient(135deg, var(--info), #2563eb); }
.chat-internal .chat-avatar { background: linear-gradient(135deg, var(--warning), #d97706); }

.chat-bubble {
    background: var(--white);
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    border: 1px solid var(--gray-200);
    position: relative;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}

.chat-time {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: auto;
}

.chat-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Detail Sidebar */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    color: var(--text-muted);
}

.detail-value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* Timeline Log */
.ticket-log-timeline {
    position: relative;
    padding-left: 16px;
}

.ticket-log-timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.log-entry {
    position: relative;
    margin-bottom: 16px;
}

.log-entry:last-child {
    margin-bottom: 0;
}

.log-dot {
    position: absolute;
    left: -16px;
    top: 3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid var(--white);
}

.log-content {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.log-user {
    font-weight: 600;
    color: var(--text-primary);
}

.log-old { text-decoration: line-through; color: var(--danger); margin: 0 4px; }
.log-new { color: var(--success); font-weight: 600; margin-left: 4px; }

.log-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Attachment chips */
.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.attachment-chip:hover {
    border-color: var(--primary-light);
    background: var(--primary-50);
}

/* Filter bar top */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    background: var(--white);
    padding: 12px 20px;
    border-radius: var(--card-radius);
    border: 1px solid var(--gray-200);
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-item label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-item select {
    padding: 6px 30px 6px 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--font-body);
    background-color: var(--gray-50);
    outline: none;
}

@media (max-width: 900px) {
    .ticket-view-layout {
        grid-template-columns: 1fr;
    }
    
    .chat-message {
        max-width: 95%;
    }
}
