/* ============================================================
   BlockServe — Design System
   Clean, trust-forward fintech aesthetic with blockchain accents
   ============================================================ */

:root {
    /* Palette */
    --bs-bg:         #f6f7fb;
    --bs-bg-soft:    #eef0f7;
    --bs-surface:    #ffffff;
    --bs-ink:        #0f1a2b;
    --bs-ink-2:      #1e2a3f;
    --bs-text:       #2a3142;
    --bs-text-2:     #6b7385;
    --bs-text-3:     #9aa0b2;
    --bs-border:     #e5e8f0;
    --bs-border-2:   #eef1f6;

    /* Signature mint / chain color */
    --bs-accent:     #00c897;
    --bs-accent-2:   #00a37a;
    --bs-accent-soft:#e5f9f2;

    /* Semantic */
    --bs-blue:       #2563eb;
    --bs-blue-soft:  #e7efff;
    --bs-amber:      #d97706;
    --bs-amber-soft: #fff4e0;
    --bs-red:        #dc2626;
    --bs-red-soft:   #fee8e8;
    --bs-purple:     #7c3aed;
    --bs-purple-soft:#f1e8ff;

    /* Shadows */
    --bs-shadow-sm:  0 1px 2px rgba(15, 26, 43, 0.04);
    --bs-shadow:     0 2px 8px rgba(15, 26, 43, 0.06), 0 1px 2px rgba(15, 26, 43, 0.04);
    --bs-shadow-lg:  0 10px 30px rgba(15, 26, 43, 0.08), 0 4px 12px rgba(15, 26, 43, 0.04);

    /* Radius */
    --bs-r-sm: 8px;
    --bs-r:    12px;
    --bs-r-lg: 16px;

    /* Type */
    --bs-font-display: 'Space Grotesk', system-ui, sans-serif;
    --bs-font-body:    'Inter', system-ui, sans-serif;
    --bs-font-mono:    'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--bs-font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--bs-text);
    background: var(--bs-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
#bs-app {
    display: flex;
    min-height: 100vh;
}

.bs-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--bs-ink);
    color: #fff;
    padding: 22px 16px 18px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.bs-main-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.bs-sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 24px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.bs-sidebar-logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bs-accent);
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 4px rgba(0,200,151,0.15);
}

.bs-sidebar-logo-name {
    font-family: var(--bs-font-display);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.01em;
}

.bs-sidebar-logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    font-family: var(--bs-font-mono);
    margin-top: 1px;
}

.bs-nav { margin-top: 18px; }

.bs-nav-section {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.4);
    padding: 0 10px;
    margin-bottom: 8px;
}

.bs-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bs-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.72);
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
}

.bs-nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.bs-nav-item.active .bs-nav-link {
    background: rgba(0, 200, 151, 0.12);
    color: #fff;
    position: relative;
}

.bs-nav-item.active .bs-nav-link::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--bs-accent);
    border-radius: 0 3px 3px 0;
}

.bs-nav-item.active .bs-nav-link svg { color: var(--bs-accent); }

/* Sidebar work counter. Sits at the far right of the row and is only ever
   rendered when there is something waiting, so it reads as a signal rather
   than as part of the label. */
.bs-nav-badge {
    margin-left: auto;
    flex-shrink: 0;
    background: var(--bs-accent);
    color: #04231b;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--bs-font-mono);
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    line-height: 1.5;
}

/* The badge must not swallow the label on a narrow phone drawer. */
.bs-nav-link > span:first-of-type { min-width: 0; }

.bs-sidebar-spacer { flex: 1; min-height: 20px; }

.bs-chain-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: rgba(0,200,151,0.12);
    color: var(--bs-accent);
    font-size: 11.5px;
    font-family: var(--bs-font-mono);
    font-weight: 500;
}

.bs-chain-status.bs-chain-ok    { background: rgba(0,200,151,0.12); color: var(--bs-accent); }
.bs-chain-status.bs-chain-error { background: rgba(220,38,38,0.18); color: #ff8080; }

.bs-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
}

.bs-sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bs-accent);
    color: var(--bs-ink);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.bs-sidebar-user-info { flex: 1; min-width: 0; }

.bs-sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bs-sidebar-user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bs-sidebar-logout {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: transparent;
    color: rgba(255,255,255,0.6);
    display: grid;
    place-items: center;
    transition: background .15s, color .15s;
}

.bs-sidebar-logout:hover { background: rgba(220,38,38,0.2); color: #ff8080; }

/* ============================================================
   TOPBAR
   ============================================================ */
.bs-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    background: var(--bs-surface);
    border-bottom: 1px solid var(--bs-border);
}

