:root {
    color-scheme: light;
    --bh-navy: #0b1220;
    --bh-navy-soft: #111c31;
    --bh-blue: #2043ff;
    --bh-blue-hover: #1735d6;
    --bh-gold: #ffc107;
    --bh-canvas: #f5f7fb;
    --bh-surface: #ffffff;
    --bh-surface-soft: #fbfcfe;
    --bh-text: #18233b;
    --bh-muted: #71809c;
    --bh-line: #e4e9f2;
    --bh-success: #168b63;
    --bh-danger: #c83b54;
    --bh-warning: #a87500;
    --bh-shadow: 0 24px 70px rgba(11, 18, 32, .10);
    --bh-radius: 18px;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bh-canvas: #101522;
    --bh-surface: #171e2d;
    --bh-surface-soft: #141b29;
    --bh-text: #f2f5fb;
    --bh-muted: #9aa8bf;
    --bh-line: #2b3548;
    --bh-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bh-canvas); }
body { margin: 0; min-height: 100vh; background: var(--bh-canvas); color: var(--bh-text); font-family: Tahoma, "Segoe UI", Arial, sans-serif; transition: background .2s ease, color .2s ease; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 42px; height: 42px; border: 1px solid var(--bh-line); border-radius: 12px; background: var(--bh-surface); color: var(--bh-text); cursor: pointer; transition: border-color .2s, transform .2s, background .2s; }
.theme-toggle:hover { border-color: var(--bh-blue); transform: translateY(-1px); }
.theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: inline; }

