:root {
    --bg:
        radial-gradient(circle at top left, rgba(244, 189, 96, 0.24), transparent 22%),
        radial-gradient(circle at top right, rgba(60, 92, 89, 0.18), transparent 20%),
        linear-gradient(180deg, #f5efe4 0%, #ebe3d2 48%, #e2d4bb 100%);
    --surface: rgba(255, 250, 242, 0.9);
    --surface-strong: #fffaf1;
    --dark: #17353c;
    --text: #11212d;
    --muted: #6f624e;
    --line: rgba(17, 33, 45, 0.12);
    --success: #2c8a63;
    --danger: #bd4d39;
    --warning: #b47734;
    --shadow: 0 18px 40px rgba(70, 53, 28, 0.08);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-width: 320px;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

a { color: inherit; text-decoration: none; }

.shell {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 18px 0 36px;
}
.shell--loading, .shell--error {
    min-height: 100vh;
    display: grid;
    place-items: center;
    text-align: center;
}

.panel, .summary-card, .op-card, .toast {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}
.eyebrow, .label, .summary-card p {
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .72rem;
    color: var(--muted);
    margin: 0 0 10px;
}
.summary-grid, .overview-grid, .op-grid, .form-grid, .triple-grid, .account-list {
    display: grid;
}
.summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) 1.35fr;
    gap: 14px;
    margin-top: 16px;
}
.summary-card {
    border-radius: 22px;
    padding: 18px;
}
.summary-card strong {
    display: block;
    font-size: 2rem;
    margin-bottom: 8px;
}
.summary-card span {
    color: #5f6d71;
    font-size: .8rem;
}

