/* ===================================================================
   SAPHIR PHP Framework — Central Theme
   All modules share this single stylesheet.
   =================================================================== */

/* ------------------------------------------------------------------
   1. CSS Custom Properties
   ------------------------------------------------------------------ */
:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --gradient: linear-gradient(135deg, var(--primary), var(--primary-dark));
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-alt: #f8f9fa;
    --surface-hover: #f0f4ff;
    --text: #333333;
    --text-secondary: #555555;
    --text-muted: #6c757d;
    --border: #dee2e6;
    --border-light: #f0f0f0;
    --font: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-mono: 'Courier New', Consolas, monospace;
    --success: #28a745;
    --success-bg: #d4edda;
    --success-text: #155724;
    --success-light: #e8f5e9;
    --success-dark: #2e7d32;
    --warning: #ffc107;
    --warning-bg: #fff3e0;
    --warning-text: #8a6d00;
    --warning-dark: #e65100;
    --error: #dc3545;
    --error-bg: #f8d7da;
    --error-text: #721c24;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 5px 15px rgba(0,0,0,.08);
    --shadow-lg: 0 20px 60px rgba(0,0,0,.3);
    --shadow-xl: 0 15px 40px rgba(102,126,234,.15);
    --radius-sm: 5px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 15px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }

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

/* ------------------------------------------------------------------
   3. Layout
   ------------------------------------------------------------------ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-xs {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-body {
    padding: 20px;
}

/* ------------------------------------------------------------------
   4. Topbar / Navigation
   ------------------------------------------------------------------ */
.topbar {
    background: var(--gradient);
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.topbar-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.topbar a, .topbar button {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background .2s;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
}

.topbar a:hover, .topbar button:hover {
    background: rgba(255,255,255,.15);
}

.topbar-nav {
    display: flex;
    gap: 4px;
}

.topbar-nav button.active {
    background: rgba(255,255,255,.3);
}

.topbar a.muted {
    opacity: .8;
    font-size: 13px;
}

.topbar a.muted:hover {
    opacity: 1;
}

/* ------------------------------------------------------------------
   5. Header / Banner
   ------------------------------------------------------------------ */
.dash-header {
    background: var(--gradient);
    color: #fff;
    padding: 40px;
    border-radius: var(--radius-xl);
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.1);
}

.dash-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.dash-header p {
    opacity: .9;
    font-size: 1.1em;
}

/* Standalone card-style header (used by PacGenerator, etc.) */
.card-header {
    background: var(--gradient);
    padding: 40px;
    text-align: center;
    color: #fff;
}

.card-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.card-header p {
    opacity: .9;
    font-size: 1.1em;
}

.card-header-sm {
    padding: 28px 32px;
}

.card-header-sm h1 {
    font-size: 2em;
}

/* ------------------------------------------------------------------
   6. Cards
   ------------------------------------------------------------------ */
.card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: slideIn .5s ease-out;
}

.card-body {
    padding: 40px;
}

.dash-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
    transition: all .3s ease;
}

.dash-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,.12);
}

/* ------------------------------------------------------------------
   7. Buttons
   ------------------------------------------------------------------ */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    transition: all .3s ease;
    font-size: 14px;
    font-family: var(--font);
    text-align: center;
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102,126,234,.3);
    color: #fff;
}

.btn-secondary {
    background: var(--surface-alt);
    color: var(--primary);
    border: 2px solid var(--primary);
}

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

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-success:hover {
    filter: brightness(1.1);
    color: #fff;
}

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

.btn-block {
    width: 100%;
    text-align: center;
}

.btn-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn-group-inline {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-weight: 500;
}

.form-group h3 {
    color: var(--primary);
    font-size: 1.3em;
    margin-bottom: 20px;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 10px;
}

.form-label-sm {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--surface-hover);
    border-radius: var(--radius);
    font-size: 1em;
    font-family: var(--font);
    transition: all .3s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface-hover);
    box-shadow: 0 0 0 3px rgba(102,126,234,.1);
}

textarea {
    min-height: 60px;
    resize: vertical;
}

