/* public/portal/css/portal.css – Vollständig mit Auth-Wrap und Seller-Auswahl */
/* ================================================================
   1. RESET & BASIS
   ================================================================ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --brand-color: #4361ee;
    --brand-color-dark: #2d4ae0;
    --brand-color-bg: #eef1fd;
    --brand-secondary: #3f37c9;

    --primary: var(--brand-color);
    --primary-light: #4895ef;
    --secondary: #3a0ca3;
    --success: #2d9d78;
    --success-bg: #e6f4f0;
    --warning: #d97706;
    --warning-bg: #fef3c7;
    --danger: #e03e3e;
    --danger-bg: #fdecea;
    --gray: #6c757d;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --light: #f5f7fa;
    --white: #fff;
    --dark: #212529;
    --border: #e9ecef;

    --font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "DM Mono", monospace;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

img {
    max-width: 100%;
    display: block;
}
a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ================================================================
   2. PORTAL WRAP – voller Viewport, Flex-Container
   ================================================================ */
.portal-wrap {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
}

/* ================================================================
   3. TOPBAR (Header)
   ================================================================ */
.portal-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.portal-header .topbar-brand {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--brand-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.portal-header .topbar-seller {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 8px;
}

.portal-header .topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ================================================================
   4. PORTAL MAIN – zentriert bei Auth
   ================================================================ */
.portal-main {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

/* Auth-Seite: volle Zentrierung */
.portal-main.auth-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: none;
    padding: 20px;
    margin: 0;
}

/* ================================================================
   5. BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--brand-color-dark);
}
.btn-outline {
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover {
    background: rgba(67, 97, 238, 0.06);
}
.btn-ghost {
    background: #fff;
    color: var(--gray);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--light);
}
.btn-danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn-danger:hover {
    background: var(--danger-bg);
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ================================================================
   6. STATES (Loading, No Auth, Seller Selection, Main)
   ================================================================ */
.state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 55vh;
    gap: 14px;
    text-align: center;
    padding: 32px 20px;
    width: 100%;
}
.state.active {
    display: flex;
}
.state h2 {
    font-size: 1.0625rem;
    color: var(--gray-800);
}
.state p {
    color: var(--gray);
    max-width: 340px;
    font-size: 0.8125rem;
    line-height: 1.6;
}
.state-icon {
    font-size: 2.25rem;
    opacity: 0.35;
}

.spinner-big {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(67, 97, 238, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================================
   7. AUTH CARD
   ================================================================ */
.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    margin: 0 auto;
}

.auth-head {
    padding: 24px 24px 0;
}
.auth-head h1 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 2px;
}
.auth-head p {
    font-size: 0.75rem;
    color: var(--gray);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin: 16px 0 0;
}
.auth-tab {
    flex: 1;
    padding: 9px;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--gray);
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
a.auth-tab {
    text-decoration: none;
}
a.auth-tab:hover {
    text-decoration: none;
}

.auth-body {
    padding: 20px 24px 24px;
}
.auth-panel {
    display: none;
}
.auth-panel.active {
    display: block;
}

/* ── Formulare ── */
.form-group {
    margin-bottom: 13px;
}
.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.form-control {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    outline: none;
    transition: border-color 0.15s;
    background: #fff;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.form-control[readonly] {
    background: var(--gray-100);
    color: var(--gray);
    cursor: not-allowed;
}

.form-hint {
    font-size: 0.6875rem;
    color: var(--gray);
    margin-top: 3px;
}

/* ── Passwort-Eye ── */
.pw-wrap {
    position: relative;
}
.pw-wrap input {
    padding-right: 38px;
}
.pw-eye {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray);
    padding: 4px;
    font-size: 0.8125rem;
}
.pw-eye:hover {
    color: var(--gray-900);
}

/* ── Fehler / Erfolg ── */
.err-box {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.8125rem;
    display: none;
}
.err-box.show {
    display: block;
}
.ok-box {
    background: var(--success-bg);
    color: var(--success);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    font-size: 0.8125rem;
    display: none;
}
.ok-box.show {
    display: block;
}

/* ── Passwort-Regeln ── */
.pw-rules {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.pw-rule {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6875rem;
    color: var(--gray);
    transition: color 0.15s;
}
.pw-rule.ok {
    color: var(--success);
}
.pw-rule .rule-icon {
    font-size: 0.625rem;
    width: 12px;
    text-align: center;
}

/* ── Divider ── */
.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0;
    color: var(--gray);
    font-size: 0.6875rem;
}
.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Link-Button ── */
.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.75rem;
    text-decoration: underline;
    padding: 0;
}
.link-btn:hover {
    color: var(--primary-dark);
}