.bs-topbar-title {
    font-family: var(--bs-font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--bs-ink);
    letter-spacing: -0.01em;
}

.bs-topbar-breadcrumb {
    font-size: 12px;
    color: var(--bs-text-2);
    margin-top: 2px;
}

.bs-topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.bs-notif-wrap { position: relative; }

.bs-notif-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--bs-border);
    background: var(--bs-surface);
    color: var(--bs-text);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: all .15s;
}

.bs-notif-btn:hover { background: var(--bs-bg-soft); border-color: var(--bs-border-2); }

.bs-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--bs-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 1.2;
    border: 2px solid var(--bs-surface);
}

.bs-notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    background: var(--bs-surface);
    border: 1px solid var(--bs-border);
    border-radius: var(--bs-r);
    box-shadow: var(--bs-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all .15s;
    z-index: 100;
    max-height: 420px;
    overflow: hidden;
}

.bs-notif-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bs-notif-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--bs-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bs-notif-header-title { font-weight: 600; font-size: 14px; }

.bs-notif-mark-all {
    background: none;
    border: none;
    font-size: 12px;
    color: var(--bs-accent-2);
    cursor: pointer;
    font-weight: 500;
}

.bs-notif-list { max-height: 360px; overflow-y: auto; }

.bs-notif-empty, .bs-notif-loading {
    padding: 40px 20px;
    text-align: center;
    color: var(--bs-text-3);
    font-size: 13px;
}

.bs-notif-item {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bs-border-2);
    cursor: pointer;
    transition: background .15s;
}

.bs-notif-item:hover { background: var(--bs-bg-soft); }

.bs-notif-item.unread { background: rgba(0,200,151,0.04); }

.bs-notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.bs-notif-dot.info    { background: var(--bs-blue); }
.bs-notif-dot.success { background: var(--bs-accent); }
.bs-notif-dot.warning { background: var(--bs-amber); }
.bs-notif-dot.error   { background: var(--bs-red); }

.bs-notif-title { font-weight: 600; font-size: 13px; color: var(--bs-ink); margin-bottom: 2px; }
.bs-notif-msg   { font-size: 12.5px; color: var(--bs-text-2); line-height: 1.45; }
.bs-notif-time  { font-size: 11px; color: var(--bs-text-3); margin-top: 4px; font-family: var(--bs-font-mono); }

.bs-topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 30px;
    background: var(--bs-bg-soft);
}

.bs-topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bs-ink);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
}

.bs-topbar-uname { font-size: 13px; font-weight: 600; line-height: 1.2; }
.bs-topbar-urole { font-size: 11px; color: var(--bs-text-2); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.bs-main {
    padding: 28px;
    flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */
.bs-card {
    background: var(--bs-surface);
    border: 1px solid var(--bs-border);
    border-radius: var(--bs-r);
    padding: 22px;
    box-shadow: var(--bs-shadow-sm);
}

.bs-card-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--bs-border-2);
}

.bs-card-title {
    font-family: var(--bs-font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--bs-ink);
    letter-spacing: -0.01em;
    margin: 0;
}

.bs-card-sub { font-size: 12px; color: var(--bs-text-2); margin-top: 2px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.bs-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.bs-stat {
    background: var(--bs-surface);
    border: 1px solid var(--bs-border);
    border-radius: var(--bs-r);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}

.bs-stat::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--bs-accent);
}

.bs-stat.bs-stat-blue::before    { background: var(--bs-blue); }
.bs-stat.bs-stat-amber::before   { background: var(--bs-amber); }
.bs-stat.bs-stat-red::before     { background: var(--bs-red); }
.bs-stat.bs-stat-purple::before  { background: var(--bs-purple); }

.bs-stat-label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-text-2);
    font-weight: 600;
    margin-bottom: 8px;
}

.bs-stat-value {
    font-family: var(--bs-font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--bs-ink);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.bs-stat-sub {
    font-size: 12px;
    color: var(--bs-text-2);
    margin-top: 6px;
}

.bs-stat-icon {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bs-accent-soft);
    color: var(--bs-accent-2);
    display: grid;
    place-items: center;
}

.bs-stat.bs-stat-blue   .bs-stat-icon { background: var(--bs-blue-soft);   color: var(--bs-blue); }
.bs-stat.bs-stat-amber  .bs-stat-icon { background: var(--bs-amber-soft);  color: var(--bs-amber); }
.bs-stat.bs-stat-red    .bs-stat-icon { background: var(--bs-red-soft);    color: var(--bs-red); }
.bs-stat.bs-stat-purple .bs-stat-icon { background: var(--bs-purple-soft); color: var(--bs-purple); }

