:root {
    --hdv2-cah-bg: hsl(0 0% 100%);
    --hdv2-cah-fg: hsl(240 5.3% 26.1%);
    --hdv2-cah-muted: hsl(240 3.8% 46.1%);
    --hdv2-cah-border: hsl(220 13% 91%);
    --hdv2-cah-card: hsl(0 0% 100%);
    --hdv2-cah-accent: hsl(240 4.8% 95.9%);
    --hdv2-cah-app-bg: hsl(0 0% 100%);
}

:root[data-hdv2-theme="dark"] {
    --hdv2-cah-bg: hsl(220 5% 16%);
    --hdv2-cah-fg: hsl(220 5% 96%);
    --hdv2-cah-muted: hsl(220 4% 68%);
    --hdv2-cah-border: hsl(220 4% 24%);
    --hdv2-cah-card: hsl(220 5% 19%);
    --hdv2-cah-accent: hsl(220 4% 22%);
    --hdv2-cah-app-bg: hsl(220 6% 13%);
}

.hdv2-a11y-sheet {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.hdv2-a11y-sheet.hdv2-sheet .hdv2-sheet__panel,
.hdv2-a11y-sheet__panel.hdv2-sheet__panel {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(480px, 100%);
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
    background: var(--hdv2-cah-bg);
    color: var(--hdv2-cah-fg);
}

.hdv2-a11y-sheet__header,
.hdv2-a11y-sheet .hdv2-sheet__header {
    grid-row: 1;
    flex-shrink: 0;
    background: hsl(217.2 91.2% 59.8%);
    border-bottom-color: hsl(217 91% 50%);
}

.hdv2-a11y-sheet__header .hdv2-sheet__title,
.hdv2-a11y-sheet__header .hdv2-sheet__subtitle {
    color: #fff;
    font-family: inherit;
}

.hdv2-a11y-sheet__header .hdv2-sheet__close {
    border-color: hsl(0 0% 100% / 0.35);
    background: hsl(0 0% 100% / 0.12);
    color: #fff;
}

.hdv2-a11y-sheet__header .hdv2-sheet__close svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
}

.hdv2-a11y-sheet__header .hdv2-sheet__close:hover {
    background: hsl(0 0% 100% / 0.22);
    color: #fff;
}

.hdv2-a11y-sheet.hdv2-sheet .hdv2-sheet__body,
.hdv2-a11y-sheet__body.hdv2-sheet__body {
    grid-row: 2;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.hdv2-a11y-sheet__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.85rem 1rem 2.75rem;
    background: var(--hdv2-cah-bg);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--hdv2-cah-border) transparent;
}

.hdv2-a11y-sheet__scroll::-webkit-scrollbar {
    width: 5px;
}

.hdv2-a11y-sheet__scroll::-webkit-scrollbar-thumb {
    background: var(--hdv2-cah-border);
    border-radius: 999px;
}

.hdv2-a11y-section + .hdv2-a11y-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--hdv2-cah-border);
}

.hdv2-a11y-section__title {
    margin: 0 0 0.65rem;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--hdv2-cah-fg);
}

.hdv2-a11y-section__lead {
    margin: 0 0 0.75rem;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--hdv2-cah-muted);
}

.hdv2-a11y-tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.hdv2-a11y-tiles--profiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hdv2-a11y-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    min-height: 5.5rem;
    padding: 0.75rem 0.55rem;
    border: 1px solid var(--hdv2-cah-border);
    border-radius: 0.65rem;
    background: var(--hdv2-cah-card);
    color: var(--hdv2-cah-fg);
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.hdv2-a11y-tile:hover {
    border-color: var(--hdv2-cah-muted);
}

.hdv2-a11y-tile.is-active {
    border-color: hsl(217.2 91.2% 59.8%);
    border-width: 2px;
    background: hsl(217 91% 60% / 0.12);
    box-shadow: 0 0 0 3px hsl(217 91% 60% / 0.16);
}

.hdv2-a11y-tile__state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.1rem;
    margin-top: 0.15rem;
    padding: 0.14rem 0.45rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.hdv2-a11y-tile__state.is-on {
    background: hsl(217.2 91.2% 59.8%);
    color: #fff;
}

.hdv2-a11y-tile__state.is-off {
    background: var(--hdv2-cah-accent);
    color: var(--hdv2-cah-muted);
}

.hdv2-a11y-tile__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: var(--hdv2-cah-accent);
    color: hsl(217.2 91.2% 59.8%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hdv2-a11y-tile__icon svg {
    width: 1.05rem;
    height: 1.05rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hdv2-a11y-tile__label {
    font-size: 0.74rem;
    line-height: 1.35;
    text-align: center;
    font-weight: 600;
}

.hdv2-a11y-field + .hdv2-a11y-field {
    margin-top: 0.75rem;
}

.hdv2-a11y-field__label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--hdv2-cah-muted);
}

