body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f6f8fa;
    color: #1f2933;
}

header {
    display: flex;
    align-items: center;
    min-height: 48px;
    margin: 0;
    padding: 8px 16px;
    background: #0f3557;
    color: #fff;
}

header h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.2;
}

nav {
    padding: 10px 24px;
    background: #163f63;
}

nav a {
    margin-right: 18px;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

main {
    padding: 24px;
}

/* Cards */

.cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.card {
    min-width: 180px;
    padding: 18px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card h3 {
    margin-top: 0;
    font-size: 15px;
}

.card p {
    margin-bottom: 0;
    font-size: 28px;
    font-weight: 700;
}

/* Tables */

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 10px 12px;
    border-bottom: none;
}

th {
    background: #eef3f7;
}

.actions-col {
    text-align: right;
}

.manage-section {
    overflow-x: auto;
}

.manage-section table {
    width: 100%;
    border-collapse: collapse;
}

.manage-section table th,
.manage-section table td {
    text-align: left;
}

.manage-section table td {
    vertical-align: top;
}

.manage-section table tr {
    border-bottom: 1px solid #e2e8f0;
}

.manage-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 14px;
    line-height: 1.4;
}

.manage-table th,
.manage-table td {
    padding: 10px 12px;
    border-bottom: none;
    color: #1f2933;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    vertical-align: top;
}

.manage-table thead tr {
    border-bottom: 2px solid #cbd5e1;
}

.manage-table tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

.manage-table tbody tr:last-child {
    border-bottom: none;
}

.manage-table th {
    background: #eef3f7;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.manage-table a,
.manage-table .btn {
    font-size: 13px;
}

.manage-table .btn {
    line-height: 1.2;
}

.table-subtext {
    display: inline-block;
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
}

.table-text-long {
    max-width: 320px;
    white-space: normal;
}

.nowrap {
    white-space: nowrap;
}

/* Page header */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 5px;
    margin-bottom: 5px;
}

.page-header h2 {
    margin-bottom: 4px;
}

.page-header p {
    margin-top: 0;
    color: #64748b;
}

.page-actions a,
.row-actions a {
    display: inline-block;
    padding: 7px 10px;
    border-radius: 7px;
    background: #eef3f7;
    color: #0f3557;
    font-weight: 700;
    text-decoration: none;
}

.page-actions a {
    background: #0f3557;
    color: #fff;
}

.row-actions,
.manage-table .row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    width: 120px;
    min-width: 120px;
    padding-right: 12px;
    text-align: right;
    white-space: nowrap;
}

/* Forms */

.dealer-form {
    max-width: 1100px;
}

.dealer-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
}

.dealer-form input,
.dealer-form select,
.dealer-form textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    font-size: 15px;
}

.dealer-form textarea {
    resize: vertical;
}

.form-section {
    margin-bottom: 22px;
    padding: 22px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.form-section h3 {
    margin-top: 0;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.form-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.grid-2-wide {
    grid-template-columns: 1.2fr 1fr;
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: 1fr 1.3fr 1fr 80px;
}

.form-row {
    display: grid;
    gap: 12px;
}

.form-row-meta {
    grid-template-columns: repeat(4, 1fr);
    color: #64748b;
    font-size: 12px;
}

.form-row-core,
.form-row-supplemental {
    grid-template-columns: 1fr 1fr;
}

.form-row-schedule {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.form-actions button {
    padding: 11px 18px;
    border: none;
    border-radius: 7px;
    background: #0f3557;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.form-actions button:hover {
    background: #163f63;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    padding: 0 10px;
    line-height: 1;
    box-sizing: border-box;
    font: inherit;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
}

button.btn {
    appearance: none;
}


.btn-primary {
    background: #0f3557;
    color: #fff;
    border-color: #0a253b;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.btn-primary:hover {
    background: #0c2c47;
    color: #fff;
}

.btn-secondary {
    background: #eef3f7;
    color: #0f3557;
    border-color: #cbd5e1;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #b91c1c;
    color: #fff;
    border-color: #b91c1c;
}

.btn-danger:hover {
    background: #991b1b;
    color: #fff;
}

/* Section actions */

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-title-row h3 {
    margin: 5px;
}

.section-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.section-actions a,
.section-actions button,
.row-actions button {
    padding: 7px 10px;
    border: none;
    border-radius: 7px;
    background: #eef3f7;
    color: #0f3557;
    font-weight: 700;
    text-decoration: none;
}

.section-actions a {
    cursor: pointer;
}

.manage-note {
    margin-top: 14px;
    color: #64748b;
    font-size: 13px;
    font-style: italic;
}

/* Guidance popover */

.guidance-trigger {
    margin-left: auto;
    padding: 7px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #eef3f7;
    color: #0f3557;
    font-weight: 800;
    cursor: pointer;
}

.guidance-popover {
    position: fixed;
    top: 90px;
    right: 32px;
    z-index: 9999;
    width: min(520px, calc(100vw - 40px));
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-left: 6px solid #0f3557;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15, 53, 87, 0.25);
}

.guidance-popover h4 {
    margin: 0 32px 14px 0;
    color: #0f3557;
}

.guidance-popover strong {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    color: #0f3557;
}

.guidance-popover p {
    margin: 0 0 8px;
    color: #334155;
    line-height: 1.45;
}

.guidance-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: #eef3f7;
    color: #0f3557;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
}

/* Read-only dealer view */

.dealer-readonly-section {
    max-width: 100%;
}

.readonly-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 14px;
}

.readonly-grid-2 {
    grid-template-columns: 1.2fr 1fr;
}

.readonly-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.readonly-grid-4 {
    grid-template-columns: 1fr 1.3fr 1fr 80px;
}

.readonly-field,
.readonly-notes {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
}

.readonly-field {
    min-height: 48px;
    padding: 10px 12px;
}

.readonly-label {
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.readonly-value {
    display: block;
    color: #1f2933;
    font-size: 15px;
    font-weight: 700;
    word-break: break-word;
}

.readonly-notes {
    margin-top: 4px;
    padding: 12px;
}

.readonly-notes p {
    margin: 6px 0 0;
    color: #1f2933;
    line-height: 1.45;
}

/* Confirmation modal */

.confirm-modal[hidden] {
    display: none;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
}

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.48);
}

