/* New JSP widgets share the existing theme tokens; pages include this file once. */
[data-ui-dialog], .common-alert, .common-banner, .common-empty-state,
.common-data-table, .common-file-uploader {
    color: var(--theme-color-component-text);
    background: var(--theme-color-background);
    border: 1px solid var(--theme-color-component-border);
    border-radius: 5px;
}
[data-ui-dialog] button, .common-alert button, .common-banner button,
.common-chip button, .common-infinite-scroll button,
.common-data-table button {
    min-width: 40px;
    min-height: 40px;
    color: inherit;
    background: transparent;
    border: 1px solid var(--theme-color-component-border);
    border-radius: 2.5px;
    padding: 3.75px 7.5px;
}
[data-ui-dialog] button:disabled, .common-infinite-scroll button:disabled {
    opacity: .55;
    cursor: default;
}
[data-ui-dialog] :focus-visible,
.common-file-uploader:focus-within, .common-scroll-area:focus-visible,
.common-tooltip :focus-visible, .common-checkbox input:focus-visible,
.common-radio input:focus-visible, .common-switch input:focus-visible,
.common-segmented-control input:focus-visible + span,
.common-rating input:focus-visible + span, .common-otp-input input:focus-visible,
.common-combobox input:focus-visible, .common-slider input:focus-visible,
.common-color-picker input:focus-visible, .common-data-table input:focus-visible {
    outline: 2px solid var(--theme-color-component-action);
    outline-offset: 3px;
}
.common-ui-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.common-alert, .common-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px;
}
.common-alert { border-inline-start: 4px solid var(--theme-color-component-action); }
.common-alert[data-tone="success"] { border-inline-start-color: var(--theme-color-component-success); }
.common-alert[data-tone="warning"] { border-inline-start-color: var(--theme-color-component-warning); }
.common-alert[data-tone="danger"] { border-inline-start-color: var(--theme-color-component-danger); }
.common-banner { background: var(--theme-color-component-action); color: var(--theme-color-on-primary); }
.common-aspect-ratio { aspect-ratio: var(--ui-ratio, 1.7777778); overflow: hidden; }
.common-aspect-ratio > img, .common-aspect-ratio > video { width: 100%; height: 100%; object-fit: cover; }
.common-audio-player, .common-video-player { display: block; width: 100%; }
.common-video-player { max-height: 80vh; background: var(--theme-color-video-background); }
.common-avatar {
    position: relative;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--theme-color-avatar-background);
    color: var(--theme-color-component-text);
    overflow: hidden;
    font-weight: 600;
}
.common-avatar[data-size="sm"] { width: 28px; height: 28px; font-size: 12px; }
.common-avatar[data-size="lg"] { width: 40px; height: 40px; font-size: 12.5px; }
.common-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.common-avatar-group { display: flex; align-items: center; padding-inline-start: 5px; }
.common-avatar-group > .common-avatar { margin-inline-start: -5px; border: 2px solid var(--theme-color-surface); }
[data-ui-dialog] {
    padding: 0;
    width: min(360px, calc(100vw - 20px));
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    overflow: auto;
    overscroll-behavior: contain;
    box-shadow: var(--theme-shadow-component-dialog);
}
[data-ui-dialog]::backdrop { background: var(--theme-color-overlay-black-53); }
.common-ui-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--theme-color-component-border);
}
.common-ui-dialog__header h2 { min-width: 0; margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.common-ui-dialog__body { padding: 10px; }
dialog.common-bottom-sheet { inset: auto 0 0; width: min(500px, 100vw); margin: 0 auto; border-radius: 7.5px 7.5px 0 0; }
dialog.common-drawer { inset: 0 0 0 auto; height: 100%; max-height: 100dvh; margin: 0; border-radius: 0; }
dialog.common-drawer[data-side="start"] { inset: 0 auto 0 0; }
dialog.common-lightbox { width: min(700px, calc(100vw - 20px)); }
.common-lightbox img { display: block; max-width: 100%; max-height: 75vh; margin: auto; object-fit: contain; }
dialog.common-context-menu { position: fixed; margin: 0; width: max-content; max-width: calc(100vw - 10px); }
.common-context-menu .common-ui-dialog__body, .common-command-palette [data-ui-command-list] { display: grid; gap: 5px; }
.common-command-palette input { width: 100%; min-height: 40px; padding: 6.25px; margin: 5px 0 10px; }
.common-breadcrumb ol { display: flex; flex-wrap: wrap; gap: 5px; }
.common-breadcrumb li + li::before { content: '/'; margin-inline-end: 5px; color: var(--theme-color-breadcrumb-muted); }
.common-checkbox, .common-radio, .common-switch { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.common-checkbox, .common-radio { min-height: 40px; }
.common-switch { min-width: 40px; min-height: 40px; }
.common-checkbox input, .common-radio input, .common-switch input,
.common-slider input, .common-color-picker input { accent-color: var(--theme-color-component-action); }
.common-checkbox input:disabled, .common-radio input:disabled { cursor: not-allowed; opacity: .55; }
.common-switch input { appearance: none; width: 25px; height: 15px; border-radius: 10px; background: var(--theme-color-switch-background); position: relative; cursor: pointer; }
.common-switch input::after { content: ''; position: absolute; width: 10px; height: 10px; top: 2.5px; left: 2.5px; border-radius: 50%; background: var(--theme-color-surface); }
.common-switch input:checked { background: var(--theme-color-component-action); }
.common-switch input:checked::after { left: 12.5px; }
.common-switch input:disabled { opacity: .5; cursor: default; }
.common-chip { display: inline-flex; align-items: center; gap: 3.75px; padding: 2.5px 6.25px; border-radius: 10px; background: var(--theme-color-avatar-background); }
.common-chip button { min-width: 40px; min-height: 40px; border: 0; padding: 0 1.25px; }
.common-color-picker, .common-slider, .common-combobox, .common-progress { display: flex; align-items: center; flex-wrap: wrap; gap: 7.5px; }
.common-combobox input { min-width: 0; max-width: 100%; min-height: 40px; border: 1px solid var(--theme-color-component-border); border-radius: 2.5px; padding: 5px 7.5px; }
.common-combobox input:disabled, .common-otp-input input:disabled {
    color: var(--theme-color-disabled-text);
    cursor: not-allowed;
    background: var(--theme-color-surface-disabled);
}
.common-data-table { padding: 10px; }
.common-data-table > label { display: grid; gap: 3.75px; max-width: 240px; font-weight: 600; }
.common-data-table input[type="search"] { width: 100%; min-height: 40px; padding: 5px 7.5px; color: inherit; border: 1px solid var(--theme-color-component-border); border-radius: 2.5px; }
.common-data-table__scroll { overflow: auto; margin-top: 7.5px; }
.common-data-table table { width: 100%; text-align: start; }
.common-data-table caption { text-align: start; font-weight: 600; padding: 5px 0; }
.common-data-table th, .common-data-table td { padding: 6.25px; border-bottom: 1px solid var(--theme-color-component-border); }
.common-data-table th { background: var(--theme-color-table-header); }
.common-data-table th[aria-sort="ascending"] button::after { content: ' ↑'; }
.common-data-table th[aria-sort="descending"] button::after { content: ' ↓'; }
.common-divider { height: 1px; width: 100%; background: var(--theme-color-component-border); margin: 10px 0; }
.common-divider[aria-orientation="vertical"] { width: 1px; height: auto; align-self: stretch; min-height: 15px; margin: 0 10px; }
.common-empty-state { padding: 20px; text-align: center; }
.common-empty-state h3 { margin-top: 0; }
.common-file-uploader { display: grid; gap: 7.5px; padding: 15px; border-style: dashed; cursor: pointer; }
.common-file-uploader input[type="file"] { width: 100%; max-width: 100%; min-width: 0; }
.common-file-uploader input:disabled { cursor: not-allowed; opacity: .55; }
.common-file-uploader [data-ui-file-status] { overflow-wrap: anywhere; color: var(--theme-color-file-status); }
.common-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.common-infinite-scroll > button { display: block; margin: 10px auto; }
.common-otp-input, .common-rating, .common-segmented-control { border: 0; padding: 0; min-width: 0; margin: 0; }
.common-otp-input legend, .common-rating legend, .common-segmented-control legend { margin-bottom: 5px; font-weight: 600; }
.common-otp-input > div { display: flex; gap: 5px; flex-wrap: wrap; }
.common-otp-input input[type="text"] { width: 40px; height: 40px; border: 1px solid var(--theme-color-component-border); border-radius: 2.5px; text-align: center; }
.common-progress progress { flex: 1; min-width: 60px; accent-color: var(--theme-color-component-action); }
.common-rating label { display: inline-flex; align-items: center; justify-content: center; gap: 2.5px; min-width: 40px; min-height: 40px; padding: 2.5px; cursor: pointer; }
.common-rating label span[aria-hidden] { color: var(--theme-color-rating-muted); font-size: 15px; }
.common-rating input:checked + span { color: var(--theme-color-component-warning); }
.common-rating input { accent-color: var(--theme-color-component-action); }
.common-rating input:disabled { cursor: not-allowed; opacity: .55; }
.common-resizable { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; overflow: auto; }
.common-resizable > div { min-width: 0; overflow: auto; }
.common-resizable > label { display: none; justify-content: center; background: var(--theme-color-resize-handle); }
.common-resizable input { writing-mode: vertical-lr; direction: rtl; width: 40px; min-height: 60px; accent-color: var(--theme-color-component-action); }
.common-scroll-area { overflow: auto; overscroll-behavior: contain; padding: 5px; }
.common-segmented-control > div { display: inline-flex; flex-wrap: wrap; }
.common-segmented-control label { position: relative; cursor: pointer; }
.common-segmented-control input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.common-segmented-control span { display: flex; align-items: center; min-height: 40px; border: 1px solid var(--theme-color-component-border); padding: 5px 7.5px; }
.common-segmented-control input:checked + span { background: var(--theme-color-component-action); color: var(--theme-color-on-primary); }
.common-segmented-control input:disabled + span { opacity: .5; cursor: default; }
.common-skeleton { background: var(--theme-color-component-skeleton); border-radius: 2.5px; min-height: 10px; animation: common-ui-pulse 1.5s ease-in-out infinite; }
.common-skeleton[data-shape="circle"] { border-radius: 50%; width: 30px; height: 30px; }
.common-skeleton[data-shape="block"] { min-height: 80px; }
.common-slider input { flex: 1; min-width: 80px; }
.common-slider input:disabled, .common-color-picker input:disabled { cursor: not-allowed; opacity: .55; }
.common-slider output, .common-color-picker output { font-variant-numeric: tabular-nums; min-width: 30px; }
.common-timeline { list-style: none; padding-inline-start: 10px; border-inline-start: 2px solid var(--theme-color-component-border); }
.common-timeline li { position: relative; padding: 2.5px 0 10px 5px; }
.common-timeline li::before { content: ''; position: absolute; inset-inline-start: -13.75px; top: 6.25px; width: 6.25px; height: 6.25px; border-radius: 50%; background: var(--theme-color-component-action); }
.common-tooltip { position: relative; display: inline-block; }
.common-tooltip [data-ui-tip] { position: absolute; inset: auto auto calc(100% + 5px) 0; z-index: 1000; width: max-content; max-width: min(200px, 80vw); padding: 5px 7.5px; color: var(--theme-color-tooltip-text); background: var(--theme-color-tooltip-background); border-radius: 2.5px; font-size: 12px; }
.common-tour__controls { display: flex; justify-content: flex-end; gap: 5px; }
.common-tour-target { outline: 3px solid var(--theme-color-component-action); outline-offset: 4px; }
.common-tour ol { padding: 0; }
.common-tree-view ul { padding-inline-start: 12.5px; }
.common-tree-view > ul { padding-inline-start: 0; }
.common-tree-view summary { min-height: 40px; cursor: pointer; padding: 3.75px 0; }
@keyframes common-ui-pulse { 50% { opacity: .45; } }
.common-alert, .common-banner { align-items: flex-start; }
.common-alert > div, .common-banner > div { min-width: 0; overflow-wrap: anywhere; }
.common-breadcrumb li, .common-tree-view a { overflow-wrap: anywhere; }
@media (min-width: 768px) {
    .common-grid { grid-template-columns: repeat(var(--ui-columns, 3), minmax(0, 1fr)); }
    .common-resizable { grid-template-columns: minmax(0, var(--ui-split, 50%)) 40px minmax(0, 1fr); }
    .common-resizable > label { display: flex; }
    .common-alert, .common-banner { align-items: center; }
}
@media (prefers-reduced-motion: reduce) { .common-skeleton { animation: none; } }

.common-popover {
    position: fixed;
    z-index: 1200;
    max-width: min(240px, calc(100vw - 10px));
    max-height: calc(100vh - 10px);
    overflow: auto;
    padding: 10px;
    color: var(--theme-color-component-text);
    background: var(--theme-color-background);
    border: 1px solid var(--theme-color-component-border);
    border-radius: 5px;
    box-shadow: var(--theme-shadow-component-popover);
}
.common-autocomplete { position: relative; max-width: 300px; }
.common-autocomplete > label { display: block; margin-bottom: 3.75px; }
.common-autocomplete > input[type="text"] { width: 100%; min-height: 40px; padding: 6.25px; border: 1px solid var(--theme-color-component-border); border-radius: 2.5px; }
.common-autocomplete [role="listbox"] { position: absolute; inset: 100% 0 auto; z-index: 1150; max-height: 150px; overflow: auto; margin: 2.5px 0 0; padding: 2.5px; background: var(--theme-color-surface); border: 1px solid var(--theme-color-component-border); box-shadow: var(--theme-shadow-component-menu); }
.common-autocomplete [role="option"] { min-height: 40px; padding: 5px 7.5px; cursor: pointer; }
.common-autocomplete [role="option"][aria-selected="true"] { color: var(--theme-color-on-primary); background: var(--theme-color-component-action); }
.common-calendar[data-ui-calendar] { max-width: 320px; }
.common-calendar[data-ui-calendar] .common-calendar__header { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.common-calendar[data-ui-calendar] table { width: 100%; table-layout: fixed; text-align: center; }
.common-calendar[data-ui-calendar] th, .common-calendar[data-ui-calendar] td { padding: 2.5px; }
.common-calendar[data-ui-calendar] button { min-height: 40px; padding: 5px; background: var(--theme-color-surface); color: inherit; border: 1px solid var(--theme-color-component-border); border-radius: 2.5px; }
.common-calendar[data-ui-calendar] td button { width: 100%; }
.common-calendar[data-ui-calendar] button[aria-pressed="true"] { background: var(--theme-color-component-action); color: var(--theme-color-on-primary); }
.common-calendar[data-ui-calendar] button:disabled { opacity: .4; cursor: default; }
.common-calendar[data-ui-calendar] button:focus-visible, .common-popover :focus-visible, .common-autocomplete input:focus-visible { outline: 2px solid var(--theme-color-component-action); outline-offset: 2px; }
.common-data-table__pagination { display: flex; flex-wrap: wrap; gap: 7.5px; align-items: center; justify-content: flex-end; margin-top: 10px; }
[data-ui-resize-drag] { touch-action: none; cursor: col-resize; padding: 2.5px; }
[data-ui-region-map] svg [data-region-code] { cursor: pointer; }
[data-ui-region-map] svg [data-region-code].active { fill: var(--theme-color-component-action); }
