/* ============================================
   APEX ROUTING — THEME2 EDITORIAL STYLE
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=Epilogue:wght@300;400;500&display=swap');

:root {
    --bg: #f5f2ec;
    --white: #ffffff;
    --ink: #0a0a0a;
    --ink2: #1a1a1a;
    --muted: #888880;
    --accent: #c8371a;
    --border: #e0ddd6;
    --surface: #edeae3;
    --text-primary: #0a0a0a;
    --text-secondary: #555550;
    --text-muted: #888880;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #c8371a;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Epilogue', -apple-system, sans-serif;
    font-weight: 300;
    overflow: hidden;
}

/* ── Layout ── */
.app-layout { display: flex; height: 100vh; }
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.content-area { flex: 1; overflow-y: auto; padding: 28px 32px; background: var(--bg); }

/* ── Sidebar ── */
.sidebar {
    width: 220px; min-width: 220px;
    background: var(--ink);
    display: flex; flex-direction: column;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--ink2);
}

.sidebar-brand-name {
    font-family: 'Playfair Display', serif;
    font-weight: 900; font-size: 1.1rem;
    color: white; letter-spacing: 0.02em;
}
.sidebar-brand-name .dot { color: var(--accent); }

.sidebar-brand-sub {
    font-size: 9px; color: rgba(255,255,255,0.25);
    margin-top: 4px; letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'Epilogue', sans-serif;
}

.sidebar-section { padding: 16px 12px 4px; }

.sidebar-section-title {
    font-size: 9px; color: rgba(255,255,255,0.25);
    letter-spacing: 0.12em; text-transform: uppercase;
    padding: 0 10px 6px;
    font-family: 'Epilogue', sans-serif;
}

.sidebar-nav { list-style: none; }

.sidebar-nav li a {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 12px;
    font-size: 12px; font-family: 'Epilogue', sans-serif; font-weight: 400;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: all 0.15s;
    letter-spacing: 0.02em;
}
.sidebar-nav li a:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.04); }
.sidebar-nav li a.active { color: white; border-left-color: var(--accent); background: rgba(200,55,26,0.08); }

/* ── Top bar ── */
.top-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 32px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.top-bar-left .eyebrow {
    font-size: 9px; letter-spacing: 0.15em;
    text-transform: uppercase; color: var(--accent);
    font-family: 'Epilogue', sans-serif; font-weight: 400;
    margin-bottom: 3px;
}

.top-bar-left h2 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-weight: 900; font-size: 20px;
    color: var(--ink); letter-spacing: -0.01em;
}

.top-bar-left .subtitle {
    font-size: 11px; color: var(--muted);
    margin-top: 2px; font-weight: 300;
}

.top-bar-right { display: flex; align-items: center; gap: 10px; }

.avatar {
    width: 32px; height: 32px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: white;
    font-family: 'Epilogue', sans-serif;
}

/* ── Stat cards ── */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px; background: var(--border);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.stat-card { background: var(--white); padding: 22px 24px; }

.stat-card .label {
    font-size: 9px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--muted);
    font-family: 'Epilogue', sans-serif; font-weight: 400;
    margin-bottom: 10px;
}

.stat-card .value {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem; font-weight: 900;
    color: var(--ink); line-height: 1;
}
.stat-card .value.accent { color: var(--accent); }
.stat-card .value.success { color: #2d6a2d; }
.stat-card .value.warning { color: #b45309; }
.stat-card .value.danger { color: var(--accent); }

/* ── Panels ── */
.panel {
    background: var(--white);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}

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

.panel-header h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-weight: 900; font-size: 14px; color: var(--ink);
}

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

/* ── Tables ── */
.data-table {
    width: 100%; border-collapse: collapse;
    font-family: 'Epilogue', sans-serif; font-size: 12px;
}

.data-table th {
    text-align: left; padding: 10px 24px;
    color: var(--muted); font-weight: 400;
    border-bottom: 1px solid var(--border);
    font-size: 10px; letter-spacing: 0.08em;
    text-transform: uppercase;
}

.data-table td {
    padding: 11px 24px; color: var(--text-secondary);
    border-bottom: 1px solid var(--bg); font-weight: 300;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface); }

/* ── Badges ── */
.badge {
    display: inline-block; font-size: 9px; padding: 3px 8px;
    font-family: 'Epilogue', sans-serif; font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase;
}

