/* Internal Types Editor — uses design-system.css tokens */
:root { --te-row-h: 44px; }

/* Tell browser this is a dark UI — fixes native form controls + scrollbars */
html { color-scheme: dark; }

/* Force dark dropdown options (native <option> can only be styled minimally) */
.te-select option,
select.te-select option { background: #0D1117; color: #e6edf3; }
.te-select:focus { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.te-search input::placeholder,
.te-input::placeholder { color: rgba(255, 255, 255, 0.4); }

.te-shell { display: flex; flex-direction: column;
    height: calc(100vh - var(--topbar-height, 56px));
    background: var(--color-bg-base, #0a0e14); color: var(--color-text, #e6edf3);
    overflow: hidden; }

.te-topbar { display: flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    background: var(--color-bg-surface, #0D1117);
    border-bottom: 1px solid var(--color-border, rgba(255,255,255,.07));
    flex-shrink: 0; }
.te-topbar__title { font-weight: 600; margin-right: 8px; }
.te-topbar__spacer { flex: 1; }

.te-btn { display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 12px; background: transparent; color: var(--color-text);
    border: 1px solid var(--color-border, rgba(255,255,255,.07));
    border-radius: 6px; font-size: 12px; cursor: pointer; transition: background .15s; }
.te-btn:hover { background: rgba(255,255,255,.05); }
.te-btn--primary { background: var(--color-primary, #E22345); border-color: var(--color-primary); color: #fff; }
.te-btn--primary:hover { background: #c01e3c; }
.te-btn--ghost { border-color: transparent; }
.te-btn svg, .te-btn i { width: 14px; height: 14px; }

.te-select { height: 32px; padding: 0 28px 0 10px;
    background: var(--color-bg-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: 6px; font-size: 12px; }

.te-filterbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    padding: 8px 16px; background: var(--color-bg-base);
    border-bottom: 1px solid var(--color-border); flex-shrink: 0; }
.te-search { position: relative; display: flex; align-items: center; flex: 0 0 280px; }
.te-search i { position: absolute; left: 8px; width: 14px; height: 14px; opacity: .6; }
.te-search input { width: 100%; height: 32px; padding: 0 8px 0 28px;
    background: var(--color-bg-surface); color: var(--color-text);
    border: 1px solid var(--color-border); border-radius: 6px; font-size: 12px; }
.te-quickfilters { display: flex; gap: 4px; flex-wrap: wrap; }
.te-chip { height: 26px; padding: 0 10px; font-size: 11px;
    background: transparent; color: var(--color-text-secondary, #9da7b3);
    border: 1px solid var(--color-border); border-radius: 13px; cursor: pointer; }
.te-chip.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.te-counter { font-size: 11px; opacity: .7; margin-left: auto; }

.te-banner { padding: 10px 16px; background: rgba(226,35,69,.1);
    border-bottom: 1px solid rgba(226,35,69,.3); font-size: 13px; }

.te-table-wrap { flex: 1; overflow: auto; position: relative; }
.te-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.te-table thead th { position: sticky; top: 0; z-index: 1;
    background: var(--color-bg-surface);
    text-align: left; padding: 8px; font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    user-select: none; cursor: pointer; white-space: nowrap; }
.te-table thead th[data-sort].is-sort-asc::after  { content: ' \25B2'; opacity: .6; }
.te-table thead th[data-sort].is-sort-desc::after { content: ' \25BC'; opacity: .6; }
.te-table tbody tr { height: var(--te-row-h); }
.te-table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
.te-table tbody tr.is-selected { background: rgba(226,35,69,.08); }
.te-table tbody td { padding: 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.te-col-sel, .te-col-icon { width: 36px; }
.te-icon-cell img { width: 28px; height: 28px; object-fit: contain; }
.te-icon-cell--missing { width: 28px; height: 28px; display: inline-flex;
    align-items: center; justify-content: center;
    background: rgba(255,255,255,.05); border-radius: 4px; font-size: 11px; opacity: .6; }
.te-name-cell { cursor: pointer; }
.te-name-cell:hover { text-decoration: underline; }
.te-mod-badge { display: inline-block; margin-left: 6px; padding: 1px 6px;
    background: rgba(255,200,0,.15); color: #ffd54f; border-radius: 8px; font-size: 10px; }

.te-cell--changed { position: relative; }
.te-cell--changed::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 2px;
    background: var(--color-primary); }

.te-input { width: 100%; height: 26px; padding: 0 6px;
    background: var(--color-bg-surface); color: var(--color-text);
    border: 1px solid var(--color-primary); border-radius: 4px; font-size: 12px; }

.te-flags { display: inline-flex; gap: 2px; }
.te-flag { width: 20px; height: 20px; font-size: 10px; font-weight: 700;
    background: rgba(255,255,255,.05); color: var(--color-text-secondary);
    border: 1px solid var(--color-border); border-radius: 4px; cursor: pointer; }
.te-flag.is-on { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.te-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.te-chips .te-chiplet { font-size: 10px; padding: 1px 6px; border-radius: 8px; background: rgba(255,255,255,.08); }
.te-chips .te-chiplet button { background: none; border: 0; color: inherit; cursor: pointer; margin-left: 4px; opacity: .6; }
.te-chips .te-add { font-size: 10px; padding: 1px 6px; border-radius: 8px;
    background: transparent; border: 1px dashed var(--color-border); cursor: pointer; }

.te-footer { display: flex; align-items: center; gap: 8px;
    padding: 8px 16px; background: var(--color-bg-surface);
    border-top: 1px solid var(--color-border); font-size: 11px; flex-shrink: 0; }

.te-fab { position: fixed; right: 24px; bottom: 64px;
    width: 48px; height: 48px;
    background: var(--color-primary); color: #fff;
    border: 0; border-radius: 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    cursor: pointer; z-index: 50;
    display: flex; align-items: center; justify-content: center; }
.te-fab i { width: 22px; height: 22px; }

.te-bulkbar { position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%);
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px;
    background: rgba(13,17,23,.97); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.1); border-radius: 24px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
    z-index: 60; font-size: 12px; }

.te-side { position: fixed; right: 0; top: var(--topbar-height, 56px); bottom: 0;
    width: 360px; background: var(--color-bg-surface);
    border-left: 1px solid var(--color-border);
    overflow-y: auto; z-index: 40; padding: 16px;
    transform: translateX(100%); transition: transform .2s; }
.te-side.is-open { transform: translateX(0); }
.te-side__close { position: absolute; right: 8px; top: 8px;
    background: none; border: 0; color: inherit; cursor: pointer; font-size: 18px; }

.te-empty { padding: 48px; text-align: center; color: var(--color-text-secondary); }

.te-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6);
    display: flex; align-items: center; justify-content: center; z-index: 100; }
.te-modal { background: var(--color-bg-surface);
    border: 1px solid var(--color-border); border-radius: 8px;
    padding: 20px; min-width: 320px; max-width: 640px; max-height: 80vh; overflow: auto; }
.te-modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.te-modal label { display: block; font-size: 12px; margin-top: 8px; opacity: .8; }
.te-modal__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
