/* ============================================================
   YPA - Youth Platform Africa (Laravel migration)
   Base application stylesheet
   Design tokens preserved from the legacy Plain PHP system
   ============================================================ */

:root {
    --ds-brand: #005fa3;
    --ds-brand-dark: #00587d;
    --ds-brand-light: #1498d1;
    --ds-bg: #f1f5f9;
    --ds-surface: #ffffff;
    --ds-border: #e5e7eb;
    --ds-text: #0f172a;
    --ds-text-muted: #64748b;
    --ds-cyan-bg: #ecfeff;
    --ds-radius: 16px;
    --ds-shadow: 0 1px 3px rgba(15, 23, 42, .08);
    --ds-shadow-hover: 0 12px 28px rgba(15, 23, 42, .12);
    --ds-sidebar-width: 260px;
    --bs-primary: #005fa3;
    --bs-primary-rgb: 0, 95, 163;
    --bs-link-color: #005fa3;
    --bs-link-hover-color: #00587d;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--ds-bg);
    color: var(--ds-text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--ds-brand);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    text-decoration: none;
}

/* Tabbed form modals (groups & members) use the standard `.ypa-tabs` pattern;
   the `modal-dialog-scrollable` class handles height, so no width overrides are needed. */

/* ------------------------------------------------------------
   Top navigation bar
   ------------------------------------------------------------ */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--ds-surface);
    border-bottom: 1px solid var(--ds-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    z-index: 1000;
}

.menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--ds-border);
    border-radius: 10px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--ds-text);
    border-radius: 2px;
}

.user-section {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    min-width: 0;
    gap: 14px;
}

.user-name {
    font-weight: 700;
    color: var(--ds-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-nav .menu-toggle,
.user-section .logout-link,
.user-section .inline-form { flex-shrink: 0; }

.platform-pdf-frame { display: block; width: 100%; height: 75vh; min-height: 420px; border: 0; background: #e5e7eb; }

.logout-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ds-text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
}

.logout-link:hover {
    color: var(--ds-brand);
}

.inline-form {
    display: inline;
}

button.logout-link {
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
}

/* ------------------------------------------------------------
   Sidebar
   ------------------------------------------------------------ */

.sidebar {
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    width: var(--ds-sidebar-width);
    background: var(--ds-brand-dark);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: rgba(255, 255, 255, .3) transparent;
    scrollbar-width: thin;
    transform: translateX(-100%);
    transition: transform .3s ease;
    z-index: 999;
}

.sidebar.active {
    transform: translateX(0);
}

.brand {
    padding: 18px 14px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: .2px;
}

.brand-logo {
    max-width: 150px;
    max-height: 70px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.brand-name {
    display: block;
    font-size: 15px;
    line-height: 1.2;
    color: #fff;
    word-break: break-word;
}

.nav-menu,
.nav-menu ul,
.nav-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu {
    padding: 8px 0 24px;
}

.nav-menu li a,
.nav-menu .dropdown-toggle {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 12px 16px;
    min-height: 46px;
    transition: background-color .18s ease, color .18s ease;
    min-width: 0;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
}

.nav-menu li {
    width: 100%;
}

.nav-menu li a > span,
.nav-menu .dropdown-label > span {
    min-width: 0;
    flex: 1 1 auto;
}

.nav-menu li a:hover,
.nav-menu .dropdown-toggle:hover {
    background: rgba(255, 255, 255, .08);
}

.nav-menu li a:focus-visible,
.nav-menu .dropdown-toggle:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .9);
    outline-offset: -3px;
}

.nav-menu li a > i:first-child,
.nav-menu .dropdown-label > i:first-child {
    width: 1.25rem;
    flex: 0 0 1.25rem;
    text-align: center;
}

.nav-menu li a > i:first-child {
    flex-shrink: 0;
}

.nav-menu li a.active {
    background: var(--ds-brand-light);
    color: #fff;
}

.nav-menu .dropdown {
    background: var(--ds-brand-dark);
}

.nav-menu .dropdown-toggle {
    cursor: pointer;
    color: #fff;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: 0;
    font: inherit;
    text-align: left;
}

.nav-menu .dropdown-label {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    flex: 1 1 auto;
    white-space: normal;
    overflow-wrap: anywhere;
}

.nav-menu .dropdown-icon {
    flex: 0 0 auto;
    transition: transform .2s ease;
}

.nav-menu .dropdown-toggle::after {
    display: none !important;
}

.nav-menu .dropdown.open > .dropdown-toggle,
.nav-menu .dropdown-toggle.active {
    background: rgba(255, 255, 255, .1);
}

.nav-menu .dropdown.open .dropdown-icon,
.nav-menu .dropdown.active .dropdown-icon {
    transform: rotate(180deg);
}

.nav-menu .dropdown-menu {
    display: none;
    position: static;
    float: none;
    min-width: 0;
    width: 100%;
    margin: 0;
    padding: 4px 0 8px;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none !important;
    font-size: inherit;
    overflow: hidden;
}

.nav-menu .dropdown.open .dropdown-menu,
.nav-menu .dropdown.active .dropdown-menu {
    display: block;
}

.nav-menu .dropdown-menu li a {
    margin: 4px 12px 4px 18px;
    padding: 12px 14px;
    min-height: 42px;
    border-radius: 12px;
    background: transparent !important;
    color: #fff;
    min-width: 0;
}

.nav-menu .dropdown-menu li a > i:first-child {
    margin-top: .1rem;
}

.nav-menu .dropdown-menu li a:hover {
    background: rgba(255, 255, 255, .08) !important;
}

.nav-menu .dropdown-menu li a.active {
    background: var(--ds-brand-light) !important;
    color: #fff !important;
}

.nav-menu > li > a.active {
    color: #fff;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 998;
}

.overlay.active {
    display: block;
}

/* ------------------------------------------------------------
   Main content
   ------------------------------------------------------------ */

.main-content {
    margin-left: 0;
    padding-top: 60px;
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

@media (min-width: 992px) {
    .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: var(--ds-sidebar-width);
    }

    .menu-toggle {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        width: min(var(--ds-sidebar-width), 86vw);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .nav-menu .dropdown-icon {
        transition: none;
    }
}

/* ------------------------------------------------------------
   Dashboard
   ------------------------------------------------------------ */

.dash-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 22px 80px;
}

.dash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.dash-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dash-avatar {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--ds-brand-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.25rem;
}

.dash-greeting {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--ds-text-muted);
    font-weight: 800;
}

