:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f3f4f6;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-border: rgba(255, 255, 255, 0.5);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --danger: #ef4444;
    --success: #16a34a;
    --field-bg: rgba(255, 255, 255, 0.88);
    --radius-sm: 12px;
    --radius-lg: 22px;
    --shadow-soft: 0 14px 40px rgba(49, 46, 129, 0.10);
}

[data-theme="dark"] {
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --bg-color: #111827;
    --surface: rgba(31, 41, 55, 0.7);
    --surface-border: rgba(75, 85, 99, 0.4);
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --field-bg: rgba(17, 24, 39, 0.82);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

body {
    background:
        radial-gradient(circle at 90% 5%, rgba(79, 70, 229, .14), transparent 28rem),
        radial-gradient(circle at 8% 90%, rgba(14, 165, 233, .10), transparent 26rem),
        var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    background: var(--surface);
    border: 1px solid var(--surface-border);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}
.theme-toggle:hover {
    transform: scale(1.1);
}

/* Pages */
.page {
    display: none;
    min-height: 100vh;
    width: 100%;
}
.page.active {
    display: flex;
}

/* Login Page */
#loginPage {
    align-items: center;
    justify-content: center;
}
.login-container {
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    text-align: center;
}
.logo h1 {
    margin: 1rem 0 2rem;
    color: var(--primary);
}
.logo i {
    font-size: 3rem;
    color: var(--primary);
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: right;
}
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.input-wrapper {
    position: relative;
}
.input-wrapper i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-wrapper input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--surface-border);
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    outline: none;
    transition: all 0.3s;
}
.input-wrapper input:focus {
    border-color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    width: 100%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-primary:hover {
    background: var(--primary-hover);
}

/* Dashboards */
.sidebar {
    width: 280px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    border-radius: 0 16px 16px 0;
    margin: 10px 0 10px 10px;
}
.logo-small {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
}
.nav-links {
    list-style: none;
    flex: 1;
}
.nav-links li {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
}
.nav-links li:hover, .nav-links li.active {
    background: var(--primary);
    color: white;
}
.btn-logout {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-logout:hover {
    background: var(--danger);
    color: white;
}

.content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}
.section {
    display: none;
    animation: fadeIn 0.4s ease;
}
.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}
.header-action .btn-primary {
    width: auto;
}

.table-container {
    overflow-x: auto;
    padding: 1rem;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 15px;
    text-align: right;
    border-bottom: 1px solid var(--surface-border);
}
.data-table th {
    color: var(--text-muted);
}

.balance-card {
    padding: 2rem;
    text-align: center;
    margin-top: 1rem;
}
.balance-card h3 {
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.balance-card .amount {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.modal.active {
    display: flex;
}
.modal-content {
    padding: 2rem;
    width: 100%;
    max-width: 500px;
}
.modal-content h3 {
    margin-bottom: 1.5rem;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 1.5rem;
}
.btn-secondary {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
}

/* Unified professional UI */
h1, h2, h3, .header-action {
    text-align: center;
}

.header-action {
    position: relative;
    justify-content: center;
    min-height: 48px;
    padding-inline: 180px;
}

.header-action h2 {
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    font-weight: 700;
    color: var(--text-main);
}

.header-action > .btn-primary {
    position: absolute;
    inset-inline-end: 0;
}

.content {
    max-width: 1500px;
    margin-inline: auto;
}

.section > .glass-panel:not(.table-container),
.modal-content,
.login-container {
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-soft);
}

.input-group {
    text-align: center;
    margin-bottom: 1.15rem;
}

.input-group label {
    text-align: center;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: .55rem;
}

.input-wrapper,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    width: 100%;
}

.input-wrapper input,
.input-wrapper select,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    min-height: 48px;
    padding: 11px 44px !important;
    border: 1px solid rgba(99, 102, 241, .22) !important;
    border-radius: var(--radius-sm) !important;
    background-color: var(--field-bg) !important;
    color: var(--text-main) !important;
    text-align: center !important;
    text-align-last: center;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .04);
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

select {
    cursor: pointer;
    appearance: auto;
}

select option {
    text-align: center;
    background: var(--bg-color);
    color: var(--text-main);
}

