@font-face {
    font-family: "Tajawal";
    src: url("/assets/fonts/tajawal-regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Tajawal";
    src: url("/assets/fonts/tajawal-bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Tajawal";
    src: url("/assets/fonts/tajawal-extra-bold.ttf") format("truetype");
    font-weight: 800;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --ink: #07131f;
    --navy: #0c1e2d;
    --card: rgba(18, 39, 55, 0.82);
    --emerald: #22c7a5;
    --emerald-dark: #0b8e79;
    --gold: #d8b76c;
    --ivory: #f6f3ea;
    --mist: #a9b7c3;
    --danger: #ff7d74;
    --line: rgba(255,255,255,.09);
    --shadow: 0 28px 80px rgba(0,0,0,.34);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--ink); }

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 85% 12%, rgba(34,199,165,.08), transparent 31rem),
        radial-gradient(circle at 5% 82%, rgba(216,183,108,.055), transparent 26rem),
        var(--ink);
    color: var(--ivory);
    font-family: "Tajawal", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.ambient {
    position: fixed;
    z-index: 0;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: .13;
    pointer-events: none;
}
.ambient-one { top: -140px; right: -100px; background: var(--emerald); }
.ambient-two { bottom: -170px; left: -100px; background: var(--gold); }

.page-shell {
    position: relative;
    z-index: 1;
    width: min(1160px, calc(100% - 36px));
    margin: 0 auto;
    padding: 32px 0 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    color: var(--ink);
    background: linear-gradient(145deg, var(--emerald), var(--emerald-dark));
    font-size: 24px;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(34,199,165,.18);
}
.brand p { margin: 0; }
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: 1.5px; }
.brand-subtitle { margin-top: 3px !important; color: var(--mist); font-size: 13px; }
.secure-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    padding: 8px 12px;
    border: 1px solid rgba(34,199,165,.25);
    border-radius: 999px;
    background: rgba(34,199,165,.08);
    color: var(--emerald);
    font-size: 12px;
    font-weight: 700;
}
.secure-badge i, .status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 0 5px rgba(34,199,165,.1);
}

.auth-layout {
    display: grid;
    grid-template-columns: 1.06fr .94fr;
    gap: clamp(36px, 7vw, 94px);
    align-items: center;
    min-height: calc(100vh - 190px);
    padding: 62px 2vw;
}
.intro h1, .dashboard-head h1 {
    margin: 15px 0 18px;
    font-size: clamp(42px, 6vw, 72px);
    line-height: 1.05;
    letter-spacing: -2px;
}
.intro h1 em { color: var(--emerald); font-style: normal; }
.intro > p {
    max-width: 620px;
    color: var(--mist);
    font-size: 18px;
    line-height: 1.9;
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gold);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .7px;
}
.eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gold);
}
.trust-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.trust-points span {
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255,255,255,.025);
    color: var(--mist);
    font-size: 12px;
}

