/* LINGOTESORO portal v2 - route based UI overrides */
:root {
    --ink: #16163f;
    --ink2: #16163f;
    --lg-bg: #f6f3ed;
    --lg-card: #ffffff;
    --lg-ink: #16163f;
    --lg-muted: #776f62;
    --lg-line: #ded5c7;
    --lg-soft: #f0ece4;
    --lg-gold: #c99209;
    --lg-gold-dark: #9d6f00;
    --lg-dark: #16163f;
    --lg-danger: #a84444;
    --lg-success: #2f7652;
}

* { box-sizing: border-box; }

/* Global dark brand override: replaces the original black UI with LINGOTESORO navy. */
.topbar,
.login-left {
    background: #16163f !important;
}
.btn.dark {
    background: #16163f !important;
    border-color: #16163f !important;
    color: #fff !important;
}
.codebox,
.toast,
.portal-toast,
.token-created code {
    background: #16163f !important;
}
.user,
.profile-trigger {
    background-color: #16163f;
}
body { background: var(--lg-bg); color: var(--lg-ink); }
a { color: inherit; }

/* Buttons: explicit states so Bootstrap never leaves a transparent hover. */
.btn {
    --bs-btn-color: var(--lg-ink);
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--lg-line);
    --bs-btn-hover-color: var(--lg-ink);
    --bs-btn-hover-bg: #f7f3eb;
    --bs-btn-hover-border-color: #cfc3b0;
    --bs-btn-focus-shadow-rgb: 201, 146, 9;
    --bs-btn-active-color: var(--lg-ink);
    --bs-btn-active-bg: #f1eadf;
    --bs-btn-active-border-color: #c7b99f;
    background-color: var(--bs-btn-bg);
    border-color: var(--bs-btn-border-color);
    color: var(--bs-btn-color);
}
.btn:hover,
.btn:focus-visible {
    background-color: var(--bs-btn-hover-bg) !important;
    border-color: var(--bs-btn-hover-border-color) !important;
    color: var(--bs-btn-hover-color) !important;
}
.btn:active,
.btn.active,
.btn.show {
    background-color: var(--bs-btn-active-bg) !important;
    border-color: var(--bs-btn-active-border-color) !important;
    color: var(--bs-btn-active-color) !important;
}
.btn.dark {
    --bs-btn-color: #fff;
    --bs-btn-bg: #16163f;
    --bs-btn-border-color: #16163f;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #24245a;
    --bs-btn-hover-border-color: #24245a;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #101032;
    --bs-btn-active-border-color: #101032;
}
.btn.gold {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--lg-gold);
    --bs-btn-border-color: var(--lg-gold);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--lg-gold-dark);
    --bs-btn-hover-border-color: var(--lg-gold-dark);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #805b00;
    --bs-btn-active-border-color: #805b00;
}
.btn.danger {
    --bs-btn-color: #8f3f3f;
    --bs-btn-bg: #fff4f4;
    --bs-btn-border-color: #e7c7c7;
    --bs-btn-hover-color: #7d3030;
    --bs-btn-hover-bg: #f9e5e5;
    --bs-btn-hover-border-color: #dbaaaa;
}

