:root {
    --strix-bg: #fdfbf6;
    --strix-bg-translucent: rgba(253, 251, 246, 0.85);
    --strix-ink: #1a1815;
    --strix-ink-soft: #221f1b;
    --strix-detail: #4a463f;
    --strix-muted: #767168;
    --strix-faint: #9a9488;
    --strix-accent: #b8472e;
    --strix-accent-hover: #a23a22;
    --strix-divider: rgba(20, 18, 15, 0.05);
    --strix-row-tag-bg: rgba(20, 18, 15, 0.04);
    --strix-row-hover-bg: #fff;
    --strix-row-hover-shadow: 0 1px 0 rgba(20, 18, 15, 0.06), 0 0 0 1px rgba(20, 18, 15, 0.05);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] { display: none !important; }

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--strix-bg);
    color: var(--strix-ink);
    font-family: "Instrument Sans", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 720px;
    margin: 0 auto;
    padding: 18px 24px;
    background: var(--strix-bg-translucent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--strix-divider);
}

.page-wide .topbar {
    max-width: 1240px;
}

.brand {
    text-decoration: none;
    color: inherit;
}

.brand-wordmark {
    font-size: 15px;
    font-weight: 400;
    letter-spacing: -0.1px;
}

.brand-wordmark b {
    font-weight: 600;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: transparent;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--strix-detail);
    cursor: pointer;
    transition: background 0.12s;
}

.icon-btn:hover {
    background: rgba(20, 18, 15, 0.05);
}

.main {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.page-wide .main {
    max-width: 1240px;
    padding: 24px 24px 80px;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 36px;
}

.header-row h1 {
    margin: 0;
    font-family: "Instrument Sans", system-ui, sans-serif;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: -0.6px;
    line-height: 1.1;
    color: var(--strix-ink);
}

.header-row .sub {
    margin: 6px 0 0;
    color: var(--strix-muted);
    font-size: 13.5px;
    line-height: 1.5;
    max-width: 420px;
}

.cta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--strix-accent);
    color: #fff;
    border: 0;
    padding: 10px 16px;
    border-radius: 9px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(184, 71, 46, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: background 0.15s;
    white-space: nowrap;
}

.header-row .cta {
    margin-bottom: 4px;
}

.cta:hover {
    background: var(--strix-accent-hover);
}

/* ── DB sections (projects index) ─────────────────────────────────────────── */

.db-section {
    margin-bottom: 32px;
}

.db-section + .db-section {
    border-top: 1px solid var(--strix-border);
    padding-top: 24px;
}

.db-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: 0 0 12px;
    margin-bottom: 4px;
}

.db-summary::-webkit-details-marker { display: none; }

.db-summary-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.db-summary-name {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.1px;
    color: var(--strix-ink);
}

.db-summary-meta {
    font-size: 11px;
    color: var(--strix-muted);
}

.db-summary-ref {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11px;
    color: var(--strix-faint);
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--strix-row-tag-bg);
}

.db-summary-count {
    font-size: 13px;
    color: var(--strix-muted);
    margin-left: auto;
}

.db-summary-chev {
    color: var(--strix-muted);
    display: flex;
    transition: transform 0.15s;
}

details.db-section[open] .db-summary-chev {
    transform: rotate(90deg);
}

.db-section-footer {
    padding-top: 8px;
}

.project-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.project-row {
    display: grid;
    grid-template-columns: 1fr auto auto 20px;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    margin: 0 -16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.12s, box-shadow 0.12s;
    color: var(--strix-ink-soft);
    text-decoration: none;
    user-select: none;
}

.fav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 5px;
    opacity: 0;
    transition: opacity 0.12s, background 0.12s;
    color: var(--strix-muted);
    flex-shrink: 0;
}

.project-row:hover .fav-btn,
.fav-btn.fav-btn-active {
    opacity: 1;
}

.fav-btn:hover {
    background: rgba(0, 0, 0, 0.07);
}

.fav-btn.fav-btn-active {
    color: var(--strix-accent);
}

.fav-btn.fav-btn-active .fav-icon-empty,
.fav-btn:not(.fav-btn-active) .fav-icon-fill {
    display: none;
}

.project-row:hover {
    background: var(--strix-row-hover-bg);
    box-shadow: var(--strix-row-hover-shadow);
    color: var(--strix-ink);
}

