/* ============================================================
   AXIS Reporting — Styles
   Matches AXIS Horizon design system
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700;800&display=swap');

:root { --bg: #0F172A; --bg2: #1E293B; --bg3: #334155; --border: rgba(255,255,255,.06); --text: #E2E8F0; --muted: #6B7280; --accent: #3B82F6; --green: #10B981; --amber: #F59E0B; --red: #EF4444; --purple: #8B5CF6; --cyan: #0891B2; }
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: 'Instrument Sans','Segoe UI','Helvetica Neue',Arial,sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; font-size: 13px; -webkit-font-smoothing: antialiased; }

/* ── Sidebar ── */
.sidebar { width: 220px; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100; }
.sidebar-brand { padding: 20px 16px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.brand-icon { font-size: 24px; }
.brand-name { font-size: 14px; font-weight: 700; }
.brand-sub { font-size: 10px; color: var(--muted); }
.nav-section { font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 16px 16px 6px; font-weight: 600; }
.nav-link { display: block; padding: 8px 16px; font-size: 12px; color: #94A3B8; text-decoration: none; border-left: 3px solid transparent; transition: all .15s; }
.nav-link:hover { background: rgba(255,255,255,.03); color: var(--text); }
.nav-link.active { background: rgba(59,130,246,.06); color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.badge-soon { font-size: 8px; padding: 1px 5px; border-radius: 8px; background: rgba(107,114,128,.15); color: #6B7280; margin-left: 4px; font-weight: 500; }

/* ── Content ── */
.content { margin-left: 220px; flex: 1; padding: 24px 32px; min-height: 100vh; }

/* ── Auth Pages ── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.auth-box { background: var(--bg2); border: 1px solid var(--border); border-radius: 16px; padding: 36px 40px; width: 400px; text-align: center; box-shadow: 0 4px 24px rgba(0,0,0,0.2); }
.auth-box h1 { font-size: 20px; font-weight: 800; margin-bottom: 2px; letter-spacing: -0.3px; }
.auth-box h2 { font-size: 11px; color: var(--muted); margin-bottom: 24px; font-weight: 400; letter-spacing: 0.5px; }
.auth-logo { margin-bottom: 16px; }

/* ── Forms ── */
label { display: block; font-size: 11px; font-weight: 600; color: #8B92A5; margin-bottom: 4px; margin-top: 10px; text-align: left; }
input, select, textarea { width: 100%; padding: 8px 12px; border: 1px solid rgba(255,255,255,.08); border-radius: 6px; background: rgba(255,255,255,.04); color: var(--text); font-size: 12px; font-family: inherit; outline: none; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { border-color: rgba(59,130,246,.4); }
input[type="checkbox"] { width: auto; margin-right: 4px; }
select option { background: var(--bg2); color: var(--text); }
optgroup { font-weight: 600; color: var(--accent); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 16px; border-radius: 6px; font-size: 12px; font-weight: 600; border: none; cursor: pointer; text-decoration: none; transition: all .15s; font-family: inherit; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563EB; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #059669; }
.btn-amber { background: var(--amber); color: #000; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: transparent; border: 1px solid rgba(255,255,255,.1); color: #94A3B8; }
.btn-outline:hover { background: rgba(255,255,255,.03); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 10px; }

/* ── Messages ── */
.msg { padding: 10px 16px; border-radius: 8px; font-size: 12px; margin-bottom: 16px; }
.msg.success { background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.2); color: #34D399; }
.msg.error { background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2); color: #F87171; }
.msg.info { background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2); color: #60A5FA; }

/* ── Page headers ── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Cards ── */
.card { background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; margin-bottom: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.stat-num { font-size: 24px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }

/* ── Tables ── */
.data-table { overflow-x: auto; }
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); font-weight: 600; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; }
.data-table tr:hover { background: rgba(255,255,255,.015); }

/* ── Status badges ── */
.badge { font-size: 9px; padding: 3px 8px; border-radius: 5px; font-weight: 600; }
.badge-draft { background: rgba(107,114,128,.1); color: #6B7280; }
.badge-review { background: rgba(245,158,11,.1); color: #F59E0B; }
.badge-approved { background: rgba(16,185,129,.1); color: #10B981; }
.badge-filed { background: rgba(59,130,246,.1); color: #3B82F6; }
.badge-cancelled { background: rgba(239,68,68,.1); color: #EF4444; }

/* ── Wizard sections ── */
.wizard-section { background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 16px; }
.wizard-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.wizard-header:hover { background: rgba(255,255,255,.01); }
.wizard-num { width: 28px; height: 28px; border-radius: 50%; background: rgba(59,130,246,.1); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.wizard-title { font-size: 14px; font-weight: 600; }
.wizard-sub { font-size: 10px; color: var(--muted); }
.wizard-body { padding: 16px 20px; display: none; }
.wizard-body.open { display: block; }
.wizard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }
.wizard-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.wizard-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }

/* ── Repeating row tables (markets/instruments) ── */
.rank-table { width: 100%; border-collapse: collapse; }
.rank-table th { font-size: 9px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding: 6px 8px; text-align: left; }
.rank-table td { padding: 4px 8px; }
.rank-table select, .rank-table input { padding: 6px 8px; font-size: 11px; }
.rank-num { font-size: 16px; font-weight: 700; color: var(--accent); font-family: 'JetBrains Mono', monospace; text-align: center; }

/* ── XML Preview ── */
.xml-preview { background: #0D1117; border: 1px solid rgba(255,255,255,.06); border-radius: 8px; padding: 14px; margin-top: 12px; max-height: 400px; overflow: auto; }
.xml-preview pre { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 11px; color: #8B949E; white-space: pre-wrap; word-break: break-all; }
.xml-preview .tag { color: #7EE787; }
.xml-preview .attr { color: #D2A8FF; }
.xml-preview .val { color: #A5D6FF; }

/* ── Modal ── */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 500px; width: 95%; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { margin-left: 0; padding: 16px; }
}

/* ============================================================
   LIGHT THEME — .light-theme class on body
   ============================================================ */
.light-theme { --bg: #F8FAFC; --bg2: #FFFFFF; --bg3: #F1F5F9; --border: rgba(0,0,0,.08); --text: #1E293B; --muted: #64748B; }

/* Layout */
.light-theme .sidebar { background: #FFFFFF; border-right-color: rgba(0,0,0,.08); }
.light-theme .sidebar-brand { border-bottom-color: rgba(0,0,0,.06); }
.light-theme .brand-name { color: #1E293B; }
.light-theme .brand-sub { color: #64748B; }
.light-theme .nav-section { color: #94A3B8; }
.light-theme .nav-link { color: #64748B; }
.light-theme .nav-link:hover { background: rgba(0,0,0,.03); color: #1E293B; }
.light-theme .nav-link.active { background: rgba(59,130,246,.06); color: var(--accent); }
.light-theme .content { background: #F8FAFC; color: #1E293B; }

/* Cards & surfaces */
.light-theme .card, .light-theme .stat-card { background: #FFFFFF; border-color: rgba(0,0,0,.06); }
.light-theme .wizard-section { background: #FFFFFF; border-color: rgba(0,0,0,.06); }
.light-theme .wizard-header:hover { background: rgba(0,0,0,.02); }
.light-theme .wizard-body { border-top-color: rgba(0,0,0,.04); }

/* Forms */
.light-theme input, .light-theme select, .light-theme textarea { background: #F8FAFC; border-color: rgba(0,0,0,.12); color: #1E293B; }
.light-theme input:focus, .light-theme select:focus, .light-theme textarea:focus { border-color: rgba(59,130,246,.5); }
.light-theme select option { background: #FFFFFF; color: #1E293B; }
.light-theme label { color: #475569; }

/* Tables */
.light-theme .data-table th { color: #64748B; border-bottom-color: rgba(0,0,0,.08); }
.light-theme .data-table td { border-bottom-color: rgba(0,0,0,.04); color: #334155; }
.light-theme .data-table tr:hover { background: rgba(59,130,246,.03); }
.light-theme .rank-table th { color: #64748B; }

/* Buttons */
.light-theme .btn-outline { border-color: rgba(0,0,0,.12); color: #475569; }
.light-theme .btn-outline:hover { background: rgba(0,0,0,.04); color: #1E293B; }

/* Messages */
.light-theme .msg.success { background: rgba(16,185,129,.06); border-color: rgba(16,185,129,.15); }
.light-theme .msg.error { background: rgba(239,68,68,.06); border-color: rgba(239,68,68,.15); }
.light-theme .msg.info { background: rgba(59,130,246,.06); border-color: rgba(59,130,246,.15); }

/* Badges */
.light-theme .badge-draft { background: rgba(100,116,139,.08); }
.light-theme .badge-review { background: rgba(245,158,11,.08); }
.light-theme .badge-approved { background: rgba(16,185,129,.08); }
.light-theme .badge-filed { background: rgba(59,130,246,.08); }

/* Page header */
.light-theme .page-title { color: #0F172A; }
.light-theme .page-sub { color: #64748B; }
.light-theme .stat-label { color: #64748B; }

/* XML preview */
.light-theme .xml-preview { background: #F1F5F9; border-color: rgba(0,0,0,.06); }
.light-theme .xml-preview pre { color: #334155; }

/* Modals */
.light-theme .modal { background: #FFFFFF; border-color: rgba(0,0,0,.08); }
.light-theme .modal h3 { color: #0F172A; }
.light-theme .modal-actions { border-top-color: rgba(0,0,0,.06); }

/* Auth pages */
.light-theme.auth-body { background: #F1F5F9; }
.light-theme .auth-box { background: #FFFFFF; border-color: rgba(0,0,0,.08); box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.light-theme .auth-box h1 { color: #0F172A; }
.light-theme .auth-box h2 { color: #64748B; }

/* Wizard specifics */
.light-theme .wizard-num { background: rgba(59,130,246,.08); }
.light-theme .wizard-title { color: #0F172A; }
.light-theme .wizard-sub { color: #64748B; }
.light-theme .rank-num { color: var(--accent); }

/* Theme toggle */
.theme-toggle { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; transition: all .15s; }
.theme-toggle:hover { background: rgba(255,255,255,.08); }
.light-theme .theme-toggle { border-color: rgba(0,0,0,.1); background: rgba(0,0,0,.03); }
.light-theme .theme-toggle:hover { background: rgba(0,0,0,.06); }

/* Scrollbar */
.light-theme ::-webkit-scrollbar { width: 6px; }
.light-theme ::-webkit-scrollbar-track { background: rgba(0,0,0,.02); }
.light-theme ::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 3px; }
.light-theme ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.2); }

/* ============================================================
   ANNEX IV ANALYTICS MODULE
   ============================================================ */

/* Lucide icon defaults */
.lucide { display: inline-block; vertical-align: -0.125em; flex-shrink: 0; }
.nav-link .lucide { margin-right: 6px; }
.btn .lucide { margin-right: 2px; }

/* Dropzone */
.dropzone { border: 2px dashed rgba(255,255,255,.1); border-radius: 8px; background: rgba(255,255,255,.02); padding: 32px 20px; text-align: center; transition: all .15s; }
.dropzone.over { border-color: var(--accent); background: rgba(59,130,246,.06); }
.light-theme .dropzone { border-color: rgba(0,0,0,.1); background: rgba(0,0,0,.02); }
.light-theme .dropzone.over { border-color: var(--accent); background: rgba(59,130,246,.04); }

/* Upload log */
.upload-log { margin-top: 14px; }
.upload-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 5px; font-size: 12px; }
.upload-row.ok { background: rgba(16,185,129,.06); border-color: rgba(16,185,129,.2); }
.upload-row.err { background: rgba(239,68,68,.06); border-color: rgba(239,68,68,.2); }
.upload-row.pending { background: rgba(245,158,11,.06); border-color: rgba(245,158,11,.2); }
.upload-row .row-msg { color: var(--muted); font-size: 11px; }

/* Library entity head */
.entity-head { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Selector — row-based selection extending data-table */
.report-row { transition: background .12s; }
.report-row:hover { background: rgba(255,255,255,.025); }
.report-row.selected { background: rgba(59,130,246,.08); }
.report-row.selected td { color: var(--text); }
.light-theme .report-row:hover { background: rgba(0,0,0,.02); }
.light-theme .report-row.selected { background: rgba(59,130,246,.06); }

/* Checkbox - reset the global input style for checkboxes inside selector */
.report-cb { width: 16px !important; height: 16px; padding: 0 !important; margin: 0 !important; accent-color: var(--accent); }

/* Chart blocks */
.category-block { margin-top: 22px; }
.category-head { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 12px; }
.chart-card { background: rgba(255,255,255,.02); border: 1px solid var(--border); border-radius: 10px; padding: 14px; min-width: 0; }
.light-theme .chart-card { background: #FFFFFF; }
.chart-title { display: flex; align-items: center; justify-content: space-between; font-weight: 600; margin-bottom: 8px; font-size: 12px; gap: 8px; }
.chart-canvas-wrap { position: relative; width: 100%; height: 200px; }
.chart-canvas-wrap canvas { position: absolute !important; top: 0; left: 0; width: 100% !important; height: 100% !important; }

/* Change deltas */
/* Big headline delta tiles inside chart cards */
.delta-headline { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.delta-tile { background: rgba(255,255,255,.025); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.delta-tile-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; font-weight: 600; }
.delta-tile-value { font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', 'Menlo', monospace; line-height: 1.1; }
.light-theme .delta-tile { background: #FAFAFA; }

/* Compact transitions table (only shown for 3+ period comparisons) */
.change-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12px; }
.change-table th, .change-table td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--border); }
.change-table th:first-child, .change-table td:first-child { text-align: left; }
.change-table th { background: transparent; font-weight: 600; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .4px; }
.change-table td { font-family: 'JetBrains Mono', 'Menlo', monospace; }
.change-table td:first-child { font-family: inherit; color: var(--muted); }

.delta-pos { color: var(--green); font-weight: 700; }
.delta-neg { color: var(--red); font-weight: 700; }
.delta-flat { color: var(--muted); font-weight: 500; }