.badge-success { background: #f0faf0; color: #2d6a2d; border: 1px solid #c8e6c8; }
.badge-warning { background: #fff8f0; color: #b45309; border: 1px solid #fde68a; }
.badge-danger { background: #fef2f0; color: var(--accent); border: 1px solid #f5c6be; }
.badge-muted { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: 'Epilogue', sans-serif;
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase;
    padding: 9px 18px; border: none;
    cursor: pointer; transition: all 0.15s;
    text-decoration: none;
}

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

.btn-primary { background: var(--ink); color: white; border: 1px solid var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.btn-outline:hover { border-color: var(--ink); color: var(--ink); }

.btn-danger { background: transparent; border: 1px solid #f5c6be; color: var(--accent); }
.btn-danger:hover { background: var(--accent); border-color: var(--accent); color: white; }

.btn-success { background: #2d6a2d; color: white; border: 1px solid #2d6a2d; }
.btn-success:hover { background: #256025; border-color: #256025; }

.btn-ghost { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 6px 10px; }
.btn-ghost:hover { color: var(--ink); border-color: var(--border); }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.form-group label {
    display: block; font-size: 10px;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 6px;
    font-weight: 400; font-family: 'Epilogue', sans-serif;
}

.form-input, .form-select {
    width: 100%; padding: 10px 14px;
    background: var(--white); border: 1px solid var(--border);
    color: var(--ink); font-family: 'Epilogue', sans-serif;
    font-size: 13px; font-weight: 300;
    outline: none; transition: border-color 0.2s;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus { border-color: var(--ink); }
.form-input::placeholder { color: var(--muted); }
.form-select option { background: var(--white); }

/* ── Status dots ── */
.status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    display: inline-block; margin-right: 8px;
}
.status-dot.green { background: #4caf50; }
.status-dot.amber { background: #ff9800; }
.status-dot.red { background: var(--accent); }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10,10,10,0.55);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}

.modal-content {
    background: var(--white); border: 1px solid var(--border);
    width: 440px; max-width: 90vw;
}

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

.modal-header h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-weight: 900; font-size: 16px; color: var(--ink);
}

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border);
    display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Terminal / Log box ── */
.terminal-box {
    background: var(--ink); border: 1px solid var(--ink2);
    padding: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px; color: rgba(255,255,255,0.6);
    white-space: pre-wrap; word-break: break-all;
    max-height: 400px; overflow-y: auto; line-height: 1.6;
}

/* ── Pagination ── */
.pagination {
    display: flex; gap: 4px; margin-top: 16px;
    list-style: none; padding: 0;
}

.pagination button {
    padding: 6px 12px; background: var(--white);
    border: 1px solid var(--border);
    color: var(--muted); cursor: pointer;
    font-size: 11px; font-family: 'Epilogue', sans-serif;
}
.pagination button:hover { border-color: var(--ink); color: var(--ink); }
.pagination button.active { background: var(--ink); border-color: var(--ink); color: white; }
.pagination button:disabled { opacity: 0.35; cursor: default; }

/* ── File browser ── */
.file-browser {
    display: grid; grid-template-columns: 200px 1fr;
    gap: 0; min-height: 500px;
}

.file-tree { border-right: 1px solid var(--border); padding: 12px; }

.file-tree-item {
    display: block; padding: 6px 10px; color: var(--muted);
    text-decoration: none; font-size: 12px;
    cursor: pointer; border: none; background: none;
    width: 100%; text-align: left;
    font-family: 'Epilogue', sans-serif;
}
.file-tree-item:hover { background: var(--surface); color: var(--ink); }
.file-tree-item.active { color: var(--accent); background: #fef2f0; }

.file-list { padding: 0; }

.breadcrumb {
    padding: 10px 16px; font-size: 12px;
    color: var(--muted); border-bottom: 1px solid var(--border);
}
.breadcrumb span { color: var(--text-secondary); }

/* ── Alert ── */
.alert-error {
    background: #fef2f0; border: 1px solid #f5c6be;
    padding: 12px 16px; color: var(--accent);
    font-size: 13px; margin-bottom: 16px; font-weight: 400;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Utilities ── */
.text-muted { color: var(--muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: #2d6a2d; }
.text-warning { color: #b45309; }
.text-danger { color: var(--accent); }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
