/* One density scale for working forms. Specialized controls (calendar cells,
   window controls, rich editor and message actions) keep their own geometry. */
html:root { --control-height:36px; --form-gap:12px; }
html:root :where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),select) {
  min-width:0; min-height:var(--control-height); padding:6px 10px; font-size:.875rem; font-weight:400; line-height:1.4;
}
html:root :where(textarea) { min-width:0; padding:8px 10px; font-size:.875rem; font-weight:400; line-height:1.5; }
html:root :where(input[type="checkbox"],input[type="radio"]) { min-height:18px; }
html:root :where(form label,fieldset) { min-width:0; }

/* Use the same baseline for search fields, selectors, tabs and their actions. */
html:root :is(.tasks-navigation,.task-filter-main,.task-filter-extra,.task-category-bar,.task-project-strip,.news-filters,.production-tabs,.production-filters,.analytics-toolbar,.fc-toolbar,.finance-tabs,.finance-toolbar,.hr-filters,.hr-actions,.testing-toolbar,.invoice-filters,.employee-toolbar,.structure-toolbar) :is(button,input:not([type="checkbox"]):not([type="radio"]),select) {
  min-height:var(--control-height); height:auto; margin-block:0; padding:6px 11px; font-size:.84rem; line-height:1.4;
}
html:root :is(.task-filters,.news-filters,.production-filters,.hr-filters,.analytics-toolbar,.invoice-filters,.finance-toolbar) { padding:12px; gap:10px; }
html:root :is(.tasks-navigation,.task-category-bar,.task-project-strip,.production-tabs,.finance-tabs) { gap:8px; }
html:root .tasks-navigation { margin-bottom:12px; }
html:root .task-category-bar { margin-bottom:10px; }
html:root .task-category-bar :is(.unread-counter,.deadline-counter) { min-width:23px; min-height:18px; padding:2px 6px; font-size:10px; }
html:root .task-project-strip { margin:12px 0 16px; }
html:root .task-project-strip .project-avatar { width:23px; height:23px; }
html:root .production-filters :is(input,select,button) { height:var(--control-height); }
html:root :is(.production-filters,.hr-filters,.analytics-toolbar,.invoice-filters,.finance-toolbar) label { margin:0; }
html:root .analytics-toolbar .analytics-refresh-icon { width:var(--control-height); height:var(--control-height); flex-basis:var(--control-height); padding:7px; border-radius:var(--radius-md); }
html:root :is(.task-form-grid,.employee-form-grid,.profile-form-grid,.calendar-time-fields,.testing-time-fields,.hr-fields) { column-gap:var(--form-gap); }
html:root :is(#hr-create-form,.testing-editor) label { gap:6px; }
html:root :is(#hr-create-form,#invoice-form) label { margin-bottom:12px; gap:6px; }
html:root #task-form .task-options-card :is(input,select) { min-height:var(--control-height); }
html:root #task-form .task-options-card { padding:16px; }
html:root #task-form .task-options-card h3 { margin-bottom:12px; }
html:root :is(.invoice-main,.invoice-side,.calendar-form-main,.calendar-form-side) > label { margin-top:12px; }
html:root :is(.invoice-actions,.project-form-actions,.calendar-form-footer,.employee-dialog-actions) { gap:8px; padding-block:12px; }
html:root :is(.invoice-actions,.project-form-actions,.calendar-form-footer,.employee-dialog-actions,.task-drawer-actions,.testing-actions,.production-actions,.hr-actions,.integration-actions,.reporting-actions) > button { min-height:var(--control-height); padding:7px 12px; font-size:.875rem; }

/* Align segmented groups and adjacent actions to the shared control scale. */
html:root #calendar-view .calendar-view-options { padding:0;border:0;box-shadow:inset 0 0 0 1px var(--border); }
html:root #calendar-view .calendar-toolbar button { min-height:var(--control-height);margin-block:0;padding:6px 12px;font-size:.875rem;line-height:1.4; }
html:root .tasks-navigation .tasks-tabs { padding:0; }
html:root .testing-heading-actions>button { min-height:var(--control-height); }
html:root #finance-view .fc-company-switch { padding:0; }
html:root #finance-view .fc-company-switch .fc-company { min-height:var(--control-height);padding-block:6px;font-size:.84rem;line-height:1.4; }
html:root #finance-view .fc-period input { min-height:var(--control-height);height:var(--control-height);padding:6px 10px;line-height:1.4; }
html:root #finance-view .fc-period>button { width:var(--control-height);min-width:var(--control-height);height:var(--control-height);min-height:var(--control-height);padding:0;line-height:1; }
html:root :is(.news-page-actions,.task-page-actions)>button { min-width:var(--control-height);min-height:var(--control-height);height:var(--control-height);padding:0;line-height:1; }

@media(max-width:480px) {
  html:root .finance-toolbar { display:grid;grid-template-columns:minmax(0,1fr); }
  html:root .finance-toolbar>label { width:100%;min-width:0;max-width:none; }
}

/* The feed entry points no longer outweigh the news themselves. */
html:root #news-expand { min-height:52px; padding:10px 14px; gap:10px; font-size:.9rem; }
html:root #news-expand .compose-avatar { width:30px; height:30px; flex:0 0 30px; font-size:1.25rem; }
html:root #news-search-toggle { min-height:var(--control-height); margin-bottom:0; padding:8px 12px; font-size:.875rem; }
html:root #news-search-toggle svg { width:18px; height:18px; }
html:root .feed-column { gap:14px; }
html:root .composer-tabs button.composer-tab { min-height:42px; }
html:root .composer-audience { padding:12px 20px; }
html:root .composer-actions { padding:0 20px 14px; }

/* Project overview has a readable surface in wallpaper themes as well. */
html:root .projects-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; padding:14px 18px; margin:0 0 14px; }
html:root .projects-heading h2 { margin:0 0 4px; font-size:1.08rem; }
html:root .projects-heading p { margin:0; color:var(--text-secondary); font-size:.84rem; }
html:root .project-list { gap:14px; grid-template-columns:repeat(auto-fill,minmax(min(100%,310px),1fr)); }
html:root .project-card { padding:18px; gap:12px; }
html:root .project-card h3 { font-size:1.05rem; }
html:root .project-card-heading { height:2.84rem; flex:none; }
html:root .project-card-heading h3 { flex:1; min-width:0; }
html:root .project-card-title { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; width:100%; height:2.7em; min-height:0; margin:0; padding:0; border:0; border-radius:3px; background:transparent; box-shadow:none; color:var(--text-primary); text-align:left; font:inherit; line-height:1.35; overflow-wrap:anywhere; }
html:root .project-card-title:hover { color:var(--accent); background:transparent; }
html:root .project-card .project-avatar { width:44px; height:44px; border-radius:10px; }
html:root .project-description, html:root .project-goal p { font-size:.85rem; line-height:1.5; }
html:root .project-description,html:root .project-goal p { display:-webkit-box; -webkit-box-orient:vertical; overflow:hidden; flex:none; }
html:root .project-description { height:4.5em; -webkit-line-clamp:3; }
html:root .project-goal { flex:none; }
html:root .project-goal p { height:3em; -webkit-line-clamp:2; }
.project-description-count { display:block; font-size:.73rem; font-weight:400; line-height:1.5; }
.project-preview { width:min(560px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); padding:22px; overflow:auto; border:1px solid var(--border); border-radius:var(--radius-card); background:var(--surface); color:var(--text-primary); }
.project-preview>header { position:sticky; top:-22px; z-index:1; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin:-22px -22px 0; padding:22px; background:var(--surface); border-bottom:1px solid var(--border); }
.project-preview h2 { margin:0; font-size:1.15rem; overflow-wrap:anywhere; }
.project-preview>header button { flex:none; }
.project-preview section { margin-top:18px; }
.project-preview h3 { margin:0 0 8px; font-size:.85rem; color:var(--text-secondary); }
.project-preview p { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; font-size:.9rem; line-height:1.6; }
html:root .project-goal { padding:12px; }
html:root .project-card-actions { padding-top:12px; gap:6px; }
html:root .project-card-actions button { min-height:var(--control-height); padding:6px 10px; font-size:.8rem; }

/* Project form uses the existing employee popover, with no inline scroll list. */
html:root #project-dialog > .employee-dialog-head { padding:14px 20px; }
html:root .project-form-layout { grid-template-columns:minmax(0,1.4fr) minmax(280px,1fr); }
html:root :is(.project-form-main,.project-form-side) { padding:18px 20px; }
html:root .project-form-main > label { margin:0 0 14px; gap:6px; }
html:root #project-form textarea { font-size:.875rem; font-weight:400; padding:8px 10px; }
html:root .project-form-side h3 { font-size:1rem; margin:0 0 8px; }
html:root .project-form-side > p { font-size:.8rem; line-height:1.5; margin:8px 0 14px; }
html:root .project-form-actions { padding-inline:20px; }
.project-person-row { display:grid; grid-template-columns:minmax(0,1fr) 32px; gap:4px 8px; align-items:center; padding:12px 0; border-top:1px solid var(--border); }
.project-person-row > .task-participant-label { grid-column:1; font-size:.84rem; font-weight:600; color:var(--text-primary); }
.project-person-row > .task-participant-selection { grid-row:2; grid-column:1 / -1; padding:0; }
html:root .project-person-row > .task-participant-add { grid-row:1; grid-column:2; width:32px; min-width:32px; height:32px; min-height:32px; padding:0; border:0; border-radius:50%; font-size:1.3rem; background:var(--accent-soft); color:var(--accent); }
html:root #project-form .task-person-chip-name { font-size:.82rem; }
html:root #project-form .task-person-chip-name .person-avatar { width:24px; height:24px; }
html:root #project-clear-lead { font-size:.78rem; padding:3px 0; min-height:28px; border:0; background:transparent; }
html:root .project-photo-editor { display:grid; gap:8px; }
html:root .project-photo-editor h3 { margin:0; font-size:.86rem; }
html:root button.project-photo-drop { display:flex; align-items:center; gap:12px; width:100%; padding:12px; border:1px dashed var(--border-strong); border-radius:12px; background:var(--surface); color:var(--text-primary); text-align:left; font-weight:400; }
html:root button.project-photo-drop:is(:hover,:focus-visible,.is-dragover) { background:var(--accent-soft); border-color:var(--accent); }
html:root .project-photo-editor .project-avatar { width:58px; height:58px; border-radius:10px; }
.project-photo-copy { display:grid; gap:4px; min-width:0; overflow-wrap:anywhere; }
.project-photo-copy strong { font-size:.85rem; font-weight:600; }
.project-photo-copy :is(span,small) { font-size:.76rem; color:var(--text-secondary); }
html:root #project-remove-photo { justify-self:start; padding:3px 0; min-height:28px; border:0; background:transparent; font-size:.8rem; }
html:root #project-photo-status { margin:0; font-size:.8rem; }

html:root .employee-editor-tabs { display:flex; gap:6px; position:sticky; top:0; z-index:2; background:var(--surface); padding:8px 0 12px; margin-bottom:12px; border-bottom:1px solid var(--border); }
html:root .employee-editor-tabs button[aria-pressed="true"] { background:var(--accent); color:var(--accent-contrast, #fff); border-color:var(--accent); }
html:root #employee-profile-section { padding:0; margin:0; border:0; }
html:root .profile-avatar-editor { display:grid; gap:8px; margin:0 0 16px; min-width:0; }
html:root .profile-avatar-editor h3 { margin:0; font-size:.875rem; }
html:root .profile-avatar-preview { display:grid; place-items:center; width:64px; height:64px; flex:0 0 64px; border-radius:12px; overflow:hidden; background:var(--accent-soft); color:var(--accent); font-size:1.4rem; }
html:root .profile-avatar-preview img { width:100%; height:100%; object-fit:cover; }
html:root .profile-avatar-actions { display:flex; flex-wrap:wrap; gap:8px; }
html:root .profile-avatar-actions button { padding:4px 10px; min-height:var(--control-height); font-size:.8rem; }
html:root #invitation-scope-button { margin-top:12px; }
html:root .profile-avatar-drop .project-photo-copy { flex:1; }
html:root #profile-dialog.is-editing-profile .profile-dialog-body { grid-template-columns:minmax(0,1fr); }
html:root #profile-dialog.is-editing-profile #profile-form { grid-column:1; }

@media (max-width:760px) {
  html:root .project-form-layout { grid-template-columns:1fr; }
  html:root :is(.project-form-main,.project-form-side) { padding:16px; }
  html:root .project-form-actions { padding-inline:16px; }
  html:root .projects-heading { padding:14px; }
}
@media (pointer:coarse), (max-width:600px) {
  html:root { --control-height:44px; }
  html:root :is(.project-person-row > .task-participant-add,#project-remove-photo,#project-clear-lead) { min-height:44px; min-width:44px; }
  .project-person-row { grid-template-columns:minmax(0,1fr) 44px; }
}

/* Shared workspace proportions, inspired by the supplied Bitrix24 reference.
   Theme colours, personal artwork and window behaviour remain token-driven. */
html:root,html:root[data-theme] {
  --workspace-header-height:64px;
  --workspace-sidebar-width:232px;
  --workspace-context-width:280px;
  --workspace-content-inset:24px;
  --workspace-content-top:20px;
  --radius-sm:6px; --radius-md:8px; --radius-lg:10px;
  --radius-card:12px; --radius-modal:14px;
  --theme-heading-font:system-ui,-apple-system,'Segoe UI',sans-serif;
  --shadow-card:0 2px 8px color-mix(in srgb,var(--text-primary) 4%,transparent);
  --shadow-modal:0 20px 64px #0c182e33,0 2px 8px #0c182e12;
  --workspace-divider:color-mix(in srgb,var(--border) 75%,var(--surface));
}
html:root body { font-size:.875rem; }
html:root h1 { font-family:var(--theme-heading-font); font-size:clamp(1.4rem,2vw,1.75rem); font-weight:650; line-height:1.25; letter-spacing:-.025em; }
html:root h2 { font-family:var(--theme-heading-font); font-size:1.05rem; font-weight:600; letter-spacing:-.015em; }
html:root h3 { font-family:var(--theme-heading-font); font-weight:600; }
html:root .eyebrow { font-size:.625rem; font-weight:600; letter-spacing:.1em; margin-bottom:6px; }
html:root .topbar { height:var(--workspace-header-height); }
html:root .topbar-inner { padding-inline:22px; gap:16px; }
html:root .brand { gap:9px; font-size:1.4rem; letter-spacing:.09em; }
html:root .brand-icon { width:27px; height:36px; }
html:root .brand-family { font-size:.5rem; letter-spacing:.12em; }
html:root .account { gap:10px; }
html:root #profile-toggle { font-size:.8rem; font-weight:500; }
html:root .header-evolution { opacity:.45; max-width:300px; height:44px; align-self:center; }
html:root .page,html:root .app-shell { min-height:calc(100dvh - var(--workspace-header-height)); }
html:root .workspace-content { padding:var(--workspace-content-top) var(--workspace-content-inset) 40px; }
html:root .workspace-content:has(> #dashboard-view:not([hidden])) { padding:var(--workspace-content-top) var(--workspace-content-inset) 40px; }

/* One translucent navigation panel, with a distinct selected row in each theme. */
html:root .sidebar-content { padding:16px 10px 12px; }
html:root .sidebar .nav-primary { margin:0 -4px; padding:4px; border:1px solid var(--nav-panel-border); border-radius:12px; background:var(--nav-panel-background); box-shadow:inset 0 1px var(--nav-panel-light); gap:3px; }
html:root[data-theme] .sidebar .nav-item { position:relative; min-height:40px; padding:8px 10px; gap:10px; font-size:.8125rem; font-weight:500; border-radius:8px; transition:background-color var(--motion-popup) ease,color var(--motion-popup) ease,border-color var(--motion-popup) ease,box-shadow var(--motion-popup) ease; }
html:root[data-theme] .sidebar .nav-item:hover:not(.current) { background:var(--nav-hover); }
html:root[data-theme] .sidebar .nav-item.current { background:var(--nav-selected); color:var(--nav-selected-text); border-color:var(--nav-selected-border); box-shadow:var(--nav-selected-shadow); font-weight:600; }
html:root[data-theme] .sidebar .nav-item.current::after { content:none; }
html:root[data-theme] .sidebar .nav-item .nav-icon { width:24px; height:24px; flex-basis:24px; background:transparent; border:0; box-shadow:none; color:var(--theme-nav-icon); }
html:root[data-theme] .sidebar .nav-item.current .nav-icon { color:var(--nav-selected-text); background:transparent; }
html:root[data-theme] .sidebar .nav-item .ui-icon { width:20px; height:20px; }
@media (prefers-reduced-motion:reduce) { html:root[data-theme] .sidebar .nav-item { transition:none; } }
html:root .sidebar-art { margin-top:28px; }
html:root .sidebar-art::before { max-height:160px; opacity:.25; }

/* Every section uses the same compact heading surface over its wallpaper. */
html:root .workspace-content > section > :is(.page-heading,.tasks-heading,.calendar-heading,.invoice-page-heading) {
  display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px;
  padding:16px 20px; margin-bottom:16px; border:1px solid var(--workspace-divider);
  border-radius:var(--radius-card); background:var(--surface); box-shadow:var(--shadow-card);
}
html:root .workspace-content > section > :is(.page-heading,.tasks-heading,.calendar-heading,.invoice-page-heading) .muted { margin:4px 0 0; font-size:.8125rem; line-height:1.5; }
html:root .workspace-content > section > :is(.page-heading,.tasks-heading,.calendar-heading,.invoice-page-heading) h1 { margin:0; }
html:root .workspace-content > section > .page-heading:not(:has(> div)) { display:block; }
html:root .card { padding:20px; border-color:var(--workspace-divider); }
html:root .card.composer { padding:0; }
html:root :is(button.secondary,button.quiet) { border-color:var(--border); font-weight:500; }
html:root :is(.task-filters,.news-filters,.hr-filters,.invoice-filters,.finance-toolbar,.production-filters) { padding:12px; gap:10px; border-color:var(--workspace-divider); border-radius:var(--radius-lg); }
html:root .dashboard-grid { grid-template-columns:minmax(0,1fr) var(--workspace-context-width); gap:20px; }
html:root .events-column { gap:16px; }
html:root .events-column > .card { padding:18px; min-height:0; }
html:root .events-column .section-heading { gap:10px; }
html:root .events-column .section-heading h2 { font-size:1rem; line-height:1.35; margin-bottom:0; }
html:root #home-calendar-card #events-title { min-height:0; }
html:root .events-empty { min-height:128px; padding-block:20px; }
html:root .events-empty p { font-weight:600; font-size:.875rem; }
html:root .today-date { padding:12px 0; font-size:.8125rem; }
html:root .home-task-links { gap:0; margin:12px 0; }
html:root .home-task-link { min-height:42px; padding:9px 0; border:0; border-bottom:1px solid var(--workspace-divider); border-radius:0; background:transparent; font-size:.8125rem; }
html:root .home-task-link:last-child { border-bottom:0; }
html:root .home-task-link strong { font-size:1rem; }
html:root .home-task-link:hover { background:var(--surface-hover); }

/* Feed rhythm: a modest avatar, compact content and a clear comment separator. */
html:root .feed-heading { margin:0; padding:6px 0; }
html:root .feed-heading h2 { font-size:1.15rem; font-weight:600; }
html:root .news-post { --feed-avatar:42px; --feed-indent:58px; padding:20px; border-radius:var(--radius-card); }
html:root .news-post .news-author { gap:16px; margin-bottom:12px; }
html:root .news-post .news-body { font-size:.875rem; line-height:1.65; }
html:root .news-post .news-body p { margin-bottom:10px; }
html:root .news-post .news-body p:last-child { margin-bottom:0; }
html:root .news-post .news-comments { margin-top:16px; padding-top:10px; border-color:var(--workspace-divider); }
html:root .feed-author-line { gap:4px 8px; line-height:1.5; }
html:root .feed-author-line > strong { font-size:.875rem; }
html:root .feed-comment-prompt .person-avatar { width:32px; height:32px; flex-basis:32px; }
html:root button.feed-comment-start { min-height:40px; padding:8px 14px; }

/* Lists and filters share a baseline without crowding the working rows. */
html:root .task-category-bar button { border-radius:8px; }
html:root .task-table-wrap { padding:0; }
html:root .task-table th { padding:11px 14px; font-size:.75rem; font-weight:600; background:var(--surface-active); }
html:root .task-table td { padding:14px; vertical-align:middle; font-size:.8125rem; }
html:root .task-table td.task-activity-cell { background:transparent; }
html:root .employee-list .employee { padding:12px 16px; font-size:.8125rem; }
html:root :is(.settings-panel,.projects-heading) { border-color:var(--workspace-divider); }
html:root .settings-panel { padding:22px; margin-top:16px; }
html:root .settings-section-heading { gap:12px; margin-bottom:18px; }
html:root .settings-section-heading h2 { font-size:1.1rem; }
html:root .settings-symbol { width:38px; height:38px; border-radius:10px; font-size:1.25rem; }
html:root .theme-options { gap:14px; }
html:root .theme-option-copy { padding:12px 8px 4px; gap:6px; }

/* Dialogs retain the common controls and local scrolling, with calmer forms. */
html:root .managed-window > .window-titlebar,html:root .crm-standard-window > .window-titlebar { padding:12px 20px; gap:12px; border-bottom:1px solid var(--workspace-divider); }
html:root :is(.managed-window,.crm-standard-window) > .window-titlebar h2 { font-family:var(--theme-heading-font); font-size:1.125rem; font-weight:600; line-height:1.3; margin:0; }
html:root .window-controls { gap:2px; padding-left:8px; }
html:root :is(.task-info-card,.profile-info-card,.task-options-card) { border-radius:10px; box-shadow:none; }
html:root .task-info-card { padding:16px; }
html:root .task-info-card h3,html:root .task-stream-heading h3 { font-size:.875rem; }
html:root .task-detail-fields { grid-template-columns:110px minmax(0,1fr); column-gap:12px; row-gap:12px; font-size:.8125rem; }
html:root #task-form .task-form-layout { grid-template-columns:minmax(0,1fr) 260px; padding:16px 20px; gap:14px; }
html:root #task-form .task-form-main { gap:12px; }
html:root #task-form #task-title { min-height:40px; padding:8px 10px; border:1px solid var(--border); background:var(--input-background); font-size:1rem; }
html:root #task-form .task-description-editor { padding:14px 16px 10px; border:1px solid var(--workspace-divider); border-radius:10px; box-shadow:none; }
html:root #task-form #task-description { min-height:128px; height:128px; }
html:root #task-form .task-participants-card { padding:6px 16px; border:1px solid var(--workspace-divider); border-radius:10px; box-shadow:none; }
html:root #task-form .task-participant-row { grid-template-columns:112px minmax(0,1fr) 32px; gap:8px; min-height:44px; }
html:root #task-form .task-participant-add { width:32px;min-width:32px;height:32px;min-height:32px; }
html:root #task-form .task-options-card { padding:16px; }
html:root :is(.calendar-form-main,.calendar-form-side,.invoice-main,.invoice-side,.profile-dialog-body,.employee-dialog-body) { padding:20px; }
html:root .calendar-planner { padding:16px; margin:0 20px 20px; }
html:root dialog.crm-standard-window:not(.window-maximized) { max-width:var(--window-width-limit); max-height:min(720px,var(--window-height-limit)); }
html:root :is(.rich-editor-expanded.crm-standard-window:not(.window-maximized),#testing-focus > .crm-standard-window:not(.window-maximized)) { max-height:min(720px,var(--window-height-limit)); }
html:root #login-view { max-width:420px; padding:30px; border-top:1px solid var(--border); }
html:root #login-view h1 { font-size:1.625rem; }

@media (min-width:761px) {
  html:root .app-shell { grid-template-columns:var(--workspace-sidebar-width) minmax(0,1fr); }
  html:root .sidebar-content { height:calc(100dvh - var(--workspace-header-height)); }
  html:root .task-detail-layout { grid-template-columns:360px minmax(0,1fr); }
}
@media (min-width:701px) and (max-width:1100px) {
  html:root .employee-filter-columns { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:12px 0; }
  html:root .employee-filter-columns > * { min-width:0; }
  html:root .hr-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html:root .hr-filters > label:first-child { grid-column:1 / -1; }
}
@media (min-width:761px) and (max-width:1100px) {
  html:root { --workspace-sidebar-width:232px; }
  html:root .workspace-content,html:root .workspace-content:has(> #dashboard-view:not([hidden])) { padding-inline:18px; }
  html:root .dashboard-grid { grid-template-columns:minmax(0,1fr); }
  html:root .events-column { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
  html:root #task-form .task-form-layout { grid-template-columns:minmax(0,1fr); }
  html:root .task-detail-layout { grid-template-columns:minmax(280px,42%) minmax(0,1fr); }
}
@media (max-width:760px) {
  html:root .topbar-inner { padding-inline:12px; gap:8px; }
  html:root .account { gap:5px; }
  html:root .header-evolution { display:none; }
  html:root .brand { font-size:1.1rem; gap:6px; }
  html:root .brand-family { font-size:.43rem; }
  html:root .brand-icon { width:23px; height:30px; }
  html:root .workspace-content,html:root .workspace-content:has(> #dashboard-view:not([hidden])) { padding:16px 12px 32px; }
  html:root .workspace-content > section > :is(.page-heading,.tasks-heading,.calendar-heading,.invoice-page-heading) { padding:14px 16px; align-items:flex-start; }
  html:root .dashboard-grid { grid-template-columns:minmax(0,1fr); gap:16px; }
  html:root .events-column { display:grid; grid-template-columns:minmax(0,1fr); }
  html:root .news-post { --feed-avatar:36px; --feed-indent:0px; padding:16px; }
  html:root .news-post .news-author { gap:10px; }
  html:root .feed-author-info { flex-basis:calc(100% - 46px); }
  html:root .managed-window > .window-titlebar,html:root .crm-standard-window > .window-titlebar { padding:10px 14px; gap:8px; }
  html:root :is(.managed-window,.crm-standard-window) > .window-titlebar h2 { font-size:1rem; }
  html:root #task-form .task-form-layout { grid-template-columns:minmax(0,1fr); padding:14px; gap:14px; }
  html:root #task-form .task-participant-row { grid-template-columns:minmax(0,1fr) 44px; }
  html:root .task-detail-fields { grid-template-columns:minmax(0,1fr); }
  html:root :is(.calendar-form-main,.calendar-form-side,.invoice-main,.invoice-side,.profile-dialog-body,.employee-dialog-body) { padding:16px; }
  html:root .calendar-planner { margin-inline:16px; padding:12px; }
  html:root .task-table td { padding:8px 0; }
  html:root .task-filter-main { grid-template-columns:repeat(2,minmax(0,1fr)); }
  html:root .task-filter-main #task-search { grid-column:1 / -1; }
  html:root .task-filter-main select { grid-column:auto; }
  html:root .settings-panel { padding:16px; }
  html:root dialog.crm-standard-window:not(.window-maximized) { max-height:calc(100dvh - 32px); }
  html:root #workspace.mobile-menu-open > .sidebar { min-height:calc(100dvh - var(--workspace-header-height)); padding:16px 12px; }
}
@media (pointer:coarse), (max-width:600px) {
  html:root #task-form .task-participant-add { width:44px;min-width:44px;height:44px;min-height:44px; }
  html:root[data-theme] .sidebar .nav-item,html:root .home-task-link,html:root button.feed-comment-start { min-height:44px; }
  html:root #task-form .task-participant-row { min-height:48px; }
  html:root :is(#company-search-toggle,#notifications-toggle,#profile-toggle,#logout) { min-height:44px; }
}

/* Compact role rows and module groups; expanded groups keep the full form width. */
html:root #roles-panel .roles-list { gap:6px; }
html:root #roles-panel .role-disclosure { border-radius:8px; }
html:root #roles-panel .role-disclosure > summary { display:grid; grid-template-columns:minmax(160px,240px) minmax(0,1fr) 16px; min-height:44px; padding:8px 12px; gap:12px; }
html:root #roles-panel .role-disclosure > summary > strong { min-width:0; font-size:.875rem; line-height:1.4; overflow-wrap:anywhere; }
html:root #roles-panel .role-disclosure > summary > .small { min-width:0; font-size:.8125rem; line-height:1.4; }
html:root #roles-panel .role-disclosure > summary::after { margin:0; font-size:1rem; line-height:1; text-align:center; }
html:root #roles-panel .role-card { padding:12px; }
html:root #roles-panel .role-card > p { margin:0 0 10px; font-size:.8125rem; line-height:1.4; }
html:root #roles-panel .role-groups { grid-template-columns:minmax(0,1fr); align-items:start; gap:6px; margin:10px 0; }
html:root #roles-panel .role-module-group { border-radius:8px; }
html:root #roles-panel .role-module-group[open] { grid-column:1 / -1; }
html:root #roles-panel .role-module-group > summary { min-height:38px; padding:7px 10px; gap:8px; flex-wrap:nowrap; }
html:root #roles-panel .role-module-group > summary strong { flex:1; font-size:.8125rem; line-height:1.35; overflow-wrap:anywhere; }
html:root #roles-panel .role-group-status { padding:2px 7px; font-size:.6875rem; line-height:1.4; }
html:root #roles-panel .role-group-body { padding:0 10px 10px; }
html:root #roles-panel .role-module-access { min-height:36px; padding:8px 0; gap:8px; font-size:.8125rem; }
html:root #roles-panel .role-permission-grid { gap:0 16px; margin:0; }
html:root #roles-panel .role-permission { padding:8px 0; gap:8px; font-size:.8125rem; line-height:1.35; }
html:root #roles-panel :is(.role-permission,.role-module-access) input { flex:0 0 18px; width:18px; height:18px; min-height:18px; }
html:root #roles-panel .role-permission > span { min-width:0; }
html:root #roles-panel .role-permission small { margin-top:2px; font-size:.75rem; line-height:1.35; }
html:root #roles-panel .role-rights-heading { margin:10px 0 4px; font-size:.75rem; }
html:root #roles-panel .role-group-hint { margin:6px 0 0; font-size:.75rem; line-height:1.4; }
html:root #roles-panel .role-actions { gap:8px; margin-top:10px; }
html:root #roles-panel .role-card .role-actions button { flex:0 1 auto; min-height:36px; padding:7px 12px; font-size:.8125rem; }
html:root #roles-panel .role-card > .employee-feedback { margin:10px 0 0; }
@media (min-width:1101px) {
  html:root #roles-panel .role-groups { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:700px) {
  html:root #roles-panel .role-disclosure > summary { grid-template-columns:minmax(0,1fr) 16px; gap:2px 8px; padding:8px 10px; }
  html:root #roles-panel .role-disclosure > summary > .small { grid-column:1; grid-row:2; font-size:.75rem; }
  html:root #roles-panel .role-disclosure > summary::after { grid-column:2; grid-row:1 / 3; }
  html:root #roles-panel .role-card { padding:10px; }
  html:root #roles-panel .role-permission-grid { grid-template-columns:minmax(0,1fr); }
  html:root #roles-panel .role-group-status { padding-inline:5px; }
}
@media (pointer:coarse), (max-width:700px) {
  html:root #roles-panel .role-module-group > summary { min-height:44px; }
  html:root #roles-panel :is(.role-permission,.role-module-access) { min-height:44px; }
  html:root #roles-panel .role-card .role-actions button { min-height:44px; }
}
