/* ═══════════════════════════════════════════════════════
   Aphias Capital — Investor Relations Portal
   Design: Refined institutional finance, dark navy +
   warm brass accents, Cormorant Garamond display
   ═══════════════════════════════════════════════════════ */

:root {
    --navy-950: #0a0f1a;
    --navy-900: #0f172a;
    --navy-800: #1e293b;
    --navy-700: #334155;
    --navy-600: #475569;
    --navy-500: #64748b;
    --navy-400: #94a3b8;
    --navy-300: #cbd5e1;
    --navy-200: #e2e8f0;
    --navy-100: #f1f5f9;
    --navy-50: #f8fafc;

    --brass-500: #c9a84c;
    --brass-400: #d4b85a;
    --brass-300: #dfc872;
    --brass-200: #e8d89a;

    --emerald-500: #10b981;
    --emerald-400: #34d399;
    --rose-500: #f43f5e;
    --rose-400: #fb7185;
    --amber-500: #f59e0b;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
}

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

html { font-size: 15px; }

body {
    font-family: var(--font-body);
    color: var(--navy-800);
    background: var(--navy-50);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Links ── */
a { color: var(--navy-800); text-decoration: none; }
a:hover { color: var(--brass-500); }

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */

.login-page {
    min-height: 100vh;
    display: flex;
    background: linear-gradient(135deg, var(--navy-950) 0%, #141c30 50%, var(--navy-900) 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(ellipse at 30% 40%, rgba(201,168,76,0.04) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 60%, rgba(201,168,76,0.03) 0%, transparent 50%);
    animation: loginGlow 20s ease-in-out infinite alternate;
}

@keyframes loginGlow {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-2%, 2%); }
}

.login-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 80px;
    position: relative;
    z-index: 1;
}

.login-brand {
    margin-bottom: 60px;
}

.login-brand img {
    height: 36px;
    opacity: 0.9;
}

.login-tagline {
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 300;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.5px;
    max-width: 420px;
}

.login-tagline em {
    font-style: italic;
    color: var(--brass-400);
}

.login-right {
    width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255,255,255,0.97);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}

.login-card h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--navy-900);
    margin-bottom: 6px;
}

.login-card .login-sub {
    font-size: 0.87rem;
    color: var(--navy-500);
    margin-bottom: 32px;
}

/* ── Form Elements ── */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--navy-600);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--navy-200);
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-family: var(--font-body);
    color: var(--navy-800);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--brass-500);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

.form-group input::placeholder { color: var(--navy-400); }

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

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--navy-900);
    color: #fff;
    width: 100%;
}
.btn-primary:hover { background: var(--navy-800); color: #fff; }

.btn-brass {
    background: var(--brass-500);
    color: var(--navy-950);
}
.btn-brass:hover { background: var(--brass-400); color: var(--navy-950); }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--navy-200);
    color: var(--navy-700);
}
.btn-outline:hover { border-color: var(--navy-400); background: var(--navy-50); }

.btn-danger {
    background: var(--rose-500);
    color: #fff;
}
.btn-danger:hover { background: var(--rose-400); }

.btn-sm {
    padding: 7px 14px;
    font-size: 0.8rem;
}

/* ── Flash Messages ── */

.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    margin-bottom: 16px;
    border-left: 3px solid;
}
.flash-error { background: #fef2f2; color: #991b1b; border-color: var(--rose-500); }
.flash-success { background: #f0fdf4; color: #166534; border-color: var(--emerald-500); }
.flash-warning { background: #fffbeb; color: #92400e; border-color: var(--amber-500); }
.flash-info { background: #f0f9ff; color: #075985; border-color: #0ea5e9; }


/* ══════════════════════════════════════════════════════════
   APP LAYOUT (post-login)
   ══════════════════════════════════════════════════════════ */

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: var(--navy-950);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    border-bottom: 1px solid rgba(201,168,76,0.15);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-logo { height: 24px; opacity: 0.9; }
.topbar-divider {
    width: 1px; height: 20px; background: rgba(255,255,255,0.15);
}
.topbar-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.5px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}
.topbar-user strong {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.topbar-logout {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.15s;
}
.topbar-logout:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.05);
}

/* ── Sidebar ── */

.app-body {
    display: flex;
    padding-top: 56px;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: var(--navy-900);
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 20px 0;
    position: fixed;
    top: 56px;
    bottom: 0;
    overflow-y: auto;
}

.nav-section {
    padding: 0 16px;
    margin-bottom: 8px;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.3);
    padding: 8px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin: 1px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.55);
    transition: all 0.12s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
}

.nav-item.active {
    background: rgba(201,168,76,0.12);
    color: var(--brass-400);
}

.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

/* ── Main Content ── */

.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 32px 40px;
    max-width: calc(100% - 220px);
}

