:root {
    --bg: #e8e8ed;
    --bg-dark: #1c1c1e;
    --shadow-light: rgba(255, 255, 255, 0.85);
    --shadow-dark: rgba(0, 0, 0, 0.13);
    --text: #2c2c2e;
    --text-muted: #8e8e93;
    --accent: #e05a5a;
    --accent-hover: #c94f4f;
    --raised: 8px 8px 18px var(--shadow-dark), -8px -8px 18px var(--shadow-light);
    --raised-sm: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
    --inset: inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light);
    --radius: 16px;
    --radius-sm: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

/* ── Layout ── */
.nm-sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--bg);
    box-shadow: var(--raised);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
}

.nm-main {
    margin-left: 240px;
    padding: 32px;
    min-height: 100vh;
}

.nm-logo {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    padding: 8px 12px 20px;
    letter-spacing: 0.02em;
    text-decoration: none;
}

/* ── Nav links ── */
.nm-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nm-nav-link:hover, .nm-nav-link.active {
    color: var(--text);
    box-shadow: var(--raised-sm);
}

/* ── Cards ── */
.nm-card {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--raised);
    padding: 24px;
}

.nm-card-sm {
    background: var(--bg);
    border-radius: var(--radius-sm);
    box-shadow: var(--raised-sm);
    padding: 16px;
}

/* ── Buttons ── */
.nm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--raised-sm);
    transition: all 0.15s;
    text-decoration: none;
}

.nm-btn:hover {
    box-shadow: var(--raised);
    color: var(--text);
}

.nm-btn:active {
    box-shadow: var(--inset);
}

.nm-btn-accent {
    background: var(--accent);
    color: #fff;
    box-shadow: 4px 4px 10px rgba(224,90,90,0.35), -4px -4px 10px var(--shadow-light);
}

.nm-btn-accent:hover {
    background: var(--accent-hover);
    color: #fff;
    box-shadow: 6px 6px 14px rgba(224,90,90,0.4), -4px -4px 10px var(--shadow-light);
}

.nm-btn-apple {
    background: #1c1c1e;
    color: #fff;
    box-shadow: 4px 4px 10px rgba(0,0,0,0.35), -4px -4px 10px var(--shadow-light);
}

.nm-btn-apple:hover {
    background: #2c2c2e;
    color: #fff;
    box-shadow: 6px 6px 14px rgba(0,0,0,0.4), -4px -4px 10px var(--shadow-light);
}

/* ── Inputs ── */
.nm-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    box-shadow: var(--inset);
    outline: none;
    transition: box-shadow 0.2s;
}

.nm-input:focus {
    box-shadow: var(--inset), 0 0 0 2px var(--accent);
}

.nm-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nm-field { margin-bottom: 20px; }

/* ── Login page ── */
.nm-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
}

.nm-login-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg);
    border-radius: 24px;
    box-shadow: var(--raised);
    padding: 40px 36px;
}

.nm-login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.nm-login-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* ── Divider ── */
.nm-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.nm-divider::before, .nm-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--shadow-dark), transparent);
}

/* ── Alerts ── */
.nm-alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    box-shadow: var(--inset);
}

.nm-alert-error { color: var(--accent); }

/* ── Page title ── */
.nm-page-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}

/* ── Spinner ── */
.nm-spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.nm-btn.loading .nm-spinner { display: inline-block; }
.nm-btn.loading .nm-btn-text { display: none; }

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

/* ── Dashboard cards ── */
.nm-card-link {
    text-decoration: none;
    color: var(--text);
    display: block;
    transition: all 0.2s;
}
.nm-card-link:hover { box-shadow: var(--raised); color: var(--text); }
.nm-card-soon { opacity: 0.55; }

/* ── Firestore Explorer ── */
.fs-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.fs-collection-path {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.fs-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.07);
    padding: 2px 9px;
    border-radius: 10px;
}

.fs-explorer {
    display: grid;
    grid-template-columns: 280px 1fr;
    border-radius: var(--radius);
    box-shadow: var(--raised);
    overflow: hidden;
    height: calc(100vh - 140px);
    background: var(--bg);
}

/* Left panel */
.fs-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(0,0,0,0.07);
    overflow: hidden;
}

.fs-search-wrap {
    padding: 12px 12px 8px;
    flex-shrink: 0;
}

