/* Shared site components. Logical properties preserve Persian/RTL layouts. */

:root {
    color-scheme: dark;
    --bt-bg: #101114;
    --bt-panel: #1b1d22;
    --bt-panel-2: #23262c;
    --bt-inset: #14161a;
    --bt-line: #34373f;
    --bt-line-strong: #545965;
    --bt-line-soft: #2b2e35;
    --bt-text: #f5f5f7;
    --bt-muted: #b5b8c1;
    --bt-faint: #969ca9;
    --bt-accent: #a99bff;
    --bt-accent-soft: rgba(169, 155, 255, 0.14);
    --bt-accent-contrast: #101114;
    --bt-primary: var(--bt-accent);
    --bt-good: #77d9a0;
    --bt-warn: #efc574;
    --bt-bad: #ff9399;
    --bt-info: #8bc9ef;
    --bt-radius-sm: 10px;
    --bt-radius-md: 14px;
    --bt-radius-lg: 24px;
    --bt-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    --bt-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, Vazirmatn, sans-serif;
    --bt-mono: "SFMono-Regular", Consolas, "Liberation Mono", Vazirmatn, monospace;
}

html[dir="rtl"] {
    --bt-sans: Vazirmatn, -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
    --bt-mono: Vazirmatn, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

body.bt-body {
    margin: 0;
    background: var(--bt-bg);
    color: var(--bt-text);
    font-family: var(--bt-sans);
    font-size: 15px;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }

:focus-visible { outline: 1px solid var(--bt-accent); outline-offset: 2px; }

.bt-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 34px 22px 90px;
}

/* ------------------------------------------------------------------- nav */

.bt-nav {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--bt-line);
    background: var(--bt-panel);
}

.bt-nav-inner {
    display: flex;
    max-width: 1180px;
    min-height: 46px;
    margin: 0 auto;
    padding: 0 22px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.bt-brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--bt-text);
    font-family: var(--bt-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bt-brand-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--bt-accent);
}