/* ── Registrierung – Bestätigungs-View ── */
#reg-verify {
    text-align: center;
}
#reg-verify .fa-envelope {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 8px;
}

/* ================================================================
   8. SELLER SELECTION
   ================================================================ */
#st-seller-selection {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 50vh;
    padding: 20px 0;
    width: 100%;
}
#st-seller-selection[style*="display:flex"] {
    display: flex !important;
}

.seller-selection-header {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 16px;
    text-align: left;
}
.seller-selection-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.seller-selection-header h2 i {
    color: var(--brand-color, #4361ee);
}
.seller-selection-header p {
    color: var(--gray-600);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 12px;
}

.seller-search {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 16px;
}
.search-box {
    position: relative;
    width: 100%;
}
.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 0.875rem;
}
.search-box .search-input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background: #fff;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
    outline: none;
}
.search-box .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.search-box .search-input::placeholder {
    color: var(--gray-400);
}

.seller-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.seller-card {
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    background: #fff;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    position: relative;
    box-shadow:
        4px 0 0 var(--brand-color, #4361ee),
        -4px 0 0 var(--brand-color, #4361ee);
}
.seller-card:hover {
    transform: translateY(-2px);
    box-shadow:
        4px 0 0 var(--brand-color, #4361ee),
        -4px 0 0 var(--brand-color, #4361ee),
        0 4px 12px rgba(0, 0, 0, 0.08);
}
.seller-card:active {
    transform: scale(0.99);
}

.seller-card .seller-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}
.seller-card .seller-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-900);
}
.seller-card .seller-email {
    font-size: 0.85rem;
    color: var(--gray-500);
    word-break: break-all;
}

.seller-card .seller-stats {
    display: flex;
    gap: 12px;
    margin: 8px 0 4px;
    flex-wrap: wrap;
}
.seller-card .stat-badge {
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.seller-card .stat-badge.overdue {
    background: var(--danger-bg);
    color: var(--danger);
}
.seller-card .stat-badge.pending {
    background: var(--warning-bg);
    color: var(--warning);
}
.seller-card .stat-badge.paid {
    background: var(--success-bg);
    color: var(--success);
}

.seller-card .seller-open-amount {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--gray-200);
}

.seller-selection-hint {
    width: 100%;
    max-width: 800px;
    margin: 20px auto 0;
    font-size: 0.8rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--gray-50);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    justify-content: center;
}
.seller-selection-hint i {
    color: var(--primary);
}

/* ================================================================
   9. INVOICE – Rechnungsübersicht
   ================================================================ */
.analytics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--primary);
}
.stat-card.overdue {
    border-left-color: var(--danger);
}
.stat-card.promised {
    border-left-color: var(--warning);
}
.stat-card.paid {
    border-left-color: var(--success);
}
.stat-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray);
    margin-bottom: 3px;
}
.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}
.stat-sub {
    font-size: 0.6875rem;
    color: var(--gray);
    margin-top: 1px;
}

/* ── Tab Navigation ── */
.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}
.tab-btn {
    flex: 1;
    padding: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    color: var(--gray);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--brand-secondary);
}
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* ── Liste ── */
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.list-title {
    font-size: 0.875rem;
    font-weight: 600;
}
.sort-sel {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    background: #fff;
    cursor: pointer;
}

.inv-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.inv-card {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.inv-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.inv-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}
.inv-num {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--primary);
}
.inv-total {
    font-size: 0.9375rem;
    font-weight: 700;
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.6875rem;
    font-weight: 500;
}
.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}
.b-open {
    background: var(--gray-100);
    color: var(--gray-600);
}
.b-overdue {
    background: var(--danger-bg);
    color: var(--danger);
}
.b-promised {
    background: var(--warning-bg);
    color: var(--warning);
}
.b-dispute {
    background: var(--danger-bg);
    color: var(--danger);
}
.b-paid {
    background: var(--success-bg);
    color: var(--success);
}
.b-draft {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* ── Body ── */
.inv-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.inv-cell {
    padding: 9px 14px;
    border-right: 1px solid var(--border);
}
.inv-cell:last-child {
    border-right: none;
}
.inv-cell-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray);
    margin-bottom: 2px;
}
.inv-cell-val {
    font-size: 0.8125rem;
    font-weight: 500;
}
.days-red {
    color: var(--danger);
    font-weight: 600;
}

.inv-cell.seller-cell {
    white-space: normal;
    word-break: break-word;
}
.seller-name {
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.75rem;
}
.seller-email {
    font-size: 0.625rem;
    color: var(--gray);
}

