/* Shared interaction states (E40, E180): the only place for hover, focus and selection styles.
   Linked by index.html right after the core sheets (style.css, brand.css, v9.css) and before every area sheet,
   so area rules that set a base background keep winning in the resting state.
   SOLL: Architektur/A5-HOVER-SOLL-2026-10-07.md. Six roles: primary, secondary, tab/filter, row/selection, text link, danger.
   New areas use the .ui-* classes below and add no own :hover/:focus colours (test_ui_states.py). */
:root{
  --ui-accent:#bf4034;--ui-accent-hover:#ad352c;--ui-on-accent:#fff;
  --ui-ink:#20252b;--ui-muted:#69717b;--ui-line:#e4e7eb;
  --ui-secondary-hover:#fafafb;
  --ui-tab-hover-line:#d3d7dc;
  --ui-row-hover:#f5f5f5;--ui-row-selected:#fcf0ed;
  --ui-chip:#f5f6f8;--ui-chip-hover:#eceef1;--ui-ink-hover:#3a4048;
  --ui-focus:#bf4034;
  --ui-ok-text:#276b53;
  --ui-pop-shadow:0 24px 100px #20252b33
}
/* Aufklapp-Fläche (Bereich wechseln, Aufnahme vor Ort): weiß, Rand, Radius und Schatten wie der Dialog (v9.css). */
.ui-pop{background:#fff;border:1px solid var(--ui-line);border-radius:12px;box-shadow:var(--ui-pop-shadow)}

/* 1 Primary: only a plain button keeps the red hover. :where() keeps it at the weight of the core "button" rule,
   so any class that gives a button its own background (tab, link, row) also wins on hover. */
button:where(:hover:not(:disabled)),.button-link:where(:hover){background:var(--ui-accent-hover);color:var(--ui-on-accent)}
/* Area buttons that are red through their own class (they lost the hover with the old blanket rule or never had one).
   Area clean-ups move them to .ui-primary and shrink this list. */
:is(.doc-primary,.documentation-photo .documentation-photo-save,
.extras-toolbar>.extras-voice,.extras-is-fixed .extras-editor-actions button:first-child,.extras-editor-actions button[type=submit],
.extras-sign-page button[type=submit],button.extras-dictation-apply,.project-editor-footer>button:last-child,
.project-list-design>.project-list-heading .project-create,.project-task-toolbar>.v9-voice-primary):hover:not(:disabled){background:var(--ui-accent-hover);color:var(--ui-on-accent);filter:none}
.ui-primary{background:var(--ui-accent);color:var(--ui-on-accent);border:1px solid transparent;border-radius:8px}
.ui-primary:hover:not(:disabled){background:var(--ui-accent-hover);color:var(--ui-on-accent)}

/* 2 Secondary: white with a hairline, a faint grey on hover. Tabs are built with btn() and so carry .secondary too;
   they take role 3 instead (no surface), which this weighty rule would otherwise outrank. */
:is(button.secondary,.ui-secondary,.documentation-design .doc-page .doc-action:not(.doc-primary)):hover:not(:disabled):not(.ui-file-input:disabled+.ui-file-button):not(:is(.ui-tab,.v9-tabs button,.project-tabs button,.project-register button,.roles-tabs .roles-button,.work-views button,.extras-mode-tabs button,.project-mobile-subnav button)):not(.ui-link){background:var(--ui-secondary-hover);color:var(--ui-ink);filter:none}
.ui-secondary{background:#fff;color:var(--ui-ink);border:1px solid var(--ui-line);border-radius:8px}
/* File picker: the native field stays focusable and named for keyboard and screen reader but is visually hidden; its
   <label for> is the visible secondary button and shows the field's focus ring and disabled state; the secondary hover
   above skips it while the field is disabled, as it skips a disabled button. */
html input.ui-file-input{position:absolute;width:1px;height:1px;min-width:0;min-height:0;margin:0;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;opacity:0}
.ui-file-button{display:inline-flex;align-items:center;width:auto;min-height:40px;margin:0;padding:8px 16px;font-size:14px;font-weight:500;line-height:20px;cursor:pointer}
html .ui-file-input:focus-visible+.ui-file-button{outline:2px solid var(--ui-focus);outline-offset:2px}
html .ui-file-input:disabled+.ui-file-button{color:var(--ui-muted);background:#fff;cursor:default}

/* Bordered document link in the Material card: secondary surface, keeps its red label. */
.material-workflow .material-doc-link:hover{background:var(--ui-secondary-hover)}

/* 3 Tab/filter: no surface; the label darkens and a grey line appears where the red selection line sits.
   An inset shadow instead of a border, so the hover never shifts the layout. */
:is(.ui-tab,.v9-tabs button,.project-tabs button,.project-register button,.roles-tabs .roles-button,.work-views button,.extras-mode-tabs button,.project-mobile-subnav button):hover:not(:disabled):not([aria-selected=true]):not([aria-pressed=true]):not([aria-current=page]):not(.selected){background:transparent;color:var(--ui-ink);box-shadow:inset 0 -2px 0 var(--ui-tab-hover-line);filter:none}
/* The open tab stays as it is under the pointer: no grey surface from the area sheets' secondary hover, which would
   fill the whole tab box (wider than the red line in the project register). */
:is(.ui-tab,.v9-tabs button,.project-tabs button,.project-register button,.roles-tabs .roles-button,.work-views button,.extras-mode-tabs button,.project-mobile-subnav button):is([aria-selected=true],[aria-pressed=true],[aria-current=page],.selected):hover:not(:disabled){background:transparent;filter:none}
.ui-tab{background:none;border:0;border-radius:0;color:var(--ui-muted);padding:8px 0 16px}
/* The inbox views still carry the boxed look of brand.css (1px #ccc all round, red frame when selected) because v9.css
   only replaces the bottom edge. A tab has no frame: only the bottom line stays. The html prefix outweighs
   brand.css ".work-views button.selected". */
html .work-views button{border-top:0;border-left:0;border-right:0;border-radius:0;background:transparent}
.ui-tab:is([aria-selected=true],[aria-pressed=true],[aria-current=page],.selected){color:var(--ui-ink);font-weight:500;box-shadow:inset 0 -2px 0 var(--ui-accent)}
/* Tabs that become a segment on the phone (E385, Regeln & Wissen; the container carries .ui-tabs-segment, size in the area
   sheet): grey track, the chosen tab white and raised, the others a darker grey on hover instead of the underline. */
@media(max-width:850px){
 .ui-tabs-segment .ui-tab{border-radius:6px;box-shadow:none}
 .ui-tabs-segment .ui-tab:hover:not(:disabled):not([aria-selected=true]):not([aria-pressed=true]):not([aria-current=page]):not(.selected){background:var(--ui-chip-hover);box-shadow:none}
 html .ui-tabs-segment .ui-tab[aria-selected=true]:not(:disabled){background:#fff;color:var(--ui-ink);box-shadow:0 1px 2px rgba(32,37,43,.16),0 0 0 1px var(--ui-line)}
}
/* Supplier list views (LD-4): the tab keeps a 2 px bottom border for its red selection, so the hover line takes that
   border instead of the inset shadow. The html prefix outweighs the secondary hover of suppliers-design.css. */
html #suppliers-page>.supplier-tabs button:hover:not(:disabled):not([aria-pressed=true]){background:transparent;color:var(--ui-ink);border-bottom-color:var(--ui-tab-hover-line)}

/* 4 Row/selection: light grey like the side navigation, pale red when selected. Filter chips already sit on grey,
   so they go one step darker. */
.ui-row{background:transparent;color:var(--ui-ink);border:0;border-radius:8px;text-align:left}
:is(.ui-row,.main-nav button,#v9-bottom button,.project-overview-card):hover:not(:disabled):not([aria-selected=true]):not(.selected){background:var(--ui-row-hover);filter:none}
.ui-row:is([aria-selected=true],.selected){background:var(--ui-row-selected);color:var(--ui-accent)}
/* List rows that mark the chosen one with a red bar on the left as well (E385, Regeln & Wissen). */
.ui-row.ui-row-mark:is([aria-selected=true],.selected){box-shadow:inset 3px 0 0 var(--ui-accent)}
/* Unterlagen (E408 (3)): a file row picked for the ZIP download shows the selection colour across its cells. */
.project-file-table tbody tr.selected{background:var(--ui-row-selected)}
/* Supplier conversations (LD-4): the open one stays pale red (suppliers-design.css), the hover wins over it as before;
   in the table the row and its selection box light up together. */
html #suppliers-page #supplier-threads>.supplier-thread:hover:not(:disabled){background-color:var(--ui-row-hover);color:var(--ui-ink)}
@media(min-width:851px){
 html #suppliers-page[data-view=list] #supplier-threads>.supplier-check:is(:hover,:has(+.supplier-thread:hover)),
 html #suppliers-page[data-view=list] #supplier-threads>.supplier-check:hover+.supplier-thread{background-color:var(--ui-row-hover)}
}
/* Material area and position cards (E141, E460 (5)): the name/title button is stretched over its card or row (::after), so
   the whole card is the target and takes the row hover and the pressed grey as one surface (on the phone the cells sit
   apart: a grey per cell left gaps). The button itself stays clear: no red surface and no v9.css filter (it would shrink
   the stretched target). */
@media(hover:hover){:is(.material-area-table,.material-position-table) tbody tr:hover{background:var(--ui-row-hover)}}
:is(.material-area-table,.material-position-table) tbody tr:has(:is(.material-area-name,.material-position-name):active){background:var(--ui-row-hover)}
.material-workflow button:is(.material-area-name,.material-position-name):is(:hover,:active):not(:disabled){background:none;filter:none}
/* Chip rest state (T4t3, placeholder chips): grey like v9-badge. button:where() weighs like the core "button" rule (it
   wins by order), so areas that give their chips an own surface by class (staff segments, day chips) keep it. */
button:where(.ui-chip){background:var(--ui-chip);color:var(--ui-ink);border:0;border-radius:8px}
:is(.ui-chip,.channel-tabs button):hover:not(:disabled):not(.selected):not([aria-pressed=true]){background:var(--ui-chip-hover);color:var(--ui-ink);filter:none}
/* Filter chip (E385, Regeln & Wissen): a .ui-chip.ui-filter that stays chosen (aria-pressed=true) turns dark, a lighter dark
   on hover. Segment chips (.staff-segment, aria-pressed as well) do not carry .ui-filter and keep their white choice. */
.ui-chip.ui-filter[aria-pressed=true]{background:var(--ui-ink);color:var(--ui-on-accent)}
.ui-chip.ui-filter[aria-pressed=true]:hover:not(:disabled){background:var(--ui-ink-hover);color:var(--ui-on-accent)}

/* 6 Danger: destructive buttons (E273, Entwurf automatisierung-v3 d08/d09): white with red text and a red line, so they
   differ from the red primary button; a pale red surface on hover. Rest state here as well, areas only place them. */
.ui-danger{background:#fff;color:var(--ui-accent);border:1px solid var(--ui-accent);border-radius:8px}
.ui-danger:hover:not(:disabled){background:var(--ui-row-selected);color:var(--ui-accent-hover);filter:none}
:is(.ui-danger,.ui-link,.survey-undo-button):disabled{color:var(--ui-muted);border-color:var(--ui-line);cursor:default}

/* 5 Text link: underlined, never a surface. */
:is(.ui-link,.project-title-link,.project-design .project-text-action,.v9-back-link):hover:not(:disabled){background:transparent;text-decoration:underline;text-underline-offset:3px;filter:none}
.ui-link{background:none;border:0;border-radius:0;padding:0;color:var(--ui-accent);min-height:0}
/* Supplier "Original in Gmail öffnen" (LD-5): a muted link that darkens to the text colour. */
html #suppliers-page a#supplier-original:hover{color:var(--ui-ink);text-decoration:underline}
/* On mobile the whole document card is its button, a transparent layer over the card: no hover surface (LD-5). */
@media(max-width:850px){html #suppliers-page button.supplier-card-open:hover:not(:disabled){background:transparent;color:transparent}}
/* Mobile "Zugeordnete Belege anzeigen" below the supplier cards (LD-4). */
html #suppliers-page #supplier-threads>button.supplier-link:hover:not(:disabled){background:transparent;color:var(--ui-accent);text-decoration:underline;text-underline-offset:3px}
/* Supplier mail (LD-5b): "n frühere Nachrichten" and the "Anhang n" links are text links (.ui-link in the script); the muted one darkens. */
html #suppliers-page button.supplier-earlier:hover:not(:disabled){color:var(--ui-ink)}
/* Supplier project mapping (LD-6a1, LD-6b): the search hits are rows (.ui-row), the chosen one stays pale red; "Projektakte öffnen"
   and "Anderes Projekt wählen" are text links (.ui-link). The IDs outweigh the red button hover of suppliers-design.css. */
html #suppliers-page #supplier-project-results button.supplier-project-hit:hover:not(:disabled):not([aria-current=true]){background:var(--ui-row-hover);color:var(--ui-ink)}
html #suppliers-page :is(#supplier-map-status,#supplier-suggestion) button.supplier-map-link:hover:not(:disabled){background:transparent;color:var(--ui-accent);text-decoration:underline;text-underline-offset:3px}
summary:where(:hover){color:var(--ui-ink)}

/* Focus: one ring for the keyboard. The html prefix outweighs the older single-element focus rules of v9.css. */
html :is(button,a,summary,select,input,textarea,[tabindex]):focus-visible{outline:2px solid var(--ui-focus);outline-offset:2px}
/* Fields: browsers count a click or tap into a text field or a select as :focus-visible, so the red ring showed on every
   tap (22.11.). A focused field shows its frame in ink instead, by mouse and keyboard alike; an error frame (aria-invalid)
   stays. !important only to outweigh the resting frame colour of v9.css, which is !important itself. */
html :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=button],[type=submit],[type=reset],[type=image]),select,textarea):focus{outline:none}
html :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=button],[type=submit],[type=reset],[type=image]),select,textarea):focus:not([aria-invalid=true]){border-color:var(--ui-ink)!important}
/* Fields without a frame (the sort select of the project list, the dictation text): the ring of the keyboard in ink. */
html :is(.project-list-toolbar>select:not(.project-mobile-group),.extras-dictation-dialog textarea):focus{outline:2px solid var(--ui-ink);outline-offset:2px}
/* The title of the supplier PDF view is focused by script when it opens (LD-5), like the router headings: no ring. */
html #suppliers-page :is(#supplier-pdf-title,#supplier-history-title,#supplier-map-title):focus{outline:none}
/* The photo viewer sheet takes the focus itself when opened by a tap (photo-viewer.js, E428): no ring, like the titles. */
html dialog.photo-viewer:focus{outline:none}
/* The element the viewer hands the focus back to after a tap (photo-viewer.js): no ring, so it does not look selected. */
html [data-focus-quiet]:focus{outline:none}
/* Material search hits (E460 (7)): the group clips its rows, so the keyboard ring lies inside the row or head. */
html .material-workflow :is(.material-hit-head,.material-hit-row):focus-visible{outline-offset:-2px}
/* Stretched name/title button (Material cards): the ring goes round the whole card, not the title text. */
.material-workflow :is(.material-area-name,.material-position-name):focus-visible{outline:0}
.material-workflow :is(.material-area-name,.material-position-name):focus-visible:after{outline:2px solid var(--ui-focus);outline-offset:-2px}
/* Free day on the planning board, focused after its dialog closes (E4b): the row clips an outer ring, so draw it inside. */
html .planning-day[tabindex]:focus-visible{outline-offset:-2px}
/* Planning bar grips (PT-2b3, E346): a short line at the bar edges on hover and keyboard focus, always on touch screens
   (no hover there), and on the ghost while an edge is dragged. Size and place in planning.css. */
:is(button.planning-bar.has-grip-start:is(:hover,:focus-visible),.planning-ghost.has-grip-start)::before,
:is(button.planning-bar.has-grip-end:is(:hover,:focus-visible),.planning-ghost.has-grip-end)::after{background-image:linear-gradient(var(--ui-muted),var(--ui-muted))}
@media(pointer:coarse){button.planning-bar.has-grip-start::before,button.planning-bar.has-grip-end::after{background-image:linear-gradient(var(--ui-muted),var(--ui-muted))}}
/* "Einteilung" (planning-own.js): the day title is focused by script when the day opens, like the supplier titles: no ring. */
html .planning-own h1[tabindex]:focus{outline:none}
/* Staff absences (A2): rules moved unchanged from staff.css. */
#v9-breadcrumb .staff-crumb:hover{color:var(--ink);text-decoration:underline}
.staff-tile:hover:not(:disabled){background:var(--ui-secondary-hover)}
.staff-calendar .staff-grid button:not(:disabled):not(.picked):hover{background:var(--pale)}
/* Meter (E354 KB-2, ai-budget.js): shared progress bar for a limit. data-state none = no limit yet (striped empty track
   and a hint), ok = neutral, warn = from 80 % (sand), over = from 100 % (accent red); the fill width comes as
   --ui-meter-value via CSSOM (CSP style-src 'self'). Not interactive: no hover or focus. */
:root{--ui-meter-track:#f1f2f4;--ui-meter-stripe:#fafafb;--ui-meter-warn:#d9a441;--ui-meter-warn-text:#89601f}
.ui-meter{display:grid;gap:6px;min-width:0}
.ui-meter-track{display:block;height:10px;border-radius:5px;background:var(--ui-meter-track);overflow:hidden}
.ui-meter-fill{display:block;height:100%;width:var(--ui-meter-value,0%);border-radius:inherit;background:var(--ui-muted)}
.ui-meter[data-state=warn] .ui-meter-fill{background:var(--ui-meter-warn)}
.ui-meter[data-state=over] .ui-meter-fill{background:var(--ui-accent)}
.ui-meter[data-state=none] .ui-meter-track{background:repeating-linear-gradient(135deg,var(--ui-meter-track) 0 6px,var(--ui-meter-stripe) 6px 12px)}
.ui-meter-text{font-size:13px;color:var(--ui-muted)}
.ui-meter[data-state=warn] .ui-meter-text{color:var(--ui-meter-warn-text)}
.ui-meter[data-state=over] .ui-meter-text{color:var(--ui-accent)}
/* 7 Choice (E359): one of several equal options, e.g. the time slots of the public booking page. Red outline at rest,
   pale red on hover, filled red once chosen (aria-pressed=true), grey when no longer available. */
:root{--ui-field-line:#8c939b}  /* field border with 3:1 on white (E359); only the booking page for now */
.ui-choice{background:#fff;color:var(--ui-accent);border:1px solid var(--ui-accent);border-radius:8px}
.ui-choice:hover:not(:disabled):not([aria-pressed=true]){background:var(--ui-row-selected);color:var(--ui-accent)}
.ui-choice[aria-pressed=true]{background:var(--ui-accent);color:var(--ui-on-accent)}
.ui-choice[aria-pressed=true]:hover:not(:disabled){background:var(--ui-accent-hover);color:var(--ui-on-accent)}
.ui-choice:disabled{background:#f5f6f8;color:#9aa1a9;border-color:var(--ui-line);cursor:default}
/* Mehr cards (button stretched over the card, v9.css): the card takes the row hover, the keyboard ring goes round the card. */
@media(hover:hover){#more-page:where(:not([class]),[class=""])>.v9-grid>.v9-card:has(>button:last-child):hover{background:var(--ui-row-hover)}}
#more-page:where(:not([class]),[class=""])>.v9-grid>.v9-card>button:last-child:focus-visible{outline:0}
#more-page:where(:not([class]),[class=""])>.v9-grid>.v9-card>button:last-child:focus-visible:after{outline:2px solid var(--ui-focus);outline-offset:-2px}
/* Project list (desktop columns): the whole row opens the project, so the title shows the link hover for the row. */
.project-list-row:not(.project-list-skeleton){cursor:pointer}
@media(hover:hover){.project-list-row:hover .project-title-link{text-decoration:underline;text-underline-offset:3px}}