.auth-page { display: grid; place-items: center; padding: 30px; min-height: 100vh; }
.auth-toolbar { position: fixed; top: 22px; left: 22px; z-index: 5; }
.auth-shell { width: min(1120px, 100%); min-height: 680px; display: grid; grid-template-columns: 1.02fr 1fr; overflow: hidden; border-radius: 28px; background: var(--bh-surface); box-shadow: var(--bh-shadow); border: 1px solid var(--bh-line); }
.auth-visual { order: 2; position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; overflow: hidden; color: #fff; background: radial-gradient(circle at 25% 80%, rgba(32, 67, 255, .25), transparent 32%), linear-gradient(145deg, #07101f 0%, #0b1831 100%); }
.auth-visual::before, .auth-visual::after { content: ""; position: absolute; border: 1px solid rgba(255,255,255,.09); transform: rotate(45deg); border-radius: 46px; pointer-events: none; }
.auth-visual::before { width: 510px; height: 510px; left: -245px; bottom: -200px; }
.auth-visual::after { width: 660px; height: 660px; left: -315px; bottom: -270px; opacity: .7; }
.auth-visual > * { position: relative; z-index: 1; }
.auth-logo { width: 224px; height: 58px; object-fit: contain; object-position: right center; }
.auth-brand-mark { margin-top: auto; margin-bottom: auto; padding-top: 100px; }
.auth-brand-mark h2 { margin: 0; max-width: 410px; color: #fff; font-size: clamp(28px, 3vw, 40px); line-height: 1.35; letter-spacing: -.035em; }
.auth-brand-mark p { max-width: 370px; margin: 18px 0 0; color: #aebbd3; font-size: 14px; line-height: 1.9; }
.auth-footer { color: #7586a7; font-size: 11px; }
.auth-form-side { order: 1; display: flex; align-items: center; padding: 64px 72px; background: var(--bh-surface); }
.auth-form-wrap { width: min(410px, 100%); margin: auto; }
.auth-form-wrap .eyebrow { margin-bottom: 14px; color: var(--bh-blue); font-size: 12px; font-weight: 800; }
.auth-form-wrap h1 { margin: 0 0 10px; color: var(--bh-text); font-size: 32px; letter-spacing: -.035em; }
.auth-subtitle { margin: 0 0 32px; color: var(--bh-muted); font-size: 13px; }
.auth-field { display: grid; gap: 8px; margin-bottom: 19px; }
.auth-field label { color: var(--bh-text); font-size: 12px; font-weight: 700; }
.auth-field input { width: 100%; padding: 14px 15px; border: 1px solid var(--bh-line); border-radius: 12px; outline: none; color: var(--bh-text); background: var(--bh-surface-soft); transition: border-color .2s, box-shadow .2s, background .2s; }
.auth-field input::placeholder { color: var(--bh-muted); }
.auth-field input:focus { border-color: var(--bh-blue); box-shadow: 0 0 0 4px rgba(32, 67, 255, .12); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 5px 0 24px; color: var(--bh-muted); font-size: 12px; }
.auth-check { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.auth-check input { accent-color: var(--bh-blue); }
.auth-link { color: var(--bh-blue); font-weight: 700; }
.auth-button { width: 100%; padding: 15px; border: 0; border-radius: 12px; background: var(--bh-blue); color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 10px 22px rgba(32, 67, 255, .22); transition: background .2s, transform .2s; }
.auth-button:hover { background: var(--bh-blue-hover); transform: translateY(-1px); }
.auth-register { margin-top: 24px; color: var(--bh-muted); font-size: 12px; text-align: center; }
.auth-alert { margin-bottom: 18px; padding: 12px 14px; border: 1px solid rgba(200, 59, 84, .25); border-radius: 12px; color: var(--bh-danger); background: rgba(200, 59, 84, .08); font-size: 12px; }

@media (max-width: 820px) {
    .auth-page { padding: 16px; }
    .auth-shell { display: block; min-height: auto; }
    .auth-visual { min-height: 235px; padding: 28px; }
    .auth-logo { width: 190px; height: 44px; }
    .auth-brand-mark { padding-top: 35px; }
    .auth-brand-mark h2 { font-size: 27px; }
    .auth-brand-mark p { display: none; }
    .auth-footer { margin-top: 35px; }
    .auth-form-side { padding: 40px 25px; }
}

/* Application shell */
.app-shell { min-height: 100vh; display: flex; align-items: stretch; }
.sidebar { order: 2; width: 276px; flex: 0 0 276px; min-height: 100vh; position: sticky; top: 0; z-index: 20; display: flex; flex-direction: column; padding: 28px 18px; color: #fff; background: linear-gradient(180deg, #0b1220 0%, #101c33 100%); }
.brand { display: flex; align-items: center; justify-content: center; min-height: 62px; padding: 4px 10px 26px; border-bottom: 1px solid rgba(255,255,255,.10); }
.brand img { width: 188px; height: 44px; object-fit: contain; object-position: center; }
.nav-label { padding: 26px 13px 10px; color: #8e9db9; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.nav { display: grid; gap: 6px; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 13px 13px; border-radius: 12px; color: #bcc8dd; font-size: 13px; transition: background .2s, color .2s, transform .2s; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.07); transform: translateX(-2px); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(32,67,255,.95), rgba(32,67,255,.58)); box-shadow: 0 10px 24px rgba(32,67,255,.20); }
.nav-icon { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid currentColor; border-radius: 9px; font-size: 10px; font-weight: 800; }
.sidebar-footer { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.10); }
.user-mini { display: flex; align-items: center; gap: 10px; padding: 9px 7px; }
.user-mini strong { display: block; color: #fff; font-size: 12px; }
.user-mini small { display: block; max-width: 160px; overflow: hidden; color: #8d9cba; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 13px; object-fit: cover; color: #d7e1f3; background: #26385f; font-weight: 800; }
.logout-btn { width: 100%; margin-top: 10px; padding: 11px; border: 0; border-radius: 11px; color: #c9d3e9; background: rgba(255,255,255,.06); cursor: pointer; }
.main-area { order: 1; flex: 1; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 80px; padding: 0 42px; border-bottom: 1px solid var(--bh-line); background: color-mix(in srgb, var(--bh-surface) 90%, transparent); backdrop-filter: blur(14px); }
.topbar-title { color: var(--bh-muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--bh-line); border-radius: 12px; color: var(--bh-text); background: var(--bh-surface); cursor: pointer; }
.mobile-menu { display: none; }
.content { max-width: 1480px; margin: 0 auto; padding: 38px 42px 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.eyebrow { margin-bottom: 9px; color: var(--bh-blue); font-size: 11px; font-weight: 800; }
.page-heading h1 { margin: 0; color: var(--bh-text); font-size: 30px; letter-spacing: -.035em; }
.page-heading p { margin: 9px 0 0; color: var(--bh-muted); font-size: 13px; }
.date-chip { padding: 11px 15px; border: 1px solid var(--bh-line); border-radius: 12px; color: var(--bh-muted); background: var(--bh-surface); font-size: 11px; }
.alert { margin-bottom: 18px; padding: 14px 16px; border-radius: 14px; font-size: 12px; }
.alert-success { border: 1px solid rgba(22,139,99,.20); color: var(--bh-success); background: rgba(22,139,99,.09); }
.alert-error { border: 1px solid rgba(200,59,84,.20); color: var(--bh-danger); background: rgba(200,59,84,.09); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card, .panel, .server-card { border: 1px solid var(--bh-line); border-radius: var(--bh-radius); background: var(--bh-surface); box-shadow: var(--bh-shadow); }
.stat-card { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px; }
.stat-label { margin-bottom: 12px; color: var(--bh-muted); font-size: 11px; }
.stat-value { color: var(--bh-text); font-size: 28px; font-weight: 800; letter-spacing: -.04em; }
.stat-icon { display: grid; place-items: center; width: 45px; height: 45px; border-radius: 14px; font-weight: 900; }
.blue { color: var(--bh-blue); background: rgba(32,67,255,.10); }
.green { color: var(--bh-success); background: rgba(22,139,99,.10); }
.gold { color: var(--bh-warning); background: rgba(255,193,7,.13); }
.purple { color: #8054c8; background: rgba(128,84,200,.11); }
.panel { padding: 25px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.panel-head h2 { margin: 0; color: var(--bh-text); font-size: 17px; }
.panel-head p { margin: 5px 0 0; color: var(--bh-muted); font-size: 11px; }
.text-link { color: var(--bh-blue); font-size: 11px; font-weight: 700; }
.servers-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.server-card { padding: 22px; }
.server-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--bh-line); }
.server-name { color: var(--bh-text); font-size: 16px; font-weight: 800; }
.server-id { margin-top: 6px; color: var(--bh-muted); direction: ltr; font-size: 10px; text-align: right; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 20px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.status-online { color: var(--bh-success); background: rgba(22,139,99,.10); }
.status-offline { color: #9aa6ba; background: rgba(154,166,186,.12); }
.status-pending { color: var(--bh-warning); background: rgba(255,193,7,.13); }
.server-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 19px 0; }
.info-item small { display: block; margin-bottom: 6px; color: var(--bh-muted); font-size: 10px; }
.info-item strong { display: block; overflow: hidden; color: var(--bh-text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.server-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding-top: 16px; border-top: 1px solid var(--bh-line); }
.action-btn { padding: 10px 6px; border: 1px solid var(--bh-line); border-radius: 10px; color: var(--bh-text); background: var(--bh-surface-soft); font-size: 10px; cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.action-btn:hover { border-color: var(--bh-blue); color: var(--bh-blue); background: rgba(32,67,255,.07); }
.action-btn.primary { border-color: var(--bh-blue); color: #fff; background: var(--bh-blue); }
.action-btn.danger { border-color: rgba(200,59,84,.25); color: var(--bh-danger); }
.action-btn.gold { border-color: rgba(255,193,7,.35); color: var(--bh-warning); background: rgba(255,193,7,.08); }
.empty { padding: 48px 20px; border: 1px dashed var(--bh-line); border-radius: 16px; color: var(--bh-muted); text-align: center; }
.empty strong { display: block; margin-bottom: 8px; color: var(--bh-text); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--bh-text); font-size: 12px; font-weight: 700; }
.field input, .field textarea, .field select { width: 100%; padding: 13px 14px; border: 1px solid var(--bh-line); border-radius: 11px; outline: none; color: var(--bh-text); background: var(--bh-surface-soft); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--bh-blue); box-shadow: 0 0 0 4px rgba(32,67,255,.12); }
.primary-btn, .secondary-btn { padding: 13px 20px; border-radius: 11px; cursor: pointer; font-weight: 700; }
.primary-btn { border: 0; color: #fff; background: var(--bh-blue); }
.secondary-btn { border: 1px solid var(--bh-line); color: var(--bh-text); background: var(--bh-surface); }
.button-row { display: flex; align-items: center; gap: 10px; margin-top: 22px; }
@media (max-width: 1100px) { .sidebar { width: 244px; flex-basis: 244px; } .topbar, .content { padding-left: 24px; padding-right: 24px; } .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 780px) { .sidebar { position: fixed; right: 0; width: 280px; transform: translateX(105%); transition: transform .25s; box-shadow: -20px 0 50px rgba(0,0,0,.2); } .sidebar.open { transform: translateX(0); } .main-area { width: 100%; } .topbar { height: 70px; padding: 0 18px; } .mobile-menu { display: inline-grid; } .content { padding: 26px 16px 50px; } .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 24px; } .page-heading h1 { font-size: 25px; } .stats-grid, .servers-grid, .form-grid { grid-template-columns: 1fr; } .server-actions { grid-template-columns: repeat(2, 1fr); } .date-chip { display: none; } .overlay { display: none; position: fixed; inset: 0; z-index: 15; background: rgba(6,14,30,.4); } .overlay.show { display: block; } }

/* Admin data views */
.data-table { width: 100%; border-collapse: collapse; color: var(--bh-text); font-size: 12px; }
.data-table th { padding: 12px; border-bottom: 1px solid var(--bh-line); color: var(--bh-muted); font-size: 10px; font-weight: 800; text-align: right; white-space: nowrap; }
.data-table td { padding: 15px 12px; border-bottom: 1px solid var(--bh-line); vertical-align: middle; }
.data-table td strong { display: block; font-size: 12px; }
.data-table td small { display: block; margin-top: 5px; color: var(--bh-muted); font-size: 10px; }
.search-form, .filter-form, .inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input { min-height: 42px; padding: 10px 12px; border: 1px solid var(--bh-line); border-radius: 11px; outline: none; color: var(--bh-text); background: var(--bh-surface-soft); }
.input:focus { border-color: var(--bh-blue); box-shadow: 0 0 0 4px rgba(32,67,255,.12); }
.search-form .input { min-width: 220px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.fields label { display: grid; gap: 8px; color: var(--bh-text); font-size: 12px; font-weight: 700; }
.fields small { color: var(--bh-muted); font-size: 10px; font-weight: 400; }
.check-row { display: flex; align-items: center; gap: 9px; margin-top: 22px; color: var(--bh-text); font-size: 12px; font-weight: 700; }
.check-row input, .permission-item input { accent-color: var(--bh-blue); }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.permission-item { display: flex; align-items: center; gap: 10px; padding: 13px; border: 1px solid var(--bh-line); border-radius: 11px; color: var(--bh-text); background: var(--bh-surface-soft); font-size: 11px; cursor: pointer; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.pagination-wrap { margin-top: 20px; color: var(--bh-muted); font-size: 11px; }
.pagination-wrap nav { display: flex; justify-content: center; }
.compact { min-height: 35px; padding: 7px 9px; font-size: 11px; }
.inline-form { justify-content: flex-start; }
@media (max-width: 780px) { .fields, .permission-grid { grid-template-columns: 1fr; } .panel-head { align-items: flex-start; flex-direction: column; } .search-form .input { min-width: 0; width: 100%; } .search-form, .filter-form { width: 100%; } }

/* Resource directory identifiers */
.resource-directory code { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: left; color: var(--bh-text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.copy-value { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.copy-btn { border: 1px solid var(--bh-line); border-radius: 8px; background: var(--bh-surface-soft); color: var(--bh-muted); padding: 5px 8px; font-size: 11px; cursor: pointer; white-space: nowrap; transition: .18s ease; }
.copy-btn:hover, .copy-btn.is-copied { border-color: var(--bh-blue); color: var(--bh-blue); background: rgba(32,67,255,.10); }
.resource-directory th:nth-child(2), .resource-directory th:nth-child(3) { white-space: nowrap; }
@media (max-width: 760px) { .copy-value { min-width: 135px; } .resource-directory code { max-width: 130px; } }

/* Customer dashboard simplification */
.stats-grid-simple { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 760px; }
.stat-card-clean { min-height: 118px; align-items: center; }
.stat-card-clean > div { width: 100%; }
.stat-state { display: flex; align-items: center; gap: 9px; color: var(--bh-text); font-size: 21px; font-weight: 800; }
.state-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: currentColor; }
.state-online { color: var(--bh-success); }
.state-offline { color: var(--bh-danger); }
.server-info-single { grid-template-columns: minmax(240px, 1fr); padding-bottom: 16px; }
.primary-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding-top: 18px; }
.primary-actions form { min-width: 0; }
.primary-actions .action-btn { width: 100%; min-height: 52px; padding: 13px 12px; border-radius: 12px; font-size: 13px; font-weight: 800; }
.primary-actions .power-start { border-color: var(--bh-success); color: #fff; background: var(--bh-success); box-shadow: 0 8px 18px rgba(22,139,99,.18); }
.primary-actions .power-start:hover { border-color: #0f704f; color: #fff; background: #0f704f; }
.primary-actions .power-stop { border-color: var(--bh-danger); color: #fff; background: var(--bh-danger); box-shadow: 0 8px 18px rgba(200,59,84,.18); }
.primary-actions .power-stop:hover { border-color: #a72e45; color: #fff; background: #a72e45; }
.primary-actions .power-restart { border-color: var(--bh-blue); color: #fff; background: var(--bh-blue); box-shadow: 0 8px 18px rgba(32,67,255,.18); }
.primary-actions .power-restart:hover { border-color: var(--bh-blue-hover); color: #fff; background: var(--bh-blue-hover); }
@media (max-width: 780px) { .stats-grid-simple { grid-template-columns: 1fr; max-width: none; } .primary-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .primary-actions form:last-child { grid-column: 1 / -1; } .primary-actions .action-btn { min-height: 52px; padding: 12px 8px; font-size: 12px; } }

@media (max-width: 780px) {
    .server-info { grid-template-columns: 1fr; gap: 10px; padding: 14px 0; }
    .server-info .info-item { display: grid; grid-template-columns: minmax(0, 86px) minmax(0, 1fr); align-items: center; gap: 10px; }
    .server-info .info-item small { margin: 0; }
    .server-info .info-item strong { min-width: 0; overflow: visible; text-overflow: clip; white-space: normal; word-break: break-word; }
    .server-info .info-item:first-child strong { font-size: 13px; }
}

/* Customer layout refinements */
.app-shell { flex-direction: row; }
.sidebar { order: 1; }
.main-area { order: 2; }
.topbar-title:empty { display: none; }
.stat-state { align-items: center; gap: 8px; line-height: 1.2; }
.state-dot { width: 9px; height: 9px; flex-basis: 9px; }
.server-info { gap: 10px; padding: 15px 0; align-items: start; }
.info-item small { margin-bottom: 3px; line-height: 1.25; }
.info-item strong { line-height: 1.3; }
.server-info .info-item:first-child strong { font-size: 13px; letter-spacing: .01em; }
@media (max-width: 780px) { .app-shell { display: block; } .sidebar { order: initial; } .main-area { order: initial; } }

/* Final customer alignment fixes */
.app-shell { min-height: 100vh; align-items: stretch; }
.sidebar { align-self: stretch; }
.main-area { display: flex; flex-direction: column; min-height: 100vh; }
.topbar { flex: 0 0 80px; }
.content { width: 100%; }
.info-item { min-width: 0; text-align: right; }
.info-item strong { margin-top: 0; text-align: right; }
.info-item strong[dir="ltr"] { direction: ltr; text-align: right; unicode-bidi: isolate; }
@media (max-width: 780px) { .topbar { flex-basis: 70px; } }

/* Customer shell alignment */
.workspace { order: 2; flex: 1 1 auto; min-width: 0; min-height: 100vh; }
.workspace .main-area { width: 100%; min-height: 100vh; }
.workspace .content { width: 100%; }
.sidebar { overflow: visible; }
@media (max-width: 780px) { .workspace { width: 100%; min-height: 100vh; } .workspace .main-area { min-height: 100vh; } }

/* Fixed customer workspace */
html, body { height: 100%; overflow: hidden; }
.app-shell { height: 100vh; min-height: 0; overflow: hidden; }
.sidebar { height: 100vh; min-height: 0; overflow: hidden; padding: 0 18px 20px; }
.brand { height: 80px; min-height: 80px; box-sizing: border-box; padding: 0 10px; }
.workspace, .workspace .main-area { height: 100vh; min-height: 0; overflow: hidden; }
.workspace .content { min-height: 0; overflow: hidden; }
.invoice-empty { min-height: 280px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; }
.invoice-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px; border: 1px solid var(--bh-line); border-radius: 17px; color: var(--bh-blue); background: rgba(32,67,255,.10); font-size: 22px; font-weight: 800; }
.invoice-empty h2 { margin: 0; color: var(--bh-text); font-size: 18px; }
.invoice-empty p { margin: 0; color: var(--bh-muted); font-size: 12px; }
@media (max-width: 780px) {
    html, body { overflow: auto; }
    .app-shell { height: auto; min-height: 100vh; overflow: visible; }
    .sidebar { height: 100vh; min-height: 100vh; overflow-y: auto; padding: 28px 18px; }
    .brand { height: auto; min-height: 62px; padding: 4px 10px 26px; }
    .workspace, .workspace .main-area { height: auto; min-height: 100vh; overflow: visible; }
    .workspace .content { overflow: visible; }
}

/* Support workflow */
.danger-btn { border: 1px solid rgba(200,59,84,.25); border-radius: 11px; padding: 10px 14px; color: #fff; background: var(--bh-danger); cursor: pointer; font-weight: 700; }
.danger-btn:hover { background: #a72e45; }
.thread { display: grid; gap: 12px; }
.thread-message { max-width: 82%; padding: 15px 17px; border: 1px solid var(--bh-line); border-radius: 15px; background: var(--bh-surface-soft); }
.thread-message.customer { justify-self: start; }
.thread-message.admin { justify-self: end; border-color: rgba(32,67,255,.24); background: rgba(32,67,255,.08); }
.thread-message-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--bh-muted); font-size: 10px; }
.thread-message-head strong { color: var(--bh-text); font-size: 11px; }
.thread-message-body { margin: 10px 0 0; color: var(--bh-text); font-size: 12px; line-height: 1.9; white-space: pre-wrap; }
.reply-locked { padding: 14px 16px; border: 1px solid rgba(200,59,84,.20); border-radius: 13px; color: var(--bh-danger); background: rgba(200,59,84,.08); font-size: 12px; }
@media (max-width: 780px) { .thread-message { max-width: 94%; } }

/* Billing */
.invoice-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.invoice-status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.invoice-status-paid { color: var(--bh-success); background: rgba(22,139,99,.10); }
.invoice-status-pending { color: var(--bh-warning); background: rgba(255,193,7,.13); }
.invoice-status-refunded { color: var(--bh-blue); background: rgba(32,67,255,.10); }
.invoice-status-cancelled { color: var(--bh-danger); background: rgba(200,59,84,.10); }
.invoice-reference { margin-top: 20px; color: var(--bh-muted); font-size: 12px; }
.invoice-reference strong { color: var(--bh-text); direction: ltr; display: inline-block; }
.table-wrap { overflow-x: auto; }
.invoice-table { min-width: 680px; }

.invoice-table .row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.invoice-table .row-actions form { margin: 0; }
.danger-btn { border: 1px solid rgba(200,59,84,.35); background: rgba(200,59,84,.12); color: var(--bh-danger); }
.danger-btn:hover { background: var(--bh-danger); color: #fff; }

.attachment-list { display: grid; gap: 8px; margin-top: 12px; }
.attachment-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border: 1px solid var(--bh-line); border-radius: 10px; background: var(--bh-surface); color: var(--bh-text); font-size: 11px; }
.attachment-actions { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.attachment-actions a { color: var(--bh-blue); font-weight: 800; text-decoration: none; }
.attachment-actions a:hover { text-decoration: underline; }

.invoice-table td:last-child { min-width: 148px; }
.invoice-table .row-actions { flex-wrap: nowrap; gap: 5px; justify-content: flex-start; }
.invoice-table .row-actions > a,
.invoice-table .row-actions > form { flex: 0 0 auto; }
.invoice-table .row-actions .compact { min-width: 58px; padding: 7px 8px; text-align: center; }
.invoice-table .row-actions form { display: flex; }

/* Invoice action cell: keep edit and delete on one horizontal line */
.row-actions { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: nowrap; gap: 5px; white-space: nowrap; }
.row-actions > form { display: flex; flex: 0 0 auto; margin: 0; }
.row-actions > a, .row-actions .compact { flex: 0 0 auto; min-width: 58px; padding: 7px 8px; text-align: center; }

.snapshot-row { display:flex; align-items:center; justify-content:space-between; gap:18px; padding:15px 0; border-bottom:1px solid var(--bh-line); }
.snapshot-row:last-of-type { border-bottom:0; }
.snapshot-row small { display:block; margin-top:5px; color:var(--bh-muted); font-size:11px; }
.snapshot-row .row-actions { display:flex; align-items:center; gap:8px; flex-wrap:nowrap; white-space:nowrap; }
@media (max-width: 780px) { .snapshot-row { align-items:stretch; flex-direction:column; } .snapshot-row .row-actions { justify-content:flex-start; } }

/* PWA install prompt */
.pwa-install-banner { position: fixed; right: 24px; bottom: 24px; z-index: 60; display: flex; align-items: center; gap: 22px; max-width: min(520px, calc(100vw - 32px)); padding: 15px 17px; border: 1px solid var(--bh-line); border-radius: 16px; color: var(--bh-text); background: var(--bh-surface); box-shadow: 0 18px 42px rgba(6,14,30,.22); }
.pwa-install-copy strong { display: block; font-size: 13px; }
.pwa-install-copy span { display: block; margin-top: 4px; color: var(--bh-muted); font-size: 11px; }
.pwa-install-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.pwa-install-button { border: 0; border-radius: 10px; padding: 10px 16px; color: #fff; background: var(--bh-blue); cursor: pointer; font-size: 11px; font-weight: 800; }
.pwa-dismiss-button { width: 30px; height: 30px; border: 1px solid var(--bh-line); border-radius: 9px; color: var(--bh-muted); background: transparent; cursor: pointer; font-size: 20px; line-height: 1; }
@media (max-width: 620px) { .pwa-install-banner { right: 16px; bottom: 16px; left: 16px; align-items: flex-start; flex-direction: column; gap: 12px; } .pwa-install-actions { width: 100%; } .pwa-install-button { flex: 1; } }

/* Manual notifications */
.account-row-actions { display: flex; align-items: center; justify-content: flex-start; gap: 12px; flex-wrap: wrap; white-space: nowrap; }
.notification-action-link { color: var(--bh-danger); }
.notification-action-link:hover { color: #a72e45; }
.notification-nav-link { position: relative; }
.notification-badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; color: #fff; background: var(--bh-danger); font-size: 10px; font-weight: 800; line-height: 1; }
.notification-topbar-link { position: relative; text-decoration: none; }
.notification-topbar-link > .notification-badge { position: absolute; top: -5px; right: -5px; }
.notification-compose-panel { max-width: 920px; }
.notification-recipient { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; padding: 14px 16px; border: 1px solid var(--bh-line); border-radius: 13px; background: var(--bh-surface-soft); }
.notification-recipient-label { color: var(--bh-muted); font-size: 11px; font-weight: 700; }
.notification-recipient strong { color: var(--bh-text); font-size: 13px; }
.notification-recipient small { color: var(--bh-muted); direction: ltr; font-size: 11px; }
.field-span-2 { grid-column: 1 / -1; }
.notification-list { display: grid; gap: 12px; }
.notification-card { display: flex; align-items: flex-start; gap: 13px; padding: 16px; border: 1px solid var(--bh-line); border-radius: 14px; background: var(--bh-surface-soft); }
.notification-card-mark { display: grid; flex: 0 0 32px; place-items: center; width: 32px; height: 32px; border-radius: 11px; color: #fff; background: var(--bh-blue); font-size: 16px; font-weight: 900; }
.notification-type-billing .notification-card-mark { background: var(--bh-success); }
.notification-type-maintenance .notification-card-mark { background: #c17b16; }
.notification-type-trial .notification-card-mark { background: #7657c8; }
.notification-type-important .notification-card-mark { background: var(--bh-danger); }
.notification-card-content { min-width: 0; flex: 1; }
.notification-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.notification-card h3 { margin: 0; color: var(--bh-text); font-size: 14px; }
.notification-card time { flex: 0 0 auto; color: var(--bh-muted); direction: ltr; font-size: 10px; }
.notification-card p { margin: 9px 0 0; color: var(--bh-muted); font-size: 12px; line-height: 1.9; white-space: pre-wrap; }
.notification-empty { padding: 34px 16px; }
@media (max-width: 780px) {
    .account-row-actions { gap: 7px 12px; }
    .notification-recipient { align-items: flex-start; flex-direction: column; gap: 5px; }
    .notification-card-head { flex-direction: column; gap: 6px; }
    .notification-card time { direction: rtl; }
}

.pwa-push-panel { position: fixed; z-index: 1200; left: 22px; right: 22px; bottom: 22px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid rgba(32,67,255,.3); border-radius: 17px; background: var(--surface, #111a2f); box-shadow: 0 16px 42px rgba(0,0,0,.28); }
.pwa-push-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: #fff; background: var(--bh-blue, #2043ff); font-weight: 900; }
.pwa-push-content { display: grid; gap: 4px; min-width: 0; }
.pwa-push-content strong { color: var(--text, #fff); font-size: 13px; }
.pwa-push-content span { color: var(--muted, #aeb8ce); font-size: 11px; line-height: 1.6; }
.pwa-push-action { border: 0; border-radius: 10px; padding: 10px 13px; color: #fff; background: var(--bh-blue, #2043ff); cursor: pointer; font-size: 11px; font-weight: 800; white-space: nowrap; }
.pwa-push-action:disabled { cursor: default; opacity: .75; }
.pwa-push-panel.is-enabled { border-color: rgba(22,139,99,.4); }
.pwa-push-panel.is-enabled .pwa-push-icon { background: var(--bh-success, #168b63); }
@media (max-width: 600px) { .pwa-push-panel { left: 12px; right: 12px; bottom: 12px; grid-template-columns: auto 1fr; } .pwa-push-action { grid-column: 1 / -1; width: 100%; } }

.pwa-push-panel { transition: opacity .2s ease, transform .2s ease; }
.pwa-push-panel.is-hidden { opacity: 0; transform: translateY(12px); pointer-events: none; }

/* Admin scrolling override: keep the fixed workspace rules limited to User PWA. */
.app-shell > .main-area { height: 100vh; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.app-shell > .main-area .content { min-height: 100vh; overflow: visible; }
@media (max-width: 780px) {
    .app-shell > .main-area { height: auto; min-height: 100vh; overflow: visible; }
    .app-shell > .main-area .content { min-height: 100vh; overflow: visible; }
}