.row-name {
    font-size: 15px;
    font-weight: 450;
    letter-spacing: -0.1px;
    transition: color 0.12s;
}

.row-code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11.5px;
    color: var(--strix-faint);
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--strix-row-tag-bg);
}

.row-chev {
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    color: var(--strix-accent);
    transition: opacity 0.15s;
}

.project-row:hover .row-chev {
    opacity: 1;
}

/* Popover menu */

.popover-wrapper {
    position: relative;
}

.popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid rgba(20, 18, 15, 0.08);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(20, 18, 15, 0.10), 0 2px 6px rgba(20, 18, 15, 0.04);
    padding: 6px;
    z-index: 50;
}

.popover[hidden] {
    display: none;
}

.menu-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 10px;
    margin: 0 0 4px;
    border-bottom: 1px solid rgba(20, 18, 15, 0.06);
}

.menu-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--strix-accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.menu-head-name {
    font-size: 13px;
    font-weight: 500;
}

.menu-head-role {
    font-size: 11.5px;
    color: #857f72;
}

.menu-meta {
    font-size: 11px;
    color: #a09890;
    padding: 4px 12px 6px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font: inherit;
    font-size: 13.5px;
    color: var(--strix-ink);
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: background 0.12s;
}

.menu-item:hover {
    background: rgba(20, 18, 15, 0.05);
}

.menu-item-danger {
    color: var(--strix-accent-hover);
}

.menu-form {
    margin: 0;
    padding: 0;
    width: 100%;
}

.menu-item-danger:hover {
    background: rgba(162, 58, 34, 0.07);
}

.menu-divider {
    height: 1px;
    background: rgba(20, 18, 15, 0.07);
    margin: 5px 4px;
}

/* Modal dialog */

.modal {
    background: #fff;
    border: 0;
    border-radius: 14px;
    width: 440px;
    max-width: calc(100vw - 32px);
    padding: 24px;
    box-shadow: 0 24px 80px rgba(20, 18, 15, 0.25);
    color: var(--strix-ink);
    overflow: visible;
}

.modal::backdrop {
    background: rgba(20, 18, 15, 0.32);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.modal-head {
    margin-bottom: 18px;
}

.modal-head h2 {
    margin: 0;
    font-size: 19px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.modal-sub {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--strix-muted);
}

.field {
    display: block;
    margin-bottom: 14px;
}

.field[hidden] {
    display: none;
}

.field:last-of-type {
    margin-bottom: 22px;
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--strix-detail);
    margin-bottom: 6px;
    letter-spacing: 0.1px;
}

.field-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid rgba(20, 18, 15, 0.14);
    background: #fdfcf9;
    font: inherit;
    font-size: 14px;
    color: var(--strix-ink);
    outline: none;
}

.field-input:focus {
    border-color: rgba(20, 18, 15, 0.32);
}

.field-input-mono {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 13px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-primary {
    background: var(--strix-accent);
    color: #fff;
    border: 0;
    padding: 9px 16px;
    border-radius: 8px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--strix-accent-hover);
}

.btn-primary:disabled {
    background: #d3cdc1;
    cursor: not-allowed;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--strix-detail);
    border: 1px solid rgba(20, 18, 15, 0.12);
    padding: 9px 14px;
    border-radius: 8px;
    font: inherit;
    font-size: 13.5px;
    cursor: pointer;
    text-decoration: none;
}

.btn-ghost:hover {
    background: rgba(20, 18, 15, 0.04);
}

/* Project detail — top crumb bar */

.pd-crumb-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
}

.pd-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 0;
    font: inherit;
    font-size: 13px;
    color: var(--strix-muted);
    cursor: pointer;
    text-decoration: none;
    padding: 4px 8px 4px 4px;
    border-radius: 6px;
    margin-left: -4px;
    transition: background 0.12s, color 0.12s;
}

.pd-back:hover {
    background: rgba(20, 18, 15, 0.05);
    color: var(--strix-ink);
}

.pd-crumb-sep {
    color: #c8c1b3;
    font-size: 13px;
}

.pd-crumb-proj {
    font-size: 14px;
    font-weight: 500;
    color: var(--strix-ink);
    text-decoration: none;
}