/* ── Items Table ── */
.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}
.items-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    padding: 0 8px 10px;
    border-bottom: 1px solid var(--gray-200);
}
.items-table th:last-child,
.items-table td:last-child {
    text-align: right;
}
.items-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-800);
    vertical-align: top;
}
.items-table tfoot td {
    border-bottom: none;
    padding-top: 14px;
    font-size: 0.88rem;
    color: var(--gray-600);
}
.items-table tfoot tr.total td {
    font-weight: 600;
    font-size: 1rem;
    color: var(--gray-900);
    padding-top: 10px;
    border-top: 2px solid var(--gray-200);
}
.row-total td {
    font-weight: 700;
}

/* ── Foot ── */
.inv-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-top: 1px solid var(--border);
    background: #fafafa;
    flex-wrap: wrap;
}

.last-action {
    background: #f0f4ff;
    border-top: 1px solid var(--border);
    padding: 8px 14px;
    font-size: 0.75rem;
    color: var(--gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.last-action .details-btn {
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
    margin-left: 10px;
    white-space: nowrap;
}

/* ── History ── */
.history-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.history-filters select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.history-item {
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 14px;
}
.history-type {
    font-weight: 600;
    margin-bottom: 4px;
}
.history-detail {
    font-size: 0.75rem;
    color: var(--gray);
    line-height: 1.5;
}
.history-date {
    font-size: 0.6875rem;
    color: var(--gray-500);
}
.history-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
}
.history-footer .withdraw-btn {
    font-size: 0.72rem;
}

/* ── Account-Banner ── */
.account-banner {
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-top: 10px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.account-banner p {
    font-size: 0.75rem;
    color: var(--gray);
    margin: 4px 0 10px;
}

/* ================================================================
   10. MODALS
   ================================================================ */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(3px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
@media (min-width: 540px) {
    .modal-bg {
        align-items: center;
        padding: 20px;
    }
}
.modal-bg.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: #fff;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 460px;
    max-height: 90dvh;
    overflow-y: auto;
    padding: 22px;
    transform: translateY(20px);
    transition: transform 0.2s;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
@media (min-width: 540px) {
    .modal {
        border-radius: var(--radius-xl);
        transform: translateY(10px) scale(0.98);
    }
    .modal-bg.open .modal {
        transform: translateY(0) scale(1);
    }
}
.modal h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 14px;
}
.modal-x {
    float: right;
    background: none;
    border: none;
    font-size: 1.0625rem;
    cursor: pointer;
    color: var(--gray);
    margin-top: -3px;
}
.modal-x:hover {
    color: var(--gray-900);
}

/* ── Modal-Formulare ── */
.modal .form-group {
    margin-bottom: 12px;
}
.modal .form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 4px;
}
.modal .form-control {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    outline: none;
    transition: border-color 0.15s;
}
.modal .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}
.modal .form-hint {
    font-size: 0.6875rem;
    color: var(--gray);
    margin-top: 3px;
}
.cb-label {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 0.8125rem;
    cursor: pointer;
}
.cb-label input {
    margin-top: 2px;
    accent-color: var(--primary);
}
.modal .err-box {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 0.8125rem;
    display: none;
}
.modal .err-box.show {
    display: block;
}
.modal .ok-box {
    background: var(--success-bg);
    color: var(--success);
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    font-size: 0.8125rem;
    display: none;
}
.modal .ok-box.show {
    display: block;
}

/* ── Withdraw-Button ── */
.withdraw-btn {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.6875rem;
    margin-top: 6px;
}
.withdraw-btn:hover {
    background: var(--danger-bg);
}

/* ================================================================
   10a. SETTINGS MODAL
   ================================================================ */
.modal-settings {
    max-width: 500px;
}
.settings-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
}
.settings-row + .settings-row {
    border-top: 1px solid var(--border);
}
.settings-row-label {
    flex: 1;
    min-width: 0;
}
.settings-row-label strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 2px;
}
.settings-desc {
    display: block;
    font-size: 0.6875rem;
    color: var(--gray);
    line-height: 1.4;
}
.danger-text {
    color: var(--danger);
}
.settings-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}
.settings-delete-btn {
    flex-shrink: 0;
}

/* ── Toggle Switch ── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-300);
    border-radius: 22px;
    transition: background 0.2s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

.modal-small {
    max-width: 400px;
}

/* ================================================================
   11. SUCCESS / PAYMENT-SUCCESS
   ================================================================ */
.success-wrap {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}
.success-card {
    max-width: 460px;
    width: 100%;
    padding: 36px 28px 32px;
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    margin: 0 auto;
}
.success-card h1 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 16px 0 8px;
}
.success-card p {
    color: var(--gray-600);
    font-size: 0.95rem;
    line-height: 1.55;
}
.success-card .back-link {
    margin-top: 24px;
    display: inline-block;
    font-size: 0.9rem;
    color: var(--gray-500);
}
.success-card .back-link:hover {
    color: var(--gray-700);
}

