html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: #111827;
    background: #f8fafc;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    width: 250px;
    background: #0b1f4d;
    color: #fff;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 22px 18px 18px;
    color: #fff;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    background: rgba(0, 0, 0, .22);
}

.brand img {
    display: block;
    width: 118px;
    max-width: 76%;
    height: auto;
    border-radius: 8px;
}

.brand span {
    display: block;
    line-height: 1.1;
}

.sidebar nav {
    display: grid;
    gap: 6px;
    padding: 22px 10px;
}

.sidebar a {
    color: #fff;
    text-decoration: none;
}

.sidebar nav a {
    padding: 12px 16px;
    border-radius: 6px;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    background: rgba(255, 255, 255, .18);
}

.sidebar nav a.menu-placeholder {
    color: rgba(255, 255, 255, .72);
    cursor: help;
}

.sidebar nav a.menu-placeholder:hover {
    background: rgba(255, 255, 255, .1);
}

.sidebar-user {
    display: grid;
    justify-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 18px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, .16);
    background: rgba(0, 0, 0, .14);
}

.user-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 50% 34%, #cbd5e1 0 18%, transparent 19%),
        radial-gradient(circle at 50% 88%, #cbd5e1 0 38%, transparent 39%),
        #e5e7eb;
    border: 2px solid rgba(255, 255, 255, .65);
}

.sidebar-user strong {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.main {
    margin-left: 250px;
    min-height: 100vh;
    padding: 44px 48px;
}

.page-header {
    margin-bottom: 28px;
}

.page-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.page-header h1 {
    margin: 0 0 8px;
    font-size: 2.25rem;
}

.page-header p {
    color: #4b5563;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.grid article,
.form-panel,
.table-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

.grid h2,
.form-panel h2,
.table-panel h2 {
    font-size: 1.15rem;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.summary-strip article,
.dashboard-card,
.loading-panel,
.empty-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 18px;
}

.summary-strip span,
.dashboard-card span {
    display: block;
    color: #4b5563;
    font-size: .9rem;
}

.summary-strip strong {
    display: block;
    margin-top: 4px;
    font-size: 1.8rem;
    line-height: 1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.dashboard-card {
    display: grid;
    gap: 18px;
}

.dashboard-card h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.dashboard-card p {
    min-height: 20px;
    margin: 0;
    color: #4b5563;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.dashboard-metrics div {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #edf2f7;
    border-radius: 8px;
}

.dashboard-metrics strong {
    display: block;
    margin-top: 4px;
    font-size: 1.55rem;
}

.loading-panel {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-panel {
    max-width: 560px;
}

.image-section {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #e5e7eb;
}

.image-section h3 {
    margin-bottom: 14px;
}

.image-list,
.image-gallery {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.image-list-item,
.gallery-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 74px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8fafc;
}

.image-list-item img,
.gallery-item img {
    width: 72px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.image-list-item span,
.gallery-item span {
    min-width: 0;
    overflow: hidden;
    color: #374151;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.split {
    display: grid;
    grid-template-columns: minmax(320px, 520px) minmax(420px, 1fr);
    gap: 24px;
    align-items: start;
}

.table-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.message {
    max-width: 880px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border-radius: 6px;
}

.message.error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.message.success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

button[disabled] {
    cursor: wait;
}

body.modal-open {
    overflow: hidden;
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, .55);
}

.modal-card {
    width: min(820px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, .3);
    padding: 22px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.35rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.actions-cell {
    width: 210px;
    white-space: nowrap;
}

.check-column {
    width: 1%;
    min-width: 72px;
    text-align: center;
    white-space: nowrap;
}

.check-column .form-check-input {
    float: none;
    margin: 0 auto;
}

.table-link-button {
    padding: 0;
    color: #0d6efd;
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    background: transparent;
    border: 0;
}

.table-link-button:hover {
    color: #0a58ca;
}

.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.repeat-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 10px;
    row-gap: 4px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 8px;
}

.repeat-panel.form-check {
    padding-left: 14px;
}

.repeat-panel .form-check-input {
    float: none;
    margin-left: 0;
    margin-top: 4px;
}

.repeat-panel .form-text {
    grid-column: 2;
    margin-top: 0;
}

.auth-link {
    color: #4b5563;
}

.auth-link a {
    color: #0d6efd;
    font-weight: 700;
    text-decoration: none;
}

.confirmation-body {
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 18%, rgba(13, 110, 253, .14), transparent 28%),
        linear-gradient(135deg, #f8fafc 0%, #eef4ff 100%);
}

.confirmation-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px;
}

.confirmation-card {
    width: min(520px, 100%);
    padding: 34px;
    text-align: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 26px 70px rgba(15, 23, 42, .16);
}

.confirmation-card img {
    width: 132px;
    height: auto;
    margin-bottom: 18px;
    border-radius: 8px;
}

.confirmation-card .eyebrow {
    margin: 0 0 8px;
    color: #0d6efd;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.confirmation-card h1 {
    margin: 0 0 12px;
    font-size: 2rem;
}

.confirmation-card p {
    color: #4b5563;
    line-height: 1.5;
}

@media (max-width: 860px) {
    .sidebar {
        position: static;
        display: block;
        width: auto;
    }

    .main {
        margin-left: 0;
        padding: 28px 18px;
    }

    .split {
        grid-template-columns: 1fr;
    }

    .page-actions,
    .table-header,
    .modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .summary-strip,
    .dashboard-metrics {
        grid-template-columns: 1fr;
    }

    .modal-shell {
        padding: 12px;
        place-items: stretch;
    }

    .modal-card {
        max-height: calc(100vh - 24px);
    }

    .actions-cell {
        width: auto;
        white-space: normal;
    }
}