.form-inline {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.form-inline .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-inline .form-group-fixed {
    flex: 0;
    margin-bottom: 0;
}

.form-hint {
    background: var(--surface-hover);
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: .95em;
    line-height: 1.5;
    margin-bottom: 30px;
}

/* ------------------------------------------------------------------
   9. Info / Alert Boxes
   ------------------------------------------------------------------ */
.info-box {
    background: var(--surface-hover);
    padding: 20px;
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
    margin-top: 20px;
}

.info-box h4 {
    color: var(--primary);
    margin-bottom: 10px;
}

.info-box p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-box-flex {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.info-box-icon {
    font-size: 1.5em;
    min-width: 30px;
}

.info-box-content {
    flex: 1;
}

.info-box-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 5px;
}

.info-box-text {
    color: var(--text-secondary);
    font-size: .95em;
}

.info-box.error {
    background: var(--warning-bg);
    border-left-color: #ff9800;
}

.info-box.error .info-box-title {
    color: #ff9800;
}

.info-box.success {
    background: var(--success-light);
    border-left-color: var(--success);
}

.info-box.success .info-box-title {
    color: var(--success);
}

/* ------------------------------------------------------------------
   10. Flash Messages
   ------------------------------------------------------------------ */
.flash-success {
    background: var(--success-bg);
    border: 1px solid #c3e6cb;
    color: var(--success-text);
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.flash-error {
    background: var(--error-bg);
    border: 1px solid #f5c6cb;
    color: var(--error-text);
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

/* ------------------------------------------------------------------
   11. Tables
   ------------------------------------------------------------------ */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.table th,
.table td {
    padding: 12px 14px;
    border: 1px solid var(--surface-hover);
    text-align: left;
}

.table th {
    background: var(--surface-hover);
    color: var(--text);
    font-weight: 600;
}

.table td {
    background: var(--surface);
}

/* ------------------------------------------------------------------
   12. Stats & Data Display
   ------------------------------------------------------------------ */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

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

.stat-row-label {
    color: var(--text-muted);
    font-weight: 500;
}

.stat-row-value {
    color: var(--primary);
    font-weight: bold;
    font-family: var(--font-mono);
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary);
    margin: 15px 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: .95em;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width .3s ease;
}

.performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.perf-card {
    background: var(--gradient);
    color: #fff;
    padding: 20px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.perf-card .label {
    font-size: .9em;
    opacity: .9;
    margin-bottom: 5px;
}

.perf-card .value {
    font-size: 1.5em;
    font-weight: bold;
    font-family: var(--font-mono);
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 14px;
}

.s-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--primary);
}

.s-card .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.s-card .val {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-top: 4px;
}

.s-card.ok { border-top-color: var(--success); }
.s-card.ok .val { color: var(--success); }
.s-card.ko { border-top-color: var(--error); }
.s-card.ko .val { color: var(--error); }

/* ------------------------------------------------------------------
   13. Badges
   ------------------------------------------------------------------ */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
}

.badge-active, .badge.ok, .badge-success {
    background: var(--success);
}

.badge-soon, .badge-warning {
    background: var(--warning);
    color: #333;
}

.badge.ko, .badge-error {
    background: var(--error);
}

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

/* ------------------------------------------------------------------
   14. Grid & Lists
   ------------------------------------------------------------------ */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.grid-sm {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* ------------------------------------------------------------------
   15. Item Lists (menu items, table items, module items, etc.)
   ------------------------------------------------------------------ */
.item-list {
    display: grid;
    gap: 12px;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--surface-alt);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
    transition: all .3s ease;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.item-row:hover {
    background: var(--surface-hover);
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(102,126,234,.2);
}

.item-row-icon {
    font-size: 2em;
    min-width: 50px;
    text-align: center;
}

.item-row-body {
    flex: 1;
}

.item-row-body h3 {
    color: var(--primary);
    font-size: 1.1em;
    margin-bottom: 5px;
}

.item-row-body p {
    color: var(--text-muted);
    font-size: .95em;
    line-height: 1.4;
}

.item-row-status {
    margin-left: auto;
    padding: 5px 15px;
    background: var(--primary);
    color: #fff;
    border-radius: 20px;
    font-size: .85em;
    font-weight: bold;
    white-space: nowrap;
}

.item-row-status.inactive {
    background: var(--warning);
    color: #333;
}

.module-item {
    background: var(--surface-alt);
    padding: 15px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    transition: all .3s ease;
}

.module-item:hover {
    background: var(--surface-hover);
    transform: translateX(5px);
}

.module-name {
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 1.1em;
}

.module-children {
    color: var(--text-muted);
    font-size: .95em;
}

.children-list {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    font-size: .85em;
    color: #777;
}

.children-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: .8em;
    margin-right: 5px;
    margin-bottom: 3px;
}

/* ------------------------------------------------------------------
   16. Sections
   ------------------------------------------------------------------ */
.dash-section {
    margin-bottom: 30px;
}