.input-wrapper input:focus,
.input-wrapper select:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .13);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    text-align: center;
    opacity: .8;
}

.input-wrapper i {
    z-index: 2;
}

.btn-primary,
.btn-secondary,
.btn-logout {
    min-height: 44px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    box-shadow: 0 5px 14px rgba(15, 23, 42, .08);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 20px rgba(15, 23, 42, .14);
}

.table-container {
    padding: .75rem;
    border-radius: var(--radius-lg);
}

.data-table {
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    text-align: center;
    vertical-align: middle;
    padding: 14px 12px;
}

.data-table th {
    background: rgba(79, 70, 229, .09);
    color: var(--primary);
    font-weight: 700;
    border-bottom: 2px solid rgba(79, 70, 229, .18);
}

.data-table th:first-child { border-radius: 0 14px 0 0; }
.data-table th:last-child { border-radius: 14px 0 0 0; }
.data-table tbody tr { transition: background .18s ease, transform .18s ease; }
.data-table tbody tr:hover { background: rgba(79, 70, 229, .055); }

.data-table td:last-child {
    min-width: 230px;
}

.data-table td button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 3px;
    min-width: 66px;
}

.sidebar {
    background: linear-gradient(180deg, var(--surface), rgba(79, 70, 229, .045));
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-soft);
}

.nav-links li {
    justify-content: center;
    text-align: center;
    font-weight: 600;
    border: 1px solid transparent;
}

.nav-links li:hover,
.nav-links li.active {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    box-shadow: 0 8px 18px rgba(79, 70, 229, .22);
}

.modal {
    padding: 18px;
    background: rgba(15, 23, 42, .64);
    backdrop-filter: blur(7px);
}

.modal-content {
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    background: var(--surface);
    animation: modalEnter .22s ease-out;
}

.modal-content h3 {
    color: var(--primary);
    font-size: 1.45rem;
}

.modal-actions {
    justify-content: center !important;
    flex-wrap: wrap;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    width: auto !important;
    min-width: 125px;
}

.balance-card {
    max-width: 760px;
    margin: 1rem auto;
    background: linear-gradient(135deg, var(--surface), rgba(99, 102, 241, .10));
}

@keyframes modalEnter {
    from { opacity: 0; transform: translateY(18px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 900px) {
    .page.active { flex-direction: column; }
    .sidebar {
        width: calc(100% - 20px);
        margin: 10px;
        padding: 1rem;
        border-radius: var(--radius-lg);
    }
    .logo-small { margin-bottom: .75rem; }
    .nav-links {
        display: flex;
        gap: 7px;
        overflow-x: auto;
        padding-bottom: 6px;
    }
    .nav-links li {
        flex: 0 0 auto;
        margin: 0;
        padding: 10px 14px;
    }
    .btn-logout { width: 100%; margin-top: 8px; }
    .content { width: 100%; padding: 1rem; }
}

@media (max-width: 640px) {
    .login-container { width: calc(100% - 24px); padding: 1.5rem; }
    .header-action {
        flex-direction: column;
        gap: 12px;
        padding-inline: 0;
    }
    .header-action > .btn-primary {
        position: static;
        width: 100%;
    }
    .data-table th, .data-table td { padding: 11px 9px; white-space: nowrap; }
    .modal-content { padding: 1.25rem; }
    .theme-toggle { width: 40px; height: 40px; top: 12px; left: 12px; }
}

/* Responsive vertical cards for manager pages */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(285px, 1fr));
    gap: 1.25rem;
    align-items: stretch;
}

.entity-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .72rem;
    min-width: 0;
    padding: 1.25rem;
    overflow: hidden;
    text-align: center;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .13), transparent 55%),
        var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.entity-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #06b6d4);
}

.entity-card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, .35);
    box-shadow: 0 20px 45px rgba(49, 46, 129, .15);
}

.card-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin: 0 auto .15rem;
    color: white;
    font-size: 1.3rem;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #06b6d4);
    box-shadow: 0 9px 20px rgba(79, 70, 229, .24);
}

.card-title {
    font-size: 1.28rem;
    font-weight: 800;
    color: var(--text-main);
}