.summary-card--special {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(160deg, #17353c, #395a52);
}

.summary-card--warning {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-card--special strong,
.summary-card--special p,
.summary-card--special span {
    color: #f6ecde;
}

.summary-card--special span {
    opacity: .82;
}

.summary-card--special small {
    color: rgba(246, 236, 222, 0.76);
    font-size: .8rem;
}

.summary-rich {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #44545c;
    font-size: .86rem;
    line-height: 1.45;
}

.summary-rich b {
    color: var(--dark);
}

.summary-rich code {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(23, 53, 60, 0.08);
    font-family: inherit;
}

.summary-rich--light,
.summary-rich--light b,
.summary-rich--light code {
    color: #f6ecde;
}

.summary-rich--light code {
    background: rgba(255, 250, 242, 0.12);
}

.top-tabs {
    display: flex;
    gap: 10px;
    margin: 22px 0 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.top-tabs button, .btn {
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
    transition: transform .2s ease, background .2s ease, color .2s ease;
}
.top-tabs button {
    background: rgba(255, 250, 242, 0.72);
    color: #3f4a4c;
    white-space: nowrap;
}
.top-tabs button.active, .top-tabs button:hover {
    background: var(--dark);
    color: #f6ecde;
    transform: translateY(-1px);
}
.btn { font-weight: 700; }
.btn-success { background: var(--success); color: #f7fbf8; }
.btn-danger { background: var(--danger); color: #fff7f4; }
.btn-dark { background: var(--dark); color: #f6ecde; }
.btn-ghost { background: rgba(23,53,60,.08); color: var(--dark); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.panel-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.panel {
    border-radius: 24px;
    padding: 20px;
}
.panel--accent {
    background: linear-gradient(160deg, rgba(23,53,60,.94), rgba(57,90,82,.88));
    color: #f8f1e6;
}
.panel--warm {
    background: linear-gradient(160deg, rgba(180,119,52,.16), rgba(255,250,242,.9));
}
.title-row, .op-card-head, .account-toolbar, .card-actions, .inline-form, .tools {
    display: flex;
    gap: 10px;
}
.title-row, .op-card-head, .account-toolbar {
    justify-content: space-between;
    align-items: flex-start;
}
.title-row h2, .op-card h3 { margin: 0; }
.title-row span { color: #6a5a42; font-size: .86rem; }

.triple-grid, .form-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.form-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.triple-grid input, .triple-grid select, .form-grid input, .form-grid select, .inline-form input {
    width: 100%;
    border: 1px solid rgba(23,53,60,.12);
    border-radius: 16px;
    background: rgba(255,255,255,.74);
    padding: 14px 16px;
    color: var(--dark);
}
.toggle-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    color: #44545c;
}
.response-box {
    margin: 14px 0 0;
    padding: 14px;
    border-radius: 16px;
    overflow: auto;
    background: var(--dark);
    color: #f6ecde;
}

.op-card {
    border-radius: 24px;
    padding: 18px;
    background: rgba(255,253,248,.95);
}
.op-card--payout {
    background: linear-gradient(180deg, rgba(255,248,238,.96), rgba(250,238,226,.98));
}
.op-card.is-alert { border-color: rgba(189,77,57,.32); }
.amount-pill {
    align-self: flex-start;
    border-radius: 999px;
    padding: 10px 14px;
    background: rgba(44,138,99,.12);
    color: #236448;
    font-weight: 800;
}
.amount-pill--warn {
    background: rgba(180,119,52,.18);
    color: #8f5816;
}
.op-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}
.label { display: block; margin-bottom: 6px; }
.warning-box {
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(189,77,57,.1);
    color: #8f2d1b;
    margin-bottom: 14px;
}
.card-actions, .account-toolbar, .tools, .inline-form, .account-actions {
    flex-wrap: wrap;
}
.linkish {
    border: 0;
    background: transparent;
    padding: 0;
    color: #7b6644;
    text-align: left;
}
.linkish.strong, .op-grid strong, .account-card strong { color: var(--dark); }

.account-owner-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.account-owner-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.account-owner-head h2 {
    margin: 0;
    font-size: 1.1rem;
}

.account-owner-head span {
    color: #6a5a42;
    font-size: .86rem;
}

.account-owner-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.account-owner-head--interactive {
    cursor: pointer;
    transition: transform .18s ease, opacity .18s ease;
}

.account-owner-head--interactive:hover {
    transform: translateY(-1px);
}

.account-owner-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-bank-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(255,255,255,.42);
    border: 1px solid rgba(23,53,60,.08);
}

.account-bank-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.account-bank-head p {
    margin: 0;
    font-size: .92rem;
    font-weight: 800;
    color: var(--dark);
}

.account-bank-head span {
    color: #6a5a42;
    font-size: .8rem;
}

.account-bank-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.72);
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.account-row:hover {
    transform: translateY(-1px);
}

.account-row.is-busy {
    opacity: .7;
    pointer-events: none;
}

.account-row--active {
    background: rgba(44,138,99,.14);
    border-color: rgba(44,138,99,.3);
}

.account-row--passive {
    background: rgba(255,248,245,.82);
    border-color: rgba(189,77,57,.18);
}

.account-row--pool {
    background: rgba(255,255,255,.76);
}

.account-row__iban,
.account-row__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.account-row__iban {
    min-width: 0;
}

.account-row__iban strong {
    color: var(--dark);
}

.account-row__iban span {
    color: #5f6d71;
    white-space: nowrap;
}

.state-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: .78rem;
    font-weight: 800;
}
.state-badge--active { background: rgba(44,138,99,.12); color: #236448; }
.state-badge--passive { background: rgba(189,77,57,.12); color: #8f2d1b; }

.mini-action {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255,255,255,.82);
    color: var(--dark);
    font-weight: 800;
    font-size: .78rem;
}

.mini-action--active {
    background: rgba(44,138,99,.14);
    border-color: rgba(44,138,99,.28);
    color: #236448;
}

.mini-action--passive {
    background: rgba(189,77,57,.1);
    border-color: rgba(189,77,57,.2);
    color: #8f2d1b;
}

.mini-action--ghost {
    background: rgba(23,53,60,.06);
    border-color: rgba(23,53,60,.12);
    color: var(--dark);
}

.mini-action[disabled] {
    opacity: .55;
    cursor: not-allowed;
}
.empty {
    text-align: center;
    color: #6a5a42;
}
.account-switch {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
.account-switch button.active {
    background: var(--dark);
    color: #f6ecde;
}
.help-text { color: #6a5a42; font-size: .92rem; }

.report-card {
    background: linear-gradient(180deg, rgba(255, 252, 246, 0.96), rgba(247, 240, 227, 0.98));
}

.report-html {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    line-height: 1.65;
    color: #34454c;
    white-space: pre-line;
}

.report-html code {
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(23, 53, 60, 0.08);
    color: var(--dark);
    font-family: inherit;
    font-weight: 700;
}

.report-html b {
    color: var(--dark);
}

.text-action {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--dark);
    font-weight: 700;
}

.text-action[disabled] {
    opacity: .5;
    cursor: not-allowed;
}

.text-action--danger {
    color: #8f2d1b;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    border-radius: 999px;
    padding: 12px 18px;
    z-index: 50;
    color: #f6ecde;
    background: var(--dark);
}
.toast--error { background: #b7402a; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(17, 33, 45, 0.54);
    backdrop-filter: blur(8px);
}

.modal-card {
    width: min(520px, 100%);
    border-radius: 28px;
    padding: 24px;
    background: rgba(255, 250, 242, 0.98);
    border: 1px solid var(--line);
    box-shadow: 0 30px 70px rgba(17, 33, 45, 0.22);
}

.modal-card--danger {
    border-color: rgba(189, 77, 57, 0.28);
}

.modal-card--success {
    border-color: rgba(44, 138, 99, 0.26);
}

.modal-card h2 {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1.1;
}

.modal-text {
    margin: 14px 0 0;
    color: #4f5e66;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

@media (max-width: 960px) {
    .summary-grid, .overview-grid, .triple-grid, .form-grid, .op-grid {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 640px) {
    .shell { width: min(100%, calc(100% - 16px)); padding-top: 10px; }
    .panel, .summary-card, .op-card { border-radius: 20px; padding: 16px; }
    .op-card-head, .title-row, .account-row, .account-row__actions, .account-owner-head { flex-direction: column; align-items: stretch; }
    .card-actions .btn, .account-toolbar .btn, .tools .btn, .summary-card--special .btn { width: 100%; }
    .modal-card { border-radius: 22px; padding: 18px; }
    .modal-actions .btn { width: 100%; }
}
