/* ============================================================
   PLAZA DE DATOS — Portal de Documentación Técnica
   Design System: Stitch (SaaS Premium)
   Paleta: Navy #0C1D3D | Blue #1B3A6B | Accent #7EC8E3 | Gold #F1C40F
   ============================================================ */

/* === CSS Variables === */
:root {
    --stitch-dark: #0C1D3D;
    --stitch-navy: #0F2347;
    --stitch-blue: #1B3A6B;
    --stitch-mid: #2D5BA0;
    --stitch-light: #4A90D9;
    --stitch-accent: #7EC8E3;
    --stitch-gold: #F1C40F;
    --stitch-gold-soft: #F9E547;

    --bg-primary: #060D1A;
    --bg-secondary: #0A1628;
    --bg-tertiary: #0F1D33;
    --bg-card: #111F38;
    --bg-card-hover: #162847;
    --bg-input: #0D1A2E;
    --bg-sidebar: #080F1F;

    --text-primary: #E8EDF5;
    --text-secondary: #8B9DC3;
    --text-muted: #5A6F8E;
    --text-accent: #7EC8E3;

    --border-color: #1A2D4D;
    --border-light: #1E3456;
    --border-accent: rgba(126, 200, 227, 0.3);

    --success: #2ECC71;
    --warning: #F39C12;
    --danger: #E74C3C;
    --info: #3498DB;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(126, 200, 227, 0.08);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --sidebar-width: 280px;
    --sidebar-collapsed: 68px;
    --topbar-height: 60px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.65;
    overflow-x: hidden;
}

::selection {
    background: rgba(126, 200, 227, 0.25);
    color: #fff;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--stitch-blue);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--stitch-mid);
}

/* === LOGIN SCREEN === */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-bg-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(126, 200, 227, 0.08) 0%, transparent 70%);
    top: -15%;
    right: -10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(45, 91, 160, 0.1) 0%, transparent 70%);
    bottom: -10%;
    left: -8%;
    animation-delay: -7s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(241, 196, 15, 0.04) 0%, transparent 70%);
    top: 40%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -30px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(15px, 15px) scale(1.02);
    }
}

.login-card {
    background: linear-gradient(145deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 420px;
    max-width: 92vw;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    z-index: 2;
    animation: cardAppear 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.login-logo svg {
    filter: drop-shadow(0 4px 12px rgba(126, 200, 227, 0.2));
}

.login-title {
    font-size: 1.65rem;
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--stitch-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 6px;
    margin-bottom: 32px;
    font-weight: 400;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-normal);
    outline: none;
}

.input-group input:focus {
    border-color: var(--stitch-accent);
    box-shadow: 0 0 0 3px rgba(126, 200, 227, 0.12);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.login-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.25);
    border-radius: var(--radius-sm);
    color: #E74C3C;
    font-size: 0.85rem;
    margin-bottom: 20px;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

.login-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--stitch-mid) 0%, var(--stitch-blue) 100%);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(126, 200, 227, 0.15) 100%);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(45, 91, 160, 0.4);
}

.login-btn:hover::before {
    opacity: 1;
}

.login-btn:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.login-footer span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* === APP CONTAINER === */
.app-container {
    display: flex;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* === 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: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
}

.sidebar-logo h2 {
    font-size: 1.05rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.sidebar-badge {
    font-size: 0.65rem;
    background: linear-gradient(135deg, var(--stitch-blue), var(--stitch-mid));
    color: var(--stitch-accent);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--bg-card-hover);
    color: var(--stitch-accent);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 10px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-title {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    padding: 12px 12px 6px;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(126, 200, 227, 0.08) 0%, rgba(45, 91, 160, 0.12) 100%);
    color: var(--stitch-accent);
    border: 1px solid var(--border-accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--stitch-accent);
    border-radius: 0 3px 3px 0;
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-logo>div,
.sidebar.collapsed .sidebar-badge {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 0.08);
    border-color: rgba(231, 76, 60, 0.3);
    color: var(--danger);
}

.sidebar.collapsed .logout-btn span {
    display: none;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-slow);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed);
}

