/*
 * Gerador de OES — Design System
 * PMPA — Polícia Militar do Pará
 * Dark theme institucional com glassmorphism
 */

/* ============================================================
   CSS CUSTOM PROPERTIES — PMPA PALETTE
   ============================================================ */
:root {
    /* PMPA Blue Palette */
    --pmpa-50:  #E6E6F0;
    --pmpa-100: #B0B0D2;
    --pmpa-200: #8A8ABC;
    --pmpa-300: #54549D;
    --pmpa-400: #33338A;
    --pmpa-500: #00006D;
    --pmpa-600: #000063;
    --pmpa-700: #00004D;
    --pmpa-800: #00003C;
    --pmpa-900: #00002E;

    /* Backgrounds — derived from PMPA navy */
    --bg-primary: #00002E;
    --bg-secondary: #00003C;
    --bg-card: #050530;
    --bg-card-hover: #0a0a42;
    --bg-input: #020228;
    --bg-sidebar: #000024;

    /* Glass effect */
    --glass-bg: rgba(0, 0, 60, 0.75);
    --glass-border: rgba(138, 138, 188, 0.12);
    --glass-shadow: 0 8px 32px rgba(0, 0, 30, 0.5);

    /* Accent colors — PMPA institutional */
    --accent-primary: #33338A;     /* pmpa-blue-400 */
    --accent-primary-light: #54549D;  /* pmpa-blue-300 */
    --accent-primary-dark: #00006D;   /* pmpa-blue-500 */
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-info: #8A8ABC;        /* pmpa-blue-200 */
    --accent-secondary: #B0B0D2;   /* pmpa-blue-100 */

    /* Gradients — PMPA institutional */
    --gradient-primary: linear-gradient(135deg, #00006D, #33338A);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);
    --gradient-info: linear-gradient(135deg, #54549D, #8A8ABC);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #fbbf24);
    --gradient-card: linear-gradient(145deg, rgba(5, 5, 48, 0.95), rgba(0, 0, 46, 0.98));

    /* Text */
    --text-primary: #E6E6F0;
    --text-secondary: #B0B0D2;
    --text-muted: #8A8ABC;
    --text-accent: #B0B0D2;

    /* Borders */
    --border-color: rgba(138, 138, 188, 0.1);
    --border-color-light: rgba(138, 138, 188, 0.18);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;

    /* Spacing */
    --sidebar-width: 270px;
    --topbar-height: 64px;

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

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 30, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 30, 0.35);
    --shadow-lg: 0 8px 24px rgba(0, 0, 30, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 30, 0.5);
    --shadow-glow: 0 0 20px rgba(51, 51, 138, 0.25);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition-base);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(51, 51, 138, 0.4));
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 16px 12px 6px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(51, 51, 138, 0.15);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(51, 51, 138, 0.2);
    color: var(--pmpa-50);
    box-shadow: inset 3px 0 0 var(--pmpa-400);
}

.nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.logout-btn {
    margin-top: 4px;
    color: var(--text-muted) !important;
}

.logout-btn:hover {
    color: var(--accent-danger) !important;
    background: rgba(239, 68, 68, 0.08) !important;
}

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

/* Topbar */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 46, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Content area */
.content-area {
    flex: 1;
    padding: 28px;
}

/* ============================================================
   MESSAGES / ALERTS
   ============================================================ */
.messages-container {
    padding: 16px 28px 0;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
    font-size: 0.875rem;
    animation: slideDown 0.3s ease;
}

