/* ─────────────────────────────────────────────────────────────────────────
   Talpie Smart Home — first-class UI components.
   Inspired by AutoHub's clean console style; no vendor namespace/resources.
───────────────────────────────────────────────────────────────────────── */

:root {
    --tsh-compact-control-h: 30px;
    --tsh-floating-z: 1400;
}

.smart-input,
.smart-select,
.smart-textarea,
.tsh-form input,
.tsh-form select,
.tsh-form textarea {
    width: 100%;
    min-height: var(--tsh-compact-control-h);
    border: 1px solid var(--ah-border-2, var(--tsh-border-strong));
    border-radius: var(--ah-radius, 5px);
    background: #fff;
    color: var(--ah-text, var(--tsh-text));
    font: inherit;
    font-size: 12.5px;
    line-height: 1.25;
    padding: 0 10px;
    box-shadow: inset 0 1px 1px rgba(15,23,42,.025);
    transition: border-color var(--ah-dur-fast, 100ms) ease, box-shadow var(--ah-dur-fast, 100ms) ease, background var(--ah-dur-fast, 100ms) ease;
}
.smart-textarea,
.tsh-form textarea {
    min-height: 86px;
    padding: 8px 10px;
    resize: vertical;
}
.smart-input:hover,
.smart-select:hover,
.smart-textarea:hover,
.tsh-form input:hover,
.tsh-form select:hover,
.tsh-form textarea:hover { border-color: #b7c5d8; }
.smart-input:focus,
.smart-select:focus,
.smart-textarea:focus,
.tsh-form input:focus,
.tsh-form select:focus,
.tsh-form textarea:focus {
    outline: 2px solid var(--ah-blue-ring, var(--tsh-primary-ring));
    outline-offset: 0;
    border-color: var(--ah-blue, var(--tsh-primary));
}

.smart-native-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    clip-path: inset(50%) !important;
}