.confirm-dialog {
    position: relative;
    width: min(420px, calc(100vw - 40px));
    margin: 15vh auto 0;
    padding: 24px;
    background: #fff;
    border-top: 6px solid #b91c1c;
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.35);
}

.confirm-dialog h3 {
    margin: 0 0 10px;
    color: #0f3557;
}

.confirm-dialog p {
    margin: 0;
    color: #334155;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 22px;
}

.confirm-cancel,
.confirm-delete-button {
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
}

.confirm-cancel {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f3557;
}

.confirm-delete-button {
    border: 1px solid #b91c1c;
    background: #b91c1c;
    color: #fff;
}

/* Interaction views */

.js-interaction-view.is-active {
    outline: 2px solid #0f3557;
    outline-offset: 2px;
}

.view-toggle {
    display: flex;
    gap: 8px;
    margin: 10px 0 14px;
}

.interaction-expanded-row {
    display: none;
}

#section-interactions.expanded-view .interaction-expanded-row {
    display: table-row;
}

#section-interactions.expanded-view .table-text-long {
    max-width: none;
}

.interaction-expanded-card {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid #dbe3ec;
    border-radius: 10px;
}

.interaction-expanded-card p {
    margin: 4px 0 0;
    line-height: 1.4;
}

.interaction-inline-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.interaction-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 16px;
}

.interaction-core-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #dbe3ec;
    clear: both;
}

.interaction-detail-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr auto;
    align-items: end;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
    clear: both;
}

.interaction-detail-row label {
    display: block;
    margin-bottom: 14px;
}

.interaction-core-labels {
    margin-bottom: 6px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.core-field {
    display: flex;
    flex-direction: column;
}

.core-field label {
    margin-bottom: 4px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.core-field textarea,
.interaction-core-row textarea {
    width: 100%;
    resize: vertical;
}

.interaction-top-row input,
.interaction-detail-row input,
.interaction-detail-row select {
    width: 100%;
}

.interaction-core-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.expanded-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

/* Responsive */

@media (max-width: 900px) {
    .grid-2-wide,
    .grid-3,
    .grid-4,
    .readonly-grid-2,
    .readonly-grid-3,
    .readonly-grid-4,
    .form-row-meta,
    .form-row-core,
    .form-row-schedule,
    .form-row-supplemental,
    .interaction-top-row,
    .interaction-core-grid,
    .interaction-core-row,
    .interaction-detail-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }

    .form-actions,
    .confirm-actions,
    .expanded-actions {
        justify-content: flex-start;
    }
}


.notification-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.notification-bell-icon {
    font-size: 14px;
}

.notification-bell-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #b91c1c;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}


.dealer-activation-tasks details {
    margin: 0;
}

.dealer-activation-tasks summary {
    cursor: pointer;
    list-style: none;
}

.dealer-activation-tasks summary::-webkit-details-marker {
    display: none;
}

.dealer-activation-tasks-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 0;
}

.dealer-activation-tasks-head::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-weight: 700;
}

.dealer-activation-tasks details[open] .dealer-activation-tasks-head {
    margin-bottom: 14px;
}

.dealer-activation-tasks details[open] .dealer-activation-tasks-head::before {
    content: "−";
}

.dealer-activation-title {
    font-size: 18px;
    font-weight: 700;
}