/* ============================================================
   BUTTONS
   ============================================================ */
.bs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: all .15s;
    font-family: var(--bs-font-body);
    white-space: nowrap;
}

.bs-btn-primary {
    background: var(--bs-ink);
    color: #fff;
    border-color: var(--bs-ink);
}

.bs-btn-primary:hover {
    background: var(--bs-ink-2);
    color: #fff;
}

.bs-btn-accent {
    background: var(--bs-accent);
    color: var(--bs-ink);
    border-color: var(--bs-accent);
}

.bs-btn-accent:hover {
    background: var(--bs-accent-2);
    color: #fff;
    border-color: var(--bs-accent-2);
}

.bs-btn-ghost {
    background: transparent;
    color: var(--bs-text);
    border-color: var(--bs-border);
}

.bs-btn-ghost:hover {
    background: var(--bs-bg-soft);
    color: var(--bs-ink);
}

.bs-btn-danger {
    background: var(--bs-red);
    color: #fff;
    border-color: var(--bs-red);
}

.bs-btn-sm { padding: 6px 12px; font-size: 12px; }
.bs-btn-lg { padding: 12px 22px; font-size: 14px; }

.bs-btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ============================================================
   BADGES
   ============================================================ */
.bs-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.5;
}

.bs-badge-pending { background: #f1f2f7; color: #5d6478; }
.bs-badge-warning { background: var(--bs-amber-soft); color: var(--bs-amber); }
.bs-badge-info    { background: var(--bs-blue-soft);  color: var(--bs-blue); }
.bs-badge-success { background: var(--bs-accent-soft); color: var(--bs-accent-2); }
.bs-badge-danger  { background: var(--bs-red-soft);   color: var(--bs-red); }

/* ============================================================
   TABLES
   ============================================================ */
.bs-table-wrap {
    background: var(--bs-surface);
    border: 1px solid var(--bs-border);
    border-radius: var(--bs-r);
    overflow: hidden;
}

.bs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.bs-table thead {
    background: var(--bs-bg-soft);
    border-bottom: 1px solid var(--bs-border);
}

.bs-table th {
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bs-text-2);
    padding: 12px 16px;
}

.bs-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--bs-border-2);
    vertical-align: middle;
}

.bs-table tbody tr:last-child td { border-bottom: none; }
.bs-table tbody tr:hover { background: var(--bs-bg); }

.bs-table-mono { font-family: var(--bs-font-mono); font-size: 12px; }

.bs-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--bs-text-3);
}

.bs-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--bs-bg-soft);
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
    color: var(--bs-text-3);
}

.bs-empty-title { font-weight: 600; font-size: 15px; color: var(--bs-text); margin-bottom: 4px; }
.bs-empty-sub   { font-size: 13px; }

/* ============================================================
   FORMS
   ============================================================ */
.bs-form-group { margin-bottom: 16px; }

.bs-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--bs-text);
    margin-bottom: 6px;
}

.bs-input, .bs-select, .bs-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bs-border);
    border-radius: 8px;
    font-size: 13.5px;
    font-family: var(--bs-font-body);
    color: var(--bs-ink);
    background: var(--bs-surface);
    transition: border-color .15s, box-shadow .15s;
}

.bs-input:focus, .bs-select:focus, .bs-textarea:focus {
    outline: none;
    border-color: var(--bs-accent);
    box-shadow: 0 0 0 3px rgba(0,200,151,0.15);
}

.bs-textarea { resize: vertical; min-height: 80px; }

.bs-help { font-size: 11.5px; color: var(--bs-text-2); margin-top: 4px; }

/* ============================================================
   TOAST
   ============================================================ */
.bs-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 18px;
    background: var(--bs-ink);
    color: #fff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--bs-shadow-lg);
    opacity: 0;
    transform: translateY(10px);
    transition: all .25s;
    pointer-events: none;
    z-index: 9999;
    max-width: 340px;
}

.bs-toast.show { opacity: 1; transform: translateY(0); }
.bs-toast.success { background: var(--bs-accent-2); }
.bs-toast.error   { background: var(--bs-red); }

/* ============================================================
   MODAL
   ============================================================ */
.bs-modal {
    border: none;
    border-radius: var(--bs-r-lg);
    overflow: hidden;
}

.bs-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bs-accent-soft);
    color: var(--bs-accent-2);
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
}

.bs-modal-title {
    font-family: var(--bs-font-display);
    font-weight: 600;
    color: var(--bs-ink);
    margin-bottom: 6px;
}

.bs-modal-sub { font-size: 13px; color: var(--bs-text-2); margin: 0; }

