/* STRVue — Institutional Finance Grade Theme */
:root {
    --primary: #0B1D32;
    --primary-light: #1F4E79;
    --primary-dark: #050D18;
    --accent: #B8860B;
    --success: #2E7D32;
    --warning: #F57C00;
    --danger: #C62828;
    --bg: #F5F7FA;
    --surface: #FFFFFF;
    --text: #0B1D32;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --radius: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: var(--primary);
    color: white;
    padding: 1.5rem 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    margin-bottom: 1rem;
}

.sidebar-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.sidebar-brand span {
    font-size: 0.75rem;
    opacity: 0.7;
    display: block;
    margin-top: 0.25rem;
}

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

.sidebar-nav a {
    display: block;
    padding: 0.65rem 1.5rem;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.sidebar-nav a:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar-nav a.active { background: rgba(255,255,255,0.15); color: white; font-weight: 600; }

.sidebar-nav .nav-section {
    padding: 1rem 1.5rem 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.5;
}

.main-content {
    margin-left: 240px;
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 1400px;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.card-header h2 {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
}

/* ── KPI Grid ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    text-align: center;
}

.kpi-card .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.kpi-card .value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}

.kpi-card .value.positive { color: var(--success); }
.kpi-card .value.negative { color: var(--danger); }
.kpi-card .value.warning { color: var(--warning); }

.kpi-card .sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ── Tables ── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background: var(--primary);
    color: white;
    padding: 0.65rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table tr:hover { background: #F8FAFC; }

.data-table .text-right { text-align: right; }
.data-table .text-center { text-align: center; }

/* ── Forms ── */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.3rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46,117,182,0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0 1.5rem;
}

.form-section {
    margin: 1.5rem 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--primary);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
}

/* ── Buttons ── */
.btn {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #D1D5DB; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1B5E20; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* ── Page Header ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.breadcrumb {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.breadcrumb a { color: var(--primary-light); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ── Health Score ── */
.health-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.health-badge.excellent { background: #E8F5E9; color: var(--success); }
.health-badge.good { background: #E3F2FD; color: var(--primary-light); }
.health-badge.fair { background: #FFF3E0; color: var(--warning); }
.health-badge.poor { background: #FFEBEE; color: var(--danger); }

/* ── Status indicators ── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.active { background: var(--success); }
.status-dot.inactive { background: var(--text-muted); }

/* ── Chart container ── */
.chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
}

/* ── Login ── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-light));
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.login-card h1 {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.login-card .error {
    background: #FFEBEE;
    color: var(--danger);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 1rem; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
}

/* ── KPI Strip (Hero Section) ── */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.kpi-card-large {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.kpi-card-large:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.kpi-card-large .kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.kpi-card-large .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.kpi-card-large .kpi-trend {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Hero KPI Strip (4 columns for dashboard) */
.kpi-strip-hero {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card-hero {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.kpi-card-hero:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.kpi-card-hero .kpi-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.kpi-card-hero .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.kpi-card-hero .kpi-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Mini KPI Cards (3 per row) */
.kpi-strip-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card-mini {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.kpi-card-mini .kpi-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.kpi-card-mini .kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

/* ── Report Cards ── */
.report-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}

.report-card.expanded .report-header {
    border-bottom: 1px solid var(--border);
}

.report-header {
    background: var(--primary);
    color: white;
    padding: 0.875rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.report-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.report-header.gold-accent {
    border-left: 4px solid var(--accent);
}

.btn-collapse {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.35rem 0.65rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.15s;
}

.btn-collapse:hover {
    background: rgba(255,255,255,0.3);
}

.report-content {
    padding: 1.25rem;
}

.kpi-highlight {
    background: linear-gradient(135deg, #F5F7FA 0%, #FFFFFF 100%);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.kpi-highlight .kpi-value {
    font-size: 2.4rem;
    font-weight: 700;
    margin: 0;
}

.kpi-highlight .kpi-value.gold {
    color: var(--accent);
}

.kpi-highlight .kpi-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* ── Professional Data Table ── */
.data-table-pro {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table-pro thead {
    background: var(--primary);
    color: white;
}

.data-table-pro th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table-pro td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.data-table-pro tbody tr {
    transition: background-color 0.15s;
}

.data-table-pro tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.01);
}

.data-table-pro tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

.data-table-pro .text-right { text-align: right; }
.data-table-pro .text-center { text-align: center; }

.data-table-pro .table-total {
    background: #F5F7FA;
    font-weight: 600;
    border-top: 2px solid var(--primary);
    border-bottom: 2px solid var(--primary);
}

.data-table-pro .table-highlight {
    background: rgba(184, 134, 11, 0.05);
    font-weight: 600;
}

.data-table-pro .table-divider {
    border-top: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
}

/* ── Financial Grid (2-column) ── */
.financial-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .financial-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Property Cards ── */
.property-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.property-card {
    background: #FAFBFC;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.property-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.property-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.property-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 0.25rem;
}

.property-address {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.property-health {
    flex-shrink: 0;
}

.property-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.property-metric {
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    background: white;
    border-radius: 6px;
    border: 1px solid #E5E7EB;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.metric-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.property-actions {
    display: flex;
    gap: 0.5rem;
}

.property-actions .btn {
    flex: 1;
    text-align: center;
}

/* ── Year Selector ── */
.year-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.year-selector label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary);
}

.year-selector select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.year-selector select:hover {
    border-color: var(--primary);
}

.year-selector select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 29, 50, 0.1);
}

/* ── Status Badges ── */
.status-badge {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-active {
    background: #E8F5E9;
    color: var(--success);
}

.status-pending {
    background: #FFF3E0;
    color: var(--warning);
}

.status-suspended {
    background: #FFEBEE;
    color: var(--danger);
}

.status-inactive {
    background: #F5F5F5;
    color: var(--text-muted);
}

/* ── Color-Coded Metrics ── */
.metric-positive {
    color: var(--success) !important;
}

.metric-negative {
    color: var(--danger) !important;
}

/* ── Gold Accent ── */
.gold-accent {
    border-left: 4px solid var(--accent) !important;
}

/* ── Tax Disclaimer ── */
.tax-disclaimer {
    background: #F5F7FA;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text);
    margin-top: 2rem;
    line-height: 1.6;
}

/* ── Action Group ── */
.action-group {
    display: flex;
    gap: 0.5rem;
}

/* ── Client Name ── */
.client-name {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.client-type {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Table Container ── */
.table-container {
    overflow-x: auto;
}

/* ── Button Variations ── */
.btn-xs {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

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

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

/* ── Utility ── */
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
