.layout {

    display: flex;

    min-height: 100vh;

}

.sidebar {

    width: 270px;

    background: #0f172a;

    color: white;

    display: flex;

    flex-direction: column;

    padding: 30px 20px;

    box-shadow: 4px 0 18px rgba(0, 0, 0, .08);

}

.logo {

    font-size: 28px;

    font-weight: 700;

    letter-spacing: .5px;

    margin-bottom: 45px;

    padding-left: 10px;

}

.sidebar nav {

    display: flex;

    flex-direction: column;

    gap: 8px;

}

.sidebar a {

    display: flex;

    align-items: center;

    gap: 12px;

    color: #cbd5e1;

    text-decoration: none;

    padding: 15px 18px;

    border-radius: 12px;

    transition: .25s;

    font-weight: 500;

}

.sidebar a:hover,
.sidebar a.active {

    background: #1e293b;

    color: white;

    transform: translateX(4px);

}

.main-content {

    flex: 1;

}

.topbar {

    height: 78px;

    background: white;

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 0 35px;

    border-bottom: 1px solid #e2e8f0;

}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    background: #f5f7fb;
}

header {
    background: #0f172a;
    color: #fff;

    padding: 20px 30px;

    display: flex;
    justify-content: space-between;
    align-items: center;
}

.container {
    max-width: 1400px;
    margin: auto;
    padding: 30px;
}

h2 {
    margin-bottom: 25px;
}

.cards {
    display: grid;

    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));

    gap: 20px;
}

.card {

    background: white;

    border-radius: 16px;

    padding: 28px;

    border: 1px solid #edf2f7;

    transition: .25s;

    box-shadow: 0 8px 30px rgba(15, 23, 42, .05);

}

.card:hover {

    transform: translateY(-4px);

    box-shadow: 0 14px 35px rgba(15, 23, 42, .08);

}

.card h3 {
    color: #64748b;

    font-size: 14px;

    margin-bottom: 10px;
}

.card h1 {
    color: #0f172a;

    font-size: 36px;
}

/* ---------------------------- */
/* Dealership Management Table  */
/* ---------------------------- */

.dealership-section {
    margin-top: 35px;

    padding: 25px;

    background: #fff;

    border-radius: 14px;

    box-shadow: 0 5px 18px rgba(0, 0, 0, .08);
}

.dealership-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 20px;

    margin-bottom: 25px;
}

.dealership-section-header h2 {
    margin-bottom: 5px;
}

.dealership-section-header p {
    color: #64748b;
    font-size: 14px;
}

#dealershipSearch {
    width: 100%;
    max-width: 320px;

    padding: 11px 14px;

    border: 1px solid #cbd5e1;

    border-radius: 10px;

    font-size: 14px;

    outline: none;
}

#dealershipSearch:focus {
    border-color: #2563eb;
}

.dealership-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.dealership-table {
    width: 100%;
    min-width: 950px;

    border-collapse: collapse;
}

.dealership-table th,
.dealership-table td {
    padding: 15px 16px;

    text-align: left;

    border-bottom: 1px solid #e2e8f0;
}

.dealership-table th {
    background: #f8fafc;

    color: #475569;

    font-size: 12px;

    text-transform: uppercase;

    letter-spacing: .5px;
}

.dealership-table td {
    color: #1e293b;

    font-size: 14px;
}

.dealership-table tbody tr {

    transition: .2s;

}

.dealership-table tbody tr:hover {

    background: #f8fafc;

}

@media (max-width: 768px) {

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .container {
        padding: 20px;
    }

    .dealership-section-header {
        flex-direction: column;
        align-items: stretch;
    }

    #dealershipSearch {
        max-width: none;
    }
}

.action-btn {

    background: #2563eb;

    color: white;

    border: none;

    padding: 8px 14px;

    border-radius: 8px;

    cursor: pointer;

    transition: .2s;

    font-size: 13px;

}

.action-btn:hover {

    background: #1d4ed8;

}

.panel-overlay {

    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, .35);

    opacity: 0;

    visibility: hidden;

    transition: .25s;

    z-index: 900;

}

.panel-overlay.show {

    opacity: 1;

    visibility: visible;

}

.side-panel {

    position: fixed;

    top: 0;
    right: -580px;

    width: 580px;

    max-width: 95vw;

    height: 100vh;

    background: #fff;

    transition: .3s;

    display: flex;
    flex-direction: column;

    z-index: 1000;

}

.side-panel.show {

    right: 0;

}

.panel-header {

    display: flex;

    justify-content: space-between;

    align-items: center;

    padding: 22px 26px;

    border-bottom: 1px solid #e2e8f0;

    background: #ffffff;

    position: sticky;

    top: 0;

    z-index: 10;

}

.panel-header h2 {

    margin: 0;

    font-size: 22px;

    font-weight: 700;

    color: #0f172a;

}

#panelContent {

    padding: 24px;

    overflow: auto;

    flex: 1;

}

.details-table {

    width: 100%;

    border-collapse: collapse;

}