.dash-section h2 {
    color: var(--primary);
    font-size: 1.6em;
    margin-bottom: 15px;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 10px;
}

/* ------------------------------------------------------------------
   17. Code & Log Viewer
   ------------------------------------------------------------------ */
.doc-box {
    background: #f8f9ff;
    border: 1px solid #e5e8ff;
    border-radius: var(--radius-lg);
    padding: 24px;
    overflow: auto;
}

.doc-box h1, .doc-box h2, .doc-box h3, .doc-box h4 {
    margin: 1rem 0 .5rem;
    color: #2f3552;
}

.doc-box p, .doc-box li {
    margin: .5rem 0;
    line-height: 1.75;
    color: #3d4455;
}

.doc-box ul {
    padding-left: 1.4rem;
    margin: .5rem 0 1rem;
}

.doc-box code {
    background: rgba(102,126,234,.08);
    color: #1b1f3a;
    padding: .15rem .35rem;
    border-radius: 6px;
    font-family: var(--font-mono);
}

.doc-box pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
    font-size: .95rem;
    line-height: 1.6;
    margin: 1rem 0;
    padding: 16px;
    background: #eef2ff;
    border-radius: var(--radius-lg);
    border: 1px solid #d7e0ff;
}

.doc-box details {
    background: var(--surface);
    border: 1px solid #e5e8ff;
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    margin: 1rem 0;
}

.doc-box summary {
    font-weight: 700;
    cursor: pointer;
    outline: none;
}

.doc-box .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 1rem;
}

.doc-box .card {
    background: var(--surface);
    border: 1px solid #e5e8ff;
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow-xl);
}

.doc-box .method-list {
    list-style: disc;
    margin: .75rem 0 0 1.4rem;
    padding: 0;
}

.log-container {
    background: #1e1e1e;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.log-container p {
    color: #d4d4d4;
    font-family: var(--font-mono);
    margin: 5px 0;
    font-size: .9em;
    line-height: 1.5;
}