.fs-search {
    width: 100%;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg);
    box-shadow: var(--inset);
    font-size: 0.82rem;
    color: var(--text);
    outline: none;
    box-sizing: border-box;
}

.fs-search:focus { box-shadow: var(--inset), 0 0 0 2px var(--accent); }

.fs-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
}

.fs-item {
    display: flex;
    flex-direction: column;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    margin-bottom: 2px;
    user-select: none;
}

.fs-item:hover { background: rgba(0,0,0,0.04); }
.fs-item.active { background: rgba(224,90,90,0.08); box-shadow: var(--inset); }

.fs-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.fs-item-nik {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text);
}

.fs-item-id {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Role badges */
.fs-role-badge {
    font-size: 0.65rem;
    padding: 1px 7px;
    border-radius: 8px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.role-admin    { background: rgba(224,90,90,0.15);  color: var(--accent); }
.role-editor   { background: rgba(0,122,255,0.12);  color: #0055cc; }
.role-tester   { background: rgba(52,199,89,0.12);  color: #248a3d; }
.role-none     { background: rgba(0,0,0,0.06);      color: var(--text-muted); }

/* Right panel */
.fs-detail-wrap {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fs-empty-state, .fs-loading {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.fs-loading .nm-spinner {
    display: inline-block;
    border-color: rgba(0,0,0,0.15);
    border-top-color: var(--accent);
}

.fs-detail-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.fs-detail-header {
    padding: 16px 24px 13px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    flex-shrink: 0;
}

.fs-breadcrumb {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.fs-breadcrumb strong { color: var(--text); }

.fs-fields {
    flex: 1;
    overflow-y: auto;
    padding: 6px 16px 16px;
}

.fs-field {
    display: grid;
    grid-template-columns: 150px 76px 1fr 24px;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    font-size: 0.84rem;
}

.fs-field:last-child { border-bottom: none; }

.fs-field-virtual {
    background: rgba(224,90,90,0.04);
    border-radius: var(--radius-sm);
    border-bottom: 1px solid rgba(224,90,90,0.08) !important;
    margin-bottom: 4px;
}

.fs-field-key {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text);
    font-size: 0.81rem;
}

.fs-type-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 8px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    text-align: center;
    white-space: nowrap;
}

.type-string    { background: rgba(0,122,255,0.1);   color: #0055cc; }
.type-number    { background: rgba(52,199,89,0.1);    color: #248a3d; }
.type-bool      { background: rgba(255,149,0,0.1);   color: #c77600; }
.type-timestamp { background: rgba(175,82,222,0.1);  color: #8944ab; }
.type-array     { background: rgba(255,214,10,0.1);  color: #8a7000; }
.type-map       { background: rgba(90,200,250,0.1);  color: #0068a8; }
.type-null      { background: rgba(0,0,0,0.06);      color: var(--text-muted); }
.type-enum      { background: rgba(224,90,90,0.1);   color: var(--accent); }
.type-other     { background: rgba(0,0,0,0.06);      color: var(--text-muted); }

.fs-field-val {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text);
    font-size: 0.81rem;
    word-break: break-all;
}

.fs-no-fields {
    padding: 24px 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ── Edit controls ── */
.fs-edit-btn {
    width: 24px; height: 24px;
    border: none; background: none; padding: 0;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    visibility: hidden;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.fs-field:hover .fs-edit-btn { visibility: visible; }
.fs-edit-btn:hover { color: var(--text); background: rgba(0,0,0,0.07); }

.fs-edit-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.fs-edit-input {
    flex: 1;
    min-width: 0;
    padding: 4px 8px;
    border-radius: 6px;
    border: none;
    background: var(--bg);
    box-shadow: var(--inset);
    font-size: 0.81rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text);
    outline: none;
}
.fs-edit-input:focus { box-shadow: var(--inset), 0 0 0 2px var(--accent); }

.fs-inline-btn {
    width: 22px; height: 22px; flex-shrink: 0;
    border: none; border-radius: 5px;
    cursor: pointer; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.fs-save-btn   { background: rgba(52,199,89,0.15);  color: #248a3d; }
.fs-cancel-btn { background: rgba(224,90,90,0.12);  color: var(--accent); }
.fs-save-btn:hover   { background: rgba(52,199,89,0.28); }
.fs-cancel-btn:hover { background: rgba(224,90,90,0.22); }

/* Lazy load sentinel spinner */
.fs-sentinel-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(0,0,0,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 10px auto;
    display: block;
}

/* ── Modal ── */
.nm-modal-backdrop {
    display: none;
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.45);
    align-items: center; justify-content: center;
    padding: 16px;
}
.nm-modal-backdrop.open { display: flex; }
.nm-modal {
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: var(--raised);
    padding: 28px 28px 24px;
    width: 100%; max-width: 500px;
    max-height: 88vh; overflow-y: auto;
}
.nm-modal-title {
    font-size: 1.05rem; font-weight: 700;
    color: var(--text); margin-bottom: 20px;
}
.nm-modal-footer {
    display: flex; gap: 8px; justify-content: flex-end;
    margin-top: 20px; padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* ── Courses / topbar extras ── */
.fs-create-btn {
    margin-left: auto;
    padding: 5px 14px !important;
    font-size: 0.8rem !important;
    height: 30px;
    box-shadow: var(--raised-sm) !important;
}
.fs-breadcrumb-nav {
    font-family: 'SF Mono','Fira Code',monospace;
    font-size: 0.88rem; font-weight: 600;
    color: var(--accent); text-decoration: none;
}
.fs-breadcrumb-nav:hover { text-decoration: underline; }
.fs-breadcrumb-sep { color: var(--text-muted); margin: 0 4px; font-size: 0.85rem; }

/* Playlists button in course detail */
.fs-playlists-btn {
    font-size: 0.78rem;
    padding: 4px 12px;
    box-shadow: var(--raised-sm);
    white-space: nowrap;
    text-decoration: none;
    color: var(--text);
}
.fs-playlists-btn:hover { box-shadow: var(--raised); color: var(--text); }

/* Expanded map rows */
.fs-field-map-header {
    background: rgba(0,0,0,0.025);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.fs-field-subrow { padding-left: 24px; background: rgba(0,0,0,0.01); }
.fs-subfield-key { color: var(--text-muted) !important; }

/* ── Locale inputs in create forms ── */
.nm-locales-container { display: flex; flex-direction: column; gap: 6px; }
.nm-locale-pair {
    display: grid;
    grid-template-columns: 70px 1fr 28px;
    gap: 6px;
    align-items: center;
}
.nm-locale-rm {
    width: 26px; height: 26px;
    border: none; background: none;
    color: var(--text-muted); cursor: pointer;
    border-radius: 6px; font-size: 12px;
    display: flex; align-items: center; justify-content: center;
}
.nm-locale-rm:hover { background: rgba(224,90,90,0.1); color: var(--accent); }

/* ── Add-locale button in detail views ── */
.fs-add-locale-btn {
    display: inline-flex; align-items: center;
    background: none; border: none;
    color: var(--accent); font-size: 0.75rem;
    cursor: pointer; padding: 4px 8px 4px 24px;
    letter-spacing: 0.02em;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.fs-add-locale-btn:hover { opacity: 1; }

.fs-add-locale-form {
    display: grid;
    grid-template-columns: 72px 1fr 24px 24px;
    gap: 6px; align-items: center;
    padding: 6px 8px;
}

/* ── Empty events state ── */
.fs-events-empty-full {
    display: flex; align-items: center; justify-content: center;
    height: calc(100vh - 140px);
    text-align: center;
}
.fs-events-empty-icon  { font-size: 2.5rem; margin-bottom: 12px; }
.fs-events-empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.fs-events-empty-sub   { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.fs-events-empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.fs-soon-btn { opacity: 0.45; cursor: default; }

/* ── Firebase Function bar ── */
.fs-fn-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 8px 0 4px;
    border-top: 1px solid rgba(0,0,0,0.05);
    margin-top: 8px;
}
.fs-fn-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-right: 2px;
}
.fs-fn-btn {
    padding: 4px 10px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--bg);
    box-shadow: var(--raised-sm);
    font-size: 0.78rem;
    color: var(--text);
    cursor: pointer;
    transition: box-shadow 0.15s;
    white-space: nowrap;
}
.fs-fn-btn:hover  { box-shadow: var(--raised); }
.fs-fn-btn:active { box-shadow: var(--inset); }

/* Delete button in event detail */
.fs-delete-btn {
    padding: 4px 10px;
    font-size: 0.78rem;
    color: var(--accent);
    box-shadow: var(--raised-sm);
}
.fs-delete-btn:hover { box-shadow: var(--raised); }

/* ── Mobile topbar (hidden on desktop) ── */
.nm-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; z-index: 100;
    height: 52px;
    background: var(--bg);
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
}
.nm-topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}
.nm-hamburger {
    width: 36px; height: 36px;
    border: none; background: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.nm-hamburger:active { box-shadow: var(--inset); }

.nm-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 150;
    background: rgba(0,0,0,0.35);
}
.nm-overlay.open { display: block; }

/* Back button — hidden on desktop */
.fs-back-btn {
    display: none;
    align-items: center;
    gap: 6px;
    background: none; border: none;
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 8px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    /* Topbar */
    .nm-topbar { display: flex; }

    /* Sidebar: slide in from left */
    .nm-sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 200;
    }
    .nm-sidebar.open { transform: translateX(0); }

    .nm-main { margin-left: 0; padding: 68px 16px 16px; }

    /* Users: single-panel slide navigation */
    .fs-explorer {
        display: block;
        position: relative;
        overflow: hidden;
        border-radius: var(--radius);
        box-shadow: var(--raised);
        height: calc(100vh - 128px);
    }

    .fs-panel {
        position: absolute; inset: 0;
        background: var(--bg);
        border-right: none;
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    }

    .fs-detail-wrap {
        position: absolute; inset: 0;
        background: var(--bg);
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    }

    .fs-explorer.detail-open .fs-panel      { transform: translateX(-100%); }
    .fs-explorer.detail-open .fs-detail-wrap { transform: translateX(0); }

    .fs-back-btn { display: flex !important; }

    /* Topbar title: hide on fs-explorer detail-open (breadcrumb visible instead) */
    .fs-detail-header { flex-direction: column; align-items: flex-start; }
}

/* ── Events Table ──────────────────────────────────────────────────────────── */
.et-wrap { padding: 0 32px 32px; }
.et-scroll {
    overflow-x: auto;
    overflow-y: clip; /* clip without creating scroll context — keeps th sticky working */
    border-radius: 12px;
    box-shadow: var(--raised);
}
.et-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: var(--bg);
}
/* ── Fixed mirror scrollbar ── */
/* ── Events: floating new-event button ── */
#et-new-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 60;
    box-shadow: var(--raised);
}

.et-scrollbar-mirror {
    position: fixed;
    bottom: 0;
    left: 240px;
    right: 0;
    height: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 50;
    background: var(--bg);
    box-shadow: 0 -1px 0 rgba(0,0,0,0.08);
}
.et-scrollbar-mirror > div { height: 1px; }
.et-table thead { position: relative; z-index: 3; }
.et-table th {
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    padding: 10px 12px;
    text-align: left;
    white-space: nowrap;
    box-shadow: 0 1px 0 rgba(0,0,0,0.07);
}
.et-table td {
    padding: 7px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    vertical-align: middle;
    min-width: 60px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text);
}
.et-table td:hover { background: rgba(255,255,255,0.35); }
.et-table tr:last-child td { border-bottom: none; }
.et-table tr:hover td { background: rgba(255,255,255,0.25); }
.et-table tr:hover td:hover { background: rgba(255,255,255,0.45); }
.et-td-num { color: var(--text-muted); min-width: 32px !important; max-width: 40px !important; text-align: right; cursor: default !important; }
.et-th-num  { width: 40px; }
.et-th-order { width: 60px; }
.et-th-type  { width: 80px; }
.et-th-voice { width: 80px; }
.et-th-audio { width: 28px; text-align: center; padding: 0; cursor: default !important; }
.et-td-audio { width: 28px; min-width: 28px !important; max-width: 28px !important; text-align: center; padding: 0; cursor: default !important; color: var(--text-muted); font-size: 0.75rem; }
.et-th-lang  { min-width: 140px; }
.et-th-del   { width: 36px; }
.et-td-del   { text-align: center; cursor: default !important; }
.et-del-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
}
.et-del-btn:hover { color: var(--accent); background: rgba(224,90,90,0.1); }
.et-cell-input {
    width: 100%;
    border: none;
    background: rgba(255,255,255,0.7);
    box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.8rem;
    font-family: inherit;
    color: var(--text);
    outline: none;
    min-width: 80px;
}
.et-add-btn { margin-top: 12px; font-size: 0.8rem; }

.et-th-special { color: var(--text-muted); font-style: italic; }
.et-th-add { width: 28px; padding: 0 !important; }
.et-td-add { width: 28px; padding: 0 !important; cursor: default !important; }
.et-add-lang-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.9rem; cursor: pointer; padding: 2px 6px;
    border-radius: 4px; width: 100%;
}
.et-add-lang-btn:hover { color: var(--accent); background: rgba(224,90,90,0.1); }

.fs-del-field-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.85rem; cursor: pointer; padding: 2px 5px;
    border-radius: 4px; line-height: 1; opacity: 0;
    transition: opacity 0.15s;
}
.fs-field:hover .fs-del-field-btn { opacity: 1; }
.fs-del-field-btn:hover { color: var(--accent); background: rgba(224,90,90,0.1); }

/* ── Events table: sticky #-column ── */
.et-table .et-th-num,
.et-table .et-td-num {
    position: sticky; left: 0; z-index: 4;
    background: var(--bg);
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
    cursor: pointer;
}
.et-table .et-th-num { z-index: 3; }

/* ── Row selection ── */
.et-table tr.et-selected td { background: rgba(224,90,90,0.08) !important; }
.et-table tr.et-selected .et-td-num { background: rgba(224,90,90,0.13) !important; color: var(--accent); }

/* ── Drag-and-drop ── */
.et-table tr.et-dragging { opacity: 0.4; }
.et-table tr.et-drop-above td { border-top: 2px solid var(--accent) !important; }
.et-table tr.et-drop-below td { border-bottom: 2px solid var(--accent) !important; }
.et-td-num { user-select: none; }

/* ── Duplicate button ── */
.et-td-act { width: 28px; text-align: center; cursor: default !important; padding: 0 !important; }
.et-dup-btn {
    background: none; border: none; color: var(--text-muted);
    font-size: 0.9rem; cursor: pointer; padding: 2px 5px;
    border-radius: 4px; opacity: 0; transition: opacity 0.15s;
}
.et-table tr:hover .et-dup-btn { opacity: 1; }
.et-dup-btn:hover { color: var(--accent); background: rgba(224,90,90,0.1); }

/* ── Dark mode ──────────────────────────────────────────────────────────────── */
html.dark {
    --bg:           #252528;
    --shadow-light: rgba(48, 48, 54, 0.85);
    --shadow-dark:  rgba(0, 0, 0, 0.55);
    --text:         #f0f0f3;
    --text-muted:   #98989f;
}

html.dark .nm-input,
html.dark .fs-edit-input,
html.dark .et-cell-input {
    color: var(--text);
    background: var(--bg);
}

html.dark .nm-modal { background: var(--bg); }

html.dark .et-table td:hover,
html.dark .et-table tr:hover td { background: rgba(255,255,255,0.04); }
html.dark .et-table tr:hover td:hover { background: rgba(255,255,255,0.07); }

html.dark .et-table .et-th-num,
html.dark .et-table .et-td-num { background: var(--bg); }

html.dark .et-table tr.et-selected td { background: rgba(224,90,90,0.12) !important; }
html.dark .et-table tr.et-selected .et-td-num { background: rgba(224,90,90,0.18) !important; }

/* ── Settings toggle switch ─────────────────────────────────────────────────── */
.nm-toggle { display: inline-block; cursor: pointer; }
.nm-toggle input { display: none; }
.nm-toggle-track {
    display: block;
    width: 52px; height: 28px;
    border-radius: 14px;
    background: var(--bg);
    box-shadow: var(--inset);
    position: relative;
    transition: background 0.2s;
}
.nm-toggle-knob {
    display: block;
    position: absolute;
    top: 4px; left: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--bg);
    box-shadow: var(--raised-sm);
    transition: transform 0.2s, background 0.2s;
}
.nm-toggle input:checked ~ .nm-toggle-track {
    background: var(--accent);
    box-shadow: inset 2px 2px 6px rgba(0,0,0,0.25), inset -1px -1px 4px rgba(255,255,255,0.08);
}
.nm-toggle input:checked ~ .nm-toggle-track .nm-toggle-knob {
    transform: translateX(24px);
    background: #fff;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
}