.details-table td {

    padding: 14px 8px;

    border-bottom: 1px solid #e2e8f0;

    vertical-align: top;

}

.details-table td:first-child {

    width: 170px;

    color: #64748b;

}

.info-grid {

    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 15px;

    margin-bottom: 25px;

}

.info-card {

    background: #f8fafc;

    border: 1px solid #e2e8f0;

    border-radius: 12px;

    padding: 16px;

}

.info-card span {

    display: block;

    color: #64748b;

    font-size: 13px;

    margin-bottom: 8px;

}

.info-card h3 {

    margin: 0;

    font-size: 17px;

    color: #0f172a;

}

.subscription-section {

    margin-top: 25px;

}

.subscription-section h3 {

    margin-bottom: 15px;

}

.panel-action-group {
    margin-top: 28px;
}

.panel-action-group h3 {
    margin-bottom: 14px;
    color: #0f172a;
    font-size: 15px;
}

.panel-action-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.green-btn,
.red-btn,
.blue-btn,
.orange-btn,
.purple-btn,
.gray-btn {
    border: none;
    color: white;
    padding: 13px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.green-btn {
    background: #16a34a;
}

.red-btn {
    background: #dc2626;
}

.blue-btn {
    background: #2563eb;
}

.orange-btn {
    background: #ea580c;
}

.purple-btn {
    background: #7c3aed;
}

.gray-btn {
    background: #475569;
}

.green-btn:hover,
.red-btn:hover,
.blue-btn:hover,
.orange-btn:hover,
.purple-btn:hover,
.gray-btn:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

/* ===========================
   MODAL
=========================== */

.app-modal-overlay {

    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);

    display: flex;
    justify-content: center;
    align-items: center;

    opacity: 0;
    visibility: hidden;

    transition: .2s;

    z-index: 5000;

}

.app-modal-overlay.show {

    opacity: 1;
    visibility: visible;

}

.app-modal-card {

    width: 420px;
    max-width: 90%;

    background: white;

    border-radius: 18px;

    box-shadow: 0 20px 50px rgba(0, 0, 0, .18);

    overflow: hidden;

    transform: translateY(25px);

    transition: .2s;

}

.app-modal-overlay.show .app-modal-card {

    transform: translateY(0);

}

.app-modal-header {

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 22px 24px;

    border-bottom: 1px solid #e2e8f0;

}

.app-modal-header h3 {

    margin: 0;

    color: #0f172a;

}

.app-modal-close {

    border: none;
    background: none;

    font-size: 28px;

    cursor: pointer;

}

.app-modal-message {

    padding: 25px;

    color: #475569;

    line-height: 1.6;

}

.app-modal-actions {

    display: flex;

    justify-content: flex-end;

    gap: 12px;

    padding: 22px;

    border-top: 1px solid #e2e8f0;

}

.app-modal-btn {

    border: none;

    padding: 12px 22px;

    border-radius: 10px;

    cursor: pointer;

    font-weight: 600;

}

.app-modal-cancel {

    background: #e2e8f0;

    color: #334155;

}

.app-modal-confirm {

    background: #2563eb;

    color: white;

}

.app-modal-confirm.danger {

    background: #dc2626;

}

/* ===========================
   TOAST
=========================== */

.app-toast-container {

    position: fixed;

    top: 25px;

    right: 25px;

    display: flex;

    flex-direction: column;

    gap: 12px;

    z-index: 6000;

}

.app-toast {

    min-width: 300px;

    background: white;

    border-left: 5px solid #16a34a;

    border-radius: 12px;

    box-shadow: 0 12px 35px rgba(0, 0, 0, .15);

    padding: 18px;

    display: flex;

    justify-content: space-between;

    align-items: center;

    opacity: 0;

    transform: translateX(50px);

    transition: .2s;

}

.app-toast.show {

    opacity: 1;

    transform: translateX(0);

}

.app-toast.error {

    border-left-color: #dc2626;

}

.app-toast.warning {

    border-left-color: #ea580c;

}

.app-toast-close {

    border: none;

    background: none;

    font-size: 22px;

    cursor: pointer;

}

.dealership-panel-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
}

.dealership-panel-title h2 {
    margin: 4px 0 0;
    color: #0f172a;
    font-size: 24px;
}

.panel-label {
    color: #64748b;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    background: #e2e8f0;
    color: #334155;
}

.status-badge.active {
    background: #dcfce7;
    color: #166534;
}