.pd-crumb-proj:hover {
    text-decoration: underline;
}

.pd-crumb-code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11.5px;
    color: #857f72;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(20, 18, 15, 0.05);
    text-decoration: none;
}

.pd-crumb-code:hover {
    background: rgba(20, 18, 15, 0.09);
}

/* Project detail — tab bar */

.pd-tab-bar-wrap {
    border-bottom: 1px solid rgba(20, 18, 15, 0.08);
    margin-bottom: 32px;
}

.pd-tab-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.pd-tab {
    background: transparent;
    border: 0;
    padding: 12px 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    color: #857f72;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.12s, border-color 0.12s;
}

.pd-tab:hover {
    color: var(--strix-ink);
}

.pd-tab-active,
.pd-tab-active:hover {
    color: var(--strix-ink);
    border-bottom-color: var(--strix-accent);
}

/* Entities tab */

.et-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 24px;
}

.et-head-text {
    min-width: 0;
}

.et-head-actions {
    display: flex;
    gap: 8px;
}

.et-crumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.et-crumb-link,
.et-crumb-current {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 12.5px;
    padding: 2px 6px;
    border-radius: 4px;
    text-decoration: none;
}

.et-crumb-link {
    color: var(--strix-muted);
    background: transparent;
}

.et-crumb-link:hover {
    background: rgba(20, 18, 15, 0.05);
    color: var(--strix-ink);
}

.et-crumb-current {
    color: var(--strix-ink);
    background: rgba(184, 71, 46, 0.08);
}

.et-crumb-chev {
    color: #c8c1b3;
    flex-shrink: 0;
}

.et-h1 {
    margin: 0;
    font-family: "Instrument Sans", system-ui, sans-serif;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.4px;
    line-height: 1.15;
    color: var(--strix-ink);
}

.et-sub {
    margin: 5px 0 0;
    color: var(--strix-muted);
    font-size: 13px;
}

.et-inline-code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 12px;
    color: #857f72;
}

.et-empty {
    text-align: center;
    padding: 60px 20px;
    border: 1px dashed rgba(20, 18, 15, 0.14);
    border-radius: 12px;
    background: #fff;
}

.et-empty-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 6px;
}

.et-empty-sub {
    color: #857f72;
    font-size: 13.5px;
}

.et-empty-cta {
    margin-top: 16px;
}

.et-table {
    background: #fff;
    border: 1px solid rgba(20, 18, 15, 0.07);
    border-radius: 12px;
    overflow: hidden;
}

.et-table-head,
.et-row {
    display: grid;
    grid-template-columns: 240px 1fr 180px 80px 70px 80px;
    gap: 12px;
    align-items: center;
}

.et-table-head {
    padding: 11px 18px;
    font-size: 10.5px;
    color: var(--strix-faint);
    letter-spacing: 1.1px;
    text-transform: uppercase;
    font-weight: 500;
    border-bottom: 1px solid rgba(20, 18, 15, 0.06);
    background: #fbf9f5;
}

.et-table-head .et-num {
    text-align: center;
}

.et-row {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(20, 18, 15, 0.04);
    color: var(--strix-ink);
    text-decoration: none;
    transition: background 0.12s, box-shadow 0.12s;
}

.et-row[data-row-href] {
    cursor: pointer;
}

.et-row-excluded {
    background: rgba(184, 71, 46, 0.08);
}

.et-row-excluded:hover {
    background: rgba(184, 71, 46, 0.14) !important;
}

.et-excluded-text {
    color: var(--strix-accent-hover);
    font-weight: 600;
}

.et-row:last-child {
    border-bottom: 0;
}

.et-row:hover {
    background: #fff;
    box-shadow: 0 0 0 1px rgba(20, 18, 15, 0.06), 0 1px 2px rgba(20, 18, 15, 0.04);
}

.et-ref-cell {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 12.5px;
    color: var(--strix-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.12s;
}

.et-row:hover .et-ref-cell {
    color: var(--strix-accent);
}

.et-title-cell {
    font-size: 14px;
    color: var(--strix-ink);
    font-weight: 450;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.et-type-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--strix-detail);
    overflow: hidden;
    white-space: nowrap;
}

.et-type-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--strix-accent);
    flex-shrink: 0;
}

