/**
 * Shared styling for the signed-in surfaces: /account, /admin, /partner.
 *
 * Layers on top of styles.css and reuses its palette, .container, .btn and
 * .form-group rules rather than restating them.
 */

.portal {
    background: var(--background-alt);
    min-height: 70vh;
    padding: 2rem 0 4rem;
}

.portal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.portal-header h1 {
    margin: 0;
    font-size: 1.75rem;
}

.portal-header p {
    margin: 0.25rem 0 0;
    color: var(--text-light);
}

.portal-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Sign-in gate */
.gate {
    max-width: 420px;
    margin: 3rem auto;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 1px 3px var(--shadow);
}

.gate h1 {
    margin-top: 0;
    font-size: 1.5rem;
}

.gate p {
    color: var(--text-light);
}

.gate-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

.gate-divider::before,
.gate-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Cards and panels */
.panel {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

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

.panel-head .count {
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.6rem 1rem;
    font: inherit;
    font-size: 0.95rem;
    color: var(--text-light);
    cursor: pointer;
}

.tab:hover { color: var(--text-dark); }

.tab[aria-selected="true"] {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.tab .pill {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.5;
}

/* Stat tiles */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}

.stat .value {
    display: block;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat .label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-top: 0.2rem;
}

/* Tables */
.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody tr + tr td {
    border-top: 1px solid var(--border);
}

.data-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.data-table .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge-neutral { background: #f3f4f6; color: #4b5563; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warn    { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }

/* Review / order rows */
.review-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}

.review-item h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
}

.review-meta {
    color: var(--text-light);
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
}

.review-body {
    margin: 0 0 1rem;
    font-size: 0.92rem;
}

.review-body dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.2rem 1rem;
    margin: 0;
}

.review-body dt {
    color: var(--text-light);
    font-size: 0.82rem;
}

.review-body dd { margin: 0; }

.row-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-dark);
    cursor: pointer;
    font-family: inherit;
}

.btn-sm:hover:not(:disabled) { background: var(--background-alt); }
.btn-sm:disabled { opacity: 0.55; cursor: default; }
.btn-sm.primary { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.btn-sm.primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-sm.danger { border-color: var(--danger, #dc2626); color: var(--danger, #dc2626); }

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 1rem;
}

.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-dark);
    background: var(--background);
}

.form-group textarea { min-height: 5rem; resize: vertical; }

.form-group .field-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-light);
    font-weight: 400;
}

.form-status {
    margin: 1rem 0 0;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #f3f4f6;
    color: var(--text-dark);
}

.form-status.error { background: #fee2e2; color: #991b1b; }
.form-status.success { background: #d1fae5; color: #065f46; }

/* Packs */
.pack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.pack {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}

.pack h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.pack .qty { font-size: 2rem; font-weight: 700; color: var(--primary-color); }
.pack .qty small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; }
.pack .price { margin: 0.5rem 0 1rem; font-size: 1.1rem; }
.pack .unit { display: block; font-size: 0.78rem; color: var(--text-light); }

/* Misc */
.empty-note {
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 0;
    padding: 0.5rem 0;
}

.notice {
    padding: 0.85rem 1.1rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    background: #eff6ff;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.notice.warn { border-left-color: #d97706; background: #fffbeb; }

.duck-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.duck-list li {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.duck-list .name { font-weight: 600; display: block; }
.duck-list .meta { color: var(--text-light); font-size: 0.83rem; }

@media (max-width: 600px) {
    .portal-header { flex-direction: column; }
    .review-body dl { grid-template-columns: 1fr; }
    .review-body dt { margin-top: 0.4rem; }
}

/* Confirm-with-reason dialog */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 100;
}

.modal-card {
    background: var(--background);
    border-radius: 14px;
    padding: 1.5rem;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.modal-card h2 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
}

.modal-message {
    margin: 0 0 1rem;
    color: var(--text-light);
    font-size: 0.92rem;
}

.modal-actions {
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* Targeting summary chips on the wild-campaign table */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* Per-campaign numbers inside a partner's campaign card */
.campaign-stats {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.6rem;
    margin: 0 0 1rem;
}

.campaign-stats .stat { padding: 0.6rem 0.75rem; }
.campaign-stats .stat .value { font-size: 1.35rem; }
