/* Admin UI kit. Components follow the FPS studio patterns; colors come from brand.css. */

* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 var(--font); background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: var(--brand); }
h1 { margin: 0 0 20px; font-size: 26px; font-weight: 700; letter-spacing: -.03em; }
h2 { margin: 28px 0 12px; font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); }
svg.icon { width: 17px; height: 17px; flex: 0 0 auto; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Shell */
.topbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 24px; min-height: 64px; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .brand { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 8px; margin-right: 18px; font-size: 15px; font-weight: 700; }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; }
.topbar nav a { display: flex; align-items: center; height: 36px; padding: 0 12px; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.topbar nav a:hover { background: var(--hover); color: var(--text); }
.topbar nav a.active { background: var(--brand-50); color: var(--brand); font-weight: 700; }
.topbar form { margin-left: auto; }
main { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

/* Surfaces */
.card { margin-bottom: 16px; padding: 20px 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card > h2:first-child { margin-top: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
/* .kpi (read-only number, may link to a list) and .stage-card (quick filter) share one card look. */
.kpi, .stage-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
a.kpi:hover, .stage-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.kpi-label { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label svg.icon { width: 15px; height: 15px; }
.kpi .stat { font-size: 24px; white-space: nowrap; }
.kpi--bad .stat { color: var(--bad); }
.quiet-link.text-bad { color: var(--bad); font-weight: 700; }
.note { margin-top: 12px; font-size: 12px; }
.check-cell { width: 44px; padding-right: 0; }
input[type="checkbox"].row-check { appearance: none; width: 18px; height: 18px; margin: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--card) center / 12px no-repeat; cursor: pointer; vertical-align: middle; }
input[type="checkbox"].row-check::after { content: none; }
input[type="checkbox"].row-check:checked, input[type="checkbox"].row-check:indeterminate { border-color: var(--brand); background-color: var(--brand); }
input[type="checkbox"].row-check:checked { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E"); }
input[type="checkbox"].row-check:indeterminate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 12h12'/%3E%3C/svg%3E"); }
tbody tr.selected td, tbody tr.selected:hover td { background: var(--brand-50); }
.bulk-bar { position: fixed; left: 50%; bottom: 24px; z-index: 40; transform: translateX(-50%); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 32px); padding: 10px 12px; background: var(--card); border: 1px solid var(--brand-200); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(31,35,49,.22); animation: popover-in var(--duration) var(--ease); }
.bulk-bar[hidden], .bulk-param[hidden] { display: none; }
.bulk-bar .select { min-width: 220px; }
.bulk-bar input[type="number"] { width: 90px; }
.bulk-param { display: inline-flex; align-items: center; gap: 6px; }
.bulk-count { margin-right: 4px; color: var(--muted); }
.bulk-bar .icon-button { width: 38px; height: 38px; }
.bulk-count b { color: var(--text); }
.lead { font-size: 15px; }
.stage-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stage-card { align-items: flex-start; }
.stage-card.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.stage-card .stat { font-size: 24px; }
.quiet-link { color: inherit; text-decoration: none; }
.quiet-link:hover { color: var(--brand); text-decoration: underline; }
.account-title { display: flex; align-items: center; gap: 10px; }
.account-title .pill { margin-top: 0; font-size: 12px; height: 22px; }
p.copyable { display: flex; align-items: center; gap: 4px; }
p.copyable .copy { opacity: 1; }
.stat { font-size: 28px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }

/* Notices */
.flash, .alert, .errors { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; padding: 12px 14px; border-radius: var(--radius); font-size: 13px; }
.flash { background: var(--brand-50); color: var(--brand); }
.alert { background: var(--highlight-50); color: var(--highlight-900); }
.errors { background: var(--bad-50); color: var(--bad); }

/* Badges */
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--radius-sm); background: var(--hover); color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge svg.icon { width: 13px; height: 13px; margin-right: 4px; }
.with-icon { display: inline-flex; align-items: center; gap: 6px; }
.with-icon svg.icon, .option svg.icon, .select-trigger .label svg.icon { width: 16px; height: 16px; color: var(--muted); }
.option svg.icon { margin-right: 8px; }
.option.selected svg.icon { color: var(--brand); }
.select-trigger .label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.pill { display: inline-flex; align-items: center; height: 18px; margin-top: 3px; padding: 0 7px; border-radius: 9px; font-size: 11px; font-weight: 700; letter-spacing: .01em; }
.pill--kommo { background: var(--kommo-50); color: var(--kommo); }
.pill--amocrm { background: var(--amocrm-50); color: var(--amocrm); }
.badge.ok { background: var(--brand-50); color: var(--brand); }
.badge.warn { background: var(--highlight-50); color: var(--highlight-900); }
.badge.bad { background: var(--bad-50); color: var(--bad); }

/* Buttons */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border: 1px solid var(--brand); border-radius: var(--radius); background: var(--brand); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { background: var(--brand-900); border-color: var(--brand-900); }
button.secondary, .button.secondary { border-color: var(--line); background: var(--card); color: var(--text); }
button.secondary:hover, .button.secondary:hover { border-color: var(--line-strong); background: var(--hover); }
button.link, .link-action { height: auto; padding: 0; border: 0; background: none; color: var(--brand); font-weight: 700; text-decoration: none; }
button.link:hover { background: none; color: var(--brand-900); }
button:disabled { opacity: .5; pointer-events: none; }
button.danger { border-color: var(--bad); background: var(--bad); }
button.danger:hover { border-color: var(--bad); background: var(--bad); filter: brightness(.9); }
button:focus-visible, .button:focus-visible, .topbar nav a:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--brand), 0 0 0 4px var(--brand-50); }

/* Form controls */
label { display: block; margin: 12px 0 6px; color: var(--muted); font-size: 12px; }
label.check { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--text); font-size: 14px; }
input, select, textarea { height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); outline: none; }
textarea { height: auto; padding: 9px 11px; }
input:hover, select:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus, .select-trigger:focus-visible, .date-control:focus-visible, .date-range:focus-visible { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); outline: none; }
input[aria-invalid="true"], .invalid > .date-control { border-color: var(--bad); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }
input[type="checkbox"] { appearance: none; position: relative; flex: 0 0 auto; width: 36px; height: 20px; margin: 0; padding: 0; border: 0; border-radius: 10px; background: var(--line-strong); cursor: pointer; vertical-align: middle; }
input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(31,35,49,.2); transition-property: transform; }
input[type="checkbox"]:checked { background: var(--brand); }
input[type="checkbox"]:checked::after { transform: translateX(16px); }
input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px var(--brand-50); }
input[type="checkbox"]:disabled { opacity: .5; cursor: default; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid > * { min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; }
.native-hidden { display: none !important; }

/* Filter row */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.filters .select { min-width: 0; }
.filters .select-trigger, .filters .date-range { width: auto; min-width: 0; gap: 6px; padding: 0 10px 0 12px; }
.filters .select-trigger:not(.applied) svg:last-child { color: var(--subtle); }
.filters .select-trigger.applied > svg.icon { display: none; }
.filters .select-trigger.applied, .filters .date-range.filled, .search-field:has(input:not(:placeholder-shown)) { border-color: var(--brand-200); background: var(--brand-50); color: var(--brand); }
.filters .select-trigger.applied:hover, .filters .date-range.filled:hover { border-color: var(--brand); background: var(--brand-50); }
.filters .select-trigger.applied .label, .filters .date-range.filled span:not(.clear) { font-weight: 700; }
.filters .select-trigger.applied svg, .filters .date-range.filled svg, .search-field:has(input:not(:placeholder-shown)) svg { color: var(--brand); }
.filters > [hidden] { display: none !important; }
.add-filter { position: relative; }
.add-filter-trigger { gap: 6px; padding: 0 12px 0 10px; border-style: dashed; color: var(--muted); font-weight: 400; }
.add-filter-trigger:hover { border-style: solid; color: var(--text); }
.add-filter-menu { width: max-content; min-width: 190px; }
.add-filter-menu .option { justify-content: space-between; gap: 16px; }
.add-filter-menu .option svg.icon { width: 14px; height: 14px; margin: 0; color: var(--subtle); }
.filters .reset-filters { width: 38px; height: 38px; color: var(--muted); border-radius: var(--radius); }
.chip-clear, .date-range .clear { display: grid; place-items: center; width: 20px; height: 20px; margin-left: auto; border-radius: 50%; color: var(--brand); }
.chip-clear:hover, .date-range .clear:hover { background: var(--card); }
.chip-clear svg.icon { width: 13px; height: 13px; }
.search-field { display: flex; align-items: center; gap: 8px; height: 38px; width: 210px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--muted); }
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.search-field input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; box-shadow: none !important; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th { height: 44px; color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; }
td { height: 52px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--bg); }
.nowrap { white-space: nowrap; }
.sort-link { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--text); }
th.num .sort-link { flex-direction: row-reverse; }
.sort-arrow { opacity: 0; font-size: 11px; }
.sort-link:hover .sort-arrow { opacity: .5; }
.sort-arrow.active { opacity: 1; color: var(--brand); }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--text); }
td .sub { display: block; white-space: normal; margin-top: 2px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
td .sub--warn { color: var(--highlight-900); }
.date, .calendar-grid, .time-column, .date-control, .date-range { font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pagination { margin-top: 16px; }
.copyable { display: inline-flex; align-items: center; gap: 4px; }
.copy { width: 24px; height: 24px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--subtle); opacity: 0; }
tr:hover .copy, .copy:focus-visible, .copy.done { opacity: 1; }
.copy:hover { background: var(--hover); color: var(--text); }
.copy.done { color: var(--brand); }
.copy svg.icon { width: 15px; height: 15px; }

/* Popover shared by select, calendar and menus */
.select, .date-picker, .date-range-wrap { position: relative; }
.popover { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; padding: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.popover[hidden] { display: none; }
.popover--right { left: auto; right: 0; }
.popover.popover--up { top: auto; bottom: calc(100% + 6px); animation-name: popover-in-up; }
@keyframes popover-in-up { from { opacity: 0; transform: translateY(4px) scale(.98); } }

/* Select */
.select-trigger { justify-content: space-between; width: 100%; padding: 0 11px; border-color: var(--line); background: var(--card); color: var(--text); font-weight: 400; }
.select-trigger:hover { border-color: var(--line-strong); background: var(--card); }
.select-trigger span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-trigger svg { color: var(--muted); }
.select-options { width: max-content; min-width: 100%; max-height: 300px; overflow-y: auto; }
.option { display: flex; width: 100%; height: 34px; justify-content: flex-start; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font-weight: 400; white-space: nowrap; }
.option:hover, .option.focused { background: var(--hover); color: var(--text); border: 0; }
.option.selected { background: var(--brand-50); color: var(--brand); font-weight: 700; }
.option--check { gap: 10px; }
.option--check.selected { background: transparent; color: var(--text); font-weight: 400; }
.option--check.selected:hover, .option--check.focused { background: var(--hover); }
.option--check .check { display: grid; place-items: center; flex: 0 0 18px; width: 18px; height: 18px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--card); }
.option--check .check svg.icon { width: 12px; height: 12px; margin: 0; color: #fff; opacity: 0; stroke-width: 2.4; }
.option--check.selected .check { border-color: var(--brand); background: var(--brand); }
.option--check.selected .check svg.icon { opacity: 1; }
.option-text { display: inline-flex; align-items: center; }

/* Date and date-time */
.datetime { display: flex; gap: 8px; }
.datetime .date-picker { flex: 1; }
.time-picker { position: relative; flex: 0 0 116px; }
.time-control { min-width: 0; }
.time-popover { display: flex; gap: 4px; }
.time-column { display: flex; flex-direction: column; gap: 2px; width: 56px; max-height: 232px; overflow-y: auto; scrollbar-width: none; }
.time-column .option { flex: 0 0 32px; justify-content: center; padding: 0; font-variant-numeric: tabular-nums; }
.date-control, .date-range { justify-content: flex-start; gap: 8px; width: 100%; min-width: 150px; padding: 0 11px; border-color: var(--line); background: var(--card); color: var(--text); font-weight: 400; }
.date-control:hover, .date-range:hover { border-color: var(--line-strong); background: var(--card); }
.date-control svg, .date-range svg { color: var(--muted); }
.date-control .placeholder, .date-range .placeholder { color: var(--muted); }
.date-range { min-width: 210px; }
.date-range.filled { border-color: var(--line-strong); background: var(--hover); }

.calendar { width: 280px; padding: 10px; }
.calendar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; font-weight: 700; }
.calendar-top button, .icon-button { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); }
.calendar-top button:hover, .icon-button:hover { background: var(--hover); color: var(--text); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px 0; text-align: center; }
.calendar-grid span { display: grid; place-items: center; height: 28px; color: var(--muted); font-size: 11px; font-weight: 700; }
.calendar-grid button { height: 32px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); font-size: 13px; font-weight: 400; }
.calendar-grid button:hover { background: var(--hover); }
.calendar-grid button.outside { color: var(--subtle); }
.calendar-grid button.today { font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); }
.calendar-grid button.in-range { border-radius: 0; background: var(--brand-50); }
.calendar-grid button.selected, .calendar-grid button.range-start, .calendar-grid button.range-end { background: var(--brand); color: #fff; font-weight: 700; box-shadow: none; }
.calendar-grid button.range-start { border-radius: 6px 0 0 6px; }
.calendar-grid button.range-end { border-radius: 0 6px 6px 0; }
.calendar-grid button.range-start.range-end { border-radius: var(--radius-sm); }
.calendar-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.calendar-actions .draft { white-space: nowrap; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.calendar-actions .buttons { display: flex; align-items: center; gap: 12px; }
.calendar-actions button { height: 30px; padding: 0 12px; font-size: 12px; }
.calendar-actions button.link { height: auto; padding: 0; }

.range-popover { display: flex; gap: 4px; width: max-content; padding: 10px; }
.range-presets { flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 2px; padding-right: 8px; border-right: 1px solid var(--line); }
.range-presets .option { font-size: 13px; }
.range-popover .calendar { width: 320px; padding: 0 0 0 6px; }

/* Tabs */
.tabs { display: flex; gap: 24px; margin: 28px 0 18px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { position: relative; height: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--muted); font-weight: 400; white-space: nowrap; }
.tab:hover { background: transparent; color: var(--text); }
.tab.active { color: var(--text); font-weight: 700; }
[data-tab-panel][hidden] { display: none; }

/* Segmented control */
.segmented { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.segmented button { height: 28px; padding: 0 11px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 13px; font-weight: 400; }
.segmented button.active { background: var(--brand-50); color: var(--brand); font-weight: 700; }

/* Modal */
dialog.modal { width: min(460px, calc(100% - 32px)); padding: 0; overflow: visible; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 60px rgba(31,35,49,.2); }
dialog.modal::backdrop { background: rgba(31,35,49,.28); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: popover-in var(--duration) var(--ease); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 4px; }
.modal-head h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.modal-body { padding: 0 22px 22px; }
.modal-body > .muted:first-child { margin-top: 4px; }
.icon-button { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Motion: one duration and easing for every hover, focus and state change. */
button, .button, input, select, textarea, .search-field, .topbar nav a, .option, .copy, tbody td, a.card, .widget-card, .stage-card, a.kpi, label.check {
    transition: background-color var(--duration) var(--ease), border-color var(--duration) var(--ease), color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), opacity var(--duration) var(--ease), transform var(--duration) var(--ease);
}
input[type="checkbox"], input[type="checkbox"]::after { transition-duration: 220ms; transition-timing-function: var(--ease); }
button:active, .button:active { transform: translateY(1px); }
.popover:not([hidden]) { animation: popover-in var(--duration) var(--ease); }
@keyframes popover-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand); transform: scaleX(0); transition: transform 240ms var(--ease); }
.tab.active::after { transform: scaleX(1); }
.select-trigger svg { transition: transform var(--duration) var(--ease); }
.select-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
a.card:hover, .widget-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-pop); transform: translateY(-2px); }
[data-tab-panel]:not([hidden]) { animation: panel-in 220ms var(--ease); }
@keyframes panel-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 650px) {
    main { padding: 20px 16px; }
    .topbar { padding: 10px 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .filters > *, .filters .select, .date-range-wrap, .search-field { width: 100%; }
    .filters .select-trigger, .filters .date-range { width: 100%; }
    .range-popover { position: fixed; top: 90px; left: 16px; right: 16px; width: auto; flex-direction: column; }
    .range-presets { padding: 0 0 8px; border-right: 0; border-bottom: 1px solid var(--line); }
    .range-popover .calendar { width: 100%; padding: 0; }
}

/* Widget cards (spec 005) */
.widget-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.widget-card { display: flex; flex-direction: column; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
.widget-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-50), 0 0 0 1px var(--brand); }
.widget-card-wrap { position: relative; display: flex; }
.widget-card-wrap > .widget-card { flex: 1; }
.widget-hide { position: absolute; z-index: 1; top: 10px; right: 10px; opacity: 0; transition: opacity var(--duration) var(--ease); }
.widget-card-wrap:hover .widget-hide, .widget-hide:focus-within { opacity: 1; }
@media (hover: none) { .widget-hide { opacity: 1; } }
.widget-card-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 16px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.widget-logo { display: block; width: 100%; aspect-ratio: 400 / 272; object-fit: cover; background: var(--bg); border-radius: var(--radius-sm); }
.widget-card .widget-logo { border-radius: 0; border-bottom: 1px solid var(--line); }
.widget-logo--empty { display: grid; place-items: center; }
.card > .widget-logo { margin-bottom: 16px; }
.widget-logo--empty img { opacity: .35; filter: grayscale(1); }
.steps { margin: 0; padding: 0; list-style: none; }
.steps-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; border-bottom: 1px solid var(--line); color: var(--muted); }
.steps-item--done { color: var(--text); }
.steps-item--current { color: var(--brand); font-weight: 700; }
.steps-item--current svg.icon { color: var(--brand); }
.missing { margin: 0; padding-left: 18px; color: var(--highlight-900); }
.missing li { margin-bottom: 4px; }
.widget-card-body .sub { color: var(--muted); font-size: 12px; }
