/*! SPDX-License-Identifier: LGPL-3.0-only */
:root {
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #263138; background: #f6f7f9; font-synthesis: none;
  --brand: #714b67; --accent: #017e84; --line: #dce0e4; --muted: #626c73; --surface: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 4px; background: #fff; color: inherit; min-height: 34px; padding: 6px 11px; white-space: nowrap; }
button:hover { background: #edf0f2; }
button:disabled { cursor: default; opacity: .55; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: #00676d; }
.danger { color: #ab2630; }
input, select, textarea { border: 1px solid #aab2b8; border-radius: 4px; background: #fff; color: inherit; min-height: 34px; padding: 6px 9px; max-width: 100%; }
textarea { min-height: 72px; resize: vertical; }
input[type=checkbox] { min-height: 18px; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
:focus-visible { outline: 3px solid #156baf; outline-offset: 3px; }
/* Route changes retain focus for assistive technology. The explicit skip-link target keeps its visible ring. */
[data-client-content][data-navigation-focus]:focus { outline: none; }
.muted { color: var(--muted); }
.error { color: #9f202b; white-space: pre-wrap; }
.skip-link { position: fixed; top: -80px; left: 12px; background: #fff; padding: 12px; z-index: 30; }
.skip-link:focus { top: 8px; }

/* Top App Bar Header (Brand & Systray) */
.app-bar { min-height: 48px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 20px; }
.app-bar button { background: transparent; border-color: #ffffff60; color: #fff; }
.app-bar .brand { border-color: transparent; padding-left: 0; font-weight: 700; letter-spacing: -.35px; font-size: 18px; }
.systray { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-menu { position: relative; }
.user-button { display: inline-flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 20px; padding: 3px 10px 3px 4px; color: #fff; font-size: 13px; }
.user-button:hover { background: rgba(255, 255, 255, 0.22); }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.user-avatar[data-letter]::before { content: attr(data-letter); }
.user-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { font-size: 10px; opacity: .8; }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: #fff; color: #263138; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(38, 49, 56, 0.16); padding: 14px 16px; z-index: 100; display: none; }
.user-dropdown.open { display: flex; flex-direction: column; gap: 12px; }
.user-dropdown-info { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.user-dropdown-company { display: flex; flex-direction: column; gap: 4px; }
.user-dropdown-company label { font-size: 12px; font-weight: 600; color: #56616b; }
.user-dropdown-company select { width: 100%; color: #263138; }
.user-dropdown form { margin: 0; }
.user-dropdown form button { width: 100%; background: #fdf2f2; color: #ab2630; border: 1px solid #f8b4b4; font-weight: 500; }
.user-dropdown form button:hover { background: #fde8e8; }

/* Sub-Navbar Navigation */
.app-navigation { display: flex; align-items: center; min-height: 42px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); gap: 8px; position: relative; }
.burger-btn { display: none; background: transparent; border: 0; font-size: 18px; padding: 6px 8px; cursor: pointer; color: #495057; }
.burger-btn:hover { background: #f1f3f5; }
.app-switcher-btn { display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 6px 8px; color: var(--brand); cursor: pointer; }
.app-switcher-btn:hover { background: #f1f3f5; }
.grid-icon { width: 16px; height: 16px; color: var(--brand); }
.app-sections { display: flex; align-items: center; gap: 2px; overflow-x: auto; flex: 1; }
.app-brand-btn { font-weight: 700; font-size: 15px; color: #212529; background: transparent; border: 0; padding: 8px 12px; border-radius: 4px; white-space: nowrap; }
.app-brand-btn:hover { background: #f1f3f5; }
.nav-item { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 12px; color: #495057; font-size: 13px; white-space: nowrap; }
.nav-item:hover { background: #f8f9fa; color: #212529; }
.nav-item[aria-current=page], .app-brand-btn[aria-current=page] { color: var(--accent); background: #eef7f7; border-bottom-color: var(--accent); font-weight: 600; }
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { background: transparent; border: 0; padding: 10px 12px; font-size: 13px; color: #495057; cursor: pointer; }
.nav-dropdown-toggle:hover { background: #f8f9fa; color: #212529; }
.nav-dropdown-menu { position: absolute; top: calc(100% + 2px); left: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.1); min-width: 180px; padding: 6px 0; z-index: 50; display: none; }
.nav-dropdown-menu.open { display: flex; flex-direction: column; }
.dropdown-item { background: transparent; border: 0; text-align: left; padding: 8px 14px; font-size: 13px; width: 100%; border-radius: 0; }
.dropdown-item:hover { background: #f1f3f5; color: var(--accent); }

/* Home Menu Full-page Overlay */
.home-menu-overlay { position: fixed; top: 48px; left: 0; right: 0; bottom: 0; background: #f8f9fa; z-index: 40; overflow-y: auto; padding: 32px 24px; }
.home-menu-overlay.hidden { display: none; }
.home-menu-container { max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.home-menu-search { max-width: 380px; width: 100%; margin-bottom: 24px; padding: 10px 16px; border-radius: 20px; border: 1px solid #ced4da; font-size: 14px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 20px; width: 100%; max-width: 860px; margin: 0 auto; }
.app-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; min-height: 100px; text-decoration: none; color: inherit; }
.app-tile:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.08); border-color: #cbd5e1; }
.app-icon { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; overflow: hidden; margin-bottom: 8px; flex-shrink: 0; }
.app-icon[data-letter]::before { content: attr(data-letter); font-size: 24px; font-weight: 700; color: #fff; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-caption { font-size: 13px; font-weight: 500; color: #334155; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Mobile Navigation Drawer */
.mobile-drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; background: #fff; z-index: 100; box-shadow: 2px 0 16px rgba(0,0,0,0.15); padding: 20px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.mobile-drawer.hidden { display: none; }
.mobile-drawer-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.drawer-close-btn { background: transparent; border: 0; font-size: 16px; cursor: pointer; }
.drawer-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 8px 0 4px; }
.drawer-item { background: transparent; border: 0; text-align: left; padding: 10px 12px; border-radius: 6px; font-size: 14px; width: 100%; }
.drawer-item:hover { background: #f1f3f5; color: var(--accent); }

/* Notice Banner */
.client-notice:not(:empty) { position: fixed; top: 100px; right: 16px; z-index: 20; max-width: min(520px, calc(100vw - 32px)); padding: 10px 14px; background: #fff1db; border: 1px solid #e5c995; border-radius: 4px; box-shadow: 0 3px 12px #26313812; }

/* Control Panel */
.control-panel { background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 24px; display: flex; flex-direction: column; gap: 10px; }
.control-panel-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.control-panel-actions-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; min-width: 0; }
.breadcrumbs h1, .breadcrumb-current { font-size: 18px; font-weight: 600; margin: 0; min-width: 60px; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumb-back { border: 0; background: transparent; padding: 0; font-size: 16px; color: var(--accent); cursor: pointer; font-weight: 500; }
.breadcrumb-back:hover { text-decoration: underline; }
.breadcrumb-separator { color: var(--muted); font-size: 14px; padding: 0 2px; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
[data-control-extension] { justify-content: flex-end; font-size: 12px; color: var(--muted); max-width: 52ch; }
[data-control-extension]:empty { display: none; }
.control-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }

/* Search Form with Removable Facet Chips */
.search-form { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #cbd5e1; border-radius: 6px; padding: 3px 6px; flex-wrap: wrap; }
.search-chips { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.search-chips:empty { display: none; }
.search-facet-chip { display: inline-flex; align-items: center; gap: 4px; background: #e0f2f1; border: 1px solid #b2dfdb; border-radius: 4px; padding: 2px 6px; font-size: 12px; color: #00695c; }
.chip-text { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-remove-btn { border: 0; background: transparent; padding: 0 2px; font-size: 11px; color: #00695c; cursor: pointer; line-height: 1; min-height: auto; }
.search-field-select { border: 0; background: transparent; font-size: 12px; color: var(--muted); cursor: pointer; padding: 2px 4px; min-height: auto; }
.search-input { border: 0; outline: 0; font-size: 13px; padding: 4px 6px; min-width: 140px; min-height: auto; }
.search-submit-btn { border: 0; background: var(--accent); color: #fff; border-radius: 4px; font-size: 12px; padding: 4px 8px; min-height: 26px; }
.search-submit-btn:hover { background: #00676d; }
.search-clear-btn { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 4px 6px; min-height: 26px; }
.search-clear-btn:hover { background: #f1f3f5; color: #212529; }

/* Pager */
.pager { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.pager-count { font-size: 13px; color: var(--muted); margin-right: 4px; }
.pager-btn { min-height: 28px; padding: 3px 8px; font-size: 12px; border-radius: 4px; }

/* Sheet & Form */
.content-sheet { background: #fff; margin: 18px auto; padding: 24px; max-width: 1160px; border: 1px solid var(--line); border-radius: 4px; }
.record-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 32px; }
.field-label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label > span { font-size: 12px; font-weight: 600; color: #56616b; }
.field-label > input:not([type=checkbox]), .field-label > select, .field-label > textarea { width: 100%; }
.field-group { display: contents; }
.field-label:has(textarea) { grid-column: 1 / -1; }
.table-scroll { overflow: auto; background: #fff; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { padding: 9px 16px; border-bottom: 1px solid var(--line); max-width: 400px; overflow-wrap: anywhere; }
th { font-size: 12px; font-weight: 600; color: #53616c; background: #f6f7f9; white-space: nowrap; }
th button { border: 0; background: transparent; padding: 0; min-height: 28px; }
tbody tr:hover { background: #f0f6f7; }
td button.link { border: 0; background: transparent; color: #006b72; padding: 0; text-align: left; white-space: normal; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state h2 { color: #33414d; font-size: 20px; font-weight: 500; }

/* Login */
.login-screen { min-height: 100vh; display: grid; place-items: center; background: #f3f5f7; padding: 24px; }
.login-card { width: 100%; max-width: 390px; padding: 32px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 28px #26313808; }
.wordmark { font-weight: 700; color: var(--brand); font-size: 24px; }
.login-card h1 { font-size: 24px; margin: 24px 0 6px; }
.login-card form { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.login-card form button { margin-top: 10px; }

/* Dialogs & Widgets */
.choice-dialog { border: 1px solid var(--line); border-radius: 8px; max-width: min(520px, 90vw); padding: 24px; }
.choice-dialog::backdrop { background: #17212c80; }
.choice-dialog h2 { margin-top: 0; font-size: 20px; }
.choice-dialog .actions { justify-content: flex-end; margin-top: 20px; }
.addon-card { padding: 16px; border: 1px solid var(--line); border-radius: 4px; display: flex; align-items: center; gap: 16px; margin: 12px 0; }
.addon-card div { flex: 1; }
.addon-card h2 { font-size: 16px; margin: 0 0 4px; }
.relation-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: start; }
.relation-results { display: flex; gap: 6px; flex-wrap: wrap; grid-column: 1 / -1; }
.relation-results:empty { display: none; }
.relation-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; background: #e5f3f3; border-radius: 4px; }
.relation-chip button { padding: 1px 6px; min-height: 24px; background: transparent; border: 0; }
.field-error { border-color: #b32d3a; }
.settings-sheet { padding: 0; }
.settings-toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.settings-toolbar > .field-label { flex: 0 1 320px; }
.settings-section { padding: 20px 24px 24px; }
.settings-section h2 { font-size: 15px; margin: 0 0 18px; font-weight: 600; }
.settings-form { gap: 16px 32px; }
.settings-toggle { flex-direction: row; align-items: center; gap: 10px; min-height: 34px; }
.settings-toggle > span { color: #263138; font-size: 14px; font-weight: 400; }

/* Responsive Media Queries */
@media (max-width: 768px) {
  button, input, select { min-height: 40px; }
  .app-bar { padding: 6px 12px; gap: 10px; }
  .user-name { display: none; }
  .burger-btn { display: inline-flex; }
  .app-sections { display: none; }
  .app-navigation { padding: 0 10px; }
  .control-panel { padding: 12px 16px; gap: 10px; }
  .control-panel-heading { flex-direction: column; align-items: stretch; gap: 8px; }
  .control-toolbar { margin-left: 0; width: 100%; justify-content: space-between; }
  .search-form { width: 100%; }
  .search-input { flex: 1; min-width: 100px; }
  .content-sheet { margin: 12px; padding: 18px; }
  .record-form { grid-template-columns: 1fr; gap: 16px; }
  .login-card { padding: 28px; }
  .home-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 14px; margin: 16px auto; }
  .addon-card { align-items: flex-start; flex-wrap: wrap; }
  .settings-sheet { padding: 0; }
  .settings-toolbar, .settings-section { padding: 16px; }
  .settings-toolbar > .field-label { flex-basis: 100%; }
  .settings-toggle { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.acceptance-note-title input { border-inline-start: 3px solid #447267; }
.acceptance-note-title small, .acceptance-note-guide { color: #52655e; font-size: .875rem; }
.acceptance-note-guide { margin: .25rem 0; }

