:root {
  color-scheme: light;
  --ink: #191c30;
  --muted: #60657a;
  --secondary-icon: #9298a9;
  --line: #e0e0e0;
  --surface: #fff;
  --purple: #7f30e3;
  --focus: #8c45e6;
  --selected: #f2eafc;
  --hover: #f6f6f6;
  --header-height: 56px;
  --org-width: clamp(310px, 26.25vw, 504px);
  --gutter: clamp(22px, 1.875vw, 36px);
  font: 400 16px/1.375 "ALS Hauss", Arial, sans-serif;
  color: var(--ink);
  background: #fff;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.portal {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  gap: 36px;
  white-space: nowrap;
}
.brand { flex: none; width: 144px; height: 32px; display: flex; align-items: center; }
.brand img { display: block; }
.brand-fallback { color: #09090b; font: 700 30px/1 Arial, sans-serif; letter-spacing: -.085em; }
.brand-fallback b { font-weight: inherit; color: #fa1669; }
.portal-nav, .portal-actions, .portal-nav > span { display: flex; align-items: center; }
.portal-nav { gap: 24px; font-size: 16px; color: var(--muted); align-self: stretch; }
.portal-nav > span { position: relative; gap: 4px; }
.portal-nav .portal-section-current { color: var(--ink); }
.portal-section-current::after {
  content: "";
  height: 2px;
  background: #fc326f;
  position: absolute;
  inset: auto 0 -1px;
}
.portal-actions { gap: 24px; margin-left: auto; }
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ff7a19, #f31269 74%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.scenario-trigger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #e8daf7;
  border-radius: 9px;
  padding: 5px 11px;
  color: var(--purple);
  background: #fcf9ff;
  font-size: 14px;
  min-height: 34px;
}
.scenario-trigger:hover { background: var(--selected); }

.workspace {
  display: grid;
  grid-template-columns: var(--org-width) minmax(0, 1fr);
  height: calc(100dvh - var(--header-height));
  min-height: 0;
}
.org-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  padding: 32px 24px 0 var(--gutter);
  border-right: 1px solid var(--line);
}
.org-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.org-heading h1 { font-size: 32px; line-height: 40px; margin: 0; font-weight: 700; letter-spacing: -.02em; }
.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  padding: 0;
  color: var(--purple);
  background: var(--selected);
  border-radius: 10px;
}
.icon-button:hover { background: #eadef8; }
.icon-button:active { background: #e4d4f7; }
.org-add { width: 44px; height: 44px; border-radius: 12px; }
.org-search { position: relative; flex-shrink: 0; }
.search-field {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  padding: 0 9px 0 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 3px #0002;
}
.search-field:hover { border-color: #b6b7c2; }
.search-field:focus-within {
  border-color: var(--focus);
  box-shadow: inset 0 0 0 1px var(--focus);
}
.search-field input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0;
  font-size: 14px;
  border: 0;
  outline: 0;
  background: transparent;
}
.search-field input::placeholder { color: var(--muted); }
.clear-search {
  width: 28px;
  height: 28px;
  border: 0;
  padding: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--secondary-icon);
  background: transparent;
}
.clear-search:hover { color: var(--ink); background: var(--hover); }
.clear-search:active { background: var(--selected); }

.result-surface {
  background: var(--surface);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  z-index: 3;
}
.result-surface.dropdown {
  position: absolute;
  inset: calc(100% + 4px) 0 auto;
  max-height: min(760px, calc(100dvh - 220px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 12px 28px #191c3020, 0 2px 6px #191c300e;
}
.result-surface.inline {
  margin-top: 12px;
  max-height: calc(100dvh - 225px);
}
.results { display: grid; gap: 4px; }
.result-option {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  padding: 10px 8px;
  border-radius: 8px;
  background: transparent;
  overflow-wrap: anywhere;
}
.inline .result-option { padding-left: 12px; padding-right: 12px; }
.result-option:is(:hover, .is-highlighted) { background: var(--hover); }
.result-option[aria-selected="true"] { background: var(--selected); }
.result-option[aria-selected="true"]:hover { background: #ebe0f8; }
.result-name, .result-meta { display: block; }
.result-name { line-height: 22px; }
.result-meta { color: var(--muted); font-size: 14px; line-height: 20px; }
.search-empty { padding: 16px 12px; color: var(--muted); font-size: 14px; }

.org-tree { display: flex; flex-direction: column; min-height: 0; margin-top: 16px; }
.tree-tools { display: flex; align-items: center; gap: 8px; position: relative; margin-bottom: 16px; }
.filter-trigger { width: 32px; height: 32px; }
.filter-label { min-height: 32px; background: #f3f3f3; border: 0; border-radius: 8px; padding: 4px 12px; font-size: 14px; }
.filter-label:hover { background: #eaeaea; }
.tree-filters {
  display: grid;
  gap: 2px;
  position: absolute;
  top: 40px;
  left: 0;
  z-index: 4;
  min-width: 170px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 8px 24px #191c3020;
}
.tree-filters button { border: 0; border-radius: 6px; padding: 7px 10px; background: transparent; font-size: 14px; text-align: left; }
.tree-filters button:hover { background: var(--hover); }
.tree-filters button[aria-pressed="true"] { background: var(--selected); }
.tree-scroll { min-height: 0; overflow: auto; scrollbar-width: thin; padding-bottom: 18px; }
.tree-row {
  display: flex;
  align-items: stretch;
  min-height: 24px;
  padding: 0 6px;
  padding-inline-start: calc(6px + var(--depth) * 24px);
  border-radius: 8px;
}
.tree-row:hover { background: var(--hover); }
.tree-row.is-current { background: var(--selected); }
.tree-row .tree-toggle {
  display: grid;
  place-items: center;
  flex: 0 0 16px;
  width: 16px;
  padding: 0;
  margin-right: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 4px;
}
button.tree-toggle:hover { background: #e9e3f2; }
.tree-label {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 2px 0;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  line-height: 20px;
}
.tree-marker { display: flex; color: var(--muted); font-size: 13px; flex: none; align-self: center; align-items: center; }

.detail-pane { min-width: 0; min-height: 0; overflow: auto; padding: 32px var(--gutter) 20px 40px; }

:where(.scenario-panel, .form-dialog) { color: var(--ink); background: #fff; border: 0; }
:where(.scenario-panel, .form-dialog)::backdrop { background: #191c3033; }
.scenario-panel {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(410px, 100vw);
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 28px 24px;
  box-shadow: -8px 0 32px #191c3020;
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2 { margin: 0; font-size: 22px; line-height: 30px; }
.scenario-options { display: grid; gap: 12px; margin-top: 24px; }
.scenario-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}
.scenario-option strong { display: block; font-size: 16px; }
.scenario-option small { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }
.scenario-option:hover { background: var(--hover); }
.scenario-option[aria-pressed="true"] { background: #faf6ff; border-color: var(--focus); }
.option-indicator { display: grid; place-items: center; width: 18px; height: 18px; flex: none; margin-top: 2px; border: 1px solid #aaacb8; border-radius: 50%; }
.scenario-option[aria-pressed="true"] .option-indicator { border-color: var(--purple); }
.scenario-option[aria-pressed="true"] .option-indicator::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--purple); }
.reset-scenario { border: 0; background: transparent; color: var(--purple); padding: 8px 0; margin-top: 16px; font-size: 14px; text-align: left; }
.reset-scenario:hover { text-decoration: underline; }
.form-dialog { width: min(430px, calc(100vw - 32px)); padding: 24px; border-radius: 16px; box-shadow: 0 12px 36px #191c3030; }
.department-field { display: grid; gap: 6px; margin-top: 20px; font-size: 14px; }
.department-field input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.department-field input:focus { outline: 2px solid var(--focus); outline-offset: -1px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.primary-button, .secondary-button { border: 0; border-radius: 10px; padding: 9px 14px; font-weight: 700; }
.primary-button { background: var(--purple); color: #fff; }
.primary-button:hover { background: #6f22d1; }
.secondary-button { background: var(--selected); color: var(--purple); }
.secondary-button:hover { background: #eadef8; }

.icon { display: inline-block; flex: none; width: 24px; height: 24px; background: center / auto no-repeat; }
.icon-panel { width: 16px; height: 16px; }
.icon-filter, .icon-chevron, .icon-chevron-down, .icon-archive, .icon-eye-off { width: 16px; height: 16px; }

@media (max-width: 1310px) {
  .portal { gap: 24px; }
  .portal-nav, .portal-actions { gap: 16px; }
}
@media (max-width: 1200px) {
  .portal-nav > span:not(.portal-section-current) { display: none; }
  .detail-pane { padding-left: 26px; }
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .portal { gap: 10px; }
  .portal-nav, .portal-service-icon { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr); height: auto; min-height: calc(100dvh - var(--header-height)); }
  .org-pane { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px var(--gutter) 12px; }
  .org-heading { margin-bottom: 16px; }
  .org-heading h1 { font-size: 28px; }
  .tree-scroll, .result-surface.inline { max-height: 36vh; }
  .result-surface.dropdown { max-height: min(530px, calc(100dvh - 180px)); }
  .detail-pane { min-height: 400px; padding: 22px var(--gutter); }
}

.icon-nav-chevron { background-image: url("assets/nav-chevron.svg"); }
.icon-nav-chevron-active { background-image: url("assets/nav-chevron-active.svg"); }
.icon-bell { background-image: url("assets/bell.svg"); }
.icon-support { background-image: url("assets/support.svg"); }
.icon-settings { background-image: url("assets/settings.svg"); }
.icon-add { background-image: url("assets/add.svg"); }
.icon-search { background-image: url("assets/search.svg"); }
.icon-filter { background-image: url("assets/filter.svg"); }
.icon-chevron { background-image: url("assets/chevron.svg"); }
.icon-chevron-down { background-image: url("assets/chevron-down.svg"); }
.icon-archive { background-image: url("assets/archive.svg"); }
.icon-eye-off { background-image: url("assets/eye-off.svg"); }
.icon-close { background-image: url("assets/close.svg"); }
.icon-panel { background: currentColor; mask: url("assets/taiga/panel-right.svg") center / 100% 100% no-repeat; }