.top-bar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    background: rgba(6, 13, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.breadcrumb span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

.top-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.doc-version {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.status-badge.online {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.content-area {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
    width: 100%;
}

/* === CONTENT COMPONENTS === */

/* Section Header */
.section-header {
    margin-bottom: 32px;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header h1 {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--stitch-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 700px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
    animation: slideUp 0.5s ease both;
}

.stat-card:nth-child(2) {
    animation-delay: 0.05s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.15s;
}

.stat-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(126, 200, 227, 0.06) 0%, transparent 70%);
    transform: translate(30%, -30%);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 1.2rem;
}

.stat-icon.blue {
    background: rgba(126, 200, 227, 0.1);
    color: var(--stitch-accent);
}

.stat-icon.green {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success);
}

.stat-icon.gold {
    background: rgba(241, 196, 15, 0.1);
    color: var(--stitch-gold);
}

.stat-icon.purple {
    background: rgba(155, 89, 182, 0.1);
    color: #9B59B6;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

/* Info Cards / Panels */
.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    overflow: hidden;
    animation: slideUp 0.4s ease both;
}

.doc-card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.doc-card-header:hover {
    background: var(--bg-card-hover);
}

.doc-card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-card-header h3 .card-icon {
    font-size: 1.1rem;
}

.doc-card-badge {
    font-size: 0.72rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-active {
    background: rgba(46, 204, 113, 0.1);
    color: var(--success);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

.badge-info {
    background: rgba(52, 152, 219, 0.1);
    color: var(--info);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.1);
    color: var(--warning);
    border: 1px solid rgba(243, 156, 18, 0.2);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, 0.2);
}

.badge-accent {
    background: rgba(126, 200, 227, 0.1);
    color: var(--stitch-accent);
    border: 1px solid var(--border-accent);
}

.doc-card-body {
    padding: 22px;
}

/* Tables */
.doc-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

.doc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.doc-table thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.doc-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(26, 45, 77, 0.5);
    color: var(--text-secondary);
    vertical-align: top;
}

.doc-table tbody tr:hover td {
    background: rgba(126, 200, 227, 0.03);
}

.doc-table tbody tr:last-child td {
    border-bottom: none;
}

/* Code Blocks */
.code-block {
    background: #050A14;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.82rem;
    line-height: 1.7;
    overflow-x: auto;
    color: var(--stitch-accent);
    position: relative;
}

.code-block .code-label {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 0.65rem;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.code-block .comment {
    color: var(--text-muted);
}

.code-block .keyword {
    color: var(--stitch-gold);
}

.code-block .string {
    color: var(--success);
}

.code-block .value {
    color: #E8A0BF;
}

/* Key-Value display */
.kv-row {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid rgba(26, 45, 77, 0.4);
    gap: 12px;
}

.kv-row:last-child {
    border-bottom: none;
}

.kv-key {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 160px;
    flex-shrink: 0;
}

.kv-value {
    font-size: 0.88rem;
    color: var(--text-primary);
    word-break: break-all;
}

.kv-value code {
    background: rgba(126, 200, 227, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    color: var(--stitch-accent);
    border: 1px solid var(--border-accent);
}

/* Architecture Diagram */
.arch-diagram {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 20px 0;
}

.arch-node {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    text-align: center;
    min-width: 140px;
    transition: all var(--transition-normal);
}

.arch-node:hover {
    border-color: var(--stitch-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.arch-node .node-icon {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.arch-node .node-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.arch-node .node-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.arch-arrow {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 1.2rem;
    padding: 0 4px;
}

/* File Tree */
.file-tree {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.9;
    color: var(--text-secondary);
    padding: 12px 0;
}

.file-tree .folder {
    color: var(--stitch-accent);
    font-weight: 600;
}

.file-tree .file {
    color: var(--text-secondary);
}

.file-tree .indent {
    padding-left: 20px;
}

.file-tree .indent-2 {
    padding-left: 40px;
}

.file-tree .indent-3 {
    padding-left: 60px;
}

/* Two Column Layout */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Alert boxes */
.alert-box {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-box.info {
    background: rgba(52, 152, 219, 0.08);
    border: 1px solid rgba(52, 152, 219, 0.2);
    color: var(--info);
}

.alert-box.warning {
    background: rgba(243, 156, 18, 0.08);
    border: 1px solid rgba(243, 156, 18, 0.2);
    color: var(--warning);
}

.alert-box.success {
    background: rgba(46, 204, 113, 0.08);
    border: 1px solid rgba(46, 204, 113, 0.2);
    color: var(--success);
}

.alert-box.danger {
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.2);
    color: var(--danger);
}

/* Credential masked fields */
.credential-field {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
}

.credential-field .masked {
    color: var(--text-muted);
    letter-spacing: 2px;
}

.credential-field .reveal-btn {
    background: none;
    border: none;
    color: var(--stitch-accent);
    cursor: pointer;
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all var(--transition-fast);
}

.credential-field .reveal-btn:hover {
    background: rgba(126, 200, 227, 0.1);
}

/* Section divider */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 32px 0;
}

/* Subsection */
.subsection-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--stitch-blue);
    display: inline-block;
}

/* File Tree Clickable */
.file-tree .file-link {
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline;
    border-radius: 4px;
    padding: 2px 8px;
    margin: -2px -8px;
    color: #7EC8E3;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    text-decoration-color: rgba(126, 200, 227, 0.4);
    font-weight: 500;
    position: relative;
}

.file-tree .file-link::after {
    content: ' 👁️';
    font-size: 0.65rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.file-tree .file-link:hover {
    background: rgba(126, 200, 227, 0.15);
    color: #a8e0f0;
    text-decoration-color: #7EC8E3;
    box-shadow: 0 0 12px rgba(126, 200, 227, 0.2);
}

.file-tree .file-link:hover::after {
    opacity: 1;
}

.file-tree .file-link:active {
    transform: scale(0.97);
    background: rgba(126, 200, 227, 0.25);
}

/* === FILE PREVIEW MODAL === */
.file-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fadeIn 0.2s ease;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.file-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.file-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 960px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.file-modal-overlay.active .file-modal {
    transform: translateY(0) scale(1);
}

.file-modal-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-card));
    flex-shrink: 0;
}