.bt-nav-links {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.bt-nav-link {
    color: var(--bt-faint);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.bt-nav-link:hover { color: var(--bt-text); }

.bt-nav-link.is-active { color: var(--bt-accent); }

/* --------------------------------------------------------------- headings */

.bt-title {
    margin: 0 0 7px;
    font-family: var(--bt-sans);
    font-size: 34px;
    font-weight: 600;
    letter-spacing: -0.015em;
    line-height: 1.15;
}

.bt-subtitle {
    margin: 0 0 26px;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 13px;
}

.bt-subtitle.is-flush { margin-bottom: 0; }

.bt-count {
    color: var(--bt-accent);
    font-weight: 700;
}

/* ---------------------------------------------------------------- filters */

/* One bordered control strip; every control is a cell divided by a 1px line. */
.bt-filters {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid var(--bt-line);
    background: var(--bt-panel);
    align-items: stretch;
}

.bt-search-wrap {
    position: relative;
    display: flex;
    min-width: 220px;
    min-height: 44px;
    padding-inline: 38px 34px;
    border-inline-end: 1px solid var(--bt-line);
    flex: 1 1 260px;
    align-items: center;
}

.bt-search-wrap:focus-within { border-color: var(--bt-accent); }

.bt-search-icon {
    position: absolute;
    inset-inline-start: 14px;
    width: 15px;
    height: 15px;
    color: var(--bt-faint);
    pointer-events: none;
}

.bt-search-wrap:focus-within .bt-search-icon { color: var(--bt-accent); }

.bt-search {
    width: 100%;
    min-width: 0;
    height: 30px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: var(--bt-mono);
    font-size: 13px;
    letter-spacing: 0.01em;
}

.bt-search::placeholder { color: var(--bt-faint); }

.bt-search-wrap.is-busy .bt-search { color: var(--bt-muted); }

/* Only visible while a filtered reload is in flight. */
.bt-search-spinner {
    position: absolute;
    inset-inline-end: 13px;
    width: 12px;
    height: 12px;
    border: 1px solid var(--bt-line-strong);
    border-top-color: var(--bt-accent);
    opacity: 0;
}

.bt-search-wrap.is-busy .bt-search-spinner {
    opacity: 1;
    animation: bt-spin 0.7s linear infinite;
}

@keyframes bt-spin {
    to { transform: rotate(360deg); }
}

.bt-select {
    min-height: 44px;
    padding-inline: 13px 32px;
    border: 0;
    border-inline-end: 1px solid var(--bt-line);
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385859c' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 13px;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    appearance: none;
}

[dir="rtl"] .bt-select { background-position: left 10px center; }

.bt-select:hover { color: var(--bt-text); }
.bt-select:focus { outline: 0; border-color: var(--bt-accent); }

.bt-select option {
    background: var(--bt-panel);
    color: var(--bt-text);
    text-transform: none;
}

/* ---------------------------------------------------------------- buttons */

.bt-btn {
    display: inline-flex;
    min-height: 44px;
    padding: 0 15px;
    border: 0;
    border-inline-end: 1px solid var(--bt-line);
    background: transparent;
    align-items: center;
    gap: 7px;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.bt-btn:last-child { border-inline-end: 0; }

.bt-btn:hover { color: var(--bt-text); }

.bt-btn-accent { color: var(--bt-accent); }

.bt-btn-danger:hover { color: var(--bt-bad); }

.bt-btn.is-disabled {
    color: var(--bt-line-strong);
    cursor: not-allowed;
}

/* Outside the filter strip a button needs its own outline. */
.bt-card .bt-btn,
.bt-pagination .bt-btn,
.bt-field .bt-btn,
.bt-nav .bt-btn,
.bt-lang-menu + .bt-btn,
nav .bt-btn {
    min-height: 32px;
    border: 1px solid var(--bt-line);
    background: var(--bt-panel);
}

.bt-card .bt-btn:hover,
.bt-pagination .bt-btn:hover,
.bt-field .bt-btn:hover,
.bt-nav .bt-btn:hover,
nav .bt-btn:hover { border-color: var(--bt-line-strong); }

.bt-card .bt-btn-accent,
.bt-pagination .bt-btn-accent { border-color: var(--bt-accent); }

.bt-card .bt-btn-danger:hover { border-color: var(--bt-bad); }

.bt-pagination .bt-btn.is-disabled,
.bt-card .bt-btn.is-disabled {
    border-color: var(--bt-line-soft);
    color: var(--bt-line-strong);
}

/* ------------------------------------------------------------------ cards */

/* Reports read as rows of one bordered table rather than floating boxes, and the
   table shares its top edge with the filter strip above it. */
.bt-grid,
.bt-empty {
    border: 1px solid var(--bt-line);
    border-top: 0;
}

.bt-card {
    padding: 22px 20px;
    border-bottom: 1px solid var(--bt-line);
    background: var(--bt-bg);
}

.bt-card:last-child { border-bottom: 0; }

.bt-card:hover { background: var(--bt-panel); }

.bt-card-head {
    display: flex;
    margin-bottom: 16px;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.bt-ign {
    font-family: var(--bt-sans);
    font-size: 19px;
    font-weight: 600;
}

.bt-meta-line {
    display: flex;
    margin-top: 6px;
    flex-wrap: wrap;
    gap: 6px 16px;
    color: var(--bt-faint);
    font-family: var(--bt-mono);
    font-size: 11px;
}

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

/* ------------------------------------------------------------------ chips */

.bt-chip {
    display: inline-flex;
    min-height: 22px;
    padding: 0 7px;
    border: 1px solid var(--bt-line-strong);
    background: var(--bt-inset);
    align-items: center;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.bt-chip-open {
    border-color: rgba(251, 111, 111, 0.5);
    color: var(--bt-bad);
}

.bt-chip-resolved {
    border-color: rgba(95, 224, 140, 0.5);
    color: var(--bt-good);
}

.bt-chip-legacy {
    border-color: var(--bt-line-strong);
    color: var(--bt-faint);
}

.bt-chip-security {
    border-color: rgba(167, 139, 250, 0.55);
    color: var(--bt-accent);
}

.bt-chip-LOW { border-color: rgba(95, 224, 140, 0.45); color: var(--bt-good); }
.bt-chip-MEDIUM { border-color: rgba(251, 191, 36, 0.45); color: var(--bt-warn); }
.bt-chip-HIGH { border-color: rgba(253, 139, 61, 0.5); color: #fd8b3d; }
.bt-chip-CRITICAL { border-color: rgba(251, 111, 111, 0.6); color: var(--bt-bad); }

/* ----------------------------------------------------------- metadata grid */

.bt-kv-grid {
    display: grid;
    margin-bottom: 18px;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px 20px;
}

/* The labels are uppercase mono, which reads small for its size — hence a size
   up and slightly tighter tracking than the chips use. */
.bt-kv-label {
    margin-bottom: 4px;
    color: var(--bt-faint);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.bt-kv-value {
    font-size: 15px;
    overflow-wrap: anywhere;
}

.bt-kv-value.is-mono {
    font-family: var(--bt-mono);
    font-size: 13px;
}

.bt-kv-value.is-empty {
    color: var(--bt-faint);
    font-family: var(--bt-mono);
    font-size: 11px;
}

/* --------------------------------------------------------------- sections */

.bt-section { margin-bottom: 16px; }

.bt-section-title {
    margin: 0 0 8px;
    color: var(--bt-text);
    font-family: var(--bt-mono);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.bt-section-title.is-neutral { color: var(--bt-faint); }
.bt-section-title.is-good { color: var(--bt-good); }
.bt-section-title.is-bad { color: var(--bt-bad); }

.bt-block {
    padding: 13px 14px;
    border: 1px solid var(--bt-line);
    background: var(--bt-inset);
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.bt-notice {
    padding: 11px 13px;
    border: 1px solid var(--bt-line);
    border-inline-start: 2px solid var(--bt-accent);
    background: var(--bt-inset);
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 11px;
}

/* ------------------------------------------------------------ attachments */

.bt-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.bt-thumb {
    width: 132px;
    height: 88px;
    border: 1px solid var(--bt-line);
    background: var(--bt-inset);
    object-fit: cover;
    cursor: zoom-in;
}

.bt-thumb:hover { border-color: var(--bt-accent); }

/* ------------------------------------------------------------- pagination */

.bt-pagination {
    display: flex;
    margin-top: 26px;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.bt-page-indicator {
    color: var(--bt-faint);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
}

/* ------------------------------------------------------------ empty state */

.bt-empty {
    padding: 70px 20px;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 12px;
    text-align: center;
}

/* Inside a .bt-box the surrounding box already draws the border. */
.bt-empty.is-inline {
    padding: 54px 20px;
    border: 0;
}

.bt-empty-icon {
    margin-bottom: 10px;
    color: var(--bt-line-strong);
    font-size: 22px;
}

/* --------------------------------------------------------------- lightbox */

.bt-lightbox {
    position: fixed;
    z-index: 90;
    inset: 0;
    display: none;
    padding: 40px;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.bt-lightbox.is-open { display: flex; }

.bt-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid var(--bt-line-strong);
    object-fit: contain;
}

.bt-lightbox-close {
    position: absolute;
    top: 18px;
    inset-inline-end: 18px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--bt-line-strong);
    background: var(--bt-panel);
    color: var(--bt-muted);
    font-size: 19px;
    line-height: 1;
}

.bt-lightbox-close:hover {
    border-color: var(--bt-accent);
    color: var(--bt-accent);
}

/* -------------------------------------------------------------- lang menu */

.bt-lang-menu {
    position: absolute;
    z-index: 50;
    top: calc(100% + 6px);
    inset-inline-end: 0;
    min-width: 190px;
    border: 1px solid var(--bt-line-strong);
    background: var(--bt-panel);
}

.bt-lang-menu button {
    display: block;
    width: 100%;
    padding: 10px 13px;
    border: 0;
    background: transparent;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 11px;
    text-align: start;
}

.bt-lang-menu button:hover {
    background: var(--bt-panel-2);
    color: var(--bt-text);
}

/* =========================================================== report form */

.bt-form-shell {
    max-width: 880px;
    margin: 0 auto;
    padding: 34px 22px 90px;
}

.bt-form-card {
    border: 1px solid var(--bt-line);
    background: var(--bt-bg);
}

.bt-form-head {
    padding: 26px 24px;
    border-bottom: 1px solid var(--bt-line);
    background: var(--bt-panel);
}

.bt-form-head .bt-subtitle { margin-bottom: 0; }

.bt-link {
    color: var(--bt-accent);
    border-bottom: 1px solid transparent;
}

.bt-link:hover { border-bottom-color: var(--bt-accent); }

.bt-fieldset {
    padding: 24px;
    border-bottom: 1px solid var(--bt-line);
}

.bt-fieldset-title {
    margin: 0 0 20px;
    color: var(--bt-accent);
    font-family: var(--bt-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

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

.bt-field { margin-bottom: 18px; }

.bt-field-grid .bt-field,
.bt-field:last-child { margin-bottom: 0; }

.bt-label {
    display: block;
    margin-bottom: 6px;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.bt-optional {
    color: var(--bt-faint);
    text-transform: none;
}

.bt-hint {
    margin: 6px 0 0;
    color: var(--bt-faint);
    font-family: var(--bt-mono);
    font-size: 11px;
    line-height: 1.5;
}

.bt-input,
.bt-textarea {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--bt-line);
    background: var(--bt-inset);
    color: var(--bt-text);
    font-family: var(--bt-sans);
    font-size: 14px;
}

.bt-input { min-height: 42px; }

.bt-textarea {
    line-height: 1.6;
    resize: vertical;
}

.bt-input::placeholder,
.bt-textarea::placeholder { color: var(--bt-faint); }

.bt-input:focus,
.bt-textarea:focus {
    outline: 0;
    border-color: var(--bt-accent);
}

/* Inside the form a select is a full-width field, not a strip cell. */
.bt-select.is-block {
    display: block;
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--bt-line);
    background-color: var(--bt-inset);
    color: var(--bt-text);
    font-family: var(--bt-sans);
    font-size: 14px;
    letter-spacing: normal;
    text-transform: none;
}

.bt-select.is-block:focus {
    border-color: var(--bt-accent);
}

.bt-url-list {
    display: grid;
    gap: 8px;
}

/* ------------------------------------------------------------- dropzone */

.bt-dropzone {
    display: flex;
    min-height: 92px;
    padding: 16px;
    border: 1px dashed var(--bt-line-strong);
    background: var(--bt-inset);
    align-items: center;
    justify-content: center;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-align: center;
    cursor: pointer;
}

.bt-dropzone:hover,
.bt-dropzone.is-dragging {
    border-color: var(--bt-accent);
    color: var(--bt-accent);
}

.bt-dropzone input[type="file"] { display: none; }

.bt-previews {
    display: flex;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.bt-preview {
    position: relative;
    width: 128px;
    border: 1px solid var(--bt-line);
    background: var(--bt-inset);
}

.bt-preview img {
    display: block;
    width: 100%;
    height: 84px;
    object-fit: cover;
}

.bt-preview-name {
    padding: 5px 6px;
    border-top: 1px solid var(--bt-line);
    color: var(--bt-faint);
    font-family: var(--bt-mono);
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bt-preview-remove {
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    width: 22px;
    height: 22px;
    border: 0;
    border-inline-start: 1px solid var(--bt-line);
    border-bottom: 1px solid var(--bt-line);
    background: var(--bt-panel);
    color: var(--bt-muted);
    font-size: 14px;
    line-height: 1;
}

.bt-preview-remove:hover {
    background: var(--bt-panel-2);
    color: var(--bt-bad);
}

/* -------------------------------------------------------------- security */

.bt-security {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid var(--bt-line);
    border-inline-start: 2px solid var(--bt-accent);
    background: var(--bt-inset);
}

.bt-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--bt-text);
    font-size: 14px;
    line-height: 1.5;
    cursor: pointer;
}

.bt-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 3px 0 0;
    accent-color: var(--bt-accent);
    flex-shrink: 0;
}

/* ---------------------------------------------------------------- submit */

.bt-submit {
    display: block;
    width: 100%;
    min-height: 46px;
    margin: 24px 0 0;
    border: 1px solid var(--bt-accent);
    background: transparent;
    color: var(--bt-accent);
    font-family: var(--bt-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.bt-submit:hover {
    background: var(--bt-accent);
    color: var(--bt-accent-contrast);
}

.bt-submit:disabled {
    border-color: var(--bt-line);
    background: transparent;
    color: var(--bt-faint);
    cursor: not-allowed;
}

/* The report form has no padding of its own — the fieldsets carry it — so the
   trailing button and footnote have to inset themselves. */
.bt-form-card form > .bt-submit,
.bt-form-card form > .bt-hint {
    width: calc(100% - 48px);
    margin-inline: 24px;
}

.bt-form-card form > .bt-hint { margin-bottom: 24px; }

/* The admin footnote sits outside the form, so it needs the padding itself. */
.bt-form-card > .bt-hint {
    padding: 0 24px 24px;
}

/* ----------------------------------------------------------------- modal */

.bt-modal {
    position: fixed;
    z-index: 95;
    inset: 0;
    display: none;
    padding: 24px;
    background: rgba(0, 0, 0, 0.88);
    align-items: center;
    justify-content: center;
}

.bt-modal.is-open { display: flex; }

.bt-modal-box {
    width: 100%;
    max-width: 420px;
    padding: 28px 24px;
    border: 1px solid var(--bt-line-strong);
    background: var(--bt-panel);
    text-align: center;
}

.bt-modal-icon {
    margin-bottom: 12px;
    font-size: 26px;
}

.bt-modal-message {
    margin: 0 0 20px;
    color: var(--bt-text);
    font-size: 14px;
    line-height: 1.6;
}

.bt-modal-box .bt-submit { margin-top: 0; }

/* ====================================================== rest of the site */

/* -------------------------------------------------------------- hero */

.bt-hero {
    padding-bottom: 34px;
    margin-bottom: 34px;
    border-bottom: 1px solid var(--bt-line);
}

.bt-eyebrow {
    margin: 0 0 14px;
    color: var(--bt-accent);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.bt-title.is-hero {
    font-size: 40px;
    letter-spacing: -0.02em;
}

.bt-lead {
    max-width: 640px;
    margin: 14px 0 0;
    color: var(--bt-muted);
    font-size: 15px;
    line-height: 1.65;
}

.bt-cta-row {
    display: flex;
    margin-top: 26px;
    flex-wrap: wrap;
    gap: 10px;
}

.bt-cta-row.is-center { justify-content: center; }

.bt-cta {
    display: inline-flex;
    min-height: 42px;
    padding: 0 20px;
    border: 1px solid var(--bt-line);
    background: var(--bt-panel);
    align-items: center;
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    white-space: nowrap;
}

.bt-cta:hover {
    border-color: var(--bt-line-strong);
    color: var(--bt-text);
}

.bt-cta.is-accent {
    border-color: var(--bt-accent);
    background: var(--bt-accent-soft);
    color: var(--bt-accent);
}

.bt-cta.is-accent:hover {
    background: var(--bt-accent);
    color: var(--bt-accent-contrast);
}

/* ------------------------------------------------------------- panels */

/* The 1px gap is the divider, so the grid never doubles up its lines. */
.bt-panels {
    display: grid;
    border: 1px solid var(--bt-line);
    background: var(--bt-line);
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1px;
}

.bt-panel-item {
    padding: 22px 20px;
    background: var(--bt-bg);
}

.bt-panel-item:hover { background: var(--bt-panel); }

.bt-panel-title {
    margin: 0 0 8px;
    font-family: var(--bt-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.bt-panel-text {
    margin: 0;
    color: var(--bt-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* --------------------------------------------------------------- box */

.bt-box {
    margin-bottom: 28px;
    border: 1px solid var(--bt-line);
    background: var(--bt-bg);
}

.bt-box-head {
    display: flex;
    padding: 14px 18px;
    border-bottom: 1px solid var(--bt-line);
    background: var(--bt-panel);
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.bt-box-title {
    margin: 0;
    color: var(--bt-text);
    font-family: var(--bt-mono);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.bt-box-body { padding: 18px; }

.bt-box-body.is-flush { padding: 0; }

/* ------------------------------------------------------------- table */

/* One row per record, columns declared once so the head lines up with it. */
.bt-tr {
    display: grid;
    padding: 12px 18px;
    border-bottom: 1px solid var(--bt-line-soft);
    /* 132px is what the "Requests / day" head label needs to stay on one line. */
    grid-template-columns: minmax(0, 2.4fr) minmax(0, 1.2fr) 132px auto;
    align-items: center;
    gap: 14px;
}

.bt-tr:last-child { border-bottom: 0; }

.bt-tr.is-head {
    border-bottom: 1px solid var(--bt-line);
    background: var(--bt-panel-2);
    color: var(--bt-faint);
    font-family: var(--bt-mono);
    font-size: 10px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.bt-tr:not(.is-head):hover { background: var(--bt-panel); }

.bt-td {
    min-width: 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

.bt-td.is-mono {
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 12px;
}

.bt-td.is-center { text-align: center; }
.bt-td.is-end { text-align: end; }

.bt-td-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.bt-td-actions .bt-btn {
    min-height: 30px;
    border: 1px solid var(--bt-line);
    background: var(--bt-panel);
}

.bt-td-actions .bt-btn:hover { border-color: var(--bt-line-strong); }
.bt-td-actions .bt-btn-danger:hover { border-color: var(--bt-bad); }

/* ---------------------------------------------------------- inline form */

.bt-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
}

.bt-form-row .bt-input { flex: 1 1 220px; width: auto; }

.bt-form-row .bt-input.is-narrow { flex: 0 0 150px; }

.bt-input.is-tiny {
    width: 100%;
    min-height: 32px;
    padding: 0 8px;
    font-family: var(--bt-mono);
    font-size: 12px;
    text-align: center;
}

.bt-input[readonly] { color: var(--bt-muted); }

/* The submit inside a row is a button, not a full-width bar. */
.bt-form-row .bt-submit {
    display: inline-flex;
    width: auto;
    min-height: 42px;
    margin: 0;
    padding: 0 20px;
    align-items: center;
}

/* ------------------------------------------------------------- alerts */

.bt-alert {
    margin: 14px 0 0;
    padding: 11px 13px;
    border: 1px solid rgba(251, 111, 111, 0.45);
    border-inline-start: 2px solid var(--bt-bad);
    background: var(--bt-inset);
    color: var(--bt-bad);
    font-family: var(--bt-mono);
    font-size: 11px;
    line-height: 1.6;
}

.bt-alert.is-warn {
    border-color: rgba(251, 191, 36, 0.45);
    border-inline-start-color: var(--bt-warn);
    color: var(--bt-warn);
}

/* -------------------------------------------------------------- toast */

.bt-toast {
    position: fixed;
    z-index: 100;
    bottom: 22px;
    inset-inline-end: 22px;
    padding: 11px 15px;
    border: 1px solid var(--bt-good);
    background: var(--bt-panel);
    color: var(--bt-good);
    font-family: var(--bt-mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    transition: opacity 0.25s ease;
}

.bt-toast.is-error {
    border-color: var(--bt-bad);
    color: var(--bt-bad);
}

/* --------------------------------------------------------------- code */

.bt-code {
    display: inline-flex;
    padding: 2px 7px;
    border: 1px solid var(--bt-line);
    background: var(--bt-inset);
    align-items: center;
    color: var(--bt-accent);
    font-family: var(--bt-mono);
    font-size: 13px;
}

button.bt-code { cursor: pointer; }

button.bt-code:hover {
    border-color: var(--bt-accent);
    background: var(--bt-accent-soft);
}

/* ------------------------------------------------------- narrow column */

.bt-narrow {
    max-width: 520px;
    margin: 0 auto;
}

.bt-center { text-align: center; }

.bt-input.is-key {
    min-height: 54px;
    font-family: var(--bt-mono);
    font-size: 16px;
    letter-spacing: 0.04em;
    text-align: center;
}

/* ------------------------------------------------------------ choices */

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

.bt-choice { display: block; cursor: pointer; }

.bt-choice input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.bt-choice-box {
    padding: 12px;
    border: 1px solid var(--bt-line);
    background: var(--bt-inset);
    color: var(--bt-muted);
    font-family: var(--bt-mono);
    font-size: 12px;
    text-align: center;
}

.bt-choice:hover .bt-choice-box {
    border-color: var(--bt-line-strong);
    color: var(--bt-text);
}

.bt-choice input:checked + .bt-choice-box.is-yes {
    border-color: var(--bt-good);
    background: rgba(95, 224, 140, 0.1);
    color: var(--bt-good);
}

.bt-choice input:checked + .bt-choice-box.is-no {
    border-color: var(--bt-bad);
    background: rgba(251, 111, 111, 0.1);
    color: var(--bt-bad);
}

.bt-choice input:focus-visible + .bt-choice-box {
    outline: 1px solid var(--bt-accent);
    outline-offset: 2px;
}

/* -------------------------------------------------------- status page */

.bt-status {
    padding: 80px 20px;
    border: 1px solid var(--bt-line);
    background: var(--bt-bg);
    text-align: center;
}

.bt-status-code {
    margin: 0 0 10px;
    color: var(--bt-accent);
    font-family: var(--bt-mono);
    font-size: 54px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
}

/* ---------------------------------------------------------------- mobile */

@media (max-width: 640px) {
    .bt-title.is-hero { font-size: 30px; }

    .bt-tr {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bt-tr.is-head { display: none; }

    .bt-td.is-center,
    .bt-td.is-end { text-align: start; }

    .bt-td-actions { justify-content: flex-start; }

    .bt-form-row .bt-input,
    .bt-form-row .bt-input.is-narrow,
    .bt-form-row .bt-submit {
        flex: 1 1 100%;
        justify-content: center;
    }

    .bt-title { font-size: 27px; }

    .bt-search-wrap,
    .bt-select,
    .bt-filters .bt-btn {
        border-inline-end: 0;
        border-bottom: 1px solid var(--bt-line);
    }

    .bt-search-wrap,
    .bt-select { flex: 1 1 100%; }

    .bt-filters > :last-child { border-bottom: 0; }

    .bt-fieldset,
    .bt-form-head { padding: 20px 16px; }

    .bt-form-card form > .bt-submit,
    .bt-form-card form > .bt-hint {
        width: calc(100% - 32px);
        margin-inline: 16px;
    }
}

/* ====================================================== shared appearance */

body.bt-body {
    min-height: 100vh;
    background: var(--bt-bg);
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--bt-accent); color: var(--bt-accent-contrast); }
button, input, select, textarea { border-radius: var(--bt-radius-sm); }
:focus-visible { outline: 2px solid var(--bt-accent); outline-offset: 4px; }
button:disabled, .bt-btn.is-disabled { cursor: not-allowed; }

.bt-nav {
    background: rgba(20, 22, 27, 0.86);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.bt-nav-inner { min-height: 76px; gap: 16px; padding-block: 12px; }
.bt-nav-links { gap: 6px; }
.bt-brand {
    margin-inline-end: 24px;
    font: 600 16px/1.3 var(--bt-sans);
    letter-spacing: -0.035em;
    text-transform: none;
    white-space: nowrap;
}
.bt-brand-dot {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    background: var(--bt-accent);
}
.bt-nav-link {
    padding: 8px 12px;
    border-radius: 9px;
    font: 500 13px/1.4 var(--bt-sans);
    letter-spacing: 0;
    text-transform: none;
    transition: color 160ms ease, background-color 160ms ease;
}
.bt-nav-link:hover { background: rgba(255, 255, 255, 0.05); }
.bt-nav-link.is-active { background: var(--bt-accent-soft); color: var(--bt-accent); }

.bt-shell { padding-top: 56px; }
.bt-form-shell { padding-top: 48px; }
.bt-title { font-size: clamp(30px, 4vw, 42px); font-weight: 650; letter-spacing: -0.045em; }
.bt-subtitle { margin-top: 12px; margin-bottom: 32px; font: 400 15px/1.65 var(--bt-sans); }
.bt-lead { font-size: 17px; line-height: 1.7; }
.bt-eyebrow { font: 600 12px/1.5 var(--bt-sans); letter-spacing: 0.1em; }
.bt-narrow > header { margin: 18px 0 32px; }

/* Interface text uses the system face; code and identifiers stay monospace. */
.bt-btn, .bt-cta, .bt-submit, .bt-select, .bt-search,
.bt-label, .bt-hint, .bt-fieldset-title, .bt-box-title, .bt-panel-title,
.bt-section-title, .bt-kv-label, .bt-page-indicator, .bt-empty,
.bt-lang-menu button, .bt-dropzone, .bt-alert, .bt-toast, .bt-notice {
    font-family: var(--bt-sans);
    letter-spacing: 0;
    text-transform: none;
}
.bt-label, .bt-kv-label { font-size: 13px; font-weight: 500; margin-bottom: 8px; }
.bt-hint { font-size: 12px; line-height: 1.65; }
.bt-fieldset-title, .bt-box-title, .bt-panel-title { font-size: 16px; font-weight: 600; }
.bt-fieldset-title { color: var(--bt-text); }
.bt-section-title { font-size: 13px; }
.bt-page-indicator, .bt-empty, .bt-lang-menu button, .bt-alert, .bt-notice, .bt-toast { font-size: 13px; }

.bt-btn, .bt-cta, .bt-submit {
    justify-content: center;
    border: 1px solid var(--bt-line);
    border-radius: 999px;
    background: var(--bt-panel-2);
    color: var(--bt-text);
    font-size: 13px;
    font-weight: 500;
    transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.bt-btn { min-height: 38px; padding-inline: 17px; }
.bt-btn:last-child { border-inline-end: 1px solid var(--bt-line); }
.bt-cta { min-height: 48px; padding-inline: 24px; font-size: 14px; }
.bt-submit { min-height: 48px; font-size: 14px; }
.bt-btn:hover, .bt-cta:hover { background: #2d313a; border-color: var(--bt-line-strong); }
.bt-card .bt-btn, .bt-pagination .bt-btn, .bt-field .bt-btn, .bt-nav .bt-btn,
.bt-lang-menu + .bt-btn, nav .bt-btn, .bt-td-actions .bt-btn { min-height: 36px; }
.bt-btn-accent, .bt-card .bt-btn-accent, .bt-nav .bt-btn-accent,
.bt-cta.is-accent, .bt-submit {
    border-color: transparent;
    background: var(--bt-primary);
    color: var(--bt-accent-contrast);
}
.bt-btn-accent:hover, .bt-card .bt-btn-accent:hover, .bt-nav .bt-btn-accent:hover,
.bt-cta.is-accent:hover, .bt-submit:hover {
    background: #b8acff;
    border-color: transparent;
    color: var(--bt-accent-contrast);
}
.bt-btn-danger { color: var(--bt-bad); }
.bt-btn-danger:hover { background: rgba(255, 147, 153, 0.1); border-color: var(--bt-bad); }
.bt-btn.is-disabled, .bt-pagination .bt-btn.is-disabled, .bt-card .bt-btn.is-disabled,
.bt-submit:disabled {
    background: var(--bt-inset);
    color: var(--bt-faint);
    border-color: var(--bt-line);
    box-shadow: none;
}

.bt-form-card, .bt-box, .bt-status, .bt-modal-box, .bt-lang-menu {
    border-radius: var(--bt-radius-lg);
    background: var(--bt-panel);
    box-shadow: var(--bt-shadow);
    overflow: hidden;
}
.bt-box-head, .bt-form-head {
    background: transparent;
    border-bottom-color: var(--bt-line-soft);
}
.bt-box-head { padding: 22px 26px; }
.bt-box-body { padding: 26px; }
.bt-box-body.is-flush { padding: 0; }
.bt-form-head { padding: 34px 30px; }
.bt-fieldset { padding: 28px 30px; border-bottom-color: var(--bt-line-soft); }
.bt-field-grid { gap: 24px; }
.bt-form-card form > .bt-submit, .bt-form-card form > .bt-hint {
    width: calc(100% - 60px);
    margin-inline: 30px;
}

.bt-input, .bt-textarea, .bt-select.is-block {
    min-height: 46px;
    border-radius: var(--bt-radius-sm);
    background-color: var(--bt-inset);
    font-size: 15px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.bt-input:focus, .bt-textarea:focus, .bt-select.is-block:focus {
    border-color: var(--bt-accent);
    box-shadow: 0 0 0 3px var(--bt-accent-soft);
}
.bt-input.is-tiny { min-height: 34px; font-size: 13px; }
.bt-input.is-key { min-height: 54px; font-size: 16px; }
.bt-dropzone {
    min-height: 116px;
    border-radius: var(--bt-radius-md);
    background: rgba(255, 255, 255, 0.015);
    font-size: 13px;
}
.bt-dropzone:hover, .bt-dropzone.is-dragging { background: var(--bt-accent-soft); }
.bt-dropzone input[type="file"] {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
}
.bt-dropzone:focus-within { outline: 2px solid var(--bt-accent); outline-offset: 3px; }

.bt-filters {
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--bt-line);
    border-radius: 18px;
    background: var(--bt-panel);
}
.bt-search-wrap, .bt-filters .bt-select {
    border: 1px solid transparent;
    border-radius: 10px;
    background-color: var(--bt-inset);
}
.bt-search, .bt-select { font-size: 13px; }
.bt-search-wrap:focus-within, .bt-filters .bt-select:focus { outline: 2px solid var(--bt-accent); outline-offset: 1px; }
.bt-filters .bt-btn { border: 1px solid var(--bt-line); }
.bt-grid { display: grid; gap: 18px; margin-top: 20px; border: 0; }
.bt-card, .bt-card:last-child {
    padding: 28px;
    border: 1px solid var(--bt-line);
    border-radius: var(--bt-radius-lg);
    background: var(--bt-panel);
}
.bt-card:hover { background: var(--bt-panel); border-color: var(--bt-line-strong); }
.bt-kv-grid { gap: 18px 24px; }
.bt-block, .bt-notice, .bt-security, .bt-alert, .bt-choice-box,
.bt-preview, .bt-thumb, .bt-lightbox-close { border-radius: var(--bt-radius-sm); }
.bt-chip, .dp-chip, .dp-copy, .bt-code { border-radius: 6px; }
.bt-chip { padding: 5px 8px; min-height: 25px; letter-spacing: 0.02em; }
.bt-empty { margin-top: 20px; border: 1px solid var(--bt-line); border-radius: var(--bt-radius-lg); background: var(--bt-panel); }
.bt-empty.is-inline { margin: 0; border: 0; }
.bt-tr { padding: 18px 24px; }
.bt-tr.is-head { background: rgba(255, 255, 255, 0.025); font-family: var(--bt-sans); text-transform: none; letter-spacing: 0; }
.bt-tr.is-head .bt-td { font-size: 12px; }
.bt-tr:not(.is-head):hover { background: rgba(255, 255, 255, 0.035); }
.bt-tr.is-picked, .bt-tr.is-active { background: var(--bt-accent-soft); border-inline-start: 3px solid var(--bt-accent); }
.bt-toast { max-width: calc(100vw - 44px); border-radius: 14px; box-shadow: var(--bt-shadow); }
.bt-lang-menu { padding: 6px; border-radius: 14px; }
.bt-lang-menu button { border-radius: 8px; }
.bt-lightbox, .bt-modal {
    background: rgba(8, 10, 14, 0.72);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.bt-modal-box { max-height: calc(100dvh - 48px); overflow-y: auto; padding: 36px; }
.bt-status { padding-block: 100px; }
.bt-status-code { font: 650 clamp(64px, 12vw, 110px)/1 var(--bt-sans); letter-spacing: -0.06em; margin-bottom: 24px; }

/* Keep dense administration navigation usable on tablets and narrow screens. */
@media (max-width: 1000px) {
    .bt-nav-inner { flex-wrap: wrap; gap: 10px; }
    .bt-brand { margin-inline-end: 12px; }
}
@media (max-width: 640px) {
    .bt-nav { position: relative; }
    .bt-nav-inner { padding: 16px; }
    .bt-nav-links { width: 100%; gap: 4px; }
    .bt-brand { flex-basis: 100%; margin: 0 0 10px; }
    .bt-nav-link { padding: 8px 10px; font-size: 12px; }
    .bt-nav .bt-actions { gap: 6px; }
    .bt-shell, .bt-form-shell { padding: 32px 16px 64px; }
    .bt-subtitle { font-size: 14px; }
    .bt-form-head, .bt-fieldset, .bt-box-body, .bt-box-head, .bt-card { padding: 22px 18px; }
    .bt-field-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .bt-form-card form > .bt-submit, .bt-form-card form > .bt-hint { width: calc(100% - 36px); margin-inline: 18px; }
    .bt-filters .bt-select { min-width: 0; width: 100%; }
    .bt-input, .bt-textarea, .bt-select.is-block { font-size: 16px; }
    .bt-tr { padding: 18px; }
    .bt-pagination { flex-wrap: wrap; }
    .bt-modal-box { padding: 28px 20px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-transparency: reduce) {
    .bt-nav { background: var(--bt-bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
    .bt-modal, .bt-lightbox { background: #101114; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