.log-container p.info { color: #4ec9b0; }
.log-container p.success { color: #ce9178; }
.log-container p.warning { color: #dcdcaa; }
.log-container p.error { color: #f48771; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #2d2d2d; }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }

/* ------------------------------------------------------------------
   18. Result / Status Boxes
   ------------------------------------------------------------------ */
.success-box {
    background: var(--success-light);
    border-left: 4px solid var(--success);
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
}

.success-box h3 {
    color: var(--success-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.success-box p {
    color: var(--text-secondary);
    font-size: 1.1em;
    font-weight: 500;
}

.empty-box {
    background: var(--warning-bg);
    border-left: 4px solid #ff9800;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 30px;
}

.empty-box h3 {
    color: var(--warning-dark);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.empty-box p {
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

.empty-message {
    color: #999;
    text-align: center;
    padding: 20px;
    background: var(--surface-alt);
    border-radius: var(--radius);
    margin: 15px 0;
}

/* ------------------------------------------------------------------
   19. PacGenerator — Module Group / Table Selection
   ------------------------------------------------------------------ */
.module-group {
    margin-bottom: 30px;
}

.module-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--gradient);
    color: #fff;
    border-radius: var(--radius-lg);
    margin-bottom: 15px;
    cursor: pointer;
    user-select: none;
    transition: all .3s ease;
}

.module-group-header:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(102,126,234,.3);
}

.module-group-header input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #fff;
}

.module-group-header-title {
    flex: 1;
    font-weight: 600;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.module-group-count {
    background: rgba(255,255,255,.3);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: .9em;
    font-weight: 500;
}

.module-tables {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    padding-left: 20px;
    animation: expandGroup .3s ease;
}

.module-group.collapsed .module-tables {
    display: none;
}

.table-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--surface-alt);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
    transition: all .3s ease;
}

.table-item:hover {
    background: var(--surface-hover);
    transform: translateX(5px);
}

.table-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.table-item label {
    flex: 1;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.table-name {
    font-weight: 500;
    color: var(--text);
}

.table-type {
    font-size: .85em;
    color: #999;
    font-style: italic;
}

/* ------------------------------------------------------------------
   20. PacTester — Route Tester Sidebar
   ------------------------------------------------------------------ */
.sidebar {
    width: 320px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    color: #495057;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header button {
    background: none;
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #495057;
}

.sidebar-header button:hover {
    background: var(--surface-alt);
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
}

.route-group-title {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .5px;
    background: var(--surface-alt);
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
}

.route-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background .15s;
    font-size: 12px;
}

.route-item:hover { background: var(--surface-hover); }
.route-item.selected { background: #e8edff; border-left: 3px solid var(--primary); }

.route-method {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 10px;
    color: #fff;
    min-width: 44px;
    text-align: center;
}

.method-GET { background: #0066cc; }
.method-POST { background: #228B22; }
.method-PUT { background: #ff8c00; }
.method-DELETE { background: #dc3545; }
.method-PATCH { background: #6f42c1; }

.route-path {
    flex: 1;
    font-family: var(--font-mono);
    word-break: break-all;
}

.route-status {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
}

.route-status.ok { background: var(--success-bg); color: var(--success-text); }
.route-status.ko { background: var(--error-bg); color: var(--error-text); }

/* ------------------------------------------------------------------
   21. PacTester — Panels & Preview
   ------------------------------------------------------------------ */
.panel {
    flex: 1;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.panel.active {
    display: flex;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.test-form {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}

.test-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-end;
}

.form-group-sm {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group-sm label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.results-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 14px;
}

.r-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    background: var(--surface);
    border-radius: 6px;
    border-left: 4px solid var(--border);
    font-size: 12px;
    cursor: pointer;
    transition: background .15s;
}

.r-item:hover { background: var(--surface-hover); }
.r-item.ok { border-left-color: var(--success); }
.r-item.ko { border-left-color: var(--error); }
.r-item.preview-active { background: #e8edff; box-shadow: 0 0 0 2px var(--primary); }

.r-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.r-item-head span:first-child {
    font-family: var(--font-mono);
    font-weight: 600;
}

.r-item-meta {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
}

.preview-section {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}

.preview-toolbar .route-label {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: #495057;
}

.preview-toolbar .meta {
    font-size: 11px;
    color: var(--text-muted);
}

.viewport-toggles {
    display: flex;
    gap: 2px;
    background: #e9ecef;
    border-radius: 5px;
    padding: 2px;
}

.viewport-btn {
    padding: 5px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    transition: all .15s;
}

.viewport-btn.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

.viewport-btn:hover { color: var(--text); }

.preview-frame-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    background: #f0f0f0;
    min-height: 400px;
    overflow: auto;
    padding: 16px;
}

.preview-frame-wrap iframe {
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    transition: width .3s ease;
    height: 500px;
}

.preview-frame-wrap iframe.desktop { width: 100%; }
.preview-frame-wrap iframe.tablet { width: 768px; }
.preview-frame-wrap iframe.mobile { width: 375px; }

.preview-empty {
    text-align: center;
    color: #999;
    padding: 60px 20px;
    font-size: 14px;
}

/* ------------------------------------------------------------------
   22. PacTester — Navigation Bar
   ------------------------------------------------------------------ */
.nav-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.nav-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 13px;
}

.nav-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

.nav-frame {
    flex: 1;
    border: none;
    width: 100%;
    background: var(--surface);
}

/* ------------------------------------------------------------------
   23. PacTester — Documentation Panel
   ------------------------------------------------------------------ */
.doc-panel {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.doc-sidebar {
    width: 260px;
    background: var(--surface-alt);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 12px;
}

.doc-sidebar h3 {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.doc-tree-item {
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    font-family: var(--font-mono);
}

.doc-tree-item:hover { background: #e8edff; }
.doc-tree-item.active { background: var(--primary); color: #fff; }
.doc-tree-item.dir { font-weight: 600; color: #495057; }

.doc-content {
    flex: 1;
    overflow: auto;
    padding: 20px;
}

.doc-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.6;
    overflow: auto;
    white-space: pre-wrap;
}

.doc-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 60px 20px;
}

/* ------------------------------------------------------------------
   24. Version Badge
   ------------------------------------------------------------------ */
.version-badge {
    display: inline-block;
    background: var(--gradient);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: .9em;
    margin-top: 10px;
}

.version-info {
    background: var(--surface-hover);
    padding: 15px;
    border-radius: var(--radius);
    margin-top: 20px;
    font-size: .95em;
}

.version-info strong {
    color: var(--primary);
}

/* ------------------------------------------------------------------
   25. Footer
   ------------------------------------------------------------------ */
footer, .footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    background: var(--surface-alt);
    font-size: .95em;
    border-top: 1px solid var(--border-light);
    margin-top: 30px;
}

footer a, .footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover, .footer a:hover {
    text-decoration: underline;
}

/* ------------------------------------------------------------------
   26. Animations
   ------------------------------------------------------------------ */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

/* ------------------------------------------------------------------
   27. Utility
   ------------------------------------------------------------------ */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }
.p-0 { padding: 0; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

/* ------------------------------------------------------------------
   28. Responsive
   ------------------------------------------------------------------ */
@media (max-width: 1024px) {
    .sidebar { width: 260px; }
    .summary-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .topbar { flex-direction: column; gap: 10px; }
    .dash-header h1 { font-size: 1.8em; }
    .card-header h1 { font-size: 1.8em; }
    .card-body { padding: 25px; }
    .sidebar { display: none; }
    .summary-cards { grid-template-columns: 1fr; }
    .doc-sidebar { width: 200px; }
    .btn-group { flex-direction: column; }
    .btn { width: 100%; }
    .grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .item-row { flex-direction: column; text-align: center; }
    .item-row-icon { min-width: auto; }
    .item-row-status { margin-left: 0; margin-top: 10px; }
}

/* ═══════════════════════════════════════════════════════════
   PROJET MODULE
   ═══════════════════════════════════════════════════════════ */

.kanban-board { display:flex; gap:12px; overflow-x:auto; padding-bottom:16px; min-height:400px; }
.kanban-column { min-width:220px; max-width:280px; flex:1; background:var(--surface-alt); border-radius:var(--radius); padding:12px; }
.kanban-column-header { font-weight:700; font-size:.85em; text-transform:uppercase; letter-spacing:.5px; padding:8px; border-radius:var(--radius-sm); margin-bottom:12px; text-align:center; color:#fff; }
.kanban-cards { min-height:200px; }
.kanban-card { background:#fff; border-radius:var(--radius-sm); padding:12px; margin-bottom:8px; box-shadow:var(--shadow-sm); cursor:grab; border-left:3px solid var(--primary); transition:opacity .2s; }
.kanban-card:active { cursor:grabbing; }
.kanban-card.dragging { opacity:.4; }
.kanban-card .card-title { font-weight:600; font-size:.9em; margin-bottom:4px; }
.kanban-card .card-meta { font-size:.75em; color:var(--text-muted); display:flex; gap:8px; }
.kanban-card[data-priority="high"] { border-left-color:var(--warning); }
.kanban-card[data-priority="critical"] { border-left-color:var(--error); }
.kanban-card[data-priority="low"] { border-left-color:var(--text-muted); }

.chart-container { position:relative; width:100%; }
.chart-legend { display:flex; gap:16px; margin-top:12px; font-size:.8em; }
.chart-legend-item { display:flex; align-items:center; gap:6px; }
.chart-legend-color { width:14px; height:10px; border-radius:2px; }

.meeting-card { background:var(--surface); border-radius:var(--radius); padding:16px; border-left:4px solid var(--primary); margin-bottom:8px; }
.meeting-card.completed { border-left-color:var(--success); opacity:.7; }
.meeting-card.cancelled { border-left-color:var(--error); opacity:.5; text-decoration:line-through; }

.notification-badge { background:var(--error); color:#fff; border-radius:50%; min-width:18px; height:18px; font-size:.7em; display:inline-flex; align-items:center; justify-content:center; padding:0 4px; font-weight:700; }
.notification-item { padding:12px 16px; border-bottom:1px solid var(--border-light); transition:background .15s; }
.notification-item:hover { background:var(--surface-hover); }
.notification-item.unread { border-left:3px solid var(--primary); font-weight:600; }

.timeline { position:relative; padding-left:24px; }
.timeline::before { content:''; position:absolute; left:8px; top:0; bottom:0; width:2px; background:var(--border); }
.timeline-item { position:relative; margin-bottom:20px; padding-left:16px; }
.timeline-item::before { content:''; position:absolute; left:-20px; top:4px; width:12px; height:12px; border-radius:50%; background:var(--primary); border:2px solid #fff; box-shadow:var(--shadow-sm); }
.timeline-item .timeline-date { font-size:.75em; color:var(--text-muted); }
.timeline-item .timeline-content { font-size:.9em; }

.resource-bar { height:8px; background:var(--border-light); border-radius:4px; overflow:hidden; margin-top:4px; }
.resource-bar-fill { height:100%; border-radius:4px; transition:width .3s; }
.resource-bar-fill.ok { background:var(--success); }
.resource-bar-fill.warning { background:var(--warning); }
.resource-bar-fill.over { background:var(--error); }

.sprint-header { background:var(--gradient); color:#fff; border-radius:var(--radius); padding:20px; margin-bottom:20px; }
.sprint-header h2 { margin:0 0 8px; color:#fff; }
.sprint-header p { margin:0; opacity:.8; font-size:.9em; }
