/* ============================================================
   ValoriaVault — Client Portal & Admin Panel styles
   ============================================================ */

.app-body { background: var(--bg); color: var(--text); }

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

/* ---------- Sidebar ---------- */
.app-sidebar {
    width: 260px; flex: 0 0 auto;
    background: #0e141b;
    border-right: 1px solid var(--border);
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    padding: 22px 16px;
    z-index: 120;
}
.app-sidebar .brand { padding: 0 6px 18px; }
.vault-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 18px;
    font-size: 0.76rem; color: var(--muted);
    text-transform: uppercase; letter-spacing: 1.5px;
}
.vault-chip b {
    display: block;
    color: var(--gold-light);
    font-size: 1.08rem;
    letter-spacing: 2px;
    font-family: var(--font-head);
    font-weight: 700;
    text-transform: none;
    margin-top: 2px;
}
.app-sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.app-sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 600; font-size: 0.94rem;
    transition: var(--transition);
}
.app-sidebar nav a svg { width: 18px; height: 18px; color: var(--gold); opacity: 0.85; flex: 0 0 auto; }
.app-sidebar nav a:hover { background: var(--surface); color: var(--text); }
.app-sidebar nav a.active { background: rgba(201, 162, 75, 0.12); color: var(--gold-light); }
.sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 4px;
}
.sidebar-foot a { padding: 10px 14px; color: var(--muted); font-size: 0.9rem; border-radius: 8px; }
.sidebar-foot a:hover { color: var(--gold-light); background: var(--surface); }

