/* ── PnL Owner Setup (FEAT-039) ──────────────────────────────────────────── */

.pnl-setup-wrapper {
    padding: 24px;
    max-width: 960px;
}

.pnl-setup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

body[data-theme="dark"] .pnl-setup-header {
    border-bottom-color: rgba(255,255,255,0.1);
}

.pnl-setup-title {
    font-weight: 700;
    font-size: 1.2rem;
}

.pnl-notification-area {
    margin-bottom: 12px;
}

/* ── Region headers (kept for backwards compat) ────────────────────────── */

.pnl-region-header {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6c757d;
    padding: 14px 4px 4px;
}

/* ── Name group headers (FEAT-041) ─────────────────────────────────────── */

.pnl-name-group-header {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    padding: 14px 4px 6px;
    margin-top: 4px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    margin-bottom: 8px;
}

body[data-theme="dark"] .pnl-name-group-header {
    border-bottom-color: rgba(255,255,255,0.1);
    color: #e8eaf0;
}

body[data-theme="light"] .pnl-name-group-header {
    color: #212529;
}

.pnl-group-chevron {
    font-size: 0.7rem;
    color: #6c757d;
    flex-shrink: 0;
}

.pnl-group-name {
    font-weight: 700;
}

.pnl-group-counts {
    font-size: 0.75rem;
    color: #f4a724;
    font-weight: 600;
    margin-left: 6px;
}

.pnl-name-group-body {
    padding-left: 12px;
}

/* ── Owner rows ────────────────────────────────────────────────────────── */

.pnl-owner-row {
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    margin-bottom: 6px;
    overflow: hidden;
}

body[data-theme="dark"] .pnl-owner-row {
    border-color: rgba(255,255,255,0.1);
    background: #1e2537;
}

body[data-theme="light"] .pnl-owner-row {
    background: #fff;
}

.pnl-owner-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
}

.pnl-owner-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    text-align: left;
    padding: 0;
    font-size: 0.9rem;
}

body[data-theme="dark"] .pnl-owner-toggle-btn { color: #e8eaf0; }
body[data-theme="light"] .pnl-owner-toggle-btn { color: #212529; }

.pnl-owner-toggle-btn:hover { text-decoration: underline; }

.pnl-chevron {
    font-size: 0.75rem;
    color: #6c757d;
    flex-shrink: 0;
}

.pnl-owner-name { font-weight: 600; }

.pnl-owner-summary {
    font-size: 0.8rem;
    color: #6c757d;
}

.pnl-owner-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* ── Expanded section ──────────────────────────────────────────────────── */

.pnl-owner-expanded {
    padding: 12px 16px 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

body[data-theme="dark"] .pnl-owner-expanded {
    border-top-color: rgba(255,255,255,0.08);
}

.pnl-assign-section {
    margin-bottom: 20px;
}

.pnl-assign-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

/* ── Assignment table ──────────────────────────────────────────────────── */

.pnl-assign-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.825rem;
}

.pnl-assign-table th {
    text-align: left;
    padding: 6px 8px;
    font-weight: 600;
    border-bottom: 2px solid rgba(0,0,0,0.1);
}

body[data-theme="dark"] .pnl-assign-table th {
    border-bottom-color: rgba(255,255,255,0.15);
    color: #adb5bd;
}

.pnl-assign-table td {
    padding: 6px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    vertical-align: middle;
}

body[data-theme="dark"] .pnl-assign-table td {
    border-bottom-color: rgba(255,255,255,0.06);
}

.pnl-assign-row-ended td {
    color: #6c757d;
    font-style: italic;
}

/* ── Status badges ─────────────────────────────────────────────────────── */

.pnl-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pnl-badge-active {
    background: rgba(25,135,84,0.15);
    color: #198754;
}

body[data-theme="dark"] .pnl-badge-active {
    background: rgba(25,135,84,0.25);
    color: #4dd48f;
}

.pnl-badge-ended {
    background: rgba(108,117,125,0.15);
    color: #6c757d;
}

/* ── Empty state ───────────────────────────────────────────────────────── */

.pnl-empty-state {
    text-align: center;
    color: #6c757d;
    padding: 40px;
    font-size: 0.9rem;
}

/* ── Owner counts ──────────────────────────────────────────────────────── */
.pnl-owner-counts {
    font-size: 0.75rem;
    color: #f4a724;
    font-weight: 600;
    margin-left: 6px;
}

/* ── Dark theme modals (default theme) ─────────────────────────────────── */
/* Targets ALL pnl modals: add/edit owner, deactivate, assign/close bus/route */

body:not([data-theme="light"]) .modal-content {
    background-color: #1e2537;
    border: 1px solid rgba(255,255,255,0.12);
    color: #e8eaf0;
    border-radius: 12px;
}

body:not([data-theme="light"]) .modal-header {
    background-color: #252d3d;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px 12px 0 0;
    padding: 16px 20px;
}

body:not([data-theme="light"]) .modal-title {
    color: #e8eaf0;
    font-weight: 700;
    font-size: 1rem;
}

body:not([data-theme="light"]) .modal-body {
    background-color: #1e2537;
    padding: 20px;
    color: #e8eaf0;
}

body:not([data-theme="light"]) .modal-footer {
    background-color: #1e2537;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-radius: 0 0 12px 12px;
    padding: 12px 20px;
}

body:not([data-theme="light"]) .modal-header .btn-close {
    filter: invert(1);
    opacity: 0.7;
}

body:not([data-theme="light"]) .modal-header .btn-close:hover {
    opacity: 1;
}

/* Form labels inside pnl modals */
body:not([data-theme="light"]) .modal .form-label {
    color: #adb5bd;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

/* Text inputs inside pnl modals */
body:not([data-theme="light"]) .modal .form-control {
    background-color: #131929 !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    color: #e8eaf0 !important;
    border-radius: 8px;
}

body:not([data-theme="light"]) .modal .form-control:focus {
    background-color: #131929 !important;
    border-color: #f4a724 !important;
    color: #e8eaf0 !important;
    box-shadow: 0 0 0 2px rgba(244,167,36,0.2);
}

body:not([data-theme="light"]) .modal .form-control::placeholder {
    color: rgba(255,255,255,0.3) !important;
}

/* Select dropdowns in pnl modals */
body:not([data-theme="light"]) .modal select.form-control,
body:not([data-theme="light"]) .modal select.form-select {
    background-color: #131929 !important;
    color: #e8eaf0 !important;
}

/* Help text / descriptions */
body:not([data-theme="light"]) .modal .form-text {
    color: #6c757d;
    font-size: 0.78rem;
}

/* Deactivate / warning modal */
body:not([data-theme="light"]) .modal p {
    color: #adb5bd;
    line-height: 1.6;
}

/* Light theme modal overrides */
body[data-theme="light"] .modal-content {
    background-color: #ffffff;
    color: #1a1f2e;
    border: 1px solid #dde1eb;
}

body[data-theme="light"] .modal-header {
    background-color: #f8f9fa;
    border-bottom-color: #dde1eb;
}

body[data-theme="light"] .modal-footer {
    border-top-color: #dde1eb;
}