.hidden { display: none !important; }
.muted { color: var(--lg-muted); }
.req::after { content: " *"; color: #a84444; font-weight: 700; }

/* Shared form / action refinements */
.input-clean { position: relative; }
.input-clean input,
.input-clean select,
.client-search-form input,
.margin-grid input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--lg-line);
    border-radius: 10px;
    background: #fff;
    color: var(--lg-ink);
    padding: 9px 11px;
    outline: none;
}
.input-clean input:focus,
.input-clean select:focus,
.client-search-form input:focus,
.margin-grid input:focus {
    border-color: #b18b31;
    box-shadow: 0 0 0 3px rgba(201, 146, 9, .10);
}
.input-clean input:disabled { background: #f4f1eb; color: #777; }
.password-field input { padding-right: 55px; }
.password-field .inside {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    font-size: 12px;
    font-weight: 700;
    color: #6f6044;
    cursor: pointer;
}
.form-errors {
    margin-top: 12px;
    border: 1px solid rgba(168, 68, 68, .32);
    background: #fff3f3;
    color: #8d3434;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
}
.form-errors ul { margin: 0; padding-left: 18px; }
.form-errors li + li { margin-top: 4px; }
.field-error { border-color: #b55757 !important; }

/* Login: fixed role, fewer decorative/explanatory elements */
.login-v2 .login-copy-clean { max-width: 650px; }
.login-v2 .login-copy-clean h1 { max-width: 650px; margin-bottom: 12px; }
.login-v2 .login-copy-clean p { max-width: 480px; font-size: 16px; opacity: .86; }
.login-v2 .login-card-clean > p,
.login-v2 .role-tabs,
.login-v2 .login-features { display: none !important; }
.login-v2 .login-role-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    margin-bottom: 12px;
    border: 1px solid var(--lg-line);
    border-radius: 999px;
    color: #806111;
    background: #faf6eb;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.login-v2 .login-row-end { justify-content: flex-end; }
.login-v2 .login-form .field label { display: block; margin-bottom: 6px; }

/* Route based admin shell */
.route-admin .layout { min-height: calc(100vh - 68px); }
.route-admin .sidebar {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 68px);
    padding-bottom: 24px;
}
.route-admin .route-nav { display: flex; flex-direction: column; gap: 4px; }
.route-admin .route-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 8px 11px;
    border-radius: 9px;
    text-decoration: none;
    color: #2d2923;
    font-weight: 600;
}
.route-admin .route-nav a:hover { background: #f6f2e9; }
.route-admin .route-nav a.active { background: #f1e5bd; color: #7d5a00; }
.route-admin .route-nav .ni { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; }
.route-admin .route-main { min-width: 0; }
.route-admin .top-logout,
.route-client .top-logout { background: #16163f; border-color: #343467; color: #fff; }
.route-admin .user-name { background: transparent; border: 0; color: inherit; padding: 0; cursor: pointer; }

.actions-filter { flex-wrap: wrap; }
.inline-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-filter .search { min-width: 235px; }
.inline-filter .status-select { min-width: 155px; }
.inline-filter .filter-client { min-width: 220px; }
.table-person { display: flex; align-items: center; gap: 9px; }
.table-person > div { display: flex; flex-direction: column; gap: 2px; }
.table-person small,
.table-sub { display: block; color: var(--lg-muted); font-size: 11px; margin-top: 3px; }
.mini-avatar {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #f0e0a7;
    color: #7e5a00;
    font-weight: 800;
    flex: 0 0 30px;
}
.table-actions { white-space: nowrap; }
.empty-cell { text-align: center; padding: 28px 16px !important; color: var(--lg-muted); }
.badge.muted-badge { background: #ece8e1; color: #746e65; }
.route-pager { padding: 12px 16px 16px; }
.route-pager nav { display: flex; justify-content: flex-end; }
.route-pager .pagination { margin: 0; }
.route-pager svg { width: 16px; }
.admin-dashboard-grid { align-items: stretch; }
.compact-list { max-height: 360px; overflow: auto; }
.api-log-panel { margin-top: 16px; }
.route-token-list { max-height: 310px; overflow: auto; }
.swagger-route-panel { padding: 12px; }

/* PVC configuration */
.pvc-layout-v2 { grid-template-columns: 360px minmax(0, 1fr); align-items: start; }
.pvc-layout-v2 .pvc-controls { max-height: calc(100vh - 150px); overflow: auto; }
.settings-section + .settings-section { margin-top: 12px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-heading h3 { margin: 0 0 4px; }
.section-heading p { margin: 0; color: var(--lg-muted); font-size: 12px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.margin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.margin-grid label { font-size: 10px; color: var(--lg-muted); }
.margin-grid input { min-height: 36px; padding: 7px; margin-top: 4px; }
.pvc-size-note { margin-top: 10px; padding: 9px 10px; background: #f8f4e9; border: 1px solid #eadcb3; border-radius: 9px; font-size: 11px; }
.pvc-preview-column { min-width: 0; }
.pvc-stage-label { position: absolute; top: 13px; left: 16px; z-index: 2; font-size: 11px; font-weight: 700; color: #6d665c; }
.pvc-stage { position: relative; min-height: 430px; display: grid; place-items: center; padding: 58px 40px 38px; }
.pvc-card-v2 { width: min(620px, 86%); height: auto; min-height: 0; max-height: 430px; }
.pvc-card-v2 .pvc-inner { width: 100%; height: 100%; }
.pvc-qr { width: 118px; height: 118px; display: grid; place-items: center; overflow: hidden; }
.pvc-qr img,
.pvc-qr canvas { width: 100% !important; height: 100% !important; object-fit: contain; }

/* Route based customer shell */
.route-client { min-height: 100vh; }
.client-topbar { position: sticky; top: 0; z-index: 30; }
.client-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 18px; }
.client-nav a {
    color: rgba(255,255,255,.72);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 10px;
    border-radius: 8px;
}
.client-nav a:hover,
.client-nav a.active { color: #fff; background: rgba(255,255,255,.08); }
.user-name-static { color: #fff; font-size: 12px; }
.client-main-v3 { max-width: 1220px; margin: 0 auto; padding: 22px 22px 28px; }
.client-hero-compact {
    min-height: 132px;
    border-radius: 18px;
    background: radial-gradient(circle at 86% 15%, rgba(197,143,13,.28), transparent 24%), linear-gradient(115deg, #16163f, #16163f);
    color: #fff;
    padding: 24px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 18px 34px rgba(0,0,0,.09);
}
.client-hero-compact h1 { margin: 10px 0 4px; font-size: 31px; line-height: 1.1; }
.client-hero-compact p { margin: 0; color: rgba(255,255,255,.75); font-size: 13px; }
.client-private-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05); font-size: 10px; color: #e8c95f; font-weight: 700; }
.gold-mark {
    width: 82px;
    height: 82px;
    border-radius: 50%;
    background: linear-gradient(145deg, #f0ca5d, #c78f10);
    border: 5px solid rgba(255,255,255,.20);
    color: #16163f;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(84,51,0,.22), 0 8px 20px rgba(0,0,0,.16);
    flex: 0 0 82px;
}
.gold-mark span { font-size: 27px; font-weight: 900; line-height: 1; }
.gold-mark small { margin-top: 5px; font-weight: 800; font-size: 9px; }
.client-stats-compact { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.client-stat {
    min-height: 72px;
    background: #fff;
    border: 1px solid var(--lg-line);
    border-radius: 13px;
    padding: 13px 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease;
}
.client-stat:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(45,35,10,.06); }
.client-stat span { color: var(--lg-muted); font-size: 11px; }
.client-stat strong { font-size: 22px; margin-top: 3px; }
.client-stat.status strong { font-size: 17px; color: var(--lg-success); }
.client-dashboard-content { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 12px; margin-top: 12px; align-items: stretch; }
.client-profile-compact,
.client-docs-compact {
    background: #fff;
    border: 1px solid var(--lg-line);
    border-radius: 14px;
}
.client-profile-compact { padding: 16px; display: flex; flex-direction: column; justify-content: space-between; min-height: 250px; }
.profile-mini-top { display: flex; align-items: flex-start; gap: 12px; }
.client-big-avatar { width: 54px; height: 54px; flex: 0 0 54px; border-radius: 50%; display: grid; place-items: center; background: #eedca2; color: #8c6500; font-size: 20px; font-weight: 900; }
.profile-mini-top > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.profile-mini-top strong { margin-bottom: 4px; }
.profile-mini-top span { color: var(--lg-muted); font-size: 11px; overflow-wrap: anywhere; }
.profile-mini-actions { margin-top: 14px; }
.client-docs-compact { padding: 16px; min-width: 0; }
.client-docs-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.client-docs-head h2 { margin: 0 0 2px; font-size: 18px; }
.client-docs-head p { margin: 0; color: var(--lg-muted); font-size: 11px; }
.client-doc-links { display: flex; gap: 7px; }
.client-doc-links a { border: 1px solid var(--lg-line); padding: 6px 8px; border-radius: 8px; text-decoration: none; font-size: 10px; font-weight: 700; }
.recent-doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recent-doc-column { min-width: 0; }
.recent-doc-column h3 { font-size: 12px; margin: 0 0 7px; color: #5d5548; }
.recent-doc-row { display: grid; grid-template-columns: 34px minmax(0,1fr) 14px; align-items: center; gap: 9px; padding: 9px 8px; border-top: 1px solid #eee9e0; text-decoration: none; }
.recent-doc-row:first-of-type { border-top: 0; }
.recent-doc-row .doc-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: #f8f1df; color: #a17400; }
.recent-doc-row > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; }
.recent-doc-row b { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-doc-row small { font-size: 9px; color: var(--lg-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-empty-compact { border: 1px dashed var(--lg-line); border-radius: 9px; padding: 18px; text-align: center; color: var(--lg-muted); font-size: 11px; }
.client-page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 6px 0 14px; }
.client-page-head h1 { margin: 0 0 3px; font-size: 28px; }
.client-page-head p { margin: 0; color: var(--lg-muted); font-size: 12px; }
.client-search-form { display: flex; gap: 7px; min-width: 330px; }
.client-table-panel { overflow: hidden; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 980px; }
.account-card form { margin-top: 14px; }
.account-card .field + .field { margin-top: 10px; }

/* Modal alignment and validation state */
#uiModal .modal-content { border: 0; border-radius: 16px; overflow: hidden; }
#uiModal .modal-head { padding: 16px 18px; border-bottom: 1px solid var(--lg-line); }
#uiModal .modal-body { padding: 16px 18px; }
#uiModal .modal-foot { padding: 13px 18px; border-top: 1px solid var(--lg-line); display: flex; justify-content: flex-end; gap: 8px; }
#uiModal .modal-head h3 { margin: 0; }
#uiModal .modal-head p { margin: 3px 0 0; color: var(--lg-muted); font-size: 11px; }
#uiModal .modal-body .field + .field { margin-top: 10px; }
#uiModal .close { border: 0; background: #f0ece4; width: 32px; height: 32px; border-radius: 9px; font-size: 18px; }
.modal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-form-grid .full { grid-column: 1 / -1; }

@media (max-width: 1100px) {
    .pvc-layout-v2 { grid-template-columns: 320px minmax(0, 1fr); }
    .client-dashboard-content { grid-template-columns: 220px minmax(0, 1fr); }
    .client-nav { display: none; }
}

@media (max-width: 820px) {
    .route-admin .layout { display: block; }
    .route-admin .sidebar { min-height: 0; padding: 9px; border-bottom: 1px solid var(--lg-line); }
    .route-admin .side-title { display: none; }
    .route-admin .route-nav { flex-direction: row; overflow-x: auto; }
    .route-admin .route-nav a { white-space: nowrap; }
    .route-admin .route-nav a span:last-child { display: none; }
    .route-admin .main { padding: 16px; }
    .pvc-layout-v2 { grid-template-columns: 1fr; }
    .pvc-layout-v2 .pvc-controls { max-height: none; }
    .pvc-stage { min-height: 340px; padding: 52px 18px 28px; }
    .pvc-card-v2 { width: 94%; }
    .client-main-v3 { padding: 14px; }
    .client-topbar .top-note,
    .client-topbar .user-name-static { display: none; }
    .client-hero-compact { min-height: 118px; padding: 20px; }
    .client-hero-compact h1 { font-size: 25px; }
    .gold-mark { width: 68px; height: 68px; flex-basis: 68px; }
    .client-stats-compact { grid-template-columns: 1fr 1fr; }
    .client-dashboard-content { grid-template-columns: 1fr; }
    .client-profile-compact { min-height: 0; }
    .recent-doc-grid { grid-template-columns: 1fr; }
    .client-page-head { align-items: stretch; flex-direction: column; }
    .client-search-form { min-width: 0; width: 100%; }
    .account-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .login-v2 .login-left { min-height: 180px; padding: 18px; }
    .login-v2 .login-copy-clean { margin-top: 24px; }
    .login-v2 .login-copy-clean h1 { font-size: 28px; }
    .login-v2 .login-copy-clean p { font-size: 13px; }
    .login-v2 .login-bottom { display: none; }
    .login-v2 .login-right { padding: 22px 16px; }
    .client-hero-compact .gold-mark { display: none; }
    .client-stats-compact { gap: 8px; }
    .client-stat { min-height: 65px; }
    .modal-form-grid,
    .form-grid-2 { grid-template-columns: 1fr; }
    .margin-grid { grid-template-columns: 1fr 1fr; }
}

/* Small components used by portal-v2.js */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 9px; }
.portal-toast { min-width: 290px; max-width: 390px; padding: 12px 14px; border-radius: 11px; background: #16163f; color: #fff; box-shadow: 0 16px 40px rgba(0,0,0,.22); opacity: 0; transform: translateY(8px); transition: .2s ease; display: flex; flex-direction: column; gap: 3px; border-left: 4px solid #c99209; }
.portal-toast.show { opacity: 1; transform: translateY(0); }
.portal-toast.bad { border-left-color: #b85858; }
.portal-toast b { font-size: 12px; }
.portal-toast span { font-size: 11px; color: rgba(255,255,255,.75); }
.detail-list { display: grid; gap: 1px; background: var(--lg-line); border: 1px solid var(--lg-line); border-radius: 10px; overflow: hidden; }
.detail-list > div { background: #fff; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 10px 12px; }
.detail-list span { color: var(--lg-muted); font-size: 11px; }
.detail-list b { font-size: 12px; text-align: right; overflow-wrap: anywhere; }
.pvc-modal-preview { display: grid; place-items: center; padding: 20px; background: #f2efe8; border-radius: 12px; overflow: auto; }
.pvc-modal-preview .pvc-card { width: min(720px, 100%); }
.history-list { max-height: 420px; overflow: auto; }
.token-scopes { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; padding: 8px 0; }
.token-created code { display: block; padding: 14px; border-radius: 10px; background: #16163f; color: #f1d77d; word-break: break-all; user-select: all; }
#uiModal .modal-dialog { max-width: 660px; }

/* Admin navigation groups */
.route-admin .nav-group { display: grid; gap: 3px; }
.route-admin .nav-group-toggle {
    width: 100%;
    min-height: 42px;
    border: 0;
    background: transparent;
    color: #2d2923;
    border-radius: 9px;
    padding: 8px 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font: inherit;
    font-weight: 600;
    text-align: left;
}
.route-admin .nav-group-toggle:hover,
.route-admin .nav-group.active > .nav-group-toggle { background: #f6f2e9; }
.route-admin .nav-group-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.route-admin .nav-group-chevron { font-size: 10px; transition: transform .18s ease; }
.route-admin .nav-group-toggle[aria-expanded="true"] .nav-group-chevron { transform: rotate(180deg); }
.route-admin .nav-submenu { display: grid; gap: 2px; padding: 2px 0 4px 37px; }
.route-admin .nav-submenu a {
    min-height: 34px;
    padding: 7px 9px;
    gap: 8px;
    border-radius: 8px;
    color: #6d655a;
    font-size: 11px;
    font-weight: 650;
}
.route-admin .nav-submenu a i { width: 15px; text-align: center; }
.route-admin .nav-submenu a.active { background: #f1e5bd; color: #7d5a00; }

/* Profile dropdown shared by admin and customer */
.profile-dropdown-shell { position: relative; }
.profile-trigger {
    border: 1px solid #343467;
    background: #16163f;
    color: #fff;
    border-radius: 999px;
    min-height: 42px;
    padding: 5px 10px 5px 5px;
    display: flex;
    align-items: center;
    gap: 9px;
    text-align: left;
}
.profile-trigger:hover,
.profile-trigger[aria-expanded="true"] { background: #16163f; border-color: #444477; }
.profile-avatar {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0dfaa;
    color: #795b0b;
    display: grid;
    place-items: center;
    font-weight: 900;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-trigger-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.profile-trigger-copy small { color: #a9a49d; font-size: 8px; margin-bottom: 2px; }
.profile-trigger-copy strong { color: #fff; font-size: 11px; max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-chevron { color: #aaa49b; font-size: 10px; }
.profile-dropdown-menu {
    min-width: 230px;
    margin-top: 7px !important;
    padding: 7px;
    border: 1px solid #ddd5c7;
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(19, 16, 10, .16);
}
.profile-dropdown-head { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.profile-dropdown-head strong { font-size: 12px; }
.profile-dropdown-head span { font-size: 10px; color: var(--lg-muted); overflow-wrap: anywhere; }
.profile-dropdown-menu .dropdown-item { border-radius: 8px; padding: 9px 10px; display: flex; align-items: center; gap: 9px; font-size: 11px; }
.profile-dropdown-menu .dropdown-item:hover { background: #f7f3eb; }
.profile-dropdown-menu .profile-logout { color: #8f3f3f; }

/* Table action menus are rendered in the document root so table overflow never clips them. */
.admin-table-wrap { position: relative; }
.action-col { width: 54px; }
.table-actions-cell { width: 54px; text-align: right; white-space: nowrap; }
.table-action-dropdown { display: inline-flex; justify-content: flex-end; position: relative; }
.table-action-trigger {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd5c7;
    background: #fff;
    color: #514b42;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    padding: 0;
}
.table-action-trigger:hover,
.table-action-trigger[aria-expanded="true"] { background: #f5f0e6; border-color: #cfbf96; color: #7d5a00; }
.table-action-menu {
    display: none;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    min-width: 190px;
    max-width: min(240px, calc(100vw - 16px));
    padding: 6px;
    background: #fff;
    border: 1px solid #ddd5c7;
    border-radius: 10px;
    box-shadow: 0 16px 38px rgba(23, 19, 12, .16);
}
.table-action-menu.is-open {
    display: grid !important;
    gap: 2px;
    position: fixed !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 10050 !important;
}
.table-action-menu.is-positioning { visibility: hidden !important; pointer-events: none !important; }
.table-action-menu a,
.table-action-menu button {
    width: 100%;
    min-height: 34px;
    border: 0;
    background: transparent;
    color: #312d27;
    border-radius: 7px;
    padding: 7px 9px;
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    text-align: left;
    font-family: inherit;
    font-size: 11px;
    font-weight: 650;
    line-height: 1.25;
}
.table-action-menu a:hover,
.table-action-menu button:hover { background: #f7f3eb; color: #7d5a00; }
.table-action-menu i { width: 15px; text-align: center; color: #88704a; }

/* PVC card preview: fully defined here so it does not depend on legacy app.css rules. */
.pvc-cards-only .pvc-stage::before { content: none !important; display: none !important; }
.pvc-cards-only .pvc-stage {
    position: relative;
    min-height: 430px;
    padding: 58px 34px 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #efede7;
    border: 1px solid #dfd8ca;
    border-radius: 13px;
}
.pvc-cards-only .pvc-stage-label {
    position: absolute;
    top: 13px;
    left: 16px;
    z-index: 5;
    white-space: nowrap;
}
.pvc-cards-only .pvc-card-v2 {
    position: relative !important;
    display: block !important;
    flex: 0 0 auto;
    width: min(620px, 88%) !important;
    height: auto !important;
    min-width: 300px;
    min-height: 0 !important;
    max-width: 100%;
    max-height: none !important;
    overflow: hidden;
    background: linear-gradient(145deg, #fff 72%, #fbf2d7);
    border: 1px solid #d8d1c4;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(32, 27, 18, .16);
    isolation: isolate;
}
.pvc-cards-only .pvc-card-v2::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -100px;
    width: 260px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(184,135,11,.17), rgba(184,135,11,0) 70%);
    z-index: 0;
}
.pvc-cards-only .pvc-card-v2 .pvc-inner {
    position: absolute !important;
    inset: 0 !important;
    width: auto !important;
    height: auto !important;
    padding: 6.5% 7%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(125px, 34%);
    gap: 6%;
    z-index: 2;
}
.pvc-cards-only .pvc-main { display: flex; flex-direction: column; min-width: 0; }
.pvc-cards-only .pvc-brand { height: 18%; display: flex; align-items: flex-start; }
.pvc-cards-only .pvc-brand img { width: 58%; max-width: 170px; height: auto; display: block; }
.pvc-cards-only .pvc-title { margin-top: auto; min-width: 0; }
.pvc-cards-only .pvc-kicker { font-size: clamp(7px, .75vw, 10px); color: #9b7312; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.pvc-cards-only .pvc-name { font-size: clamp(17px, 2vw, 28px); font-weight: 900; letter-spacing: -.04em; line-height: 1.05; margin: 4px 0 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pvc-cards-only .pvc-meta { font-size: clamp(8px, .8vw, 11px); color: #615c53; display: flex; gap: 12px; flex-wrap: wrap; }
.pvc-cards-only .pvc-qrbox {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f4ea;
    border: 1px solid #ded4c0;
    border-radius: 12px;
    padding: 10%;
}
.pvc-cards-only .pvc-qr { width: min(118px, 100%); height: auto; aspect-ratio: 1; background: #fff; }
.pvc-cards-only .pvc-qrbox > span { font-size: clamp(6px, .62vw, 8px); color: #5f594f; text-align: center; line-height: 1.25; margin-top: 6px; }
.pvc-cards-only .pvc-qr-url {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-all;
    user-select: text;
}
.pvc-cards-only .pvc-number { position: absolute; left: 7%; bottom: 5%; z-index: 3; font-size: clamp(6px, .65vw, 9px); color: #9a948a; }

/* PVC settings separated from card generation */
.pvc-cards-only .pvc-controls { max-height: none; overflow: visible; }
.pvc-size-note { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pvc-size-note a { margin-left: auto; color: #7d5a00; font-weight: 750; text-decoration: none; }
.pvc-settings-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, .75fr); gap: 14px; align-items: start; }
.pvc-settings-card { padding: 20px; }
.pvc-settings-card .pvc-margin-field { margin-top: 13px; }
.pvc-settings-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.pvc-settings-preview-card { padding: 20px; }
.pvc-settings-preview-stage { min-height: 330px; border: 1px solid #e0d8ca; border-radius: 12px; background: #f1eee8; display: grid; place-items: center; padding: 28px; }
.pvc-settings-preview { width: min(430px, 94%); background: linear-gradient(145deg, #fff 72%, #faf0d5); border: 1px solid #d8cfbf; border-radius: 16px; box-shadow: 0 18px 38px rgba(30, 25, 16, .12); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 130px; }
.pvc-settings-preview span { font-size: 16px; font-weight: 900; }
.pvc-settings-preview small { color: #8a7242; font-weight: 750; }
.pvc-format-summary { margin-top: 12px; display: grid; gap: 1px; border: 1px solid var(--lg-line); border-radius: 10px; overflow: hidden; background: var(--lg-line); }
.pvc-format-summary > div { background: #fff; display: flex; justify-content: space-between; gap: 14px; padding: 10px 11px; font-size: 11px; }
.pvc-format-summary span { color: var(--lg-muted); }

/* Admin profile */
.profile-flash { margin-bottom: 14px; }
.profile-errors { margin-bottom: 14px; }
.admin-profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; max-width: 1040px; }
.admin-profile-card { padding: 20px; }
.profile-photo-row { display: flex; align-items: center; gap: 18px; }
.profile-photo-large { width: 104px; height: 104px; flex: 0 0 104px; border-radius: 50%; overflow: hidden; background: #eedca2; color: #805d08; display: grid; place-items: center; font-size: 34px; font-weight: 900; border: 4px solid #fff; box-shadow: 0 0 0 1px #ddd4c5, 0 12px 28px rgba(27, 22, 13, .10); }
.profile-photo-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-photo-copy h3 { margin: 0 0 4px; font-size: 14px; }
.profile-photo-copy p { margin: 0 0 10px; color: var(--lg-muted); font-size: 11px; }
.profile-photo-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.profile-photo-button { margin: 0; }
.profile-form-grid { margin-top: 2px; }
.profile-form-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.admin-security-card { padding: 20px; }
.security-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 11px; background: #f3ead3; color: #87630d; font-size: 18px; margin-bottom: 12px; }
.admin-security-card h3 { margin: 0 0 4px; }
.admin-security-card p { margin: 0 0 16px; color: var(--lg-muted); font-size: 11px; line-height: 1.5; }

@media (max-width: 1000px) {
    .pvc-settings-grid { grid-template-columns: 1fr; }
    .admin-profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .route-admin .nav-group { min-width: 48px; }
    .route-admin .nav-group-toggle { justify-content: center; padding: 7px; }
    .route-admin .nav-group-main > span:last-child,
    .route-admin .nav-group-chevron { display: none; }
    .route-admin .nav-group .collapse { display: none !important; }
    .profile-trigger-copy { display: none; }
    .profile-trigger { padding-right: 6px; }
    .profile-chevron { display: none; }
}

@media (max-width: 560px) {
    .profile-photo-row { align-items: flex-start; }
    .profile-photo-large { width: 82px; height: 82px; flex-basis: 82px; }
    .pvc-settings-preview-stage { min-height: 230px; padding: 16px; }
}

@media(max-width:700px){
    .pvc-cards-only .pvc-stage { min-height: 300px; padding: 48px 14px 24px; }
    .pvc-cards-only .pvc-card-v2 { width: 96% !important; min-width: 0; border-radius: 13px; }
    .pvc-cards-only .pvc-card-v2 .pvc-inner { grid-template-columns: minmax(0,1fr) minmax(90px,34%); padding: 6% 6.5%; }
    .pvc-cards-only .pvc-qrbox { padding: 7%; }
}


/* Login desktop: prioritize the visual left panel and keep the form intentionally narrower. */
@media (min-width: 821px) {
    .login-v2 {
        display: grid !important;
        grid-template-columns: minmax(0, 1.72fr) minmax(360px, .72fr) !important;
        min-height: 100vh;
    }
    .login-v2 .login-left { min-width: 0; }
    .login-v2 .login-right {
        min-width: 0;
        padding-left: clamp(28px, 4vw, 58px) !important;
        padding-right: clamp(28px, 4vw, 58px) !important;
    }
    .login-v2 .login-card-clean {
        width: 100%;
        max-width: 390px !important;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Mobile navigation: hidden on desktop, drawer on compact layouts. */
.mobile-nav-toggle,
.mobile-nav-backdrop { display: none; }

.mobile-nav-toggle {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    border: 1px solid rgba(255,255,255,.20);
    border-radius: 10px;
    background: rgba(255,255,255,.08);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.mobile-nav-toggle:hover,
.mobile-nav-toggle:focus-visible {
    background: rgba(255,255,255,.15);
    border-color: rgba(255,255,255,.32);
    color: #fff;
}
.mobile-nav-backdrop {
    position: fixed;
    inset: 68px 0 0;
    z-index: 1035;
    border: 0;
    padding: 0;
    background: rgba(22,22,63,.34);
    backdrop-filter: blur(2px);
}
body.mobile-nav-open { overflow: hidden; }

@media (max-width: 1100px) {
    .route-client .client-mobile-nav-toggle { display: inline-flex; }
    .route-client .topbar { position: sticky; top: 0; z-index: 1050; }
    .route-client .client-nav.mobile-nav-panel {
        display: flex !important;
        position: fixed;
        top: 68px;
        left: 0;
        bottom: 0;
        z-index: 1040;
        width: min(84vw, 310px);
        margin: 0;
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        overflow-y: auto;
        background: #fff;
        border-right: 1px solid var(--lg-line);
        box-shadow: 18px 0 45px rgba(22,22,63,.14);
        transform: translateX(-105%);
        transition: transform .22s ease;
    }
    .route-client .client-nav.mobile-nav-panel.is-open { transform: translateX(0); }
    .route-client .client-nav.mobile-nav-panel a {
        width: 100%;
        padding: 11px 12px;
        color: #2d2923;
        border-radius: 9px;
        font-size: 13px;
    }
    .route-client .client-nav.mobile-nav-panel a:hover { background: #f6f2e9; color: #16163f; }
    .route-client .client-nav.mobile-nav-panel a.active { background: #f1e5bd; color: #7d5a00; }
    .route-client .mobile-nav-backdrop.is-open { display: block; }
}

@media (max-width: 820px) {
    .route-admin .admin-mobile-nav-toggle { display: inline-flex; }
    .route-admin .topbar { position: sticky; top: 0; z-index: 1050; }
    .route-admin .layout { display: block; }
    .route-admin .sidebar.mobile-nav-panel {
        display: block !important;
        position: fixed;
        top: 68px;
        left: 0;
        bottom: 0;
        z-index: 1040;
        width: min(86vw, 320px);
        min-height: 0;
        margin: 0;
        padding: 16px 12px 24px;
        overflow-y: auto;
        background: #fff;
        border-right: 1px solid var(--lg-line);
        border-bottom: 0;
        box-shadow: 18px 0 45px rgba(22,22,63,.14);
        transform: translateX(-105%);
        transition: transform .22s ease;
    }
    .route-admin .sidebar.mobile-nav-panel.is-open { transform: translateX(0); }
    .route-admin .sidebar .side-title { display: block; }
    .route-admin .route-nav { flex-direction: column; overflow: visible; }
    .route-admin .route-nav a { white-space: normal; }
    .route-admin .route-nav a span:last-child { display: inline; }
    .route-admin .nav-group { min-width: 0; }
    .route-admin .nav-group-toggle { justify-content: space-between; padding: 8px 11px; }
    .route-admin .nav-group-main > span:last-child,
    .route-admin .nav-group-chevron { display: inline; }
    .route-admin .nav-group .collapse.show { display: block !important; }
    .route-admin .mobile-nav-backdrop.is-open { display: block; }
}

@media (max-width: 560px) {
    .mobile-nav-toggle { width: 38px; height: 38px; flex-basis: 38px; font-size: 20px; }
}

/* =============================================================
   Login - clean split layout
   ============================================================= */
body[data-role="login"] {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: #f3efe8;
}

#loginView.portal-login {
    width: 100vw !important;
    max-width: none !important;
    min-height: 100vh !important;
    margin: 0 !important;
    padding: 24px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #f3efe8;
}

#loginView .portal-login-shell {
    width: min(1500px, calc(100vw - 48px)) !important;
    max-width: 1500px !important;
    height: clamp(640px, calc(100vh - 48px), 820px);
    min-height: 640px;
    margin: 0 auto !important;
    padding: 18px;
    display: grid !important;
    grid-template-columns: minmax(360px, 430px) minmax(0, 1fr) !important;
    gap: 18px;
    background: #fff;
    border: 1px solid #e8e0d5;
    border-radius: 30px;
    box-shadow: 0 22px 60px rgba(31, 24, 13, .08);
    overflow: hidden;
}

#loginView .portal-login-form-panel {
    min-width: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px 38px;
    background: #fff;
    border-radius: 20px;
}

#loginView .portal-login-form-inner {
    width: 100%;
    max-width: 330px;
}

#loginView .portal-login-brand {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 34px;
}

#loginView .portal-login-logo {
    display: block;
    width: 220px !important;
    max-width: 100%;
    height: 64px !important;
    max-height: 64px !important;
    object-fit: contain;
    object-position: left center;
}

#loginView .portal-login-wordmark {
    display: none;
    color: #16163f;
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -.035em;
}

#loginView .portal-login-heading {
    margin-bottom: 28px;
}

#loginView .portal-login-heading h1 {
    margin: 0 0 10px;
    color: #16163f;
    font-size: clamp(34px, 3vw, 46px);
    line-height: 1.03;
    letter-spacing: -.05em;
    font-weight: 800;
}

#loginView .portal-login-heading p {
    margin: 0;
    color: #776f62;
    font-size: 14px;
    line-height: 1.55;
}

#loginView .portal-login-form .field + .field {
    margin-top: 14px;
}

#loginView .portal-login-form .field label {
    display: block;
    margin-bottom: 7px;
    color: #2e2a24;
    font-size: 12px;
    font-weight: 700;
}

#loginView .portal-login-form .input-clean input {
    width: 100%;
    min-height: 48px;
    padding: 10px 13px;
    border: 1px solid #ded7cc;
    border-radius: 11px;
    background: #fbfaf8;
    color: #16163f;
    font-size: 13px;
}

#loginView .portal-login-form .input-clean input:focus {
    border-color: #b98b18;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(201, 146, 9, .10);
}

#loginView .portal-login-form .password-field input {
    padding-right: 62px;
}

#loginView .portal-login-form .password-field .inside {
    right: 9px;
    min-width: 42px;
    padding: 5px 7px;
    border-radius: 7px;
    background: #f0eef5;
    color: #16163f;
    font-size: 11px;
}

#loginView .portal-login-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 18px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 800;
}

#loginView .portal-login-visual-panel {
    position: relative;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    border-radius: 22px;
    background: #071d43;
}

#loginView .portal-login-visual-image {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#loginView.portal-login-admin .portal-login-visual-image {
    object-position: center 64%;
}

#loginView.portal-login-client .portal-login-visual-image {
    object-position: center 70%;
}

#loginView .portal-login-visual-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(4, 19, 49, .30) 0%, rgba(4, 19, 49, .06) 38%, rgba(4, 19, 49, .08) 100%);
}

#loginView .portal-login-visual-copy {
    position: absolute;
    z-index: 2;
    top: 38px;
    left: 42px;
    max-width: 470px;
    color: #fff;
}

#loginView .portal-login-visual-copy > span {
    display: block;
    margin-bottom: 10px;
    color: #f0cd68;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
}

#loginView .portal-login-visual-copy h2 {
    margin: 0 0 10px;
    max-width: 460px;
    color: #fff;
    font-size: clamp(34px, 3.4vw, 58px);
    line-height: 1.02;
    letter-spacing: -.045em;
    font-weight: 750;
}

#loginView .portal-login-visual-copy p {
    margin: 0;
    max-width: 410px;
    color: rgba(255,255,255,.82);
    font-size: 14px;
    line-height: 1.55;
}

@media (max-width: 1050px) {
    #loginView.portal-login {
        padding: 14px !important;
        align-items: flex-start;
    }

    #loginView .portal-login-shell {
        width: calc(100vw - 28px) !important;
        height: auto;
        min-height: 0;
        grid-template-columns: 1fr !important;
        padding: 14px;
        border-radius: 24px;
    }

    #loginView .portal-login-visual-panel {
        order: 1;
        height: 360px;
        border-radius: 18px;
    }

    #loginView .portal-login-form-panel {
        order: 2;
        padding: 30px 26px;
    }

    #loginView .portal-login-form-inner {
        max-width: 520px;
    }

    #loginView .portal-login-visual-copy {
        top: 28px;
        left: 30px;
        max-width: 420px;
    }

    #loginView .portal-login-visual-copy h2 {
        font-size: 40px;
    }
}

@media (max-width: 600px) {
    body[data-role="login"] {
        background: #fff;
    }

    #loginView.portal-login {
        padding: 0 !important;
        background: #fff;
    }

    #loginView .portal-login-shell {
        width: 100vw !important;
        padding: 0;
        gap: 0;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    #loginView .portal-login-visual-panel {
        height: 235px;
        border-radius: 0;
    }

    #loginView .portal-login-visual-copy {
        top: 22px;
        left: 20px;
        right: 20px;
    }

    #loginView .portal-login-visual-copy > span {
        margin-bottom: 7px;
        font-size: 9px;
    }

    #loginView .portal-login-visual-copy h2 {
        max-width: 320px;
        margin-bottom: 7px;
        font-size: 29px;
    }

    #loginView .portal-login-visual-copy p {
        max-width: 320px;
        font-size: 11px;
    }

    #loginView .portal-login-form-panel {
        padding: 28px 22px 34px;
        border-radius: 0;
    }

    #loginView .portal-login-brand {
        min-height: 56px;
        margin-bottom: 22px;
    }

    #loginView .portal-login-logo {
        width: 190px !important;
        height: 56px !important;
        max-height: 56px !important;
    }

    #loginView .portal-login-heading {
        margin-bottom: 22px;
    }

    #loginView .portal-login-heading h1 {
        font-size: 34px;
    }

}