.status-badge.trial {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge.grace-period,
.status-badge.grace {
    background: #ffedd5;
    color: #c2410c;
}

.status-badge.expired {
    background: #fee2e2;
    color: #b91c1c;
}

.status-badge.suspended {
    background: #e2e8f0;
    color: #475569;
}

.info-card.full-width {
    grid-column: 1 / -1;
}

.panel-action-grid button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.subscription-progress {

    margin-top: 14px;

    height: 10px;

    background: #e2e8f0;

    border-radius: 999px;

    overflow: hidden;

}

.subscription-progress-fill {

    height: 100%;

    width: 0;

    transition: .4s;

    background: #16a34a;

}

.subscription-progress-fill.active {

    background: #16a34a;

}

.subscription-progress-fill.trial {

    background: #2563eb;

}

.subscription-progress-fill.grace,
.subscription-progress-fill.grace-period {

    background: #ea580c;

}

.subscription-progress-fill.expired {

    background: #dc2626;

}

.subscription-progress-fill.suspended {

    background: #64748b;

}

.dealership-toolbar {

    display: flex;

    align-items: center;

    gap: 14px;

}

.dealership-toolbar input {

    width: 260px;

}

/* ===== New Dealership Form ===== */

.panel-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.form-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-section h3 {
    margin: 0 0 18px;
    color: #0f172a;
    font-size: 18px;
}

.form-section label {
    display: block;
    margin: 14px 0 6px;
    font-weight: 600;
    color: #475569;
}

.form-section input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    transition: .2s;
    box-sizing: border-box;
}

.form-section input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.subscription-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.subscription-option {
    flex: 1;
    min-width: 120px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    text-align: center;
    transition: .2s;
}

.subscription-option:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.subscription-option input {
    margin-bottom: 10px;
}

.panel-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    position: sticky;
    bottom: 0;
}

/* ===== New Dealership Close Button ===== */

.panel-close-btn {

    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: none;
    border-radius: 10px;

    background: #f8fafc;

    color: #64748b;

    font-size: 22px;

    cursor: pointer;

    transition: all .2s ease;

}

.panel-close-btn:hover {

    background: #fee2e2;

    color: #dc2626;

    transform: rotate(90deg);

}

.panel-close-btn:active {

    transform: rotate(90deg) scale(.95);

}

#newDealershipBtn {
    min-width: 190px;
    height: 46px;
    padding: 0 22px;
    font-size: 15px;
    white-space: nowrap;
}

.password-strength {
    margin-top: 10px;
}

.password-strength-bar {
    width: 100%;
    height: 7px;

    background: #e2e8f0;

    border-radius: 999px;

    overflow: hidden;
}

#passwordStrengthFill {
    width: 0;
    height: 100%;

    background: #cbd5e1;

    border-radius: inherit;

    transition: width .2s ease,
        background .2s ease;
}

#passwordStrengthText {
    display: block;

    margin-top: 7px;

    color: #64748b;

    font-size: 12px;
    font-weight: 600;
}

.password-tools {

    margin-top: 14px;

}

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 72px;
}

.password-icon-btn {
    position: absolute;
    top: 50%;
    right: 8px;

    transform: translateY(-50%);

    border: none;
    background: transparent;

    color: #2563eb;

    font-size: 12px;
    font-weight: 700;

    cursor: pointer;
}

.password-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;

    margin-top: 14px;
}

#generatePassword,
#copyPassword {
    width: 100%;
}

.dealership-success-card {
    width: 500px;
    max-width: 92vw;
    padding: 30px;
    text-align: center;
    overflow: visible;
}

.dealership-success-icon {
    width: 64px;
    height: 64px;

    margin: 0 auto 16px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: #dcfce7;
    color: #16a34a;

    font-size: 32px;
    font-weight: 800;
}

.dealership-success-card h2 {
    margin-bottom: 8px;
    color: #0f172a;
}

.dealership-success-intro {
    margin-bottom: 24px;
    color: #64748b;
    line-height: 1.5;
}

.dealership-success-details {
    display: grid;
    gap: 12px;

    padding: 18px;

    border: 1px solid #e2e8f0;
    border-radius: 14px;

    background: #f8fafc;

    text-align: left;
}

.dealership-success-details div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.dealership-success-details span {
    color: #64748b;
}

.dealership-success-details strong {
    color: #0f172a;
    text-align: right;
    overflow-wrap: anywhere;
}

.dealership-success-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

    margin-top: 22px;
}

/* ========================================
   PLATFORM ADMIN LOGIN
======================================== */

.platform-login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #f8fafc;
}

.platform-login-card {
    width: 100%;
    max-width: 440px;
    padding: 40px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.platform-login-brand {
    margin-bottom: 32px;
    color: #0b132b;
    font-size: 28px;
    font-weight: 700;
}

.platform-login-card h1 {
    margin: 0 0 8px;
    color: #0b132b;
    font-size: 32px;
}

.platform-login-subtitle {
    margin: 0 0 32px;
    color: #64748b;
}

.platform-login-field {
    margin-bottom: 20px;
}

.platform-login-field label {
    display: block;
    margin-bottom: 8px;
    color: #0b132b;
    font-weight: 600;
}

.platform-login-field input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font: inherit;
    box-sizing: border-box;
}

.platform-login-field input:focus {
    outline: none;
    border-color: #3b82f6;
}

.platform-login-error {
    min-height: 20px;
    margin-bottom: 16px;
    color: #dc2626;
    font-size: 14px;
}

.platform-login-button {
    width: 100%;
    height: 48px;
}