/* Shared presentation for the dashboard. OBS sources keep their own transparent styles. */
.app-ui {
    color-scheme: dark;
    background: #0c111d;
    font-size: .875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    --ui-border: #2b3548;
    --ui-focus: #c4a0ff;
}
.app-ui :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--ui-focus);
    outline-offset: 3px;
}
.app-ui :where(button, a, input, select, textarea) {
    -webkit-tap-highlight-color: transparent;
}
.app-ui :where(button, input, select, textarea):disabled {
    cursor: not-allowed;
    opacity: .5;
}
.app-ui .text-twitch { color: #bc94ff; }
.app-ui a.text-twitch:hover { color: #dcc8ff; }
.app-ui .skip-link {
    position: fixed;
    top: .5rem;
    left: .5rem;
    z-index: 60;
    padding: .6rem 1rem;
    border-radius: .5rem;
    background: #772ce8;
    transform: translateY(-150%);
}
.app-ui .skip-link:focus { transform: translateY(0); }
.app-ui .app-content {
    width: 100%;
    max-width: 96rem;
    margin-inline: auto;
    padding: 1.25rem clamp(.75rem, 2vw, 2rem) 2rem;
    overflow-wrap: anywhere;
}
.app-ui .app-content :where(.grid, .flex) > * { min-width: 0; }
.app-ui .app-content :where(h1, h2, h3) { letter-spacing: -.025em; }
.app-ui .app-content h1 { font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.3; }
.app-ui .app-content :where(img, video, iframe, audio) { max-width: 100%; }
.app-ui .app-content iframe { color-scheme: normal; }
.app-ui .app-content audio { width: 100%; }
.app-ui .ui-card {
    background: #141c2b;
    border: 1px solid var(--ui-border);
    border-radius: .75rem;
    box-shadow: 0 2px 6px rgb(0 0 0 / .1);
}
.app-ui .ui-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    min-height: 2.25rem;
    max-width: 100%;
    padding: .45rem .8rem;
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: center;
    transition: background-color 150ms, border-color 150ms, box-shadow 150ms;
}
.app-ui .ui-button > svg { flex-shrink: 0; }
.app-ui .ui-button:active:not(:disabled) { box-shadow: inset 0 2px 4px rgb(0 0 0 / .2); }
.app-ui .ui-button.bg-twitch { background-color: #8034d9; }
.app-ui .ui-button.bg-twitch:hover { background-color: #7030c0; }
.app-ui .ui-button.bg-green-600 { background-color: #15803d; }
.app-ui .ui-button.bg-green-600:hover { background-color: #166534; }
.app-ui .ui-button.bg-yellow-600 { background-color: #a16207; }
.app-ui .ui-button.bg-yellow-600:hover { background-color: #854d0e; }
.app-ui .ui-button:is(.bg-gray-600, .bg-gray-700):hover { background-color: #475569; }
.app-ui .app-content :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]), select, textarea) {
    min-width: 0;
    max-width: 100%;
    min-height: 2.375rem;
    padding: .5rem .65rem;
    border: 1px solid #445168;
    border-radius: .5rem;
    background-color: #0f1726;
    color: #f3f4f6;
    font-size: .875rem;
    line-height: 1.4;
    transition: border-color 150ms, box-shadow 150ms;
}
.app-ui .app-content :where(input, textarea)::placeholder { color: #8896ad; opacity: 1; }
.app-ui .app-content :where(input, select, textarea):focus { border-color: #ac7cf8; }
.app-ui .app-content :where(input[readonly]) { color: #bac5d8; font-family: ui-monospace, monospace; }
.app-ui .app-content textarea { resize: vertical; }
.app-ui .app-content select { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-ui .app-content :where(input[type="checkbox"], input[type="radio"]) {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    accent-color: #9146ff;
}
.app-ui .app-content input[type="range"] { min-width: 0; max-width: 100%; accent-color: #a970ff; }
.app-ui .app-content :where(label:has(input[type="checkbox"]), label:has(input[type="radio"])) {
    min-height: 2rem;
    cursor: pointer;
}
.app-ui .app-content :where(code, pre) { overflow-wrap: anywhere; white-space: pre-wrap; }
.app-ui .app-content summary { cursor: pointer; padding-block: .25rem; }
.app-ui .ui-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem; max-width: 44rem; padding: .25rem; border: 1px solid var(--ui-border); border-radius: .65rem; background: #141c2b; }
.app-ui .ui-tabs a { padding: .6rem .5rem; border: 0; border-radius: .4rem; text-align: center; }
.app-ui .ui-tabs a:hover { background: #2b3548; }
.app-ui .ui-tabs [aria-current="page"] { background: #9146ff24; color: #ddc9ff; }
.app-ui .app-content .table-scroll {
    position: relative;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: #56627a transparent;
}
.app-ui .app-content .ui-table { width: 100%; min-width: 38rem; font-size: .8125rem; overflow-wrap: normal; }
.app-ui .app-content .ui-table.table-small { min-width: 26rem; }
.app-ui .app-content .ui-table.table-fluid { min-width: 0; table-layout: fixed; }
.app-ui .app-content .table-fluid th:nth-child(3) { width: 4.5rem; }
.app-ui .app-content .table-fluid th:nth-child(4) { width: 11rem; }
.app-ui .app-content .ui-table :where(th, td) { padding: .7rem 1rem; }
.app-ui .app-content .ui-table th { font-size: .6875rem; color: #bac5d8; letter-spacing: .06em; white-space: nowrap; }
.app-ui .app-content .ui-table thead { background: #192335; }
.app-ui .app-content .ui-table tbody tr:hover { background: rgb(148 163 184 / .045); }
.app-ui .app-content .ui-table td { vertical-align: middle; overflow-wrap: break-word; }
.app-ui .app-content .ui-table td > div { max-width: 22rem; overflow-wrap: anywhere; }
.app-ui .app-content .ui-table td > .truncate { max-width: 16rem; }
.app-ui .app-content .table-actions { white-space: nowrap; }
.app-ui .app-content .table-actions :where(a, button) { display: inline-flex; align-items: center; min-height: 2rem; }
.app-ui .app-content [role="switch"] { vertical-align: middle; }
.app-ui .app-content [role="switch"]::after { content: ""; position: absolute; inset: -.5rem -.2rem; }
.app-ui .app-content .theme-card[aria-pressed="true"] { border-color: #b68aff; box-shadow: 0 0 0 2px #9146ff; }
.app-ui .app-content .theme-card[aria-pressed="true"] .theme-check { opacity: 1; }

#sidebar, #app-shell { transition: width 150ms ease, padding-left 150ms ease, transform 150ms ease; }
#sidebar { width: 13.5rem; background: #111927; }
#app-shell { min-width: 0; padding-left: 13.5rem; }
#app-shell > header { background: rgb(17 25 39 / .96); backdrop-filter: blur(12px); }
.app-ui .sidebar-link { min-height: 2.25rem; height: auto; padding-block: .45rem; font-size: .8125rem; }
.sidebar-link.bg-twitch { background: #9146ff24; color: #ddc9ff; box-shadow: inset 3px 0 #ad78ff; }
.app-ui .sidebar-section { color: #94a0b5; font-size: .625rem; }
.sidebar-collapsed #sidebar { width: 4rem; }
.sidebar-collapsed #app-shell { padding-left: 4rem; }
.sidebar-collapsed :is(.sidebar-label, .sidebar-section, .sidebar-brand) { display: none; }
.sidebar-collapsed .app-ui .sidebar-link { justify-content: center; padding-inline: 0; }
.sidebar-collapsed #sidebar-toggle svg { transform: rotate(180deg); }
@media (max-width: 1023px) {
    #sidebar, .sidebar-collapsed #sidebar { width: min(18rem, calc(100vw - 3rem)); transform: translateX(-100%); visibility: hidden; }
    #app-shell, .sidebar-collapsed #app-shell { padding-left: 0; }
    .sidebar-collapsed :is(.sidebar-label, .sidebar-brand) { display: inline; }
    .sidebar-collapsed .app-ui .sidebar-section { display: block; }
    .sidebar-collapsed .app-ui .sidebar-link { justify-content: flex-start; padding-inline: .75rem; }
    .mobile-sidebar-open #sidebar { transform: translateX(0); visibility: visible; }
    .mobile-sidebar-open #sidebar-overlay { display: block; }
    .mobile-sidebar-open, .mobile-sidebar-open body { overflow: hidden; }
    .app-ui .sidebar-link { min-height: 2.75rem; }
}
@media (max-width: 639px) {
    .app-ui .ui-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-ui .app-content { padding-top: 1rem; }
    .app-ui .app-content :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { font-size: 1rem; }
    .app-ui .app-content .ui-table :where(th, td) { padding: .65rem .75rem; }
    /* Keep every field and action available in compact mobile records. */
    .app-ui .app-content .table-stack { display: block; min-width: 0; }
    .app-ui .app-content .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .app-ui .app-content .table-stack tbody { display: block; }
    .app-ui .app-content .table-stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1rem; padding: 1rem; }
    .app-ui .app-content .table-stack td { display: block; min-width: 0; padding: 0; white-space: normal; overflow-wrap: anywhere; }
    .app-ui .app-content .table-stack td:first-child { grid-column: 1 / -1; }
    .app-ui .app-content .table-stack td::before { content: attr(data-label); display: block; margin-bottom: .25rem; color: #94a0b5; font-size: .625rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
    .app-ui .app-content .table-stack td > .truncate { display: -webkit-box; max-width: 100%; white-space: normal; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
    .app-ui .app-content .table-stack .table-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: .75rem; }
    .app-ui .app-content .table-stack .table-actions::before { margin-right: auto; margin-bottom: 0; }
    .app-ui .app-content .table-stack .table-actions :where(a, button) { min-height: 2.5rem; }
    .app-ui .app-content .ui-button { min-height: 2.5rem; }
}
@media (pointer: coarse) {
    .app-ui .ui-button, .app-ui #sidebar-open, .app-ui #sidebar-close { min-height: 2.75rem; }
    .app-ui .app-content input[type="range"] { min-height: 2rem; }
    .app-ui .app-content :where(label:has(input[type="checkbox"]), label:has(input[type="radio"])) { min-height: 2.75rem; }
}
@media (prefers-reduced-motion: reduce) {
    .app-ui *, .app-ui *::before, .app-ui *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