.file-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--stitch-accent);
    font-weight: 600;
}

.file-modal-title .file-icon {
    font-size: 1.1rem;
}

.file-modal-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.file-modal-meta span {
    padding: 3px 8px;
    background: var(--bg-input);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.file-modal-close {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.file-modal-close:hover {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.3);
    color: var(--danger);
}

.file-modal-body {
    overflow: auto;
    flex: 1;
    position: relative;
}

.file-modal-code {
    margin: 0;
    padding: 16px 18px 16px 60px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    line-height: 1.75;
    color: var(--text-primary);
    white-space: pre;
    overflow-x: auto;
    background: #050A14;
    counter-reset: line;
    min-height: 200px;
    tab-size: 4;
}

.file-modal-code .line {
    display: block;
    position: relative;
}

.file-modal-code .line::before {
    counter-increment: line;
    content: counter(line);
    position: absolute;
    left: -44px;
    width: 32px;
    text-align: right;
    color: var(--text-muted);
    font-size: 0.72rem;
    opacity: 0.5;
    user-select: none;
}

.file-modal-code .line:hover {
    background: rgba(126, 200, 227, 0.04);
}

.file-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 16px;
    color: var(--text-muted);
}

.file-modal-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--stitch-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.file-modal-badge {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 0.65rem;
    padding: 2px 8px;
    background: rgba(126, 200, 227, 0.1);
    border: 1px solid var(--border-accent);
    border-radius: 4px;
    color: var(--stitch-accent);
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 2;
}

/* Syntax highlighting in modal */
.file-modal-code .syn-kw {
    color: #C792EA;
}

.file-modal-code .syn-fn {
    color: #82AAFF;
}

.file-modal-code .syn-str {
    color: #C3E88D;
}

.file-modal-code .syn-num {
    color: #F78C6C;
}

.file-modal-code .syn-com {
    color: #546E7A;
    font-style: italic;
}

.file-modal-code .syn-dec {
    color: #FFCB6B;
}

.file-modal-code .syn-op {
    color: #89DDFF;
}

.file-modal-code .syn-cls {
    color: #FFCB6B;
}

.file-modal-code .syn-imp {
    color: #89DDFF;
}

/* === RESPONSIVE === */