/* Dashboard activity: readable context instead of raw UUID references. */
.dashboard-activity-list {
    max-height: 360px;
    overflow-y: auto;
}
.dashboard-activity-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border-top: 1px solid #eee8de;
}
.dashboard-activity-row:first-child { border-top: 0; }
.dashboard-activity-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #f7f0dc;
    color: #8a6509;
    font-size: 15px;
}
.dashboard-activity-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dashboard-activity-copy b {
    font-size: 11px;
    color: #6d655a;
    font-weight: 700;
}
.dashboard-activity-copy strong {
    font-size: 12px;
    color: var(--lg-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dashboard-activity-copy span {
    font-size: 10px;
    color: var(--lg-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dashboard-activity-row time {
    min-width: 72px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    color: #4f4a43;
    font-size: 10px;
    font-weight: 700;
}
.dashboard-activity-row time small {
    color: var(--lg-muted);
    font-size: 9px;
    font-weight: 600;
}
.admin-self-label { color: #8a6509; font-weight: 800; }

@media (max-width: 560px) {
    .dashboard-activity-row {
        grid-template-columns: 34px minmax(0, 1fr);
    }
    .dashboard-activity-row time {
        grid-column: 2;
        align-items: flex-start;
        flex-direction: row;
        gap: 5px;
    }
}

/* Administrators: profile photo uploader in create/edit modal */
.mini-avatar {
    overflow: hidden;
}
.mini-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.admin-user-photo-field {
    margin-bottom: 18px;
}
.admin-user-photo-label {
    display: block;
    margin-bottom: 7px;
    font-size: 12px;
    font-weight: 750;
    color: #3f392f;
}
.admin-user-photo-dropzone {
    position: relative;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 104px;
    padding: 13px 14px;
    border: 1.5px dashed #cfbf96;
    border-radius: 14px;
    background: #fbf8f1;
    cursor: pointer;
    transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease;
    outline: none;
}
.admin-user-photo-dropzone:hover,
.admin-user-photo-dropzone:focus-visible {
    border-color: #b28a26;
    background: #fffaf0;
    box-shadow: 0 0 0 3px rgba(201, 146, 9, .09);
}
.admin-user-photo-dropzone.is-dragging {
    border-color: var(--lg-gold);
    background: #fff7df;
    box-shadow: 0 0 0 4px rgba(201, 146, 9, .11);
    transform: translateY(-1px);
}
.admin-user-photo-preview {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    overflow: hidden;
    display: grid;
    place-items: center;
    flex: 0 0 76px;
    background: linear-gradient(145deg, #f1e6be, #ddc36d);
    color: #6f5208;
    font-size: 22px;
    font-weight: 900;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px #d9cfbe, 0 8px 18px rgba(40, 31, 13, .10);
}
.admin-user-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.admin-user-photo-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.admin-user-photo-copy strong {
    font-size: 12px;
    color: #302b24;
}
.admin-user-photo-copy span {
    font-size: 11px;
    color: #756c5f;
}
.admin-user-photo-copy small {
    margin-top: 3px;
    font-size: 10px;
    color: #9a9184;
}
.admin-user-photo-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    min-width: 105px;
}
.admin-user-photo-select {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 9px;
    font-size: 10px;
    font-weight: 750;
    white-space: nowrap;
    pointer-events: none;
}
.admin-user-photo-remove {
    min-height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #8d4b45;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 750;
    cursor: pointer;
}
.admin-user-photo-remove:hover {
    background: #fff0ee;
    color: #773b36;
}
.admin-user-photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.admin-user-photo-error {
    margin-top: 6px;
    color: #973f3f;
    font-size: 10px;
    font-weight: 650;
}
.admin-user-form-grid {
    padding-top: 2px;
}

@media (max-width: 640px) {
    .admin-user-photo-dropzone {
        grid-template-columns: 64px minmax(0, 1fr);
        gap: 12px;
        padding: 12px;
    }
    .admin-user-photo-preview {
        width: 64px;
        height: 64px;
        flex-basis: 64px;
        font-size: 19px;
    }
    .admin-user-photo-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        padding-left: 76px;
    }
    .admin-user-photo-select,
    .admin-user-photo-remove {
        flex: 1 1 0;
    }
}


/* Destructive admin-user confirmation */
.table-action-menu .table-action-danger { color: #9b3737; }
.table-action-menu .table-action-danger i { color: #b14b4b; }
.table-action-menu .table-action-danger:hover { background: #fff1f1; color: #842d2d; }
.btn.danger-solid {
    background: #a83f3f;
    border-color: #a83f3f;
    color: #fff;
}
.btn.danger-solid:hover,
.btn.danger-solid:focus-visible { background: #8e3030 !important; border-color: #8e3030 !important; color: #fff !important; }
.admin-delete-confirm { padding: 2px 0 4px; }
.admin-delete-icon {
    width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
    background: #fff0f0; color: #a83f3f; font-size: 24px; margin-bottom: 14px;
}
.admin-delete-copy h4 { margin: 0 0 6px; font-size: 17px; }
.admin-delete-copy p { margin: 0; color: var(--lg-muted); font-size: 12px; line-height: 1.55; }
.admin-delete-user {
    margin-top: 16px; padding: 12px; border: 1px solid var(--lg-line); border-radius: 12px;
    display: flex; align-items: center; gap: 11px; background: #fbfaf8;
}
.admin-delete-avatar {
    width: 42px; height: 42px; flex: 0 0 42px; border-radius: 50%; overflow: hidden;
    display: grid; place-items: center; background: #eadcae; color: #775600; font-weight: 900;
}
.admin-delete-avatar img { width: 100%; height: 100%; object-fit: cover; }
.admin-delete-user > div:last-child { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.admin-delete-user strong { font-size: 12px; }
.admin-delete-user span { font-size: 10px; color: var(--lg-muted); overflow-wrap: anywhere; }
.admin-delete-warning {
    margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fff7e4; color: #7d5c12;
    display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 650;
}

/* Client profile */
.client-name-link { color: inherit; text-decoration: none; }
.client-name-link:hover { color: #8b670d; }
.client-profile-head { align-items: center; }
.client-profile-heading { display: flex; align-items: center; gap: 13px; min-width: 0; }
.client-back-link {
    width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid var(--lg-line); border-radius: 10px;
    display: grid; place-items: center; text-decoration: none; background: #fff;
}
.client-profile-avatar {
    width: 54px; height: 54px; flex: 0 0 54px; border-radius: 15px; display: grid; place-items: center;
    background: #f1e5bd; color: #7b5900; font-size: 20px; font-weight: 900;
}
.client-profile-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.client-profile-title-row h1 { margin: 0; }
.client-profile-heading p { margin: 4px 0 0; color: var(--lg-muted); font-size: 11px; }
.client-profile-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin-bottom: 12px; }
.client-profile-stat {
    position: relative; min-height: 100px; padding: 18px; border: 1px solid var(--lg-line); border-radius: 14px; background: #fff;
    display: flex; flex-direction: column; justify-content: center; overflow: hidden;
}
.client-profile-stat span { color: var(--lg-muted); font-size: 11px; }
.client-profile-stat strong { margin-top: 6px; font-size: 24px; letter-spacing: -.03em; }
.client-profile-stat > i { position: absolute; right: 15px; top: 15px; font-size: 21px; color: #b78b1d; opacity: .72; }
.client-profile-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 12px; margin-bottom: 12px; }
.client-profile-data-card, .client-profile-quick-card { min-width: 0; }
.client-data-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--lg-line); }
.client-data-list > div { background: #fff; padding: 13px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.client-data-list > div.full { grid-column: 1 / -1; }
.client-data-list span { font-size: 10px; color: var(--lg-muted); }
.client-data-list strong { font-size: 12px; overflow-wrap: anywhere; }
.client-quick-actions { display: grid; gap: 1px; background: var(--lg-line); }
.client-quick-actions > a, .client-quick-actions > button {
    border: 0; background: #fff; padding: 13px 15px; display: grid; grid-template-columns: 36px minmax(0,1fr) 18px; gap: 10px;
    align-items: center; text-align: left; text-decoration: none; color: inherit;
}
.client-quick-actions > a:hover, .client-quick-actions > button:hover { background: #faf7f0; }
.client-quick-actions > a > i:first-child, .client-quick-actions > button > i:first-child {
    width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #f5ecd0; color: #89640c;
}
.client-quick-actions > a > div, .client-quick-actions > button > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.client-quick-actions strong { font-size: 11px; }
.client-quick-actions span { color: var(--lg-muted); font-size: 9px; }
.client-quick-actions > a > i:last-child, .client-quick-actions > button > i:last-child { color: #aaa196; }
.client-profile-section { margin-bottom: 12px; }
.btn-small { min-height: 30px; padding: 5px 9px; font-size: 10px; }
.client-profile-grid-bottom { grid-template-columns: 1fr 1fr; }
.client-profile-list { display: grid; }
.client-profile-list-row {
    min-height: 62px; padding: 11px 15px; border-top: 1px solid #eee8dd; display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: 10px; align-items: center;
}
.client-profile-list-row:first-child { border-top: 0; }
.client-profile-list-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #f5ecd0; color: #8a650d; }
.client-profile-list-row > div:nth-child(2) { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.client-profile-list-row strong { font-size: 11px; }
.client-profile-list-row span { color: var(--lg-muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-profile-list-row > a { color: #7b5a0d; }
.client-profile-empty { padding: 24px; text-align: center; color: var(--lg-muted); font-size: 11px; }

@media (max-width: 1000px) {
    .client-profile-stats { grid-template-columns: 1fr 1fr; }
    .client-profile-grid, .client-profile-grid-bottom { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .client-profile-head { align-items: stretch; }
    .client-profile-heading { align-items: flex-start; }
    .client-profile-stats { gap: 8px; }
    .client-profile-stat { min-height: 84px; padding: 14px; }
    .client-profile-stat strong { font-size: 19px; }
    .client-data-list { grid-template-columns: 1fr; }
    .client-data-list > div.full { grid-column: auto; }
}

/* Application footer */
.app-footer {
    margin-top: auto;
    color: #7b7469;
    font-size: 10px;
}

.app-footer-inner {
    width: 100%;
    min-height: 44px;
    padding: 14px 0 4px;
    border-top: 1px solid #e2dacd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.app-footer-powered {
    white-space: nowrap;
}

.app-footer a {
    color: #16163f;
    font-weight: 800;
    text-decoration: none;
    transition: color .15s ease;
}

.app-footer a:hover,
.app-footer a:focus-visible {
    color: #9d6f00;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.route-admin .route-main {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 68px);
}

.route-admin .route-main > .app-footer {
    margin-top: 34px;
}

.route-client {
    display: flex;
    flex-direction: column;
}

.route-client .client-main-v3 {
    width: 100%;
    flex: 1 0 auto;
}

.route-client > .app-footer {
    width: min(1220px, calc(100% - 44px));
    margin: 8px auto 0;
    padding-bottom: 14px;
}

@media (max-width: 820px) {
    .route-admin .route-main {
        min-height: calc(100vh - 62px);
    }

    .route-admin .route-main > .app-footer {
        margin-top: 28px;
        padding-bottom: 8px;
    }

    .route-client > .app-footer {
        width: calc(100% - 28px);
        padding-bottom: 10px;
    }
}

@media (max-width: 560px) {
    .app-footer-inner {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
        padding-top: 12px;
    }

    .app-footer-powered {
        white-space: normal;
    }
}

/* Footer layout fix: keep it at the bottom of the viewport on short pages
   and after the content on long pages, without overlaying content. */
.route-admin {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.route-admin > .layout {
    flex: 1 0 auto;
    min-height: 0;
}

.route-admin .route-main {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.route-admin .route-main > .app-footer {
    margin-top: auto !important;
    padding-top: 30px;
    flex: 0 0 auto;
}

.route-client {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.route-client .client-main-v3 {
    flex: 1 0 auto;
}

.route-client > .app-footer {
    margin-top: auto !important;
    flex: 0 0 auto;
}

@media (max-width: 820px) {
    .route-admin .route-main {
        min-height: calc(100vh - 62px);
    }

    .route-admin .route-main > .app-footer {
        margin-top: auto !important;
    }

    .route-client > .app-footer {
        margin-top: auto !important;
    }
}

/* =============================================================
   Footer final: fixed to the real viewport bottom.
   Reserve content space so it never overlays tables/forms.
   ============================================================= */
:root {
    --app-footer-height: 58px;
}

.route-admin .route-main {
    min-height: calc(100dvh - 68px) !important;
    padding-bottom: calc(48px + var(--app-footer-height)) !important;
}

.route-admin .route-main > .app-footer {
    position: fixed;
    left: 238px;
    right: 0;
    bottom: 0;
    z-index: 25;
    height: var(--app-footer-height);
    margin: 0 !important;
    padding: 0 30px;
    background: rgba(246, 243, 237, .98);
    border-top: 1px solid #e2dacd;
    backdrop-filter: blur(10px);
}

.route-admin .route-main > .app-footer .app-footer-inner {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    border-top: 0;
}

.route-client .client-main-v3 {
    padding-bottom: calc(28px + var(--app-footer-height)) !important;
}

.route-client > .app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    width: 100% !important;
    height: var(--app-footer-height);
    margin: 0 !important;
    padding: 0 22px !important;
    background: rgba(246, 243, 237, .98);
    border-top: 1px solid #e2dacd;
    backdrop-filter: blur(10px);
}

.route-client > .app-footer .app-footer-inner {
    width: min(1220px, 100%);
    height: 100%;
    min-height: 0;
    margin: 0 auto;
    padding: 0;
    border-top: 0;
}

@media (max-width: 820px) {
    :root {
        --app-footer-height: 62px;
    }

    .route-admin .route-main {
        min-height: calc(100dvh - 62px) !important;
        padding-bottom: calc(16px + var(--app-footer-height)) !important;
    }

    .route-admin .route-main > .app-footer {
        left: 0;
        padding: 0 16px;
    }

    .route-client .client-main-v3 {
        padding-bottom: calc(14px + var(--app-footer-height)) !important;
    }

    .route-client > .app-footer {
        padding: 0 14px !important;
    }
}

@media (max-width: 560px) {
    :root {
        --app-footer-height: 76px;
    }

    .app-footer-inner {
        height: 100%;
        justify-content: center;
        gap: 3px;
        padding: 0 !important;
    }

    .route-admin .route-main,
    .route-client .client-main-v3 {
        padding-bottom: calc(18px + var(--app-footer-height)) !important;
    }
}


/* Client login: compact shortcut to the administrative login. */
#loginView .portal-login-admin-access {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

#loginView .portal-login-admin-access-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #ded7cc;
    border-radius: 9px;
    background: #fff;
    color: #575065;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

#loginView .portal-login-admin-access-btn:hover,
#loginView .portal-login-admin-access-btn:focus-visible {
    background: #f7f4ee;
    border-color: #cfc5b5;
    color: #16163f;
}

#loginView .portal-login-admin-access-btn i {
    font-size: 13px;
}