.dash-name {
    font-size: 1.55rem;
    font-weight: 900;
    color: var(--ds-text);
    margin: 0;
}

.dash-date {
    font-size: .85rem;
    color: var(--ds-text-muted);
    margin-top: 3px;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 999px;
    background: var(--ds-cyan-bg);
    color: var(--ds-brand-dark);
    font-weight: 900;
    font-size: .84rem;
}

.dash-section {
    margin-top: 24px;
}

.dash-section-title {
    font-size: 1rem;
    font-weight: 900;
    color: var(--ds-text);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.dash-grid.d-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-grid.d-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash-grid.d-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.dash-grid > .dash-card:nth-child(5n + 2) { --ds-card-accent: #15803d; }
.dash-grid > .dash-card:nth-child(5n + 3) { --ds-card-accent: #b45309; }
.dash-grid > .dash-card:nth-child(5n + 4) { --ds-card-accent: #7c3aed; }
.dash-grid > .dash-card:nth-child(5n + 5) { --ds-card-accent: #be123c; }

/* Semantic accents. Bootstrap's border-* utilities are !important and would
   paint the whole card, so on stat cards they only drive the left accent. */
.dash-card.accent-primary, .dash-grid > .dash-card.border-primary { --ds-card-accent: #005fa3; }
.dash-card.accent-success, .dash-grid > .dash-card.border-success, .dash-card.border-success { --ds-card-accent: #15803d; }
.dash-card.accent-warning, .dash-grid > .dash-card.border-warning { --ds-card-accent: #d97706; }
.dash-card.accent-danger,  .dash-grid > .dash-card.border-danger,  .dash-card.border-danger  { --ds-card-accent: #dc2626; }
.dash-card.accent-info,    .dash-grid > .dash-card.border-info    { --ds-card-accent: #0891b2; }
.dash-card.accent-purple { --ds-card-accent: #7c3aed; }
.dash-card.accent-muted  { --ds-card-accent: #64748b; }

.dash-card[class*="border-"] {
    border-color: var(--ds-border) !important;
    border-left-color: var(--ds-card-accent, var(--ds-brand)) !important;
}

.dash-card {
    position: relative;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-left: 4px solid var(--ds-card-accent, var(--ds-brand));
    border-radius: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--ds-shadow);
    transition: transform .18s, box-shadow .18s;
    min-height: 0;
    min-width: 0;
    display: block;
}

a.dash-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ds-shadow-hover);
}

.dash-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.dash-card-title {
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ds-text-muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-card-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 8px;
    background: color-mix(in srgb, var(--ds-card-accent, var(--ds-brand)) 12%, #fff);
    color: var(--ds-card-accent, var(--ds-brand-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
}

.dash-card-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--ds-text);
    margin-top: 4px;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.dash-card-desc,
.dash-card-sub {
    font-size: .74rem;
    color: var(--ds-text-muted);
    margin-top: 2px;
}

.dash-panel {
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: var(--ds-radius);
    box-shadow: var(--ds-shadow);
    overflow: hidden;
    margin-top: 18px;
}

.dash-panel > .table-responsive:last-child,
.dash-panel-body > .table-responsive:last-child {
    margin-bottom: 0;
}

.dash-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    background: #f8fafc;
    border-bottom: 1px solid var(--ds-border);
    font-weight: 900;
}

.dash-panel-body {
    padding: 18px;
}

/* Constrain create/edit forms so fields don't stretch across the full page width. */
.form-panel {
    max-width: 800px;
}

/* Keep the member form modal compact (it has the most tabs and fields). */
#memberModal .modal-dialog {
    max-width: 640px;
}

.stock-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stock-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: .86rem;
}

.stock-name {
    font-weight: 800;
    color: var(--ds-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-qty {
    color: var(--ds-text-muted);
    font-weight: 800;
}

.stock-track {
    height: 8px;
    background: var(--ds-border);
    border-radius: 999px;
    overflow: hidden;
}

.stock-fill {
    height: 100%;
    background: var(--ds-brand-dark);
    border-radius: 999px;
}

.empty-box {
    background: var(--ds-surface);
    border: 1px dashed #cbd5e1;
    border-radius: var(--ds-radius);
    padding: 28px;
    text-align: center;
    color: var(--ds-text-muted);
}

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--ds-brand-dark);
    color: #fff;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 900;
    border: 0;
    cursor: pointer;
}

.quick-btn:hover {
    color: #fff;
    background: var(--ds-brand);
}

.quick-btn.secondary {
    background: #fff;
    color: var(--ds-brand-dark);
    border: 1px solid #bfdbfe;
}

.quick-btn.secondary:hover {
    background: var(--ds-cyan-bg);
    color: var(--ds-brand-dark);
}

/* ------------------------------------------------------------
   Auth pages
   ------------------------------------------------------------ */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #00587d 0%, #005fa3 55%, #1498d1 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--ds-surface);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    padding: 36px 32px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 22px;
}

.auth-logo img {
    max-width: 150px;
    max-height: 70px;
    object-fit: contain;
}

.auth-title {
    font-size: 1.35rem;
    font-weight: 900;
    color: var(--ds-text);
    margin: 0 0 6px;
    text-align: center;
}

.auth-subtitle {
    font-size: .9rem;
    color: var(--ds-text-muted);
    text-align: center;
    margin: 0 0 24px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-weight: 700;
    font-size: .85rem;
    color: var(--ds-text);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--ds-border);
    border-radius: 12px;
    font: inherit;
    background: #fff;
    color: var(--ds-text);
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--ds-brand);
    box-shadow: 0 0 0 3px rgba(0, 95, 163, .15);
}

.auth-card .btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: var(--ds-brand-dark);
    color: #fff;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background .15s;
}

.auth-card .btn-primary:hover {
    background: var(--ds-brand);
}

.btn-link {
    background: none;
    border: 0;
    color: var(--ds-brand);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

/* ------------------------------------------------------------
   Alerts / flash messages
   ------------------------------------------------------------ */

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: .9rem;
    font-weight: 600;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error,
.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ------------------------------------------------------------
   Shared application components
   ------------------------------------------------------------ */

.container,
.container-fluid {
    --bs-gutter-x: 2.5rem;
}

.card {
    border-color: var(--ds-border);
    border-radius: 14px;
    box-shadow: var(--ds-shadow);
}

.card-header,
.card-footer {
    padding: 14px 18px;
    background: #f8fafc;
    border-color: var(--ds-border);
}

.card-body {
    padding: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    font-weight: 700;
    border-radius: 10px;
}

.btn.btn-primary {
    --bs-btn-bg: var(--ds-brand-dark);
    --bs-btn-border-color: var(--ds-brand-dark);
    --bs-btn-hover-bg: var(--ds-brand);
    --bs-btn-hover-border-color: var(--ds-brand);
    --bs-btn-active-bg: var(--ds-brand-dark);
    --bs-btn-active-border-color: var(--ds-brand-dark);
}

.form-control,
.form-select {
    border-color: var(--ds-border);
    border-radius: 10px;
}

.form-select:focus,
.form-check-input:focus {
    border-color: var(--ds-brand);
    box-shadow: 0 0 0 3px rgba(0, 95, 163, .15);
}

.form-check-input:checked {
    background-color: var(--ds-brand);
    border-color: var(--ds-brand);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    border: 1px solid var(--ds-border);
    border-radius: 8px;
}

.table {
    --bs-table-bg: var(--ds-surface);
    --bs-table-color: var(--ds-text);
    --bs-table-striped-bg: #f8fafc;
    --bs-table-hover-bg: #f1f5f9;
    margin-bottom: 0;
    vertical-align: middle;
    font-size: .875rem;
}

.table > :not(caption) > * > * {
    padding: .6rem .75rem;
    border-bottom-color: var(--ds-border);
}

.table thead th {
    color: #334155;
    background: #f8fafc;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table td .d-flex,
.table td form.d-inline {
    white-space: nowrap;
}

.table td {
    max-width: 320px;
    overflow-wrap: break-word;
}

.table td.text-end:has(.btn) {
    min-width: 132px;
    white-space: nowrap;
}

.table td .btn {
    min-width: 34px;
}

.table.table-sm > :not(caption) > * > * {
    padding: .4rem .55rem;
}

.table td .btn + .btn,
.table td form + .btn,
.table td .btn + form {
    margin-left: .2rem;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.badge {
    padding: .42em .68em;
    font-weight: 700;
}

.alert-dismissible {
    position: relative;
    padding-right: 3rem;
}

.pagination {
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: 1.25rem;
}

.page-link {
    color: var(--ds-brand);
    border-color: var(--ds-border);
    border-radius: 8px !important;
}

.active > .page-link,
.page-link.active {
    background: var(--ds-brand);
    border-color: var(--ds-brand);
}

/* Tables inside panels: the panel provides the frame. */
.dash-panel .table-responsive,
.card .table-responsive {
    border: 0;
    border-radius: 0;
}

.dash-panel .table thead th {
    border-bottom: 1px solid #cbd5e1;
}

.table-hover > tbody > tr {
    transition: background-color .12s;
}

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

.table .empty-row td,
.table td.empty-cell {
    padding: 2.25rem 1rem !important;
    text-align: center;
    color: var(--ds-text-muted);
}

.table .empty-row i,
.table td.empty-cell i {
    display: block;
    font-size: 1.6rem;
    margin-bottom: .4rem;
    opacity: .45;
}

.table td .btn-sm {
    padding: .25rem .5rem;
    border-radius: 8px;
}

/* Pagination footer (resources/views/vendor/pagination/ypa.blade.php) */
.ypa-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
    margin-top: 12px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-border);
    border-radius: 12px;
    font-size: .82rem;
    color: var(--ds-text-muted);
}

.ypa-pagination-summary strong {
    color: var(--ds-text);
    font-weight: 700;
}

.ypa-pagination .pagination {
    margin-top: 0;
    gap: 4px;
}

.ypa-pagination .page-link {
    min-width: 32px;
    text-align: center;
    font-weight: 600;
}

.dash-panel-foot {
    border-top: 1px solid var(--ds-border);
    background: #f8fafc;
}

.dash-panel-foot:empty {
    display: none;
}

.dash-panel-foot .ypa-pagination,
.dash-panel-body > .ypa-pagination,
.card-body > .ypa-pagination,
.card-footer > .ypa-pagination {
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.dash-panel-body:has(> .ypa-pagination:only-child) {
    padding: 0;
    border-top: 1px solid var(--ds-border);
    background: #f8fafc;
}

/* Modal forms */
.modal-header .modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.modal-content {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .24);
}

.modal-header {
    background: #f8fafc;
}

.modal-body {
    max-height: min(68vh, 720px);
    overflow-y: auto;
}

.modal-header,
.modal-footer {
    border-color: var(--ds-border);
}

.member-search-results {
    max-height: 200px;
    overflow-y: auto;
}

.preformatted-content,
.card pre {
    max-width: 100%;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.receipt-card {
    max-width: 900px;
    margin-inline: auto;
}

@media (max-width: 767.98px) {
    .container,
    .container-fluid {
        --bs-gutter-x: 1.5rem;
    }

    .dash-head > .d-flex,
    .dash-panel-head,
    .card-header.d-flex {
        flex-wrap: wrap;
    }

    .dash-head .btn,
    .dash-panel-head .btn {
        flex: 1 1 auto;
    }

    .table > :not(caption) > * > * {
        padding: .65rem .7rem;
    }

    .user-name {
        display: none;
    }

    .user-section {
        gap: 10px;
    }

    .table-responsive > .table {
        min-width: 560px;
    }

    .table td.text-end:has(.btn) {
        position: sticky;
        right: 0;
        background: var(--ds-surface);
        box-shadow: -8px 0 12px rgba(15, 23, 42, .06);
        z-index: 1;
    }
}

@media (max-width: 420px) {
    .top-nav {
        padding-inline: 10px;
    }

    .user-section .logout-link {
        font-size: 0;
        gap: 0;
    }

    .user-section .logout-link i {
        font-size: 1rem;
    }
}

@media print {
    body {
        background: #fff;
    }

    .sidebar,
    .top-nav,
    .overlay,
    .btn,
    form {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }

    .receipt-card {
        max-width: none;
        box-shadow: none !important;
        border: 1px solid #222 !important;
    }
}

/* ------------------------------------------------------------
   Flash popups (global toast stack)
   ------------------------------------------------------------ */

.ypa-flash-stack {
    position: sticky;
    top: 72px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.ypa-flash {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .16);
    font-weight: 600;
}

.ypa-flash ul {
    margin-bottom: 0;
}

/* ------------------------------------------------------------
   Tabs (Bootstrap tabs with YPA theme + legacy-style tab bars)
   ------------------------------------------------------------ */

.ypa-tabs {
    border-bottom: 2px solid var(--ds-border);
    gap: 4px;
}

.ypa-tabs .nav-link {
    color: var(--ds-text-muted);
    font-weight: 700;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    padding: 10px 16px;
    margin-bottom: -2px;
}

.ypa-tabs .nav-link:hover {
    color: var(--ds-brand);
    border-bottom-color: #bae6fd;
}

.ypa-tabs .nav-link.active {
    color: var(--ds-brand-dark);
    border-bottom-color: var(--ds-brand);
    background: transparent;
}

.ypa-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.ypa-tab-bar .btn.active,
.ypa-tab-bar .btn[aria-selected="true"] {
    background: var(--ds-brand-dark);
    border-color: var(--ds-brand-dark);
    color: #fff;
}

/* ------------------------------------------------------------
   Modal polish (Bootstrap modals with YPA theme)
   ------------------------------------------------------------ */

.ypa-modal-form .form-group {
    margin-bottom: 14px;
}

.modal-title .fa-trash-can {
    color: #dc2626;
}

@media (max-width: 767.98px) {
    .ypa-flash-stack {
        top: 66px;
    }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */

@media (max-width: 1100px) {
    .dash-grid,
    .dash-grid.d-grid-2,
    .dash-grid.d-grid-4,
    .dash-grid.d-grid-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 580px) {
    .dash-wrap {
        padding: 18px 12px 60px;
    }

    .dash-grid,
    .dash-grid.d-grid-2,
    .dash-grid.d-grid-4,
    .dash-grid.d-grid-5 {
        grid-template-columns: 1fr;
    }

    .dash-head {
        align-items: flex-start;
    }

    .dash-name {
        font-size: 1.25rem;
    }
}