.et-type-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.et-type-child-count {
    display: none;
    margin-left: 4px;
    color: var(--strix-muted);
    font-size: 12px;
    flex-shrink: 0;
}

.et-type-code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10.5px;
    color: #857f72;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.et-num-cell {
    text-align: center;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 12.5px;
    color: var(--strix-ink);
}

.et-num-cell-muted {
    color: #c8c1b3;
}

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

.et-edit-btn {
    background: transparent;
    color: var(--strix-detail);
    border: 1px solid rgba(20, 18, 15, 0.14);
    padding: 4px 10px;
    border-radius: 6px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.et-edit-btn:hover {
    background: var(--strix-ink);
    color: #fff;
    border-color: var(--strix-ink);
}

.et-row-chev {
    color: #c8c1b3;
    opacity: 0.35;
    transition: opacity 0.15s, color 0.12s;
    flex-shrink: 0;
}

.et-row:hover .et-row-chev {
    opacity: 1;
    color: var(--strix-accent);
}

/* Tab content — forms + placeholders */

.pd-form-section {
    max-width: 560px;
    margin: 0 auto;
}

.pd-h1 {
    margin: 0 0 20px;
    font-family: "Instrument Sans", system-ui, sans-serif;
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.4px;
    line-height: 1.15;
    color: var(--strix-ink);
}

.pd-form-card {
    background: #fff;
    border: 1px solid rgba(20, 18, 15, 0.07);
    border-radius: 12px;
    padding: 24px;
}

.pd-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.pd-form-actions-split {
    justify-content: space-between;
}

.btn-ghost-danger {
    color: var(--strix-accent-hover);
}

.btn-ghost-danger:hover {
    background: rgba(162, 58, 34, 0.07);
}

.pd-modal-body {
    margin: 0 0 22px;
    color: var(--strix-detail);
    font-size: 13.5px;
    line-height: 1.5;
}

.pd-error {
    margin: 0 0 14px;
    color: var(--strix-accent-hover);
    font-size: 13px;
}

@keyframes strix-autofill-detect { from {} to {} }

form[data-sign-in-form] input:-webkit-autofill,
form[data-sign-in-form] input:autofill {
    animation-name: strix-autofill-detect;
    animation-duration: 0.001s;
}

.pd-banner {
    background: #fff8ee;
    border: 1px solid #f0d8b0;
    color: #5a4628;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13.5px;
    line-height: 1.5;
}

.pd-banner-link {
    display: block;
    margin-top: 6px;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 12px;
    color: var(--strix-accent);
    word-break: break-all;
}

.user-role-desc {
    margin: 6px 0 0;
    color: var(--strix-muted);
    font-size: 12.5px;
    line-height: 1.4;
}

.user-project-trigger {
    text-align: left;
    cursor: pointer;
    color: var(--strix-ink);
}

.user-project-trigger[aria-expanded="true"] {
    border-color: rgba(20, 18, 15, 0.32);
}

.user-project-popover {
    left: 0;
    right: 0;
    min-width: 100%;
    padding: 8px;
    display: flex;
    flex-direction: column;
}

.user-project-search {
    margin-bottom: 8px;
    flex-shrink: 0;
}

.user-project-list {
    max-height: min(60vh, 480px);
    overflow-y: auto;
    flex: 1 1 auto;
}

.user-project-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.user-project-row:hover {
    background: rgba(20, 18, 15, 0.04);
}

.user-project-row input {
    margin: 0;
    flex-shrink: 0;
}

.user-project-name {
    color: var(--strix-ink);
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-project-ref {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11.5px;
    color: var(--strix-faint);
    flex-shrink: 0;
}

.user-project-db {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10.5px;
    color: var(--strix-faint);
    margin-left: auto;
    flex-shrink: 0;
}

.pd-placeholder {
    margin: 0;
    color: var(--strix-muted);
    font-size: 13.5px;
}

.pd-lede {
    margin: -8px 0 24px;
    color: var(--strix-muted);
    font-size: 13.5px;
}

.pd-link {
    color: var(--strix-accent);
    font-size: 13px;
    text-decoration: underline;
    font-weight: 500;
}

.pd-form-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 18px;
}

.pd-spacer {
    flex: 1;
}

.field-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a463f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* Entity types table — same shell as entities table, different columns */

.et-table-types .et-table-head,
.et-table-types .et-row {
    grid-template-columns: 1fr 280px 140px;
}

/* Users table — username, role, api key, actions */

.et-table-users .et-table-head,
.et-table-users .et-row {
    grid-template-columns: minmax(0, 1fr) 100px minmax(0, 1fr) 140px;
}

/* XML validation table */

.et-table-xml {
    overflow-x: auto;
}

.et-table-xml .et-table-head,
.et-table-xml .et-row {
    grid-template-columns: 200px 1fr 200px 80px;
    min-width: 560px;
}

.et-row-static {
    cursor: default;
}

.et-row-static:hover {
    box-shadow: none;
    background: transparent;
}

.et-delete-btn {
    background: transparent;
    color: var(--strix-accent-hover);
    border: 1px solid rgba(20, 18, 15, 0.14);
    padding: 4px 10px;
    border-radius: 6px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.12s, color 0.12s, border-color 0.12s;
}

.et-edit-btn-action {
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.12s, color 0.12s, border-color 0.12s;
}

.et-row:hover .et-edit-btn-action {
    opacity: 1;
}

.et-row:hover .et-delete-btn {
    opacity: 1;
}

.et-delete-btn:hover {
    background: var(--strix-accent-hover);
    color: #fff;
    border-color: var(--strix-accent-hover);
}

/* Dropzone */

.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    border: 1.5px dashed rgba(20, 18, 15, 0.18);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    text-align: center;
    background: #fff;
}