/* ---------- Main column ---------- */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
    position: sticky; top: 0; z-index: 60;
    background: rgba(11, 15, 20, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 15px 30px;
}
.app-topbar h1 { font-size: 1.25rem; margin: 0; }
.topbar-user { margin-left: auto; text-align: right; }
.topbar-name { display: block; font-weight: 700; font-size: 0.9rem; }
.topbar-vault { font-size: 0.78rem; color: var(--gold); letter-spacing: 1px; }
.sidebar-toggle {
    display: none;
    width: 40px; height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 1.1rem;
    align-items: center; justify-content: center;
}
.app-content { padding: 30px; max-width: 1180px; width: 100%; margin: 0 auto; flex: 1; }
.app-footer {
    padding: 18px 30px;
    border-top: 1px solid var(--border);
    color: var(--muted-2); font-size: 0.82rem;
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* ---------- Stat cards ---------- */
.app-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 26px; }
.stat-card {
    background: linear-gradient(165deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
}
.stat-card .stat-num { font-family: var(--font-head); font-size: 1.9rem; color: var(--gold-light); line-height: 1.1; }
.stat-card .stat-lbl { color: var(--muted); font-size: 0.84rem; margin-top: 5px; }

/* ---------- Panels ---------- */
.panel-card {
    background: linear-gradient(165deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 26px;
    margin-bottom: 22px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.2rem; margin: 0; }
.panel-card h2 { font-size: 1.2rem; margin: 0 0 16px; }
.panel-card h3 { font-size: 1.05rem; margin-bottom: 8px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tbl th {
    text-align: left; padding: 12px 14px;
    color: var(--muted);
    font-size: 0.73rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 1.2px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
.tbl tr:hover td { background: rgba(255, 255, 255, 0.02); }
.tbl .tbl-title { font-weight: 700; color: var(--text); }
.tbl .tbl-sub { font-size: 0.8rem; color: var(--muted-2); }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 40px;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.4px;
    text-transform: capitalize;
    white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-success { background: rgba(62, 207, 142, 0.12); color: #3ecf8e; }
.b-info    { background: rgba(76, 163, 255, 0.12); color: #4ca3ff; }
.b-warn    { background: rgba(230, 198, 111, 0.14); color: #e6c66f; }
.b-danger  { background: rgba(244, 93, 93, 0.14); color: #f45d5d; }
.b-gold    { background: rgba(201, 162, 75, 0.14); color: #c9a24b; }
.b-muted   { background: rgba(152, 165, 178, 0.12); color: #98a5b2; }

/* ---------- Buttons ---------- */
.btn-sm { padding: 9px 17px; font-size: 0.82rem; }
.btn-danger { background: rgba(244, 93, 93, 0.12); color: #f45d5d; border: 1px solid rgba(244, 93, 93, 0.35); }
.btn-danger:hover { background: #f45d5d; color: #0b0f14; transform: none; }
.link-btn { color: var(--gold); font-weight: 700; font-size: 0.85rem; }
.link-btn:hover { color: var(--gold-light); }

/* ---------- Thumbnails / documents ---------- */
.thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); background: var(--surface); }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.doc-card { background: #0f151c; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.doc-card .doc-media { height: 150px; background: var(--surface); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.doc-card .doc-media img, .doc-card .doc-media video { width: 100%; height: 100%; object-fit: cover; }
.doc-card .doc-icon { font-size: 2.6rem; color: var(--gold); line-height: 1; }
.doc-card .doc-meta { padding: 12px 14px; }
.doc-card .doc-name { font-size: 0.85rem; font-weight: 700; word-break: break-word; }
.doc-card .doc-sub { font-size: 0.74rem; color: var(--muted-2); margin: 3px 0 10px; }
.doc-card .doc-actions { display: flex; gap: 14px; font-size: 0.8rem; }

/* ---------- Valuables grid ---------- */
.val-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.val-card {
    background: linear-gradient(165deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: var(--transition);
}
.val-card:hover { border-color: var(--border-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.val-card .val-media { height: 170px; background: var(--surface); position: relative; }
.val-card .val-media img { width: 100%; height: 100%; object-fit: cover; }
.val-card .val-media .val-media-ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--gold); opacity: 0.5; }
.val-card .val-media .val-media-ph svg { width: 64px; height: 64px; }
.val-card .val-badge { position: absolute; top: 10px; left: 10px; }
.val-card .val-body { padding: 16px 18px; }
.val-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.val-card .val-meta { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }
.val-card .val-value { color: var(--gold-light); font-weight: 800; font-family: var(--font-head); font-size: 1.05rem; margin-top: 10px; }

/* ---------- Timeline (tracking) ---------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--border-2); }
.t-event { position: relative; padding-bottom: 22px; }
.t-event::before {
    content: "";
    position: absolute; left: -28px; top: 4px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--bg); border: 3px solid var(--gold);
}
.t-event.current::before { background: var(--gold); box-shadow: 0 0 0 5px rgba(201, 162, 75, 0.2); }
.t-event .t-status { font-weight: 800; color: var(--text); text-transform: capitalize; }
.t-event .t-loc { color: var(--gold); font-size: 0.85rem; }
.t-event .t-note { color: var(--muted); font-size: 0.88rem; }
.t-event .t-time { color: var(--muted-2); font-size: 0.78rem; }

/* ---------- Forms ---------- */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid-2 .field.full { grid-column: 1 / -1; }
.form-actions { margin-top: 10px; }
.readonly {
    padding: 13px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    word-break: break-word;
}
.hint { display: block; color: var(--muted-2); font-size: 0.78rem; margin-top: 6px; }
.search-row { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-row input[type="text"] { flex: 1; min-width: 220px; }
.search-row select {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text);
    padding: 13px 16px; font-size: 0.92rem;
}
.search-row select:focus { border-color: var(--gold); outline: none; }

/* ---------- Two-column panel layout ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }

/* ---------- Activity list ---------- */
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.activity-list li:last-child { border-bottom: none; }
.activity-list .act-title { font-weight: 700; font-size: 0.9rem; text-transform: capitalize; }
.activity-list .act-detail { color: var(--muted); font-size: 0.83rem; }
.activity-list .act-time { color: var(--muted-2); font-size: 0.76rem; margin-top: 3px; }

/* ---------- Selectable valuable cards ---------- */
.val-card:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201, 162, 75, 0.35); }
.val-card:has(input:checked) .val-media::after {
    content: "✓";
    position: absolute; top: 10px; right: 10px;
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--gold); color: #0b0f14;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.9rem;
}

/* ---------- Auth pages ---------- */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
    background:
        radial-gradient(900px 500px at 80% 0%, rgba(201, 162, 75, 0.12), transparent 55%),
        radial-gradient(700px 500px at 10% 100%, rgba(38, 64, 94, 0.30), transparent 55%),
        var(--bg);
}
.auth-card {
    width: 100%; max-width: 460px;
    background: linear-gradient(165deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 40px;
    box-shadow: var(--shadow);
}
.auth-card .brand { margin-bottom: 10px; }
.auth-card h1 { font-size: 1.7rem; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 26px; }
.auth-links { margin-top: 20px; text-align: center; font-size: 0.88rem; color: var(--muted); }
.auth-links a { color: var(--gold); font-weight: 700; }
.auth-links a:hover { color: var(--gold-light); }
.auth-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 22px; color: var(--muted); font-size: 0.85rem; }
.auth-back:hover { color: var(--gold-light); }
.vaultid-box {
    background: #0b0f14;
    border: 1px dashed var(--gold);
    border-radius: 12px;
    padding: 18px;
    margin: 18px 0;
}
.vaultid-box .lbl { font-size: 0.72rem; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }
.vaultid-box .val { font-family: var(--font-head); font-size: 1.7rem; color: var(--gold-light); letter-spacing: 3px; font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .app-sidebar {
        position: fixed; left: 0; top: 0;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
    }
    .app-sidebar.open { transform: none; box-shadow: var(--shadow); }
    .sidebar-toggle { display: inline-flex; }
    .app-topbar { padding: 13px 18px; }
    .app-content { padding: 22px 18px; }
    .app-stats { grid-template-columns: repeat(2, 1fr); }
    .form-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .app-stats { grid-template-columns: 1fr; }
    .topbar-name { display: none; }
    .panel-card { padding: 20px; }
}