/* ============================================================
   HASH / CODE DISPLAY
   ============================================================ */
.bs-hash {
    font-family: var(--bs-font-mono);
    font-size: 12px;
    color: var(--bs-text-2);
    background: var(--bs-bg-soft);
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.bs-hash-full { word-break: break-all; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.bs-login-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bs-bg);
}

.bs-login-hero {
    background: linear-gradient(135deg, #0f1a2b 0%, #1e2a3f 100%);
    color: #fff;
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.bs-login-hero::before {
    content: "";
    position: absolute;
    bottom: -120px;
    right: -120px;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,200,151,0.25), transparent 70%);
}

.bs-login-hero::after {
    content: "";
    position: absolute;
    top: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,0.15), transparent 70%);
}

.bs-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.bs-login-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    background: var(--bs-accent);
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 6px rgba(0,200,151,0.15);
}

.bs-login-brand-name {
    font-family: var(--bs-font-display);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.bs-login-brand-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    font-family: var(--bs-font-mono);
}

.bs-login-tagline {
    position: relative;
    z-index: 1;
}

.bs-login-tagline h1 {
    font-family: var(--bs-font-display);
    font-size: 42px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 18px;
    letter-spacing: -0.02em;
}

.bs-login-tagline h1 em {
    font-style: normal;
    color: var(--bs-accent);
}

.bs-login-tagline p {
    color: rgba(255,255,255,0.7);
    font-size: 15px;
    line-height: 1.6;
    max-width: 440px;
}

.bs-login-features {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 36px;
}

.bs-login-feature {
    padding: 14px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}

.bs-login-feature-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: rgba(0,200,151,0.15);
    color: var(--bs-accent);
    display: grid;
    place-items: center;
    margin-bottom: 8px;
}