.dropzone.drop-active {
    border-color: var(--strix-accent);
    background: rgba(184, 71, 46, 0.04);
}

.dropzone-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(184, 71, 46, 0.08);
    color: var(--strix-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.dropzone-title {
    font-size: 14px;
    font-weight: 500;
}

.dropzone-sub {
    font-size: 12.5px;
    color: #857f72;
    margin-top: 4px;
}

.cta:disabled {
    background: #d3cdc1;
    cursor: not-allowed;
    box-shadow: none;
}

/* Export column filters */

.ep-column-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid rgba(20, 18, 15, 0.07);
    border-radius: 10px;
    font-size: 13px;
}

.ep-filter-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.ep-apply-filters {
    margin-left: auto;
}

.ep-column-filters-label {
    font-weight: 500;
    color: var(--strix-detail);
}

.ep-column-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.ep-column-checkbox input {
    margin: 0;
}

.ep-hidden {
    display: none !important;
}

/* Import preview */

.ip-table-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid rgba(20, 18, 15, 0.07);
    border-radius: 12px;
}

.ip-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ip-table th,
.ip-table td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(20, 18, 15, 0.05);
    vertical-align: top;
    white-space: nowrap;
}

.ip-table th {
    font-size: 12.5px;
    color: var(--strix-detail);
    font-weight: 500;
    background: #fbf9f5;
    border-bottom: 1px solid rgba(20, 18, 15, 0.06);
}

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

.ip-line-col {
    width: 56px;
    color: var(--strix-faint);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11.5px;
}

.ip-status-col {
    width: 80px;
}

.ip-errors-col {
    min-width: 200px;
    white-space: normal;
}

.ip-row-new td {
    background: rgba(54, 162, 102, 0.08);
}

.ip-row-error td {
    background: rgba(184, 71, 46, 0.06);
}

.ip-cell-changed {
    background: rgba(54, 162, 102, 0.18);
}

.ip-row-new .ip-cell-changed {
    background: rgba(54, 162, 102, 0.28);
}

.ip-cell-ref {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 12px;
}

.ip-cell-empty {
    color: var(--strix-faint);
}

.ip-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.ip-badge-new {
    background: rgba(54, 162, 102, 0.18);
    color: #1e6e44;
}

.ip-badge-edit {
    background: rgba(20, 18, 15, 0.07);
    color: var(--strix-detail);
}

.ip-badge-noop {
    background: transparent;
    color: var(--strix-faint);
}

.ip-error-text {
    color: var(--strix-accent-hover);
    font-size: 12.5px;
}

.ip-global-errors {
    background: rgba(184, 71, 46, 0.08);
    border: 1px solid rgba(184, 71, 46, 0.25);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    color: var(--strix-accent-hover);
    font-size: 13.5px;
}