.success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: var(--success-bg);
    color: var(--success);
    margin: 0 auto;
}

.icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.confetti-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    animation: confettiFall 0.9s var(--ease-out) forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(60px) rotate(360deg);
        opacity: 0;
    }
}

/* ── Payment-Success ── */
.fee-note {
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.75rem;
    color: var(--gray);
    margin: 16px 0;
    text-align: left;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.fee-note i {
    color: var(--primary);
    margin-top: 1px;
}
.invoice-ref {
    display: inline-block;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 20px;
}
.countdown {
    font-size: 0.8125rem;
    color: var(--gray);
    margin-top: 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.8125rem;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    text-align: left;
}
.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}
.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-left: 4px solid var(--warning);
}
.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-left: 4px solid var(--success);
}
.hidden {
    display: none !important;
}

/* ================================================================
   12. RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .portal-header {
        padding: 8px 16px;
        flex-wrap: wrap;
    }
    .portal-header .topbar-brand {
        font-size: 0.85rem;
    }
    .portal-header .topbar-seller {
        font-size: 0.75rem;
        order: 3;
        flex-basis: 100%;
        text-align: center;
        margin-top: 4px;
    }
    .portal-header .topbar-right {
        margin-left: 0;
    }

    .analytics {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .stat-card {
        padding: 12px;
    }
    .stat-value {
        font-size: 1.1rem;
    }
    .inv-body {
        grid-template-columns: repeat(2, 1fr);
    }
    .inv-cell {
        padding: 6px 10px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .seller-grid {
        max-width: 100%;
        padding: 0 8px;
    }
    .seller-card {
        padding: 16px 18px;
        box-shadow:
            3px 0 0 var(--brand-color, #4361ee),
            -3px 0 0 var(--brand-color, #4361ee);
    }
    .seller-card .seller-name {
        font-size: 0.95rem;
    }
    .seller-selection-header {
        padding: 0 8px;
    }
    .seller-selection-header h2 {
        font-size: 1.05rem;
    }
    .seller-selection-header p {
        font-size: 0.85rem;
    }
    .seller-search {
        padding: 0 8px;
    }
    .seller-selection-hint {
        margin: 16px 8px 0;
    }

    /* Auth */
    .portal-main.auth-wrap {
        padding: 16px;
    }
    .auth-card {
        max-width: 100%;
    }
    .auth-head {
        padding: 16px 16px 0;
    }
    .auth-body {
        padding: 16px;
    }
    .auth-tabs {
        flex-wrap: wrap;
    }
    .auth-tab {
        flex: 1 0 50%;
        font-size: 0.75rem;
        padding: 8px;
    }

    .modal {
        padding: 16px;
        max-width: 100%;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
    .modal-bg {
        align-items: flex-end;
    }
    .success-card {
        padding: 24px 20px;
    }
    .portal-main {
        padding: 16px 12px;
    }
}

@media (max-width: 480px) {
    .portal-header {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        text-align: center;
    }
    .portal-header .topbar-seller {
        order: 2;
    }
    .portal-header .topbar-right {
        justify-content: center;
        margin-left: 0;
        order: 3;
    }

    .analytics {
        grid-template-columns: 1fr 1fr;
    }
    .stat-card {
        padding: 10px;
    }
    .stat-value {
        font-size: 1rem;
    }
    .inv-head {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .inv-foot {
        flex-direction: column;
        align-items: stretch;
    }
    .inv-foot .btn {
        justify-content: center;
    }
    .list-header {
        flex-direction: column;
        align-items: stretch;
    }
    .list-header .sort-sel {
        width: 100%;
    }
    .tab-btn {
        font-size: 0.75rem;
        padding: 8px;
    }
    .seller-card {
        padding: 14px 16px;
        box-shadow:
            3px 0 0 var(--brand-color, #4361ee),
            -3px 0 0 var(--brand-color, #4361ee);
    }
    .seller-card .seller-stats {
        flex-direction: column;
        gap: 4px;
    }
    .seller-card .stat-badge {
        display: inline-block;
        width: fit-content;
    }
    .seller-selection-header h2 {
        font-size: 0.95rem;
    }
    .search-box .search-input {
        font-size: 0.8rem;
        padding: 8px 12px 8px 32px;
    }
    .search-box .search-icon {
        font-size: 0.75rem;
    }

    /* Auth */
    .portal-main.auth-wrap {
        padding: 12px;
    }
    .auth-card {
        border-radius: var(--radius-md);
    }
    .auth-tab {
        padding: 6px;
        font-size: 0.7rem;
    }
    .auth-body {
        padding: 12px;
    }
}