.auth-card, .panel {
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--card);
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}
.auth-card { padding: clamp(27px, 4vw, 42px); }
.auth-card h2, .panel h2 { margin: 9px 0 5px; font-size: 27px; }
.step {
    color: var(--emerald);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 2px;
}
.muted { color: var(--mist); line-height: 1.65; }
form { display: grid; gap: 11px; margin-top: 24px; }
label { color: var(--mist); font-size: 13px; font-weight: 700; }
input, select {
    width: 100%;
    min-height: 54px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 15px;
    outline: none;
    background: rgba(255,255,255,.035);
    color: var(--ivory);
    padding: 0 15px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, select:focus {
    border-color: var(--emerald);
    background: rgba(34,199,165,.035);
    box-shadow: 0 0 0 4px rgba(34,199,165,.08);
}
.otp-input {
    direction: ltr;
    text-align: center;
    font-size: 25px;
    font-weight: 800;
    letter-spacing: 12px;
}
.primary, .ghost {
    min-height: 54px;
    border: 0;
    border-radius: 15px;
    padding: 0 20px;
    font-weight: 800;
    transition: transform .2s, opacity .2s, background .2s;
}
.primary {
    margin-top: 7px;
    background: linear-gradient(135deg, var(--emerald), #18ae91);
    color: var(--ink);
    box-shadow: 0 14px 30px rgba(34,199,165,.16);
}
.primary:hover { transform: translateY(-1px); }
.primary:disabled { cursor: wait; opacity: .55; transform: none; }
.ghost {
    border: 1px solid var(--line);
    background: rgba(255,255,255,.025);
    color: var(--mist);
}
.ghost:hover { background: rgba(255,255,255,.06); color: var(--ivory); }
.compact { min-height: 44px; padding: 0 17px; margin: 0; }
.message { min-height: 24px; margin: 16px 0 0; color: var(--mist); font-size: 13px; }
.message.error { color: var(--danger); }
.message.success { color: var(--emerald); }

.dashboard { padding: 54px 0 44px; }
.dashboard-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}
.dashboard-head h1 { margin: 8px 0 3px; font-size: clamp(34px, 5vw, 56px); }
.dashboard-head p { margin: 0; }
.dashboard-actions { display: flex; align-items: center; gap: 10px; }
.password-dialog {
    width: min(520px, calc(100% - 28px));
    border: 1px solid var(--line);
    border-radius: 26px;
    padding: 0;
    background: #102535;
    color: var(--ivory);
    box-shadow: 0 34px 100px rgba(0,0,0,.62);
}
.password-dialog::backdrop {
    background: rgba(2,10,17,.76);
    backdrop-filter: blur(8px);
}
.password-dialog form { margin: 0; padding: 30px; }
.dialog-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 4px;
}
.dialog-heading h2 { margin: 8px 0 0; font-size: 28px; }
.dialog-close {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.035);
    color: var(--mist);
    font-size: 25px;
    line-height: 1;
}
.dialog-close:hover { color: var(--ivory); background: rgba(255,255,255,.07); }
.password-dialog .muted { margin: 6px 0 8px; }
.password-dialog input { direction: ltr; text-align: left; }
.password-rules {
    margin: 2px 0 0;
    color: var(--mist);
    font-size: 12px;
    line-height: 1.7;
}
.dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 10px;
    margin-top: 2px;
}
.dialog-actions .primary { margin: 0; }
.workspace-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 20px; }
.panel { padding: 27px; }
.upload-panel form { margin-top: 20px; }
#vcardFile { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-zone {
    display: grid;
    place-items: center;
    min-height: 220px;
    padding: 25px;
    border: 1px dashed rgba(34,199,165,.37);
    border-radius: 22px;
    background: rgba(34,199,165,.035);
    text-align: center;
    cursor: pointer;
}
.drop-zone:hover { background: rgba(34,199,165,.065); }
.upload-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 10px;
    border-radius: 18px;
    background: rgba(34,199,165,.12);
    color: var(--emerald);
    font-size: 28px;
}
.drop-zone strong { color: var(--ivory); font-size: 17px; }
.drop-zone small { margin-top: 5px; color: var(--mist); }
.security-panel { align-self: start; background: linear-gradient(145deg, rgba(34,199,165,.08), rgba(18,39,55,.82)); }
.security-panel h3 { margin: 18px 0 8px; font-size: 22px; }
.security-panel p { margin: 0; color: var(--mist); line-height: 1.75; }

.preview-panel { margin-top: 20px; }
.preview-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.ready-pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(34,199,165,.1);
    color: var(--emerald);
    font-size: 12px;
    font-weight: 800;
}
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0; }
.metrics div {
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(255,255,255,.025);
}
.metrics strong { display: block; color: var(--emerald); font-size: 26px; }
.metrics span { color: var(--mist); font-size: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { padding: 14px 17px; text-align: right; border-bottom: 1px solid var(--line); }
th { color: var(--gold); font-size: 12px; }
td { color: var(--mist); }
tbody tr:last-child td { border-bottom: 0; }
.commit-row {
    display: grid;
    grid-template-columns: auto minmax(210px, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}
.commit-row select { min-height: 44px; }

footer {
    padding: 25px 0 0;
    color: rgba(169,183,195,.48);
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.4px;
}
footer span { color: var(--gold); padding: 0 5px; }

@media (max-width: 820px) {
    .auth-layout, .workspace-grid { grid-template-columns: 1fr; }
    .auth-layout { padding: 42px 0; }
    .intro h1 { font-size: 43px; }
    .dashboard-head { align-items: start; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .commit-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .page-shell { width: min(100% - 24px, 1160px); padding-top: 18px; }
    .brand { padding-bottom: 18px; }
    .brand-subtitle { display: none; }
    .secure-badge { padding: 7px 9px; }
    .auth-layout { padding-top: 34px; }
    .auth-card, .panel { border-radius: 22px; padding: 21px; }
    .trust-points { display: grid; grid-template-columns: 1fr 1fr; }
    .dashboard { padding-top: 34px; }
    .dashboard-head { display: grid; }
    .dashboard-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .dashboard-head .ghost { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