.alert-success { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.2); color: #34d399; }
.alert-error   { background: rgba(239, 68, 68, 0.12);  border: 1px solid rgba(239, 68, 68, 0.2);  color: #f87171; }
.alert-warning { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.2); color: #fbbf24; }
.alert-info    { background: rgba(59, 130, 246, 0.12);  border: 1px solid rgba(59, 130, 246, 0.2); color: #60a5fa; }

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0 4px;
}

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

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

/* ============================================================
   STATS GRID
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.stat-primary::before  { background: var(--gradient-primary); }
.stat-success::before  { background: var(--gradient-success); }
.stat-info::before     { background: var(--gradient-info); }
.stat-warning::before  { background: var(--gradient-warning); }
.stat-danger::before   { background: var(--gradient-danger); }
.stat-secondary::before { background: linear-gradient(135deg, #54549D, #8A8ABC); }
.stat-accent::before   { background: linear-gradient(135deg, #B0B0D2, #E6E6F0); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-color-light);
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    transition: box-shadow var(--transition-base);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.card-link {
    font-size: 0.8rem;
    color: var(--accent-primary-light);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.card-link:hover {
    color: var(--accent-primary);
}

.card-body {
    padding: 20px 24px;
}

.card-form .card-body {
    padding: 28px 32px;
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 20px;
}

/* ============================================================
   LIST ITEMS
   ============================================================ */
.list-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.list-item-icon {
    font-size: 1.25rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.list-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.list-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-item-badge {
    flex-shrink: 0;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: capitalize;
}

.badge-concluido, .badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-processando, .badge-info  { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-pendente                  { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
.badge-enviado                   { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.badge-parcial, .badge-warning   { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-erro, .badge-danger       { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 109, 0.4);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 109, 0.5);
}

.btn-secondary {
    background: rgba(84, 84, 157, 0.2);
    color: var(--pmpa-100);
    border: 1px solid rgba(84, 84, 157, 0.3);
}

.btn-secondary:hover {
    background: rgba(84, 84, 157, 0.35);
}

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

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-page {
    max-width: 720px;
    margin: 0 auto;
}

.form-section {
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.form-section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.form-section-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

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

.form-group label {
    display: block;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-input select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--pmpa-400);
    box-shadow: 0 0 0 3px rgba(51, 51, 138, 0.2);
}

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

select.form-input {
    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: 12px;
    padding-right: 36px;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.form-checkbox {
    width: auto;
    margin-right: 8px;
    accent-color: var(--accent-primary);
    transform: scale(1.15);
}

.form-checkbox-group {
    display: flex;
    align-items: center;
}

.form-checkbox-group label {
    margin-bottom: 0;
    color: var(--text-primary);
}

.form-error {
    display: block;
    font-size: 0.75rem;
    color: var(--accent-danger);
    margin-top: 4px;
}

.form-help-link {
    font-size: 0.8rem;
    color: var(--accent-primary-light);
    margin-top: 8px;
    display: inline-block;
}

.form-help-link:hover {
    text-decoration: underline;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
}

/* File Drop Zone */
.file-drop-zone {
    border: 2px dashed var(--border-color-light);
    border-radius: var(--border-radius);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.04);
}

.file-drop-zone.has-file {
    border-color: var(--accent-success);
    background: rgba(16, 185, 129, 0.04);
}

.file-drop-zone input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.drop-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.drop-text {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.drop-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    overflow-x: auto;
}

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

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 14px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

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

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

.data-table td code {
    background: rgba(99, 102, 241, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--accent-primary-light);
    font-family: 'Consolas', 'Monaco', monospace;
}

.table-actions {
    display: flex;
    gap: 4px;
}

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

/* ============================================================
   PROGRESS
   ============================================================ */
.progress-section {
    margin-bottom: 24px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Mini progress bar */
.progress-mini {
    width: 60px;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.progress-mini-bar {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ============================================================
   STATUS BANNER
   ============================================================ */
.status-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
}

.status-concluido { background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.15); }
.status-processando { background: rgba(59, 130, 246, 0.08); border: 1px solid rgba(59, 130, 246, 0.15); }
.status-enviado { background: rgba(139, 92, 246, 0.08); border: 1px solid rgba(139, 92, 246, 0.15); }
.status-parcial { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.15); }
.status-erro { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.15); }

.status-icon { font-size: 2rem; }
.status-info { display: flex; flex-direction: column; }
.status-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.status-subtitle { font-size: 0.825rem; color: var(--text-secondary); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ============================================================
   DETAIL PAGE
   ============================================================ */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}

.detail-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.detail-description {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.download-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Tags */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'Consolas', monospace;
}

.tag-success { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.tag-warning { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }

/* Error List */
.error-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.error-item {
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.1);
    border-radius: var(--border-radius-sm);
    font-size: 0.825rem;
    color: #f87171;
}

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.template-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all var(--transition-base);
}

.template-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(-2px);
}

.template-icon { font-size: 2rem; }
.template-info { flex: 1; }
.template-name { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.template-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.template-file { font-size: 0.75rem; color: var(--text-secondary); margin-top: 2px; }

/* Filter Bar */
.card-filter {
    margin-bottom: 16px;
}

.filter-bar {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(0, 0, 109, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(51, 51, 138, 0.1) 0%, transparent 50%);
}

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

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-xl);
    padding: 40px 36px;
    box-shadow: var(--shadow-xl);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo-img {
    width: 90px;
    height: auto;
    display: block;
    margin: 0 auto 16px;
    filter: drop-shadow(0 0 16px rgba(0, 0, 109, 0.4));
}

.login-logo {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 16px rgba(0, 0, 109, 0.4));
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.03em;
}

.login-header p {
    font-size: 0.825rem;
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
}

.login-footer p {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 0.825rem;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 4px;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.page-link:hover:not(.disabled):not(.active) {
    background: rgba(255, 255, 255, 0.05);
}

.page-link.active {
    background: var(--pmpa-400);
    color: var(--pmpa-50);
}

.page-link.disabled {
    color: rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

/* ============================================================
   SELECTION BAR
   ============================================================ */
.selection-bar {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: rgba(2, 2, 40, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--pmpa-400);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transform: translateY(100%);
    transition: transform var(--transition-base);
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.selection-bar.active {
    transform: translateY(0);
}

.selection-info {
    font-weight: 600;
    color: var(--pmpa-50);
}

.selection-actions {
    display: flex;
    gap: 12px;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }

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

    .sidebar.collapsed {
        transform: translateX(0);
    }

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

    .menu-toggle {
        display: block;
    }

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

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

    .content-area {
        padding: 16px;
    }

    .filter-bar {
        flex-direction: column;
    }
}