/* SF Symbol icons — CSS mask lets the SVG inherit text color */

.sf-icon {
    display: inline-block;
    background-color: currentColor;
    mask-position: center;
    mask-repeat: no-repeat;
    mask-size: contain;
    -webkit-mask-position: center;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    flex-shrink: 0;
    vertical-align: middle;
}

.icon-gearshape {
    mask-image: url("/icons/gearshape.svg");
    -webkit-mask-image: url("/icons/gearshape.svg");
}

.icon-globe {
    mask-image: url("/icons/globe.svg");
    -webkit-mask-image: url("/icons/globe.svg");
}

.icon-person {
    mask-image: url("/icons/person.svg");
    -webkit-mask-image: url("/icons/person.svg");
}

.icon-signout {
    mask-image: url("/icons/rectangle.portrait.and.arrow.forward.svg");
    -webkit-mask-image: url("/icons/rectangle.portrait.and.arrow.forward.svg");
}

.icon-arrow-backward {
    mask-image: url("/icons/arrow.backward.svg");
    -webkit-mask-image: url("/icons/arrow.backward.svg");
}

.icon-arrow-down-circle {
    mask-image: url("/icons/arrow.down.circle.svg");
    -webkit-mask-image: url("/icons/arrow.down.circle.svg");
}

.icon-plus {
    mask-image: url("/icons/plus.svg");
    -webkit-mask-image: url("/icons/plus.svg");
}

.icon-chevron-forward {
    mask-image: url("/icons/chevron.forward.svg");
    -webkit-mask-image: url("/icons/chevron.forward.svg");
}

.icon-heart {
    mask-image: url("/icons/heart.svg");
    -webkit-mask-image: url("/icons/heart.svg");
}

.icon-heart-fill {
    mask-image: url("/icons/heart.fill.svg");
    -webkit-mask-image: url("/icons/heart.fill.svg");
}

.icon-power {
    mask-image: url("/icons/power.svg");
    -webkit-mask-image: url("/icons/power.svg");
}

.icon-list-clipboard {
    mask-image: url("/icons/list.clipboard.svg");
    -webkit-mask-image: url("/icons/list.clipboard.svg");
}

.api-key-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
    text-align: left;
    overflow: hidden;
    min-width: 0;
}

.api-key-btn:hover {
    color: var(--text-primary);
}

.api-key-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.icon-exclamation-circle {
    mask-image: url("/icons/exclamationmark.circle.svg");
    -webkit-mask-image: url("/icons/exclamationmark.circle.svg");
}

.et-edit-btn:hover + .et-row-chev {
    opacity: 0.35;
    color: #c8c1b3;
}

/* Entity edit slide-over */

.ep-scrim {
    position: fixed;
    inset: 0;
    background: rgba(20, 18, 15, 0.32);
    z-index: 80;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: block;
    text-decoration: none;
}

.ep-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1240px;
    max-width: 92vw;
    background: #fdfbf6;
    box-shadow: -12px 0 40px rgba(20, 18, 15, 0.18);
    display: flex;
    flex-direction: column;
    z-index: 81;
    color: var(--strix-ink);
}

.ep-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 22px 18px;
    border-bottom: 1px solid rgba(20, 18, 15, 0.06);
    background: #fff;
    flex-shrink: 0;
}

.ep-head-info {
    min-width: 0;
}

.ep-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 0;
    background: transparent;
    color: var(--strix-detail);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ep-close-btn:hover {
    background: rgba(20, 18, 15, 0.05);
    color: var(--strix-ink);
}

.ep-eyebrow {
    font-size: 10.5px;
    color: #a8a294;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    font-weight: 500;
    margin-bottom: 4px;
}

.ep-head-title {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin-bottom: 3px;
}

.ep-head-code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 11.5px;
    color: #857f72;
}

.ep-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.ep-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 22px 18px;
}

.ep-section {
    padding: 20px 0;
    border-bottom: 1px solid rgba(20, 18, 15, 0.06);
}

.ep-section:last-child {
    border-bottom: 0;
}

.ep-h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--strix-detail);
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.ep-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 14px;
}

.ep-field {
    display: block;
}

.ep-field-full {
    grid-column: 1 / -1;
}