.card-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .28rem;
    min-height: 67px;
    padding: .7rem .8rem;
    border: 1px solid rgba(99, 102, 241, .11);
    border-radius: 14px;
    background: rgba(99, 102, 241, .045);
}

.field-label {
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 700;
}

.field-value {
    max-width: 100%;
    color: var(--text-main);
    font-size: 1.02rem;
    overflow-wrap: anywhere;
}

.highlight-field {
    background: linear-gradient(135deg, rgba(79, 70, 229, .11), rgba(6, 182, 212, .08));
    border-color: rgba(79, 70, 229, .22);
}

.highlight-field .field-value {
    color: var(--primary);
    font-size: 1.23rem;
}

.danger-value { color: var(--danger); }

.currency-badge,
.status-badge {
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 70px;
    padding: 6px 13px;
    border-radius: 999px;
    font-weight: 800;
}

.currency-badge {
    color: var(--primary);
    background: rgba(79, 70, 229, .11);
}

.status-badge.is-active {
    color: var(--success);
    background: rgba(22, 163, 74, .11);
}

.status-badge.is-disabled {
    color: var(--danger);
    background: rgba(239, 68, 68, .11);
}

.card-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .5rem;
    margin-top: auto;
    padding-top: .35rem;
}

.card-actions button {
    min-width: 0;
    padding: 9px 6px !important;
}

.form-feature-card {
    position: relative;
    max-width: 650px;
    margin: 0 auto;
    padding: clamp(1.25rem, 4vw, 2.4rem);
    overflow: hidden;
}

.form-feature-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), #06b6d4);
}

.empty-state {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    gap: .75rem;
    min-height: 220px;
    padding: 2rem;
    color: var(--text-muted);
    text-align: center;
    border: 2px dashed rgba(99, 102, 241, .2);
    border-radius: var(--radius-lg);
    background: rgba(99, 102, 241, .035);
}

.empty-state i { font-size: 2.3rem; color: var(--primary); opacity: .65; }

@media (min-width: 1200px) {
    .cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .reports-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 700px) and (max-width: 1199px) {
    .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 699px) {
    .cards-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .entity-card { padding: 1rem; }
    .card-actions { grid-template-columns: 1fr; }
    .card-actions button { width: 100%; }
}

/* Delegate currency safes */
.delegate-safes-title {
    margin: 1.25rem 0 1.5rem;
}

.delegate-balances-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 920px;
    margin: 0 auto;
}

.delegate-safe-card {
    padding: clamp(1.2rem, 3vw, 1.8rem);
}

.delegate-safe-card .card-title {
    font-size: 1.45rem;
}

.delegate-safe-card .card-field {
    min-height: 78px;
}

.delegate-safe-card .field-value {
    font-size: 1.12rem;
}