.hdv2-a11y-segment {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.hdv2-a11y-segment__btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.42rem 0.55rem;
    border: 1px solid var(--hdv2-cah-border);
    border-radius: 0.45rem;
    background: var(--hdv2-cah-card);
    color: var(--hdv2-cah-fg);
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.hdv2-a11y-segment__btn.is-active {
    border-color: hsl(217.2 91.2% 59.8%);
    background: hsl(217 91% 60% / 0.1);
    color: hsl(217.2 91.2% 45%);
}

.hdv2-a11y-actions-row {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.hdv2-a11y-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.62rem 0.75rem;
    border: 1px solid hsl(217.2 91.2% 59.8%);
    border-radius: 0.55rem;
    background: hsl(217.2 91.2% 59.8%);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.hdv2-a11y-action-btn svg {
    width: 1rem;
    height: 1rem;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.hdv2-a11y-action-btn svg rect {
    fill: currentColor;
    stroke: none;
}

.hdv2-a11y-action-btn--ghost {
    background: var(--hdv2-cah-card);
    color: var(--hdv2-cah-fg);
    border-color: var(--hdv2-cah-border);
}

.hdv2-a11y-action-btn--read {
    justify-content: center;
}

.hdv2-a11y-action-btn--read.is-speaking {
    background: var(--hdv2-cah-card);
    color: var(--hdv2-cah-fg);
    border-color: hsl(0 72% 46%);
    box-shadow: inset 0 0 0 1px hsl(0 72% 46% / 0.18);
}

.hdv2-a11y-action-btn--read.is-speaking svg rect {
    fill: currentColor;
}

.hdv2-a11y-read-control__active[hidden],
.hdv2-a11y-read-control__idle[hidden] {
    display: none !important;
}

.hdv2-a11y-action-btn--toggle {
    justify-content: space-between;
    background: var(--hdv2-cah-card);
    color: var(--hdv2-cah-fg);
    border-color: var(--hdv2-cah-border);
}

.hdv2-a11y-action-btn--toggle.is-active {
    background: hsl(217.2 91.2% 59.8%);
    color: #fff;
    border-color: hsl(217.2 91.2% 59.8%);
    box-shadow: inset 0 0 0 2px hsl(0 0% 100% / 0.18);
}

.hdv2-a11y-action-btn__lead {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.hdv2-a11y-action-btn__state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 3.4rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.2;
}

.hdv2-a11y-action-btn__state.is-on {
    background: hsl(0 0% 100% / 0.22);
    color: #fff;
}

.hdv2-a11y-action-btn--toggle:not(.is-active) .hdv2-a11y-action-btn__state.is-off {
    background: var(--hdv2-cah-accent);
    color: var(--hdv2-cah-muted);
}

.hdv2-a11y-feedback {
    margin: 0.65rem 0 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--hdv2-cah-muted);
}

.hdv2-a11y-feedback[hidden] {
    display: none;
}

.hdv2-a11y-sheet.hdv2-sheet .hdv2-sheet__footer,
.hdv2-a11y-sheet__footer.hdv2-sheet__footer {
    grid-row: 3;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
    padding: 0.65rem 1.15rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
    background: var(--hdv2-cah-card);
    border-top: 1px solid var(--hdv2-cah-border);
    box-shadow: 0 -10px 24px hsl(0 0% 0% / 0.06);
    position: relative;
    z-index: 2;
}

.hdv2-a11y-sheet__footer-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.hdv2-a11y-statement-link {
    display: block;
    width: 100%;
    font-size: 0.78rem;
    color: var(--hdv2-cah-muted);
    text-decoration: none;
}

.hdv2-a11y-statement-link:hover {
    color: hsl(217.2 91.2% 59.8%);
    text-decoration: underline;
}

.hdv2-a11y-sheet .hdv2-spd-btn {
    min-height: 2.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.85rem;
    border-radius: 0.55rem;
    border: 1px solid var(--hdv2-cah-border);
    background: var(--hdv2-cah-card);
    color: var(--hdv2-cah-fg);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.hdv2-a11y-sheet .hdv2-spd-btn--ghost:hover {
    background: var(--hdv2-cah-accent);
}

@media (max-width: 480px) {
    .hdv2-a11y-tiles {
        grid-template-columns: 1fr;
    }
}

.hdv2-a11y-shortcuts {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.hdv2-a11y-shortcuts__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--hdv2-cah-border);
    border-radius: 0.55rem;
    background: var(--hdv2-cah-card);
}

.hdv2-a11y-shortcuts__label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--hdv2-cah-fg);
}

.hdv2-a11y-shortcuts__key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.55rem;
    padding: 0.12rem 0.38rem;
    border: 1px solid var(--hdv2-cah-border);
    border-radius: 0.35rem;
    background: var(--hdv2-cah-accent);
    color: var(--hdv2-cah-fg);
    font-family: inherit;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.hdv2-a11y-shortcuts__plus {
    margin: 0 0.08rem;
    color: var(--hdv2-cah-muted);
    font-size: 0.72rem;
    font-weight: 700;
}

@media (max-width: 480px) {
    .hdv2-a11y-shortcuts__item {
        flex-direction: column;
        align-items: flex-start;
    }
}