.bs-login-feature-title { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.bs-login-feature-sub   { font-size: 11.5px; color: rgba(255,255,255,0.55); line-height: 1.45; }

.bs-login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.bs-login-form {
    width: 100%;
    max-width: 380px;
}

.bs-login-form h2 {
    font-family: var(--bs-font-display);
    font-size: 26px;
    font-weight: 700;
    color: var(--bs-ink);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.bs-login-form p.bs-login-sub {
    color: var(--bs-text-2);
    font-size: 14px;
    margin-bottom: 28px;
}

.bs-login-demo {
    margin-top: 24px;
    padding: 14px;
    background: var(--bs-bg-soft);
    border-radius: 10px;
    font-size: 12px;
}

.bs-login-demo-title {
    font-weight: 600;
    color: var(--bs-ink);
    margin-bottom: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.bs-login-demo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    font-family: var(--bs-font-mono);
    font-size: 11.5px;
}

.bs-login-demo-grid b { color: var(--bs-text-2); font-weight: 500; }

.bs-login-error {
    padding: 10px 12px;
    background: var(--bs-red-soft);
    color: var(--bs-red);
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* Mobile login */
@media (max-width: 900px) {
    .bs-login-wrap { grid-template-columns: 1fr; }
    .bs-login-hero { padding: 36px; min-height: 280px; }
    .bs-login-tagline h1 { font-size: 30px; }
    .bs-login-features { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.bs-flex       { display: flex; }
.bs-items-cntr { align-items: center; }
.bs-gap-2      { gap: 8px; }
.bs-gap-3      { gap: 12px; }
.bs-mb-0       { margin-bottom: 0 !important; }
.bs-mb-1       { margin-bottom: 8px; }
.bs-mb-2       { margin-bottom: 16px; }
.bs-mb-3       { margin-bottom: 24px; }
.bs-mt-2       { margin-top: 16px; }
.bs-text-mono  { font-family: var(--bs-font-mono); }
.bs-text-sm    { font-size: 12.5px; }
.bs-text-muted { color: var(--bs-text-2); }
.bs-text-accent{ color: var(--bs-accent-2); }
.bs-text-right { text-align: right; }
.bs-w-full     { width: 100%; }

/* Grid helpers */
.bs-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.bs-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ============================================================
   MOBILE MENU BUTTON
   Hidden on desktop; becomes the drawer trigger on small screens.
   ============================================================ */
.bs-menu-btn {
    display: none;                 /* only appears under the mobile breakpoint */
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 10px 0 -6px;         /* optical alignment with the page padding */
    padding: 0;
    background: transparent;
    border: none;                  /* borderless reads as part of the bar, not bolted on */
    border-radius: 9px;
    color: var(--bs-text-2);
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
}
.bs-menu-btn:hover  { background: var(--bs-bg-soft); color: var(--bs-ink); }
.bs-menu-btn:active { background: var(--bs-border-2); }

/* Turns mint while the drawer is open, echoing the sidebar's accent */
.bs-menu-btn[aria-expanded="true"] {
    background: var(--bs-accent-soft);
    color: var(--bs-accent-2);
}

/* Keep the title block from being squeezed by a long page name */
.bs-topbar-left { display: flex; align-items: center; min-width: 0; }

/* Backdrop behind the drawer */
.bs-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 26, 43, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity .22s ease;
}
.bs-sidebar-overlay.open { opacity: 1; }

/* ============================================================
   RESPONSIVE — TABLET AND BELOW
   ============================================================ */
@media (max-width: 900px) {
    /* Sidebar becomes an off-canvas drawer.
       It slides in when .open is set (see toggleSidebar in app.js) rather
       than being permanently pushed off-screen with no way back. */
    .bs-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;               /* avoids the iOS URL-bar gap */
        transform: translateX(-100%);
        transition: transform .24s cubic-bezier(.4, 0, .2, 1);
        z-index: 1000;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .bs-sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }

    .bs-menu-btn { display: inline-flex; }
    .bs-sidebar-overlay.open { display: block; }

    .bs-grid-2, .bs-grid-3 { grid-template-columns: 1fr !important; }
    .bs-topbar, .bs-main { padding-left: 16px; padding-right: 16px; }
    .bs-topbar { padding-top: 12px; padding-bottom: 12px; }
    .bs-topbar-title { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .bs-topbar-breadcrumb { display: none; }

    /* Stat tiles: two across instead of one long column */
    .bs-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* Any wide table scrolls inside its own box rather than
       forcing the whole page sideways */
    .bs-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .bs-table { min-width: 620px; }

    .bs-notif-dropdown { width: calc(100vw - 32px); right: -8px; max-width: 360px; }
}

/* ============================================================
   RESPONSIVE — PHONES
   ============================================================ */
@media (max-width: 560px) {
    .bs-sidebar { width: 82vw; max-width: 300px; }

    .bs-main { padding: 16px 12px; }
    .bs-topbar { padding-left: 12px; padding-right: 12px; }

    .bs-stats { grid-template-columns: 1fr; }
    .bs-stat-value { font-size: 22px; }

    .bs-card { padding: 16px 14px; border-radius: 12px; }
    /* card header direction is handled in the 640px block below */

    /* Buttons go full width so they are easy to hit with a thumb */
    .bs-btn-lg { width: 100%; justify-content: center; }

    /* Hide the duplicated avatar in the topbar — it is already in the drawer */
    .bs-topbar-user { display: none; }

    /* Inputs at 16px stop iOS Safari zooming in on focus */
    .bs-input, .bs-select, .bs-textarea { font-size: 16px; }
}

/* ============================================================
   CHECKBOX (for item selection)
   ============================================================ */
.bs-check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--bs-border);
    border-radius: 5px;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
    background: var(--bs-surface);
    transition: all .15s;
    flex-shrink: 0;
}

.bs-check.checked {
    background: var(--bs-accent);
    border-color: var(--bs-accent);
}

.bs-check.checked::after {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
}

/* Step progress */
.bs-steps {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.bs-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 20px;
    background: var(--bs-bg-soft);
    color: var(--bs-text-2);
    font-size: 12.5px;
    font-weight: 500;
}

.bs-step.active { background: var(--bs-ink); color: #fff; }
.bs-step.done { background: var(--bs-accent-soft); color: var(--bs-accent-2); }

.bs-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 700;
}

.bs-step.active .bs-step-num { background: var(--bs-accent); color: var(--bs-ink); }
.bs-step.done   .bs-step-num { background: var(--bs-accent); color: #fff; }

.bs-step-sep {
    flex: 1;
    height: 1px;
    background: var(--bs-border);
    max-width: 40px;
}

/* ---- Danger button ---- */
.bs-btn-danger {
    background: var(--bs-red);
    color: #fff;
    border-color: var(--bs-red);
}
.bs-btn-danger:hover { background: #a93226; border-color: #a93226; }

/* ---- Loading Spinner ---- */
.bs-spinner-ring {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: var(--bs-accent);
    border-radius: 50%;
    animation: bs-spin .75s linear infinite;
}
@keyframes bs-spin { to { transform: rotate(360deg); } }

/* ---- Confirm/Spinner overlays ---- */
.bs-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,26,43,.72);
    z-index: 9998;
    place-items: center;
    backdrop-filter: blur(2px);
}
.bs-overlay.show { display: grid; }

#bs-confirm-card {
    max-width: 380px;
    width: 90%;
    animation: bs-slide-up .18s ease;
}
@keyframes bs-slide-up {
    from { opacity:0; transform:translateY(18px); }
    to   { opacity:1; transform:translateY(0); }
}

/* ============================================================
   MOBILE OVERFLOW GUARDS
   
   Many pages set grid columns inline (style="grid-template-columns:...").
   Inline styles beat stylesheet rules, so these need !important to be
   overridden — matching on the style attribute avoids having to edit
   every page individually, and keeps the fix in one reviewable place.
   
   auto-fit/minmax grids are deliberately NOT matched here: they already
   collapse on their own and forcing them would waste horizontal space.
   ============================================================ */
@media (max-width: 640px) {
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 300px"],
    [style*="grid-template-columns:1fr 340px"],
    [style*="grid-template-columns:1fr 360px"],
    [style*="grid-template-columns:360px 1fr"],
    [style*="grid-template-columns:1fr 140px 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Nothing may push the page sideways */
    html, body { overflow-x: hidden; max-width: 100%; }
    #bs-app    { max-width: 100vw; overflow-x: hidden; }

    /* Long unbroken strings — hashes, transaction codes, reference numbers */
    .bs-hash, code, pre {
        word-break: break-all;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    /* Payment QR: scale to the screen instead of a fixed 232px box */
    #qr-container { width: 100% !important; max-width: 260px; }
    #qr-container img,
    #qr-container > div { width: 100% !important; height: auto !important; aspect-ratio: 1; }

    /* Flex rows that used a min-width wider than a phone */
    [style*="min-width:180px"],
    [style*="min-width:200px"],
    [style*="min-width:220px"] { min-width: 100% !important; }

    /* Images never exceed their container */
    img { max-width: 100%; height: auto; }

    /* Modals need room to breathe on a small screen */
    .bs-modal, [id$="Modal"] > form { width: 94% !important; max-width: 94% !important; }

    /* Button rows wrap rather than overflowing */
    .bs-card-hdr > div[style*="display:flex"] { flex-wrap: wrap; }
}

/* ============================================================
   STATUS TIMELINE
   Horizontal rail on desktop, vertical list on phones. Five steps
   cannot fit across a phone, and scrolling them sideways hides the
   very information the student opened the page for.
   ============================================================ */
.bs-timeline {
    display: flex;
    align-items: flex-start;
    padding: 4px 0 8px;
}

.bs-tl-step {
    /* flex-basis 0 with min-width 0 lets every step take an equal share and
       shrink below its content. Without min-width:0 a long label like
       "Registrar is preparing your documents" forces the step wider than its
       share, and the last step is pushed outside the card — which is what
       happened once assessed requests added two extra steps. */
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.bs-tl-line {
    position: absolute;
    top: 13px;
    left: 50%;
    right: -50%;
    height: 2px;
    background: var(--bs-border);
    z-index: 0;
}
.bs-tl-step.is-done .bs-tl-line { background: var(--bs-accent); }

.bs-tl-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    background: var(--bs-bg-soft);
    color: var(--bs-text-3);
    border: 2px solid var(--bs-border);
}
.bs-tl-step.is-done    .bs-tl-dot { background: var(--bs-accent); color: #fff; border-color: var(--bs-accent); }
.bs-tl-step.is-current .bs-tl-dot { background: var(--bs-ink);    color: #fff; border-color: var(--bs-ink); }

.bs-tl-text  { text-align: center; margin-top: 10px; padding: 0 3px; max-width: 100%; overflow-wrap: break-word; }
.bs-tl-label { font-weight: 600; font-size: 12px; color: var(--bs-ink); line-height: 1.3; }
.bs-tl-sub   { font-size: 11px; color: var(--bs-text-3); margin-top: 3px; line-height: 1.3; }
.bs-tl-step.is-future .bs-tl-label { color: var(--bs-text-3); }

/* Assessed requests have 7 steps instead of 5, so they run out of horizontal
   room sooner. Stack them earlier rather than squeezing the labels. */
@media (max-width: 900px) {
    .bs-timeline.is-long { flex-direction: column; align-items: stretch; padding: 2px 0; }
    .bs-timeline.is-long .bs-tl-step {
        flex: none; flex-direction: row; align-items: flex-start;
        gap: 12px; padding-bottom: 18px;
    }
    .bs-timeline.is-long .bs-tl-step.is-last { padding-bottom: 0; }
    .bs-timeline.is-long .bs-tl-line {
        top: 30px; bottom: -4px; left: 13px; right: auto; width: 2px; height: auto;
    }
    .bs-timeline.is-long .bs-tl-text  { text-align: left; margin-top: 3px; padding: 0; }
    .bs-timeline.is-long .bs-tl-label { font-size: 13px; }
}

@media (max-width: 640px) {
    .bs-timeline { flex-direction: column; align-items: stretch; padding: 2px 0; }

    .bs-tl-step {
        flex: none;
        min-width: 0;
        flex-direction: row;          /* dot beside the label */
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 18px;
    }
    .bs-tl-step.is-last { padding-bottom: 0; }

    /* Connector becomes a vertical spine running between the dots */
    .bs-tl-line {
        top: 30px;
        bottom: -4px;
        left: 13px;
        right: auto;
        width: 2px;
        height: auto;
    }

    .bs-tl-text  { text-align: left; margin-top: 3px; padding: 0; }
    .bs-tl-label { font-size: 13px; }
    .bs-tl-sub   { font-size: 11.5px; }
}

/* ============================================================
   APPOINTMENT CARD
   Date chip + details + amount/action. On a phone the three columns
   cannot sit side by side, so the date and title pair up on one row
   and the action drops below at full width.
   ============================================================ */
.bs-appt-card {
    padding: 18px;
    border: 1px solid var(--bs-border);
    border-radius: var(--bs-r);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.bs-appt-date {
    text-align: center;
    padding: 10px 16px;
    background: var(--bs-ink);
    color: #fff;
    border-radius: 10px;
    min-width: 80px;
    flex-shrink: 0;
}

.bs-appt-body { flex: 1; min-width: 200px; }
.bs-appt-side { text-align: right; }

@media (max-width: 640px) {
    .bs-appt-card {
        padding: 14px;
        gap: 12px;
        align-items: center;
    }

    /* Compact the date chip so it sits beside the details rather than
       consuming a whole row on its own */
    .bs-appt-date { padding: 8px 12px; min-width: 62px; }
    .bs-appt-date > div:nth-child(2) { font-size: 22px; }

    .bs-appt-body { min-width: 0; flex: 1 1 55%; }

    /* Amount and button span the full width underneath */
    .bs-appt-side {
        flex: 1 1 100%;
        text-align: left;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding-top: 12px;
        margin-top: 2px;
        border-top: 1px solid var(--bs-border-2);
    }
    .bs-appt-side .bs-btn { margin-top: 0 !important; }
}

/* ============================================================
   OVERFLOW CONTAINMENT
   
   Grid and flex children default to min-width:auto, so they refuse to
   shrink below their content. A table with a min-width therefore widens
   its whole grid track — which stretches every SIBLING card as well, not
   just the one holding the table. Setting min-width:0 lets the track
   shrink so the table scrolls inside its own wrapper instead.
   ============================================================ */
.bs-grid-2 > *,
.bs-grid-3 > *,
.bs-main-wrap { min-width: 0; }

.bs-card { min-width: 0; }

.bs-table-wrap {
    /* The base rule above sets overflow:hidden to clip the rounded corners.
       Restate BOTH axes here so the horizontal axis genuinely scrolls rather
       than inheriting the clip and cutting the table off. */
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    /* Keep the table wide enough to stay readable and let it scroll,
       the same behaviour as the fee catalog. */
    .bs-table { min-width: 560px; }

    /* Fade on the right edge as an affordance that there is more to see */
    .bs-table-wrap {
        position: relative;
        background:
            linear-gradient(to right, var(--bs-surface) 30%, rgba(255,255,255,0)),
            linear-gradient(to right, rgba(255,255,255,0), var(--bs-surface) 70%) 100% 0,
            radial-gradient(farthest-side at 0 50%, rgba(15,26,43,.12), transparent),
            radial-gradient(farthest-side at 100% 50%, rgba(15,26,43,.12), transparent) 100% 0;
        background-repeat: no-repeat;
        background-size: 32px 100%, 32px 100%, 14px 100%, 14px 100%;
        background-attachment: local, local, scroll, scroll;
    }

    /* Empty states were overflowing because the stretched grid pushed their
       centred content off-screen. Constrain and let long lines wrap. */
    .bs-empty {
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
        overflow-wrap: anywhere;
    }
    .bs-empty-title, .bs-empty-sub { max-width: 100%; }

    /* Card headers: title and "View all" on one row rather than stacked */
    .bs-card-hdr {
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
    }
    .bs-card-hdr > .bs-btn { flex-shrink: 0; }
}

/* ============================================================
   SIGN-IN PAGE — HERO LAYOUT
   
   .bs-login-hero uses justify-content:space-between, which pins the tagline
   block to the very bottom. The feature cards live inside that block, so on
   a short window they hang past the panel edge and get cut off.
   
   Brand stays at the top; the tagline group is centred in the space beneath
   it, keeping the whole thing on screen. The sign-in form is short, so this
   page needs no scroll containment — unlike registration.
   ============================================================ */
@media (min-width: 901px) {
    .bs-login-hero {
        justify-content: flex-start;
        overflow: hidden;
    }
    .bs-login-hero .bs-login-brand   { flex-shrink: 0; }
    .bs-login-hero .bs-login-tagline { margin-top: auto; margin-bottom: auto; }
}

/* Short windows: shrink rather than clip */
@media (min-width: 901px) and (max-height: 800px) {
    .bs-login-hero       { padding: 36px 44px; }
    .bs-login-tagline h1 { font-size: 32px; }
    .bs-login-tagline p  { font-size: 13.5px; }
    .bs-login-features   { margin-top: 22px; gap: 14px; }
}
@media (min-width: 901px) and (max-height: 660px) {
    .bs-login-hero       { padding: 26px 36px; }
    .bs-login-tagline h1 { font-size: 27px; }
    .bs-login-tagline p  { font-size: 12.5px; }
    .bs-login-features   { margin-top: 16px; gap: 10px; }
}
@media (min-width: 901px) and (max-height: 520px) {
    .bs-login-features  { display: none; }
    .bs-login-tagline p { display: none; }
}

/* ============================================================
   DEMO ACCOUNTS MENU (sign-in page)
   A hamburger in the panel's top-right corner. The panel is the
   positioning context, so the button sits over the form area rather
   than the dark hero where it would be hard to see.
   ============================================================ */
.bs-login-panel { position: relative; }

.bs-demo-menu {
    position: absolute;
    top: 18px;
    right: 20px;
    z-index: 20;
}

.bs-demo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 9px;
    color: var(--bs-text-2);
    cursor: pointer;
    transition: background .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
}
.bs-demo-btn:hover   { background: var(--bs-bg-soft); color: var(--bs-ink); }
.bs-demo-btn.is-open { background: var(--bs-accent-soft); color: var(--bs-accent-2); }

.bs-demo-panel {
    position: absolute;
    top: 46px;
    right: 0;
    width: 268px;
    background: var(--bs-surface);
    border: 1px solid var(--bs-border);
    border-radius: 12px;
    box-shadow: var(--bs-shadow-lg);
    padding: 14px;
    animation: bsDemoIn .16s ease;
}
@keyframes bsDemoIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bs-demo-panel-title {
    font-family: var(--bs-font-display);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--bs-ink);
}
.bs-demo-panel-sub {
    font-size: 11.5px;
    color: var(--bs-text-2);
    margin: 2px 0 10px;
}
.bs-demo-panel-sub code {
    font-family: var(--bs-font-mono);
    font-size: 11px;
    background: var(--bs-bg-soft);
    padding: 1px 5px;
    border-radius: 4px;
}

.bs-demo-list { display: flex; flex-direction: column; gap: 2px; }

.bs-demo-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    width: 100%;
    padding: 7px 9px;
    background: transparent;
    border: none;
    border-radius: 7px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s;
}
.bs-demo-item:hover { background: var(--bs-bg-soft); }
.bs-demo-item b     { font-size: 12.5px; font-weight: 600; color: var(--bs-ink); }
.bs-demo-item span  { font-family: var(--bs-font-mono); font-size: 11px; color: var(--bs-text-2); }

.bs-demo-hint {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid var(--bs-border-2);
    font-size: 11px;
    color: var(--bs-text-3);
}

@media (max-width: 560px) {
    .bs-demo-menu  { top: 10px; right: 10px; }
    .bs-demo-panel { width: min(268px, calc(100vw - 28px)); }
}


/* ---- Queue ageing chips ----
   Colour is a second channel, never the only one: the chip always carries
   the day count as text so it survives colourblindness and bad projectors. */
.bs-age {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--bs-font-mono);
    padding: 2px 7px;
    border-radius: 10px;
    white-space: nowrap;
    line-height: 1.4;
}
.bs-age-ok   { background: var(--bs-accent-soft);        color: var(--bs-accent-2); }
.bs-age-warn { background: var(--bs-amber-soft);          color: var(--bs-amber); }
.bs-age-late { background: var(--bs-red-soft);            color: var(--bs-red); }

/* Queue rows. No edge stripes: age is carried entirely by the chip, which
   states the number in words as well as colour. One row, one place to look. */
.bs-queue-row {
    display: block;
    padding: 14px 20px;
    border-bottom: 1px solid var(--bs-border-2);
    text-decoration: none;
    transition: background .15s;
}
.bs-queue-row.is-active { background: var(--bs-accent-soft); }