.delegate-safe-card .highlight-field .field-value {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.usd-safe::before {
    background: linear-gradient(90deg, #059669, #22c55e);
}

.usd-safe .card-icon {
    background: linear-gradient(135deg, #047857, #22c55e);
    box-shadow: 0 9px 20px rgba(5, 150, 105, .24);
}

.usd-safe .currency-badge,
.usd-safe .highlight-field .field-value {
    color: #059669;
}

.usd-safe .currency-badge {
    background: rgba(5, 150, 105, .11);
}

.iqd-safe::before {
    background: linear-gradient(90deg, var(--primary), #06b6d4);
}

@media (max-width: 699px) {
    .delegate-balances-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Safes dashboard inspired by the supplied layout */
.section-heading p {
    margin-top: .35rem;
    color: var(--text-muted);
    font-weight: 500;
}

.safes-header,
.accounts-header {
    flex-direction: column;
    gap: 1rem;
    padding-inline: 0;
}

.safes-header > .btn-primary,
.accounts-header > .btn-primary {
    position: static;
    width: auto;
    min-width: 180px;
}
#safesTableBody {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.showcase-safe-card {
    gap: 1rem;
    padding: 1.55rem;
    min-height: 440px;
}

.showcase-safe-card::after {
    content: '';
    position: absolute;
    width: 230px;
    height: 230px;
    inset: -90px -70px auto auto;
    border-radius: 50%;
    background: rgba(99, 102, 241, .065);
    pointer-events: none;
}

.showcase-usd::after { background: rgba(20, 184, 166, .09); }

.safe-card-head {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 82px;
}

.safe-card-head .card-icon { margin: 0; }
.safe-identity { display: flex; flex-direction: column; align-items: flex-start; gap: .55rem; }
.safe-identity .card-title { font-size: 1.45rem; }

.safe-numbers-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.safe-numbers-row .card-field {
    min-height: 100px;
    background: rgba(255, 255, 255, .28);
}

.safe-remaining {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    min-height: 105px;
    margin-top: .25rem;
    padding: 1rem 1.25rem;
    color: white;
    border-radius: 16px;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    box-shadow: 0 13px 26px rgba(67, 56, 202, .24);
}

.showcase-usd .safe-remaining {
    background: linear-gradient(135deg, #0891b2, #14b8a6);
    box-shadow: 0 13px 26px rgba(13, 148, 136, .24);
}

.safe-remaining span { font-weight: 700; }
.safe-remaining strong { font-size: clamp(1.3rem, 2.5vw, 1.8rem); text-align: center; }
.safe-remaining i {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    font-size: 1.25rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, .22);
}

.safe-date {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    margin-top: auto;
    color: var(--text-muted);
    font-weight: 600;
}

.safe-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.4rem;
}

.summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    min-height: 190px;
    padding: 1.1rem;
    text-align: center;
    border: 1px solid rgba(99, 102, 241, .24);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-soft);
}

.summary-card > i { font-size: 1.45rem; color: var(--primary); }
.summary-card > span { color: var(--text-muted); font-weight: 700; }
.summary-card > strong { color: var(--primary); font-size: 1.7rem; }
.summary-card small { color: var(--text-muted); }
.dual-amount { display: flex; flex-direction: column; gap: .25rem; font-size: 1.08rem !important; }
.spent-summary { border-color: rgba(22, 163, 74, .28); }
.spent-summary > i, .spent-summary > strong { color: #16a34a; }
.total-summary { border-color: rgba(249, 115, 22, .30); }
.total-summary > i, .total-summary > strong { color: #ea580c; }
.remaining-summary { border-color: rgba(37, 99, 235, .30); }
.remaining-summary > i, .remaining-summary > strong { color: #2563eb; }

@media (max-width: 1100px) {
    .safe-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    #safesTableBody { grid-template-columns: minmax(0, 1fr); }
    .showcase-safe-card { min-height: 0; }
}

@media (max-width: 520px) {
    .safe-summary-grid { grid-template-columns: minmax(0, 1fr); }
    .safe-numbers-row { grid-template-columns: minmax(0, 1fr); }
    .safe-remaining { grid-template-columns: 1fr; justify-items: center; }
    .safe-card-head { align-items: flex-start; }
}

.delegate-summary-grid {
    max-width: 1100px;
    margin: 1.4rem auto 0;
}

.delegate-safe-card.showcase-safe-card {
    min-height: 370px;
}

.delegate-summary-grid .summary-card {
    min-height: 175px;
}

@media (max-width: 760px) {
    .delegate-safe-card.showcase-safe-card { min-height: 0; }
}

/* Delegate receipt cards */
.receipt-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; max-width: 760px; margin: 0 auto 1.4rem; }
.receipt-iqd-summary { border-color: rgba(79, 70, 229, .30); }
.receipt-usd-summary { border-color: rgba(5, 150, 105, .30); }
.receipt-usd-summary > i,
.receipt-usd-summary > strong { color: #059669; }
.receipt-cards-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.receipt-card { min-height: 350px; }
.receipt-card-head { display: flex; align-items: center; justify-content: space-between; }
.receipt-card-head .card-icon { margin: 0; }
.receipt-details-field { min-height: 92px; }
.receipt-amount-field { min-height: 92px; background: linear-gradient(135deg, rgba(79, 70, 229, .11), rgba(6, 182, 212, .08)); border-color: rgba(79, 70, 229, .22); }
.receipt-amount-field .field-value { color: var(--primary); font-size: 1.3rem; }
.receipt-date-field { min-height: 78px; }
.receipt-usd .receipt-amount-field .field-value { color: #059669; }
.receipt-usd::before { background: linear-gradient(90deg, #059669, #22c55e); }
.receipt-usd .card-icon { background: linear-gradient(135deg, #047857, #22c55e); }
@media (max-width: 1150px) { .receipt-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .receipt-summary-grid, .receipt-cards-grid { grid-template-columns: minmax(0, 1fr); } .receipt-card { min-height: 0; } }
/* Delegate expense cards */
.expense-cards-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.expense-card {
    min-height: 470px;
}

.expense-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.expense-card-head .card-icon { margin: 0; }

.expense-details-field {
    min-height: 92px;
}

.expense-amount {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 102px;
    padding: 1rem;
    color: white;
    border-radius: 16px;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    box-shadow: 0 12px 25px rgba(67, 56, 202, .22);
}

.expense-amount span { font-weight: 700; opacity: .9; }
.expense-amount strong { font-size: clamp(1.35rem, 2.5vw, 1.75rem); }

.expense-usd::before { background: linear-gradient(90deg, #059669, #22c55e); }
.expense-usd .card-icon { background: linear-gradient(135deg, #047857, #22c55e); }
.expense-usd .expense-amount {
    background: linear-gradient(135deg, #047857, #22c55e);
    box-shadow: 0 12px 25px rgba(5, 150, 105, .22);
}

.expense-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    max-width: 1000px;
    margin: 1.4rem auto 0;
}

.usd-expense-summary { border-color: rgba(5, 150, 105, .30); }
.usd-expense-summary > i,
.usd-expense-summary > strong { color: #059669; }

@media (max-width: 1150px) {
    .expense-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .expense-cards-grid,
    .expense-summary-grid { grid-template-columns: minmax(0, 1fr); }
    .receipt-card,
    .expense-card { min-height: 0; }
}

.voucher-print-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    width: 100%;
    margin-top: auto;
    padding: .78rem 1rem;
    color: #fff;
    font-family: inherit;
    font-weight: 800;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
    background: linear-gradient(135deg, #4338ca, #06b6d4);
    box-shadow: 0 9px 20px rgba(67, 56, 202, .2);
    transition: transform .2s ease, box-shadow .2s ease;
}
.voucher-print-btn:hover { transform: translateY(-2px); box-shadow: 0 13px 25px rgba(67, 56, 202, .28); }
.receipt-usd .voucher-print-btn,
.expense-usd .voucher-print-btn { background: linear-gradient(135deg, #047857, #22c55e); }
.company-logo-upload { display:grid; place-items:center; gap:.8rem; padding:1rem; border:1px dashed rgba(99,102,241,.28); border-radius:14px; background:rgba(99,102,241,.04); }
.company-logo-upload img { display:none; width:130px; height:130px; padding:.35rem; object-fit:contain; border:1px solid var(--surface-border); border-radius:16px; background:#fff; }
.company-logo-upload img.has-logo { display:block; }
.company-logo-upload input[type="file"] { width:100%; color:var(--text-main); }
.company-logo-upload small { color:var(--text-muted); text-align:center; }
.voucher-number-card { align-self:center; display:inline-flex; flex-direction:column; align-items:center; justify-content:center; gap:.2rem; min-width:130px; padding:.55rem 1rem; color:var(--primary); border:1px solid rgba(79,70,229,.28); border-radius:13px; background:rgba(79,70,229,.07); }
.voucher-number-card span { color:var(--text-muted); font-size:.76rem; font-weight:700; }
.voucher-number-card strong { font-size:1.2rem; letter-spacing:.12em; }
.receipt-usd .voucher-number-card,
.expense-usd .voucher-number-card { color:#059669; border-color:rgba(5,150,105,.28); background:rgba(5,150,105,.07); }
.settings-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.75rem; align-items:stretch; }
.settings-actions button { display:inline-flex; align-items:center; justify-content:center; gap:.5rem; width:100%; min-width:0; min-height:48px; margin:0; padding:.75rem .6rem; }
/* Mobile and tablet slide-out navigation */
.mobile-menu-toggle,
.mobile-menu-backdrop { display: none; }

@media (max-width: 1024px) {
    #managerDashboard.active,
    #delegateDashboard.active { display: block; }
    #managerDashboard .content,
    #delegateDashboard .content { padding-top: 5.5rem; }
    .mobile-menu-toggle {
        position: fixed; top: 16px; right: 16px; z-index: 1202;
        display: inline-flex; align-items: center; justify-content: center;
        width: 48px; height: 48px; padding: 0; color: #fff;
        font-size: 1.35rem; border: 0; border-radius: 12px;
        background: linear-gradient(135deg, var(--primary), #6366f1);
        box-shadow: 0 8px 22px rgba(79, 70, 229, .3); cursor: pointer;
    }
    .mobile-menu-toggle i { pointer-events: none; }
    #managerDashboard .sidebar,
    #delegateDashboard .sidebar {
        position: fixed; z-index: 1201; top: 0; right: 0; bottom: 0;
        width: min(310px, 86vw); height: 100dvh; margin: 0;
        padding: 5rem 1rem 1rem; border-radius: 0; overflow-y: auto;
        transform: translateX(105%); visibility: hidden;
        transition: transform .28s ease, visibility .28s ease;
    }
    #managerDashboard.mobile-menu-open .sidebar,
    #delegateDashboard.mobile-menu-open .sidebar { transform: translateX(0); visibility: visible; }
    #managerDashboard .nav-links,
    #delegateDashboard .nav-links { display: flex; flex-direction: column; gap: 7px; overflow: visible; }
    #managerDashboard .nav-links li,
    #delegateDashboard .nav-links li {
        width: 100%; flex: none; justify-content: flex-start; margin: 0;
    }
    .mobile-menu-backdrop {
        position: fixed; z-index: 1200; inset: 0; display: block;
        background: rgba(15, 23, 42, .55); opacity: 0; visibility: hidden;
        backdrop-filter: blur(2px); transition: opacity .28s ease, visibility .28s ease;
    }
    #managerDashboard.mobile-menu-open .mobile-menu-backdrop,
    #delegateDashboard.mobile-menu-open .mobile-menu-backdrop { opacity: 1; visibility: visible; }
}
/* Manager delegates balances */
.manager-delegate-filter { max-width: 620px; margin: 0 auto 1.5rem; padding: 1.25rem; }
.manager-delegate-filter .input-group { margin: 0; }
.manager-delegate-filter select {
    width: 100%; min-height: 48px; padding: .75rem 1rem;
    color: var(--text-main); border: 1px solid var(--surface-border);
    border-radius: 10px; background: var(--surface); font: inherit;
}
.presence-field { min-height: 68px; }
.presence-badge { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; text-align: center; font-size: .9rem; }
.presence-badge.is-online { color: #059669; }
.presence-badge.is-online i { font-size: .65rem; animation: presencePulse 1.8s infinite; }
.presence-badge.is-offline { color: var(--text-muted); }
@keyframes presencePulse { 50% { opacity: .35; transform: scale(.8); } }
.delegate-person-filter { max-width: 620px; margin: 0 auto 1.5rem; padding: 1.25rem; }
.delegate-person-filter .input-group { margin: 0; text-align: center; }
.delegate-person-filter label { display: block; margin-bottom: .65rem; font-weight: 700; }
.delegate-person-filter select { width: 100%; min-height: 48px; padding: .75rem 1rem; color: var(--text-main); border: 1px solid var(--surface-border); border-radius: 10px; background: var(--surface); font: inherit; text-align: center; text-align-last: center; }
.delegate-person-filter select option { text-align: center; direction: rtl; }
.person-vouchers-grid .empty-state { grid-column: 1 / -1; }
.person-expense-summary { margin: 0 auto 1.4rem; }
.vouchers-search-panel { max-width: 620px; margin: 0 auto 1.5rem; padding: 1.25rem; }
.vouchers-search-panel .input-group { margin: 0; text-align: center; }
.vouchers-search-panel label { display: block; margin-bottom: .65rem; font-weight: 700; }
.vouchers-grid .empty-state { grid-column: 1 / -1; }
.voucher-library-card { position: relative; }
.voucher-library-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.voucher-type-badge { padding: .45rem .8rem; color: #fff; border-radius: 999px; background: linear-gradient(135deg, var(--primary), var(--secondary)); font-weight: 700; }
.vouchers-grid.showing-print-preview { display: block; }
.voucher-print-preview {
    position: relative; width: min(100%, 720px); min-height: 900px; margin: 0 auto;
    padding: 42px 48px 70px; color: #111852; background: linear-gradient(145deg, #fff 0%, #fdfdff 70%, #f1efff 100%);
    border: 1px solid #d9dcef; border-radius: 4px; box-shadow: 0 18px 50px rgba(17,24,61,.2); overflow: hidden;
}
.preview-edge { position: absolute; top: 0; right: 0; left: 0; height: 18px; background: linear-gradient(90deg,#061b78 0 62%,#fff 62% 63%,#5940d6 63%); }
.preview-edge-bottom { top: auto; bottom: 0; transform: rotate(180deg); }
.preview-voucher-head { display: grid; grid-template-columns: 90px 1fr 125px; align-items: center; gap: 18px; text-align: center; }
.preview-logo { display: grid; place-items: center; width: 80px; height: 80px; margin: auto; color: #4338ca; font-size: 32px; border: 1px solid #d7dafa; border-radius: 50%; background: #fff; }
.preview-logo img { width: 100%; height: 100%; padding: 5px; object-fit: contain; border-radius: 50%; }
.preview-voucher-head h3 { margin: 0; color: #352ac6; font-size: 28px; }
.preview-voucher-head p { margin: 8px 0 0; }
.preview-serial { display: flex; flex-direction: column; gap: 5px; padding: 12px; border: 1px solid #4338ca; border-radius: 14px; background: #fff; }
.preview-serial b { color: #e11d2e; font-size: 20px; }
.preview-dashed-line { margin: 24px 0; border-top: 2px dashed #b8b9ee; }
.preview-date { display: flex; justify-content: center; gap: 30px; padding: 14px; border: 1px solid #3f46bb; border-radius: 12px; background: #fff; }
.preview-amount { margin: 25px 0; padding: 25px; text-align: center; color: #fff; border-radius: 16px; background: linear-gradient(120deg,#2523ad,#5949e6); }
.preview-amount span { display: block; font-weight: 800; }
.preview-amount strong { display: block; margin-top: 8px; font-size: 34px; }
.preview-amount small { font-size: 18px; }
.preview-details { position: relative; padding: 28px 22px 18px; border: 1px solid #3f46bb; border-radius: 14px; background: #fff; }
.preview-details h4 { position: absolute; top: -17px; right: 50%; transform: translateX(50%); margin: 0; padding: 8px 28px; color: #fff; border-radius: 8px; background: linear-gradient(135deg,#2523ad,#5949e6); }
.preview-details > div { display: grid; grid-template-columns: 145px 1fr; min-height: 48px; border-bottom: 1px solid #d5d8e7; }
.preview-details > div:last-child { border-bottom: 0; }
.preview-details span, .preview-details strong { display: grid; place-items: center; padding: 10px; text-align: center; }
.preview-details span { color: #20247e; border-left: 1px solid #d5d8e7; background: #fafaff; }
.preview-signatures { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 35px; margin-top: 55px; text-align: center; font-weight: 700; }
.preview-signatures span { padding-bottom: 30px; border-bottom: 1px dashed #8e94c7; }
.preview-print-button { display: flex; width: fit-content; margin: 35px auto 0; }
@media (max-width: 700px) {
    .voucher-print-preview { min-height: 720px; padding: 32px 18px 55px; }
    .preview-voucher-head { grid-template-columns: 60px 1fr 92px; gap: 8px; }
    .preview-logo { width: 55px; height: 55px; font-size: 22px; }
    .preview-voucher-head h3 { font-size: 18px; }
    .preview-serial { padding: 8px 4px; font-size: 12px; }
    .preview-serial b { font-size: 15px; }
    .preview-details > div { grid-template-columns: 100px 1fr; }
}
.logs-person-filter { max-width: 620px; margin: 0 auto 1.5rem; padding: 1.25rem; }
.logs-person-filter .input-group { margin: 0; text-align: center; }
.logs-person-filter label { display: block; margin-bottom: .65rem; font-weight: 700; }
.logs-person-filter select {
    width: 100%; min-height: 48px; padding: .75rem 1rem; color: var(--text-main);
    border: 1px solid var(--surface-border); border-radius: 10px;
    background: var(--surface); font: inherit; text-align: center;
}
.manager-delegate-balances .empty-state { grid-column: 1 / -1; }
.install-app-banner {
    position: fixed;
    z-index: 10000;
    right: 18px;
    bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: min(520px, calc(100vw - 36px));
    padding: 14px;
    color: #fff;
    background: linear-gradient(135deg, #312e81, #4f46e5);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 16px;
    box-shadow: 0 18px 45px rgba(30, 27, 75, .35);
}
.install-app-banner[hidden] { display: none !important; }
.install-app-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; font-size: 20px; background: rgba(255,255,255,.16); border-radius: 12px; }
.install-app-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 3px; }
.install-app-copy strong { font-size: 15px; }
.install-app-copy span { font-size: 12px; line-height: 1.5; opacity: .9; }
.install-app-banner .btn-primary { width: auto; white-space: nowrap; padding: 9px 14px; background: #fff; color: #312e81; }
.install-dismiss { padding: 7px; color: #fff; border: 0; background: transparent; cursor: pointer; }
.notification-banner { bottom: 104px; background: linear-gradient(135deg, #065f46, #059669); }
@media (max-width: 640px) {
    .install-app-banner { right: 10px; bottom: 10px; left: 10px; max-width: none; flex-wrap: wrap; }
    .install-app-copy { min-width: 180px; }
    .notification-banner { bottom: 126px; }
}
.notification-settings-card{margin-top:1.25rem;padding:1rem;border:1px solid var(--border);border-radius:14px;background:rgba(255,255,255,.45)}
.notification-setting-row{display:flex;align-items:center;justify-content:space-between;gap:1rem}.notification-setting-row>div{display:flex;flex-direction:column;gap:.35rem}.notification-setting-row strong{color:var(--primary)}.notification-setting-row span,.notification-settings-card small{font-size:.82rem;line-height:1.6;color:var(--text-muted)}
.settings-switch{position:relative;flex:0 0 52px;width:52px;height:29px;cursor:pointer}.settings-switch input{position:absolute;opacity:0;pointer-events:none}.settings-switch span{position:absolute;inset:0;border-radius:20px;background:#94a3b8;transition:.2s}.settings-switch span::after{content:"";position:absolute;top:4px;right:4px;width:21px;height:21px;border-radius:50%;background:#fff;transition:.2s;box-shadow:0 2px 5px rgba(0,0,0,.2)}.settings-switch input:checked+span{background:#16a34a}.settings-switch input:checked+span::after{transform:translateX(-23px)}.notification-device-actions{margin-top:1rem}.notification-settings-card small{display:block;margin-top:.75rem}
.delegate-settings-panel{max-width:620px;margin:auto;padding:2rem}.delegate-settings-panel>h3{margin-bottom:1rem;color:var(--primary)}.install-help{display:flex;flex-direction:column;gap:.45rem;margin-top:1rem;padding: .85rem;border-radius:10px;background:rgba(79,70,229,.08)}.install-help strong{color:var(--primary)}.install-help span{font-size:.82rem;line-height:1.65;color:var(--text-muted)}
@media(max-width:640px){.delegate-settings-panel{padding:1rem}.notification-setting-row{align-items:flex-start}.notification-device-actions{grid-template-columns:1fr}}
.account-panel form{display:grid;gap:.85rem}.account-panel .btn-primary{width:auto;justify-self:center;min-width:210px}.account-message{display:block;min-height:24px;text-align:center;font-weight:700}.account-message.success{color:#15803d}.account-message.error{color:#dc2626}.account-panel input[readonly]{opacity:.75;cursor:not-allowed}
.trash-card{border:1px solid rgba(220,38,38,.25)}.trash-card .card-icon{color:#dc2626;background:rgba(220,38,38,.1)}.danger-button{border-color:#dc2626!important;color:#dc2626!important}.trash-card .card-actions{display:flex;gap:.6rem;flex-wrap:wrap}