.smart-choice { position: relative; width: 100%; min-width: 160px; }
.smart-choice-button {
    width: 100%;
    min-height: var(--tsh-compact-control-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid var(--ah-border-2, var(--tsh-border-strong));
    border-radius: var(--ah-radius, 5px);
    background: #fff;
    color: #1a2b42;
    padding: 0 8px 0 10px;
    cursor: pointer;
    font: inherit;
    font-size: 12.5px;
    box-shadow: inset 0 1px 1px rgba(15,23,42,.025);
    transition: border-color var(--ah-dur-fast, 100ms) ease, box-shadow var(--ah-dur-fast, 100ms) ease, background var(--ah-dur-fast, 100ms) ease;
}
.smart-choice-button:hover { background: #f8fafc; border-color: #b7c5d8; }
.smart-choice.open .smart-choice-button,
.smart-choice-button:focus-visible {
    outline: 2px solid var(--ah-blue-ring, var(--tsh-primary-ring));
    outline-offset: 0;
    border-color: var(--ah-blue, var(--tsh-primary));
}
.smart-choice-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.smart-choice-caret { color: var(--ah-muted, var(--tsh-muted)); font-size: 10px; }
.smart-choice-menu {
    position: absolute;
    z-index: var(--tsh-floating-z);
    top: calc(100% + 5px);
    left: 0;
    width: max(100%, 240px);
    max-width: min(520px, calc(100vw - 24px));
    background: #fff;
    border: 1px solid var(--ah-border, var(--tsh-border));
    border-radius: 7px;
    box-shadow: var(--ah-shadow-lg, var(--tsh-shadow-lg));
    padding: 6px;
}
.smart-choice-menu[hidden] { display: none !important; }
.smart-choice-search {
    margin-bottom: 6px;
    height: 28px;
    min-height: 28px;
}
.smart-choice-items {
    max-height: 250px;
    overflow: auto;
    display: grid;
    gap: 2px;
}
.smart-choice-item {
    min-height: 27px;
    width: 100%;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--ah-text, var(--tsh-text));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 8px;
    cursor: pointer;
    font: inherit;
    font-size: 12.5px;
    text-align: left;
}
.smart-choice-item:hover { background: #eef4ff; }
.smart-choice-item.selected { background: var(--ah-blue-weak, var(--tsh-primary-soft)); color: var(--ah-blue, var(--tsh-primary)); font-weight: 750; }
.smart-choice-item:disabled { opacity: .45; cursor: not-allowed; }
.smart-choice-check { width: 14px; height: 14px; object-fit: contain; opacity: .85; }
.country-flag,
.tsh-country-flag {
    width: 18px;
    height: 13px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(15,23,42,.12);
    flex: 0 0 auto;
}
.tsh-country-option { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }

.tsh-tag-input {
    min-height: 34px;
    border: 1px solid var(--ah-border-2, var(--tsh-border-strong));
    border-radius: var(--ah-radius, 5px);
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    padding: 4px 6px;
    box-shadow: inset 0 1px 1px rgba(15,23,42,.025);
}
.tsh-tag-input:focus-within {
    outline: 2px solid var(--ah-blue-ring, var(--tsh-primary-ring));
    border-color: var(--ah-blue, var(--tsh-primary));
}
.tsh-tag-input input {
    min-width: 120px;
    flex: 1 1 120px;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    min-height: 23px !important;
    padding: 0 3px !important;
}
.tsh-tag-chip {
    height: 23px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    padding: 0 6px 0 8px;
    font-size: 11.5px;
    font-weight: 750;
}
.tsh-tag-remove {
    width: 15px;
    height: 15px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-weight: 900;
    line-height: 1;
}
.tsh-tag-remove:hover { background: rgba(30,58,138,.12); }

.tsh-drawer-backdrop,
.tsh-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(15,23,42,.44);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 160ms cubic-bezier(.16,1,.3,1);
}
.tsh-drawer-backdrop.open,
.tsh-modal-backdrop.open { opacity: 1; }
.tsh-drawer-panel {
    position: absolute;
    right: 0;
    top: 0;
    width: min(520px, 100%);
    height: 100%;
    background: #fff;
    box-shadow: -18px 0 48px rgba(15,23,42,.20);
    transform: translateX(24px);
    transition: transform 180ms cubic-bezier(.16,1,.3,1);
    display: flex;
    flex-direction: column;
}
.tsh-drawer-backdrop.open .tsh-drawer-panel { transform: none; }
.tsh-drawer-panel.wide { width: min(860px, 100%); }
.tsh-drawer-panel header,
.tsh-modal-card header {
    height: 52px;
    padding: 0 14px 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--ah-border, var(--tsh-border));
}
.tsh-drawer-title,
.tsh-modal-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tsh-drawer-title img,
.tsh-modal-title img { width: 16px; height: 16px; object-fit: contain; }
.tsh-drawer-title h2,
.tsh-modal-title h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.tsh-drawer-body { flex: 1 1 auto; overflow: auto; padding: 16px; background: #f8fafc; }
.tsh-modal-backdrop { display: grid; place-items: center; padding: 20px; }
.tsh-modal-card {
    width: min(520px, 100%);
    max-height: min(720px, calc(100vh - 40px));
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--ah-border, var(--tsh-border));
    box-shadow: var(--ah-shadow-lg, var(--tsh-shadow-lg));
    transform: translateY(8px) scale(.985);
    transition: transform 180ms cubic-bezier(.16,1,.3,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.tsh-modal-backdrop.open .tsh-modal-card { transform: none; }
.tsh-modal-body { padding: 16px; overflow: auto; }
.tsh-icon-button {
    width: 30px;
    height: 30px;
    border: 1px solid var(--ah-border, var(--tsh-border));
    border-radius: var(--ah-radius, 5px);
    background: #fff;
    display: inline-grid;
    place-items: center;
    cursor: pointer;
}
.tsh-icon-button:hover { background: #f4f7fb; }
.tsh-icon-button img { width: 14px; height: 14px; object-fit: contain; }
body.tsh-overlay-open { overflow: hidden; }

.tsh-spinner,
.mini-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(26,75,174,.18);
    border-top-color: var(--ah-blue, var(--tsh-primary));
    border-radius: 50%;
    display: inline-block;
    animation: tsh-spin .75s linear infinite;
}
.tsh-top-button .mini-spinner,
.tsh-form button .mini-spinner { border-color: rgba(255,255,255,.45); border-top-color: #fff; }
@keyframes tsh-spin { to { transform: rotate(360deg); } }

.tsh-component-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.tsh-component-field { display: grid; gap: 6px; min-width: 0; }
.tsh-component-field > span { font-size: 11.5px; font-weight: 800; color: #283a52; }

@media (max-width: 960px) {
    .tsh-component-grid { grid-template-columns: 1fr; }
    .smart-choice-menu { width: 100%; }
}

/* Iteration 7 Hotfix 4 — clean reusable Talpie UI primitives. */
.ah-muted, .text-muted { color: var(--text-2); }
.ah-code {
    font-family: var(--tsh-mono);
    font-size: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line-1);
    border-radius: var(--r-xs);
    padding: 2px 5px;
    color: #1f3f76;
}
.ah-btn {
    min-height: var(--tsh-control-h);
    border: 1px solid var(--line-2);
    background: var(--surface-1);
    color: #1a2b42;
    border-radius: var(--r-sm);
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 760;
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 1px 1px rgba(15,23,42,.02);
    transition: background var(--ah-dur-fast), border-color var(--ah-dur-fast), transform var(--ah-dur-fast), box-shadow var(--ah-dur-fast);
}
.ah-btn:hover { background: var(--surface-2); border-color: var(--line-2); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-xs); }
.ah-btn:active { transform: none; box-shadow: none; }
.ah-btn.primary { background: linear-gradient(180deg, var(--brand), var(--brand-deep)); color: #fff; border-color: var(--brand-deep); }
.ah-btn.primary:hover { background: linear-gradient(180deg, #235dcc, var(--brand-deep)); color: #fff; }
.ah-btn.soft { background: #f3f7fc; border-color: var(--line-1); color: #17356c; }
.ah-btn.danger { color: var(--danger); border-color: #f4b7b7; background: #fffafa; }
.ah-btn.icon { width: var(--tsh-control-h); padding: 0; }
.ah-btn[disabled], .ah-btn.is-busy { opacity: .65; cursor: wait; transform: none; }
.btn-ico { width: 14px; height: 14px; object-fit: contain; flex: 0 0 auto; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.smart-table-wrap { overflow: auto; border: 1px solid var(--line-1); border-radius: var(--r-md); background: #fff; box-shadow: var(--shadow-xs); }
.smart-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.smart-table th, .smart-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-1); text-align: left; vertical-align: middle; }
.smart-table th { background: #f7f9fc; color: #334155; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .055em; white-space: nowrap; }
.smart-table td { color: #1a2b42; }
.smart-table tr:last-child td { border-bottom: 0; }
.smart-table tbody tr:hover td { background: #f6f9ff; }
.smart-table-configurable { table-layout: fixed; min-width: 100%; }
.smart-table-configurable td, .smart-table-configurable th { overflow: hidden; text-overflow: ellipsis; }
.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    border: 1px solid var(--line-1);
    background: var(--surface-2);
    color: #334155;
    padding: 0 9px;
    font-size: 11.5px;
    font-weight: 800;
}
.pill.ok { background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
.pill.off { background: #f8fafc; border-color: #dbe3ed; color: #64748b; }
.pill.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.tsh-floating-panel {
    position: absolute;
    z-index: var(--tsh-floating-z, 1200);
    top: calc(100% + 5px);
    left: 0;
    width: var(--tsh-dropdown-width, max(100%, 240px));
    max-width: min(520px, calc(100vw - 24px));
    background: #fff;
    border: 1px solid var(--line-1);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 7px;
    transform-origin: top left;
}
.tsh-floating-panel.align-right { left: auto; right: 0; transform-origin: top right; }
.tsh-floating-panel.drop-up { top: auto; bottom: calc(100% + 5px); transform-origin: bottom left; }
.tsh-floating-panel.drop-up.align-right { transform-origin: bottom right; }
.smart-choice-menu { width: var(--tsh-dropdown-width, max(100%, 240px)); }
.smart-choice-items { max-height: var(--tsh-dropdown-max-height, 250px); overflow: auto; }
.smart-choice-empty { padding: 12px; color: var(--text-2); text-align: center; font-size: 12.5px; }

.tsh-tag-input-control { position: relative; min-width: 0; }
.tsh-tag-input { min-height: var(--tsh-compact-control-h, 30px); }
.tsh-tag-chip-root { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tsh-tag-editor { min-width: 70px; flex: 1 1 90px; border: 0; outline: 0; min-height: 22px; padding: 0 3px; font: inherit; background: transparent; }
.tsh-tag-more, .tsh-tag-open {
    height: 22px;
    min-width: 22px;
    border: 1px solid var(--line-1);
    border-radius: 999px;
    background: var(--surface-2);
    color: #1e3a8a;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    font-weight: 850;
    padding: 0 6px;
}
.tsh-tag-open { margin-left: auto; padding: 0; width: 24px; }
.tsh-tag-open img { width: 13px; height: 13px; }
.tsh-tag-panel { width: var(--tsh-dropdown-width, max(100%, 280px)); }
.tsh-tag-list { max-height: var(--tsh-dropdown-max-height, 220px); overflow: auto; display: grid; gap: 3px; margin: 7px 0; }
.tsh-tag-row { min-height: 28px; border-radius: 5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 0 9px; color: #1a2b42; }
.tsh-tag-row:hover { background: #eef4ff; }
.tsh-tag-row button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; color: #64748b; cursor: pointer; font-weight: 900; }
.tsh-tag-row button:hover { background: rgba(30,58,138,.12); color: #1e3a8a; }
.tsh-tag-add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding-top: 6px; border-top: 1px solid var(--line-1); }

.tsh-drawer-panel { border-left: 1px solid var(--line-1); }
.tsh-modal-card.wide { width: min(820px, 100%); }
.tsh-drawer-panel header, .tsh-modal-card header { background: linear-gradient(180deg, #fff, #f8fafc); }
.tsh-drawer-body, .tsh-modal-body { scrollbar-width: thin; }

.tsh-toast-root { z-index: 1500; }
.tsh-toast {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 18px;
    align-items: start;
    gap: 9px;
    min-width: min(360px, calc(100vw - 32px));
    background: #fff;
    border: 1px solid var(--line-1);
    border-left: 3px solid var(--brand);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 10px 10px 10px 11px;
    color: var(--text-1);
}
.tsh-toast img { width: 16px; height: 16px; object-fit: contain; margin-top: 1px; }
.tsh-toast span { min-width: 0; overflow-wrap: anywhere; }
.tsh-toast button { border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-weight: 900; padding: 0; }
.tsh-toast.success { border-left-color: var(--ok); }
.tsh-toast.warning { border-left-color: var(--warn); }
.tsh-toast.error { border-left-color: var(--danger); }

.tsh-command-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1400;
    display: grid;
    place-items: start center;
    padding-top: min(12vh, 90px);
    background: rgba(15,23,42,.38);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 160ms cubic-bezier(.16,1,.3,1);
}
.tsh-command-backdrop.open { opacity: 1; }
.tsh-command-card { width: min(640px, calc(100vw - 28px)); background: #fff; border: 1px solid var(--line-1); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; }
.tsh-command-input-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line-1); background: #f8fafc; }
.tsh-command-input-row img { width: 16px; height: 16px; }
.tsh-command-input-row span { font-size: 11px; color: var(--text-2); border: 1px solid var(--line-1); border-radius: 5px; background: #fff; padding: 2px 5px; }
.tsh-command-list { max-height: min(420px, 60vh); overflow: auto; padding: 7px; display: grid; gap: 3px; }
.tsh-command-list button { width: 100%; min-height: 42px; border: 0; border-radius: 7px; background: transparent; display: grid; grid-template-columns: 20px minmax(0,1fr); align-items: center; gap: 9px; text-align: left; padding: 6px 8px; cursor: pointer; }
.tsh-command-list button:hover { background: #eef4ff; }
.tsh-command-list img { width: 17px; height: 17px; object-fit: contain; }
.tsh-command-list strong { display: block; color: var(--text-1); font-size: 13px; }
.tsh-command-list small { display: block; color: var(--text-2); font-size: 11.5px; }
.tsh-command-empty { padding: 18px; color: var(--text-2); text-align: center; }
.ah-alert {
    border: 1px solid var(--line-1);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--text-1);
    padding: 12px 14px;
    line-height: 1.45;
}
.ah-alert.danger { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.ah-alert.success { background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
.ah-alert.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.ah-skip-link { position: fixed; left: 12px; top: 8px; z-index: 2000; transform: translateY(-140%); background: #fff; color: var(--brand); border: 1px solid var(--line-1); border-radius: var(--r-sm); padding: 7px 10px; font-weight: 800; box-shadow: var(--shadow-md); }
.ah-skip-link:focus { transform: none; }

/* Iteration 8 Hotfix 1 — reusable UX refinements */
.tsh-page-root > * + *,
[data-tsh-page-fragment] > * + *,
.tsh-segment > * + * {
    margin-top: 14px;
}

.tsh-tag-input {
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
}
.tsh-tag-chip-root {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    flex: 0 1 auto;
    overflow: hidden;
}
.tsh-tag-chip {
    max-width: 150px;
    flex: 0 1 auto;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.tsh-tag-editor {
    min-width: 88px !important;
    flex: 1 1 90px !important;
}
.tsh-tag-more,
.tsh-tag-open {
    flex: 0 0 auto;
}
.tsh-tag-more {
    gap: 4px;
    min-width: 42px;
    padding: 0 7px;
}
.tsh-tag-more .btn-ico {
    width: 12px;
    height: 12px;
}
.tsh-tag-panel .smart-input,
.smart-choice-menu .smart-input {
    width: 100%;
}
.smart-choice-menu,
.tsh-tag-panel,
.tsh-floating-panel {
    overflow: hidden;
}
.smart-choice-items,
.tsh-tag-list {
    max-height: var(--tsh-dropdown-max-height, 260px);
    overflow: auto;
}
.smart-choice-item {
    min-width: 0;
}
.smart-choice-item > span,
.tsh-country-option {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tsh-tab-card {
    padding: 0;
    overflow: hidden;
}
.tsh-tab-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--line-1, var(--tsh-border));
    overflow-x: auto;
}
.tsh-tab-strip button {
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: var(--text-2, var(--tsh-muted));
    min-height: 30px;
    padding: 0 10px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
}
.tsh-tab-strip button:hover,
.tsh-tab-strip button.is-active {
    background: #fff;
    border-color: var(--line-1, var(--tsh-border));
    color: var(--ah-blue, var(--tsh-primary));
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(15,23,42,.06));
}
.tsh-tab-panel {
    padding: 14px;
}
.tsh-note-card.compact,
.tsh-note-card {
    border: 1px solid var(--line-1, var(--tsh-border));
    border-radius: 8px;
    background: #fff;
    padding: 12px 14px;
    box-shadow: var(--shadow-xs, 0 1px 2px rgba(15,23,42,.06));
}
.tsh-note-card h3 {
    margin: 0 0 6px;
}
.tsh-note-card p {
    margin: 0;
    color: var(--text-2, var(--tsh-muted));
}
.tsh-form.compact {
    gap: 10px;
}
.tsh-inline-settings-form {
    max-width: 720px;
}
.form-actions.split {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
}
.tsh-login-step[hidden] { display: none !important; }
.tsh-login-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}
.tsh-link-button {
    border: 0;
    background: transparent;
    color: var(--ah-blue, var(--tsh-primary));
    padding: 0;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
}
.tsh-command-list button.is-active {
    background: var(--ah-blue-weak, #eef4ff);
    outline: 2px solid var(--ah-blue-ring, rgba(37,99,235,.22));
    outline-offset: -2px;
}

/* Iteration 8 Hotfix 2 — harden dynamic dropdown/tag UX. */
[data-tsh-page-root],
[data-tsh-page-fragment],
.tsh-core-page,
.tsh-segment {
    display: grid;
    gap: 14px;
    align-content: start;
}
[data-tsh-page-root] > *,
[data-tsh-page-fragment] > *,
.tsh-core-page > *,
.tsh-segment > * {
    min-width: 0;
}
[data-tsh-page-root] > * + *,
[data-tsh-page-fragment] > * + *,
.tsh-core-page > * + *,
.tsh-segment > * + * {
    margin-top: 0 !important;
}
.smart-choice-menu,
.tsh-tag-panel,
.tsh-floating-panel {
    width: var(--tsh-dropdown-width, max(100%, 240px));
    max-width: calc(100vw - 24px);
    overflow: hidden;
}
.smart-choice-item.is-active,
.smart-choice-item:focus-visible,
.tsh-tag-row.is-active {
    background: #e7f0ff;
    outline: 2px solid var(--ah-blue-ring, rgba(37,99,235,.22));
    outline-offset: -2px;
}
.smart-choice.multiple .smart-choice-menu .smart-choice-item {
    cursor: pointer;
}
.tsh-tag-input-control {
    min-width: 0;
    width: 100%;
}
.tsh-tag-input {
    min-height: var(--tsh-compact-control-h, 30px) !important;
    height: var(--tsh-compact-control-h, 30px);
    flex-wrap: nowrap !important;
    overflow: hidden;
    gap: 5px;
    padding: 3px 6px !important;
}
.tsh-tag-chip-root {
    flex-wrap: nowrap !important;
    white-space: nowrap;
    overflow: hidden;
    max-width: min(58%, 420px);
}
.tsh-tag-chip {
    height: 21px;
    max-width: 145px;
}
.tsh-tag-editor {
    min-width: 60px !important;
    flex: 1 1 60px !important;
    height: 22px !important;
    min-height: 22px !important;
}
.tsh-tag-more[hidden] {
    display: none !important;
}
.tsh-tag-more {
    height: 22px;
    min-width: 44px;
}
.tsh-tag-panel {
    width: var(--tsh-dropdown-width, max(100%, 300px));
}
.tsh-tag-row.is-active button {
    background: rgba(30,58,138,.12);
    color: #1e3a8a;
}
.tsh-tag-add-row {
    align-items: center;
}
.tsh-card,
.summary-card,
.tsh-tab-card,
.tsh-note-card,
.smart-table-wrap,
.tsh-hero-card {
    min-width: 0;
}

/* Iteration 11 hotfix: professional settings editor */
.tsh-settings-editor {
    border: 1px solid var(--line-1, #dbe3ef);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-sm, 0 8px 24px rgba(15,23,42,.06));
}
.tsh-settings-editor-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-1, #dbe3ef);
    background: linear-gradient(180deg, #fff, #f8fafc);
}
.tsh-settings-editor-head strong { display: block; font-size: 15px; color: var(--text-1, #172033); }
.tsh-settings-editor-head small { display: block; margin-top: 3px; color: var(--text-2, #667085); }
.tsh-settings-list { display: grid; }
.tsh-setting-row {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(240px, 1.2fr) auto;
    gap: 14px;
    align-items: center;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-1, #dbe3ef);
}
.tsh-setting-row:last-child { border-bottom: 0; }
.tsh-setting-row.is-dirty { background: #fffdf3; }
.tsh-setting-row.is-saving { opacity: .72; }
.tsh-setting-meta strong { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--text-1, #172033); }
.tsh-setting-meta small { display: block; margin-top: 4px; color: var(--text-2, #667085); line-height: 1.45; }
.tsh-setting-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tsh-setting-tags span { border: 1px solid var(--line-1, #dbe3ef); border-radius: 999px; padding: 2px 7px; font-size: 10.5px; color: var(--text-2, #667085); background: #f8fafc; }
.tsh-setting-control .smart-input { width: 100%; }
.tsh-setting-textarea { resize: vertical; min-height: 74px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tsh-setting-actions { display: flex; justify-content: flex-end; align-items: center; gap: 7px; }
.tsh-settings-empty { padding: 18px; color: var(--text-2, #667085); }
.tsh-toggle-line { display: inline-flex; align-items: center; gap: 8px; color: var(--text-1, #172033); font-weight: 650; }
@media (max-width: 980px) {
    .tsh-setting-row { grid-template-columns: 1fr; align-items: stretch; }
    .tsh-setting-actions { justify-content: flex-start; }
}