.page-header {
    margin-bottom: 32px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--navy-900);
    letter-spacing: -0.3px;
}

.page-header .subtitle {
    font-size: 0.87rem;
    color: var(--navy-500);
    margin-top: 2px;
}

/* ── Cards ── */

.card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

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

.card-header h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--navy-900);
}

.card-body { padding: 24px; }

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--navy-100);
    background: var(--navy-50);
}

/* ── Stats Grid ── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 20px 24px;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--brass-500);
}

.stat-label {
    font-size: 0.73rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--navy-500);
    margin-bottom: 6px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--navy-900);
}

.stat-meta {
    font-size: 0.75rem;
    color: var(--navy-400);
    margin-top: 4px;
}

/* ── Tables ── */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    font-size: 0.73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--navy-500);
    padding: 10px 16px;
    border-bottom: 2px solid var(--navy-200);
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    font-size: 0.87rem;
    border-bottom: 1px solid var(--navy-100);
    color: var(--navy-700);
}

tbody tr:hover { background: var(--navy-50); }

tbody tr:last-child td { border-bottom: none; }

.table-actions {
    display: flex;
    gap: 6px;
}

/* ── Badges ── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 0.73rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-active { background: #ecfdf5; color: #065f46; }
.badge-inactive { background: #fef2f2; color: #991b1b; }
.badge-admin { background: rgba(201,168,76,0.12); color: #92710c; }
.badge-lp { background: #eff6ff; color: #1e40af; }
.badge-mfa { background: #ecfdf5; color: #065f46; }
.badge-no-mfa { background: #fef2f2; color: #991b1b; }

/* ── Document Cards ── */

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.doc-card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 20px;
    transition: box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}

.doc-card:hover { box-shadow: var(--shadow-md); }

.doc-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: var(--navy-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.doc-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--navy-900);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-desc {
    font-size: 0.8rem;
    color: var(--navy-500);
    margin-bottom: 12px;
    flex: 1;
}

.doc-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.73rem;
    color: var(--navy-400);
}

.doc-download {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--brass-500);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--brass-500);
    transition: all 0.12s;
}

.doc-download:hover {
    background: var(--brass-500);
    color: #fff;
}


/* ══════════════════════════════════════════════════════════
   MFA PAGES
   ══════════════════════════════════════════════════════════ */

.mfa-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--navy-950) 0%, #141c30 100%);
    padding: 40px;
}

.mfa-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 48px 44px;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.mfa-card h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--navy-900);
    margin-bottom: 8px;
}

.mfa-card .mfa-sub {
    font-size: 0.87rem;
    color: var(--navy-500);
    margin-bottom: 28px;
    line-height: 1.5;
}

.qr-wrap {
    display: inline-block;
    background: #fff;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--navy-100);
    margin-bottom: 24px;
}

.qr-wrap img { display: block; width: 200px; height: 200px; }

.secret-key {
    font-family: var(--font-mono);
    font-size: 0.87rem;
    color: var(--navy-700);
    background: var(--navy-50);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    letter-spacing: 2px;
    word-break: break-all;
}

.code-input {
    text-align: center;
    font-size: 1.6rem;
    font-family: var(--font-mono);
    letter-spacing: 8px;
    padding: 14px 20px;
    font-weight: 600;
}

.backup-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 20px 0;
}

.backup-code {
    font-family: var(--font-mono);
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--navy-800);
    background: var(--navy-50);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    letter-spacing: 1px;
}


/* ══════════════════════════════════════════════════════════
   COMMITMENT DETAIL
   ══════════════════════════════════════════════════════════ */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.detail-item {
    padding: 12px 0;
}

.detail-label {
    font-size: 0.73rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--navy-500);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 0.93rem;
    font-weight: 500;
    color: var(--navy-900);
}


/* ══════════════════════════════════════════════════════════
   SEARCH
   ══════════════════════════════════════════════════════════ */

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.search-bar input {
    flex: 1;
    padding: 11px 16px;
    border: 1.5px solid var(--navy-200);
    border-radius: var(--radius-sm);
    font-size: 0.93rem;
    font-family: var(--font-body);
}
.search-bar input:focus {
    outline: none;
    border-color: var(--brass-500);
    box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}


/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .login-left { display: none; }
    .login-right { width: 100%; }
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 24px 20px; max-width: 100%; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .login-card { padding: 32px 24px; }
    .stats-grid { grid-template-columns: 1fr; }
    .doc-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .main-content { padding: 20px 16px; }
}


/* ══════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--navy-500); }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.73rem; }
.font-mono { font-family: var(--font-mono); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--navy-400);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--navy-600);
    margin-bottom: 4px;
}
.empty-state p { font-size: 0.87rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--navy-400); }

/* Print-friendly */
@media print {
    .topbar, .sidebar, .btn, .topbar-logout { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
}