.ep-field-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    padding-top: 22px;
}

.ep-label {
    display: block;
    font-size: 11.5px;
    color: var(--strix-muted);
    margin-bottom: 5px;
    font-weight: 500;
}

.ep-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 7px;
    border: 1px solid rgba(20, 18, 15, 0.12);
    background: #fff;
    font: inherit;
    font-size: 13.5px;
    color: var(--strix-ink);
    outline: none;
}

.ep-input:focus {
    border-color: rgba(20, 18, 15, 0.32);
}

.ep-input-mono {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 12.5px;
}

.ep-textarea {
    resize: vertical;
    min-height: 36px;
    max-height: calc(1.4em * 6 + 18px);
    line-height: 1.4;
    font-size: 13px;
    overflow-y: auto;
}

.ep-value-popup-ta {
    width: 100%;
    min-height: 160px;
    resize: none;
    line-height: 1.5;
}

.ep-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a463f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.ep-attr-sticky {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #fdfbf6;
    padding-top: 20px;
    padding-bottom: 12px;
}

.ep-attr-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ep-lang-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--strix-faint);
}

.ep-lang-filter-select {
    width: auto;
    padding-top: 4px;
    padding-bottom: 4px;
    font-size: 12px;
}

.ep-ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid rgba(20, 18, 15, 0.14);
    padding: 5px 10px;
    border-radius: 6px;
    font: inherit;
    font-size: 12px;
    color: var(--strix-ink);
    cursor: pointer;
}

.ep-ghost-btn:hover {
    background: rgba(20, 18, 15, 0.04);
}

.ep-attr-table {
    border: 1px solid rgba(20, 18, 15, 0.08);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.ep-attr-table-head {
    display: grid;
    grid-template-columns: 168px 1fr 180px 28px;
    gap: 8px;
    padding: 8px 10px;
    font-size: 10.5px;
    color: var(--strix-faint);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 500;
    background: #fbf9f5;
    border-bottom: 1px solid rgba(20, 18, 15, 0.06);
}

.ep-attr-row {
    display: grid;
    grid-template-columns: 168px 1fr 180px 28px;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-top: 1px solid rgba(20, 18, 15, 0.04);
}

.ep-attr-row:first-child {
    border-top: 0;
}

.ep-xml-error {
    grid-column: 2 / -1;
    display: flex;
    align-items: center;
    padding: 0 0 4px;
}

.ep-xml-error-popup-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.ep-xml-error-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: #c0392b;
    font-size: 11.5px;
    line-height: 1;
}

.ep-xml-error-popup {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1c1c1e;
    color: #fff;
    font-size: 11px;
    line-height: 1.5;
    padding: 8px 10px;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-word;
    width: 260px;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.ep-xml-snippet {
    display: block;
    margin-top: 4px;
    cursor: pointer;
    opacity: 0.75;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 10.5px;
}

.ep-xml-snippet:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ep-del-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 0;
    background: transparent;
    color: var(--strix-accent-hover);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ep-del-btn:hover {
    background: rgba(162, 58, 34, 0.12);
}

.ep-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    border-top: 1px solid rgba(20, 18, 15, 0.06);
    background: #fff;
    flex-shrink: 0;
}

.ep-ghost-btn-lg {
    background: transparent;
    color: var(--strix-detail);
    border: 1px solid rgba(20, 18, 15, 0.14);
    padding: 8px 14px;
    border-radius: 7px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
}

.ep-ghost-btn-lg:hover {
    background: rgba(20, 18, 15, 0.04);
}