/* Tablet */
@media (max-width: 1024px) {
    .two-col {
        grid-template-columns: 1fr;
    }

    .content-area {
        padding: 24px 20px;
    }

    .section-header h1 {
        font-size: 1.5rem;
    }
}

/* Mobile landscape / small tablet */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .mobile-menu-btn {
        display: block;
    }

    .content-area {
        padding: 16px 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    .top-bar {
        padding: 0 14px;
        height: 52px;
    }

    .top-bar-right .doc-version {
        display: none;
    }

    .breadcrumb {
        font-size: 0.8rem;
    }

    .section-header {
        margin-bottom: 20px;
    }

    .section-header h1 {
        font-size: 1.35rem;
    }

    .section-header p {
        font-size: 0.85rem;
    }

    .doc-card {
        margin-bottom: 14px;
    }

    .doc-card-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .doc-card-header h3 {
        font-size: 0.95rem;
    }

    .doc-card-body {
        padding: 16px;
    }

    .doc-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .doc-table {
        min-width: 500px;
        font-size: 0.8rem;
    }

    .doc-table th,
    .doc-table td {
        padding: 10px 12px;
        white-space: nowrap;
    }

    .file-tree {
        font-size: 0.8rem;
    }

    .alert-box {
        font-size: 0.82rem;
        padding: 12px 14px;
    }

    .nav-item {
        padding: 12px 14px;
        font-size: 0.92rem;
    }

    /* File preview modal on mobile */
    .file-modal-overlay {
        padding: 8px;
    }

    .file-modal {
        width: 100% !important;
        max-width: 100% !important;
        height: 90vh !important;
        border-radius: var(--radius-md) !important;
    }

    .file-modal-header {
        padding: 12px 14px;
    }

    .file-modal-code {
        font-size: 0.75rem !important;
    }

    /* Legal note */
    .legal-note {
        padding: 16px !important;
    }

    .legal-signature {
        flex-direction: column;
        gap: 12px;
    }

    /* Sidebar overlay backdrop */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        backdrop-filter: blur(4px);
    }

    .sidebar.mobile-open~.sidebar-overlay {
        display: block;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    html {
        font-size: 13.5px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 14px;
        display: flex;
        align-items: center;
        gap: 14px;
    }

    .stat-icon {
        margin-bottom: 0;
        width: 36px;
        height: 36px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .login-card {
        padding: 28px 20px;
        border-radius: var(--radius-lg);
    }

    .login-title {
        font-size: 1.3rem;
    }

    .login-subtitle {
        font-size: 0.82rem;
    }

    .section-header h1 {
        font-size: 1.2rem;
    }

    .section-header p {
        font-size: 0.8rem;
    }

    .doc-card-header h3 {
        font-size: 0.88rem;
    }

    .doc-card-body {
        padding: 14px;
    }

    .two-col {
        gap: 14px;
    }

    .doc-table {
        min-width: 400px;
        font-size: 0.75rem;
    }

    .doc-table th,
    .doc-table td {
        padding: 8px 10px;
    }

    .breadcrumb {
        font-size: 0.75rem;
    }

    .breadcrumb span:first-child {
        display: none;
    }

    .status-badge {
        font-size: 0.68rem;
        padding: 3px 8px;
    }

    .content-area {
        padding: 12px 10px;
    }

    .top-bar {
        padding: 0 10px;
        height: 48px;
    }

    .top-bar-right .status-badge {
        display: none;
    }

    .alert-box {
        font-size: 0.78rem;
        padding: 10px 12px;
    }

    .doc-card-badge {
        font-size: 0.65rem;
    }

    /* System password forms on mobile */
    .sys-pass-btn {
        width: 100%;
    }

    /* Ensure forms are full width */
    form div[style*="max-width"] {
        max-width: 100% !important;
    }

    select,
    input[type="password"],
    input[type="text"] {
        font-size: 16px !important;
        /* Prevent iOS zoom on focus */
    }
}

/* Very small screens */
@media (max-width: 360px) {
    html {
        font-size: 13px;
    }

    .sidebar {
        width: 100%;
    }

    .login-card {
        padding: 24px 16px;
    }

    .section-header h1 {
        font-size: 1.1rem;
    }

    .content-area {
        padding: 10px 8px;
    }
}