:root {
    --ofii-blue: #0f4c97;
    --ofii-blue-dark: #082d63;
    --ofii-blue-light: #eaf1fb;
    --ofii-red: #ec382b;
    --ink: #15223b;
    --muted: #66738a;
    --line: #e3e9f2;
    --panel: #ffffff;
    --canvas: #f3f6fb;
    --success: #168a5b;
    --danger: #b34239;
    --shadow: 0 22px 70px rgba(13, 42, 91, .16);
    --soft-shadow: 0 8px 28px rgba(19, 52, 104, .08);
    font-family: Inter, Aptos, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--canvas); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
img { max-width: 100%; }
a { color: inherit; }

/* Public card */
.public-page {
    background:
        radial-gradient(circle at 15% 12%, rgba(29, 91, 177, .18), transparent 28rem),
        radial-gradient(circle at 88% 88%, rgba(236, 56, 43, .12), transparent 25rem),
        linear-gradient(145deg, #eef3fa, #f9fbfe 52%, #edf2f9);
    display: grid;
    place-items: center;
    padding: 36px 16px;
}
.card-shell { width: min(100%, 510px); }
.digital-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(15, 61, 138, .09);
    border-radius: 28px;
    box-shadow: var(--shadow);
}
.public-header {
    position: relative;
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(0, auto);
    align-items: start;
    gap: 14px;
    padding: 22px 24px 10px;
}
.ofii-logo { display: flex; align-items: center; text-decoration: none; padding-top: 4px; }
.ofii-logo img { width: 160px; max-width: 42vw; height: 48px; object-fit: contain; object-position: left center; }
.header-brand-marks {
    max-width: 230px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.header-brand-marks::-webkit-scrollbar { display: none; }
.header-trust-badge {
    flex: 0 0 auto;
    width: 96px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    text-decoration: none;
    border-radius: 7px;
}
.header-trust-badge img { width: 100%; height: 100%; object-fit: contain; }
.nfc-pill {
    position: absolute;
    right: 24px;
    top: 79px;
    color: var(--ofii-blue);
    background: var(--ofii-blue-light);
    border: 1px solid #d9e5f8;
    border-radius: 999px;
    padding: 5px 8px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .55px;
}
.hero-profile { text-align: center; padding: 20px 24px 0; }
.avatar {
    width: 92px; height: 92px; margin: 0 auto 16px;
    display: grid; place-items: center; overflow: hidden;
    color: #fff; font-size: 27px; font-weight: 800;
    border: 5px solid #fff; border-radius: 50%;
    background: linear-gradient(145deg, #184e9f, #092a69);
    box-shadow: 0 9px 24px rgba(15, 61, 138, .25), 0 0 0 1px #dce6f5;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero-profile h1 {
    color: #101827;
    max-width: 100%;
    font-size: clamp(18px, 4.8vw, 25px);
    line-height: 1.08;
    letter-spacing: -.55px;
    text-transform: uppercase;
    white-space: nowrap;
    margin: 0 auto;
}
.position { color: var(--ofii-blue); font-size: 17px; font-weight: 700; margin: 8px 0 3px; }
.company { color: var(--muted); font-size: 13px; margin: 0; }
.save-contact {
    width: calc(100% - 56px); min-height: 52px;
    margin: 24px 28px 19px;
    color: #fff; background: linear-gradient(135deg, #124b9e, #0b3379);
    border: 0; border-radius: 14px; box-shadow: 0 10px 22px rgba(15, 61, 138, .23);
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-weight: 800; text-transform: uppercase; letter-spacing: .8px; text-decoration: none;
}
.quick-actions {
    display: flex;
    justify-content: space-around;
    gap: 10px;
    padding: 0 28px 23px;
}
.quick-actions a { min-width: 58px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; text-decoration: none; }
.action-icon { width: 44px; height: 44px; display: grid; place-items: center; color: var(--ofii-blue); background: #f1f5fb; border: 1px solid #e1e9f5; border-radius: 13px; font-size: 18px; }
.contact-panel { margin: 0 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fbfcfe; }
.contact-row { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 12px; padding: 14px 15px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.contact-row:last-child { border-bottom: 0; }
.contact-mark { width: 34px; height: 34px; display: grid; place-items: center; color: var(--ofii-blue); border-radius: 10px; background: var(--ofii-blue-light); }
.contact-row > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.contact-row small { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; }
.contact-row strong { overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.4; font-weight: 650; }
.row-arrow { color: #9aa7b9; font-size: 23px; }
.partners { padding: 26px 20px 22px; }
.section-heading { display: grid; grid-template-columns: 1fr auto 1fr; gap: 11px; align-items: center; }
.section-heading span { height: 1px; background: var(--line); }
.section-heading h2 { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; margin: 0; }
.partner-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.partner-grid a { min-width: 0; min-height: 76px; display: flex; align-items: center; justify-content: center; padding: 10px 7px; border: 1px solid var(--line); border-radius: 12px; background: #fff; text-decoration: none; }
.partner-grid img { width: 100%; max-width: 116px; height: 48px; object-fit: contain; }
.public-footer { color: #fff; text-align: center; background: linear-gradient(145deg, var(--ofii-blue), var(--ofii-blue-dark)); padding: 18px 28px 21px; }
.share-button { min-height: 42px; padding: 0 21px; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.28); border-radius: 11px; font-weight: 700; }
.public-footer p { color: #b8c9e4; font-size: 9px; text-transform: uppercase; letter-spacing: 2.2px; margin: 16px 0 0; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; color: #fff; background: #172238; border-radius: 10px; padding: 11px 16px; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Inactive card */
.inactive-shell { width: min(100%, 480px); }
.inactive-card { text-align: center; background: #fff; border-radius: 24px; box-shadow: var(--shadow); padding: 42px 34px; }
.inactive-card img { width: 190px; height: 70px; object-fit: contain; }
.inactive-card > span { display: block; color: var(--ofii-blue); text-transform: uppercase; letter-spacing: 1.5px; font-size: 10px; font-weight: 800; margin-top: 20px; }
.inactive-card h1 { margin: 8px 0 10px; }
.inactive-card p { color: var(--muted); line-height: 1.65; margin-bottom: 24px; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, #dce9fb, transparent 34rem), #f4f7fb; }
.login-shell { width: min(100%, 430px); }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 34px; }
.login-logo { width: 190px; height: 66px; object-fit: contain; object-position: left center; margin-bottom: 24px; }
.login-heading span { color: var(--ofii-blue); font-size: 10px; font-weight: 800; letter-spacing: 1.3px; }
.login-heading h1 { margin: 5px 0 7px; }
.login-heading p { color: var(--muted); line-height: 1.5; margin: 0 0 24px; }

/* Shared forms/buttons */
.btn { min-height: 40px; border: 1px solid transparent; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; text-decoration: none; font-weight: 700; font-size: 12px; }
.btn-primary { color: #fff; background: var(--ofii-blue); border-color: var(--ofii-blue); }
.btn-secondary { color: var(--ink); background: #fff; border-color: #dce4ef; }
.btn-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-danger-light { color: var(--danger); background: #fff4f2; border-color: #f1cec9; }
.btn-success-light { color: var(--success); background: #effaf5; border-color: #cdebdc; }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 10px; border-radius: 8px; }
.btn-block { width: 100%; }
.form-stack, .form-grid { display: grid; gap: 16px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-span-2 { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 7px; }
label > span { color: #455268; font-size: 11px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid #d8e0eb; border-radius: 10px; background: #fff; color: var(--ink); padding: 10px 12px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #6e99d4; box-shadow: 0 0 0 3px rgba(15,61,138,.09); }
textarea { resize: vertical; }
label small { color: var(--muted); font-size: 10px; }
.check-row { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.check-row input { width: auto; }
.check-row span { font-weight: 600; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.alert { border-radius: 12px; padding: 13px 15px; margin-bottom: 18px; font-size: 12px; line-height: 1.5; }
.alert-success { color: #0e6f48; background: #eaf8f1; border: 1px solid #cbe9da; }
.alert-error { color: #8e332c; background: #fff0ee; border: 1px solid #f0cbc7; }
.alert ul { margin: 8px 0 0 18px; }

/* Admin */
.admin-page { background: var(--canvas); }
.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 255px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; color: #fff; background: linear-gradient(180deg, #0a316f 0%, #071f4a 100%); padding: 22px 16px 18px; display: flex; flex-direction: column; z-index: 20; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand img { width: 72px; height: 34px; object-fit: contain; filter: brightness(0) invert(1); }
.sidebar-brand div { min-width: 0; display: flex; flex-direction: column; }
.sidebar-brand strong { font-size: 13px; }
.sidebar-brand small { color: #aac0df; font-size: 9px; margin-top: 3px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; padding-top: 22px; }
.nav-link { width: 100%; min-height: 43px; color: #c3d2e8; background: transparent; border: 0; border-radius: 11px; display: flex; align-items: center; padding: 0 14px; font-size: 12px; font-weight: 650; text-decoration: none; text-align: left; }
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,.12); }
.nav-link.active { box-shadow: inset 3px 0 var(--ofii-red); }
.sidebar-bottom { margin-top: auto; }
.admin-profile { padding: 15px 8px; border-top: 1px solid rgba(255,255,255,.12); display: flex; align-items: center; gap: 10px; }
.admin-profile > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #3473c8; font-size: 10px; font-weight: 800; }
.admin-profile div { display: flex; flex-direction: column; }
.admin-profile strong { font-size: 11px; }
.admin-profile small { color: #a9bcda; font-size: 9px; margin-top: 3px; }
.logout-link { cursor: pointer; }
.admin-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.admin-header { min-height: 80px; display: flex; align-items: center; gap: 14px; background: #fff; border-bottom: 1px solid var(--line); padding: 13px 28px; }
.admin-header h1 { font-size: 19px; margin: 0 0 4px; }
.admin-header p { color: var(--muted); font-size: 11px; margin: 0; }
.system-live { margin-left: auto; color: var(--success); font-size: 10px; font-weight: 700; }
.system-live i { display: inline-block; width: 7px; height: 7px; background: var(--success); border-radius: 50%; margin-right: 5px; }
.menu-button { display: none; border: 0; background: transparent; font-size: 22px; }
.admin-content { flex: 1; padding: 26px 28px; }
.admin-footer { color: #8995a7; padding: 17px 28px 24px; font-size: 9px; text-align: center; }
.welcome-panel { display: flex; justify-content: space-between; align-items: center; gap: 20px; color: #fff; background: linear-gradient(135deg, #0c3c86, #135aad); border-radius: 20px; padding: 28px; margin-bottom: 18px; }
.welcome-panel .eyebrow { color: #c8dbf6; text-transform: uppercase; letter-spacing: 1.4px; font-size: 9px; font-weight: 800; }
.welcome-panel h2 { font-size: 23px; margin: 7px 0; }
.welcome-panel p { max-width: 710px; color: #d7e5f8; line-height: 1.55; margin: 0; font-size: 12px; }
.welcome-panel .btn-primary { color: var(--ofii-blue); background: #fff; border-color: #fff; flex: 0 0 auto; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-grid article { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--soft-shadow); padding: 18px; }
.stat-grid span, .stat-grid small { display: block; color: var(--muted); font-size: 10px; }
.stat-grid strong { display: block; font-size: 26px; margin: 8px 0 4px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--soft-shadow); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-heading h3 { font-size: 14px; margin: 0 0 4px; }
.panel-heading p { color: var(--muted); font-size: 10px; margin: 0; }
.text-link { color: var(--ofii-blue); font-size: 11px; font-weight: 700; text-decoration: none; }
.manager-list { padding: 5px 20px; }
.manager-list-row { min-height: 64px; display: grid; grid-template-columns: 42px 1fr auto auto; align-items: center; gap: 12px; border-bottom: 1px solid #edf0f5; }
.manager-list-row:last-child { border-bottom: 0; }
.manager-list-row > div { min-width: 0; display: flex; flex-direction: column; }
.manager-list-row strong { font-size: 11px; }
.manager-list-row small { color: var(--muted); font-size: 9px; margin-top: 4px; }
.mini-avatar { width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--ofii-blue); color: #fff; font-size: 10px; font-weight: 800; }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.status-badge { width: max-content; color: var(--success); background: #eaf7f1; border-radius: 999px; display: inline-flex; align-items: center; padding: 6px 9px; font-size: 8px; font-weight: 750; }
.status-badge.inactive { color: #8c4c22; background: #fff1e6; }
.toolbar { min-height: 58px; display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 18px; }
.toolbar h2 { font-size: 18px; margin: 0 0 5px; }
.toolbar p { color: var(--muted); font-size: 11px; margin: 0; }
.search-wrap { width: min(100%, 560px); display: flex; align-items: center; gap: 8px; }
.table-panel { overflow: hidden; }
.responsive-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { color: #6e7b8f; background: #f8fafc; font-size: 9px; text-transform: uppercase; letter-spacing: .6px; text-align: left; padding: 12px 17px; }
td { padding: 14px 17px; border-top: 1px solid #edf0f5; font-size: 10px; vertical-align: middle; }
td > strong, td > small { display: block; }
td > small { color: var(--muted); margin-top: 5px; }
.table-person { display: flex; align-items: center; gap: 10px; }
.table-person > span:last-child { display: flex; flex-direction: column; }
.table-person small { color: var(--muted); font-size: 9px; margin-top: 4px; }
code { color: var(--ofii-blue); background: #edf3fb; border-radius: 6px; padding: 5px 7px; font: 700 9px ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; white-space: normal; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions form { margin: 0; }
.empty-state { color: var(--muted); text-align: center; padding: 30px; }
.pagination-wrap { margin-top: 18px; }
.pagination-wrap nav > div:first-child { display: none; }
.pagination-wrap nav > div:last-child { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.form-panel form { padding: 20px; }
.compact-form { align-items: end; }
.current-photo { display: flex; align-items: center; gap: 14px; background: #f7f9fc; border-radius: 12px; padding: 12px; }
.current-photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 50%; }
.public-url-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; background: #edf4ff; border: 1px solid #ccdcf4; border-radius: 16px; padding: 18px; margin-bottom: 18px; }
.public-url-card > div:first-child { min-width: 0; display: grid; gap: 7px; }
.public-url-card span { color: var(--ofii-blue); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .9px; }
.public-url-card small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.url-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.danger-panel { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 18px; padding: 18px; border: 1px solid #efd1ce; border-radius: 16px; background: #fff9f8; }
.danger-panel strong { font-size: 12px; }
.danger-panel p { color: var(--muted); margin: 5px 0 0; font-size: 10px; line-height: 1.45; }
.url-cell { display: flex; align-items: center; gap: 7px; max-width: 360px; }
.copy-inline { border: 0; color: var(--ofii-blue); background: transparent; font-size: 9px; font-weight: 800; }
.card-action-stack { display: grid; gap: 7px; }
.inline-reassign { display: grid; grid-template-columns: 150px 160px auto; gap: 6px; }
.inline-reassign select, .inline-reassign input { padding: 7px 8px; font-size: 10px; min-height: 32px; }
.content-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.content-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--soft-shadow); padding: 17px; }
.content-logo { height: 86px; display: grid; place-items: center; background: #f8fafc; border-radius: 12px; padding: 10px; margin-bottom: 14px; }
.content-logo img { width: 100%; height: 100%; object-fit: contain; }
.certification-logo { height: 110px; }
.content-card-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 9px; margin-bottom: 14px; }
.content-card-heading h3 { font-size: 12px; margin: 0 0 5px; }
.content-card-heading a { color: var(--muted); display: block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; font-size: 9px; }
details { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
summary { cursor: pointer; color: var(--ofii-blue); font-size: 10px; font-weight: 800; margin-bottom: 12px; }
details form { display: grid; gap: 10px; }
.content-card > form:last-child { margin-top: 12px; }

@media (max-width: 1080px) {
    .admin-layout { grid-template-columns: 220px 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .content-card-grid { grid-template-columns: repeat(2, 1fr); }
    .inline-reassign { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .public-page { padding: 0; display: block; background: #fff; }
    .card-shell { width: 100%; }
    .digital-card { min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
    .public-header { padding-left: 18px; padding-right: 18px; gap: 8px; }
    .ofii-logo img { width: 132px; max-width: 36vw; }
    .header-brand-marks { max-width: 48vw; gap: 4px; }
    .header-trust-badge { width: 82px; height: 42px; }
    .nfc-pill { right: 18px; top: 72px; }
    .hero-profile { padding-left: 18px; padding-right: 18px; }
    .hero-profile h1 { font-size: clamp(17px, 5vw, 21px); letter-spacing: -.45px; }
    .save-contact { width: calc(100% - 40px); margin-left: 20px; margin-right: 20px; }
    .quick-actions { padding-left: 20px; padding-right: 20px; }
    .partner-grid { gap: 6px; }
    .admin-layout { display: block; }
    .sidebar { position: fixed; left: -280px; width: 255px; transition: left .2s ease; }
    .sidebar.open { left: 0; box-shadow: 16px 0 50px rgba(5,22,54,.28); }
    .menu-button { display: block; }
    .admin-header { padding: 12px 16px; }
    .admin-header p, .system-live { display: none; }
    .admin-content { padding: 18px 14px; }
    .welcome-panel { align-items: flex-start; flex-direction: column; padding: 23px; }
    .welcome-panel .btn { width: 100%; }
    .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .search-wrap { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
    .form-span-2 { grid-column: auto; }
    .content-card-grid { grid-template-columns: 1fr; }
    .public-url-card, .danger-panel { align-items: stretch; flex-direction: column; }
    .url-actions { width: 100%; }
    .url-actions .btn { flex: 1; }
    .manager-list-row { grid-template-columns: 42px 1fr auto; }
    .manager-list-row > .btn { grid-column: 2 / -1; justify-self: start; }
}
@media (max-width: 430px) {
    .stat-grid { grid-template-columns: 1fr; }
    .header-trust-badge { width: 74px; height: 38px; }
    .hero-profile h1 { font-size: 18px; }
    .avatar { width: 82px; height: 82px; }
    .partner-grid { grid-template-columns: 1fr; }
    .partner-grid a { min-height: 68px; }
}