.ep-primary-btn {
    background: var(--strix-accent);
    color: #fff;
    border: 0;
    padding: 8px 16px;
    border-radius: 7px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.ep-primary-btn:hover:not(:disabled) {
    background: var(--strix-accent-hover);
}

.ep-primary-btn:disabled {
    background: #d3cdc1;
    cursor: not-allowed;
}

.ep-danger-btn {
    background: transparent;
    color: var(--strix-accent-hover);
    border: 0;
    padding: 8px 0;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.ep-danger-btn:hover {
    text-decoration: underline;
}

[data-entity-delete-form],
[data-entity-bulk-delete-form] {
    display: none;
}

/* ── Mobile responsive (phones only, ≤ 600 px) ────────────────────────────── */

@media (max-width: 600px) {

    /* 1. Projects list: hide reference code column */
    .project-row {
        grid-template-columns: 1fr auto 20px;
    }

    .row-code {
        display: none;
    }

    /* 2. Entities list header: wrap actions onto a new line below the title */
    .et-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* 3. Entity edit panel: full screen width */
    .ep-panel {
        width: 100%;
        max-width: 100%;
    }

    /* 4. Attribute rows: Key + Lang on line 1, Value on line 2, X spanning both rows */
    .ep-attr-table-head {
        display: none;
    }

    .ep-attr-row {
        grid-template-columns: 1fr 28px;
        grid-template-rows: auto auto auto;
        gap: 6px 8px;
    }

    .ep-attr-row > input {
        grid-column: 1;
        grid-row: 1;
    }

    .ep-attr-row > select {
        grid-column: 1;
        grid-row: 2;
    }

    .ep-attr-row > textarea {
        grid-column: 1;
        grid-row: 3;
    }

    .ep-attr-row .ep-del-btn {
        grid-column: 2;
        grid-row: 1 / 4;
        align-self: center;
        height: auto;
        width: 28px;
    }

    /* 5. Entity form: stack all fields to single column so Parent and
          Exclude from export each sit on their own line */
    .ep-grid {
        grid-template-columns: 1fr;
    }

    .ep-field-full {
        grid-column: 1;
    }

    .ep-field-checkbox {
        padding-top: 6px;
    }

    /* Prevent iOS zoom on input focus (requires font-size >= 16px) */
    .field-input,
    .ep-input,
    .field-select {
        font-size: 16px;
    }

    /* 6. Languages table: let name flex, code takes only what it needs */
    .et-table-types .et-table-head,
    .et-table-types .et-row {
        grid-template-columns: 1fr auto auto;
    }

    /* 7. Users table: card layout */
    .et-table-users .et-table-head {
        display: none;
    }

    .et-table-users .et-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        gap: 2px 12px;
        align-items: start;
        padding: 12px 16px;
    }

    /* Username */
    .et-table-users .et-row > *:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
        font-size: 15px;
        font-weight: 500;
    }

    /* Role */
    .et-table-users .et-row > *:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
        font-size: 12.5px;
        color: var(--strix-muted);
    }

    /* API Key */
    .et-table-users .et-row > *:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
        min-width: 0;
        margin-top: 4px;
    }

    /* Actions: spans all three rows, vertically centred */
    .et-table-users .et-row > *:nth-child(4) {
        grid-column: 2;
        grid-row: 1 / 4;
        align-self: center;
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        gap: 4px;
    }

    /* Replace raw API key text with a friendly label on mobile */
    .et-table-users .api-key-text {
        display: none;
    }

    .et-table-users .api-key-btn::before {
        content: 'Copy API key';
        font-size: 13px;
        color: var(--strix-muted);
    }

    /* 8. Entity table: card layout */
    .et-table-entities .et-table-head {
        display: none;
    }

    .et-table-entities .et-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        align-items: start;
        gap: 2px 0;
    }

    /* Reference */
    .et-table-entities .et-row > *:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    /* Title */
    .et-table-entities .et-row > *:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }

    /* Type */
    .et-table-entities .et-row > *:nth-child(3) {
        grid-column: 1;
        grid-row: 3;
    }

    /* Hide children count and order */
    .et-table-entities .et-row > *:nth-child(4),
    .et-table-entities .et-row > *:nth-child(5) {
        display: none;
    }

    /* Actions: right column, spans all three rows */
    .et-table-entities .et-row > *:nth-child(6) {
        grid-column: 2;
        grid-row: 1 / 4;
        align-self: center;
    }

    .et-table-entities .et-type-dot {
        display: none;
    }

    .et-table-entities .et-type-child-count {
        display: inline;
    }
}

/* ── Touch devices: always show hover-dependent action buttons ─────────────── */

@media (hover: none) {
    .fav-btn {
        opacity: 1;
    }

    .row-chev {
        opacity: 1;
    }

    .et-row-chev {
        opacity: 1;
        color: var(--strix-accent);
    }

    .et-edit-btn-action,
    .et-delete-btn {
        opacity: 1;
    }
}
