/* Arboris – Struktur-Designer */
/* Bereinigte Arbeitsbasis v11: ein konsistentes Stylesheet ohne gestapelte Korrekturblöcke. */

:root {
  --bg-0: #0a1020;
  --bg-1: #101a31;
  --bg-2: #17243d;

  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.115);
  --panel-soft: rgba(255, 255, 255, 0.050);

  --line: rgba(255, 255, 255, 0.140);
  --line-soft: rgba(255, 255, 255, 0.090);

  --text: #edf4ff;
  --muted: #aab8d2;
  --faint: #7f8ba5;

  --input-text: #edf4ff;
  --input-bg: rgba(255,255,255,0.075);
  --input-focus-bg: rgba(255,255,255,0.105);
  --option-text: #111827;

  --accent: #d8bd7b;
  --accent-strong: #f1d998;
  --accent-light-mode: #25406f;

  --green: #91e3b0;
  --red: #ff8b9a;
  --orange: #f4b16d;
  --blue: #89a9ff;

  --shadow: 0 20px 62px rgba(0, 0, 0, 0.32);
  --radius: 8px;
  --header-h: 96px;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="light"] {
  --bg-0: #eef2f8;
  --bg-1: #f8fafd;
  --bg-2: #dde6f3;

  --panel: rgba(255, 255, 255, 0.76);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.58);

  --line: rgba(35, 48, 77, 0.16);
  --line-soft: rgba(35, 48, 77, 0.10);

  --text: #172033;
  --muted: #53627a;
  --faint: #647086;

  --input-text: #172033;
  --input-bg: rgba(255,255,255,0.86);
  --input-focus-bg: rgba(255,255,255,0.98);
  --option-text: #172033;

  --accent: #25406f;
  --accent-strong: #25406f;

  --shadow: 0 18px 52px rgba(31, 45, 75, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-0);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at top left, rgba(216, 189, 123, 0.18), transparent 32rem),
    radial-gradient(circle at top right, rgba(137, 169, 255, 0.16), transparent 36rem),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
}

body[data-theme="light"] {
  background:
    radial-gradient(circle at top left, rgba(37, 64, 111, 0.10), transparent 32rem),
    radial-gradient(circle at top right, rgba(137, 169, 255, 0.16), transparent 36rem),
    linear-gradient(145deg, var(--bg-0), var(--bg-1) 45%, var(--bg-2));
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

input,
select,
textarea {
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  outline: none;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

select option {
  color: var(--option-text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(216, 189, 123, 0.72);
  box-shadow: 0 0 0 4px rgba(216, 189, 123, 0.11);
  background: var(--input-focus-bg);
}

body[data-theme="light"] input:focus,
body[data-theme="light"] select:focus,
body[data-theme="light"] textarea:focus {
  border-color: rgba(37, 64, 111, 0.58);
  box-shadow: 0 0 0 4px rgba(37, 64, 111, 0.08);
}

.app-shell {
  width: min(1760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.app-header {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-home {
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  max-width: 58px;
  max-height: 58px;
  flex: 0 0 58px;
  display: inline-grid;
  place-items: center;
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  background:
    linear-gradient(145deg, var(--panel-strong), var(--panel-soft)),
    radial-gradient(circle at 22% 22%, rgba(216,189,123,0.12), transparent 18rem);
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.18), inset 0 1px rgba(255,255,255,0.08);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.brand-home:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 189, 123, 0.42);
}

.brand-logo {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  border-radius: 4px;
  object-fit: contain;
  display: block;
}

.brand-text {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
}

.brand p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.header-actions,
.structure-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.glass-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, var(--panel-strong), var(--panel-soft)),
    radial-gradient(circle at top right, rgba(216,189,123,0.11), transparent 24rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body[data-theme="light"] .glass-panel {
  background:
    linear-gradient(145deg, var(--panel-strong), var(--panel-soft)),
    radial-gradient(circle at top right, rgba(37,64,111,0.08), transparent 24rem);
}

.field {
  display: block;
}

.field span,
.project-name-field span {
  display: block;
  margin-bottom: 7px;
  color: var(--faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
}

.field.compact select {
  min-width: 210px;
}

.project-strip {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  padding: 12px;
  margin-bottom: 18px;
  overflow: hidden;
}

.project-name-field {
  min-width: 0;
  width: 100%;
}

.project-name-field input {
  width: 100%;
  padding: 12px 13px;
  font-size: 1rem;
  font-weight: 700;
}

.toolbar {
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.toolbar .field,
.toolbar .btn {
  flex: 0 0 auto;
}

.toolbar #viewSelect {
  min-width: 168px;
}

.toolbar #pdfModeSelect {
  min-width: 174px;
}

.search-field input {
  width: 240px;
  min-width: 240px;
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  background: rgba(255,255,255,0.075);
  box-shadow: inset 0 1px rgba(255,255,255,0.08);
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.115);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  color: #202230;
  border-color: rgba(216, 189, 123, .8);
  background: linear-gradient(145deg, #f1d998, #d8bd7b);
  font-weight: 800;
}

body[data-theme="light"] .btn {
  color: var(--text);
  background: rgba(255,255,255,0.78);
}

body[data-theme="light"] .btn.primary {
  color: #202230;
  border-color: rgba(37, 64, 111, 0.30);
  background: linear-gradient(145deg, #dbe5f5, #b9c9e4);
}

.btn.soft {
  background: rgba(255,255,255,0.07);
}

.btn.danger-soft {
  border-color: rgba(255, 139, 154, 0.32);
  color: #ffd7dc;
  background: rgba(255, 139, 154, 0.09);
}

body[data-theme="light"] .btn.danger-soft {
  color: #8b2633;
}

.btn.tiny {
  padding: 8px 11px;
  min-width: 38px;
  height: 38px;
}

.compact-action {
  font-size: 0.78rem;
  padding: 8px 10px;
  letter-spacing: -0.01em;
}

#resetStorageBtn.compact-action {
  width: auto;
  max-width: none;
  min-width: 168px;
  white-space: nowrap;
  line-height: 1.1;
  text-align: center;
}

.theme-switch-field {
  display: inline-flex;
  align-items: end;
  flex: 0 0 auto;
}

.theme-switch-field > span,
.header-theme-switch > span {
  display: none;
}

.theme-toggle {
  min-width: 104px;
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.theme-toggle-icon {
  width: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 1rem;
}

.theme-toggle[aria-pressed="true"] {
  border-color: rgba(37, 64, 111, 0.34);
  background: rgba(37, 64, 111, 0.09);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(420px, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.sidebar,
.structure-panel,
.inspector {
  min-height: calc(100vh - 210px);
}

.sidebar,
.inspector {
  padding: 18px;
}

.structure-panel {
  padding: 18px;
  overflow: hidden;
}

.side-card,
.entity-card,
.inspector-section,
.icon-card,
.list-card,
.empty-state {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.045);
}

body[data-theme="light"] .side-card,
body[data-theme="light"] .entity-card,
body[data-theme="light"] .inspector-section,
body[data-theme="light"] .icon-card,
body[data-theme="light"] .list-card,
body[data-theme="light"] .empty-state,
body[data-theme="light"] .node-row {
  background: rgba(255,255,255,0.62);
}

.side-card {
  padding: 16px;
  margin-bottom: 14px;
}

.muted-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: .93rem;
}

.side-title,
.structure-head,
.inspector-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.side-title h2,
.structure-head h2,
.inspector h2 {
  margin: 0;
  font-size: 1.04rem;
  letter-spacing: -0.02em;
}

body[data-theme="light"] .side-title h2,
body[data-theme="light"] .structure-head h2,
body[data-theme="light"] .inspector h2,
body[data-theme="light"] .inspector-section h3,
body[data-theme="light"] .list-card-label,
body[data-theme="light"] .permission-table th {
  color: var(--accent-light-mode);
}

.structure-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 14px;
}

.structure-head p {
  margin: 7px 0 0;
  color: var(--muted);
}

.mini-badge,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 3px 9px;
  color: var(--muted);
  background: rgba(255,255,255,0.055);
  font-size: 0.75rem;
  white-space: nowrap;
}

body[data-theme="light"] .badge,
body[data-theme="light"] .mini-badge,
body[data-theme="light"] .badge.gold {
  color: var(--accent-light-mode);
  border-color: rgba(37, 64, 111, 0.22);
  background: rgba(37, 64, 111, 0.07);
}

.badge.gold {
  color: #ffe7ac;
  border-color: rgba(216,189,123,0.34);
  background: rgba(216,189,123,0.12);
}

.badge.green {
  color: #c5ffd7;
  border-color: rgba(145,227,176,0.34);
  background: rgba(145,227,176,0.10);
}

.badge.red {
  color: #ffd5da;
  border-color: rgba(255,139,154,0.34);
  background: rgba(255,139,154,0.10);
}

.badge.orange {
  color: #ffe3c1;
  border-color: rgba(244,177,109,0.34);
  background: rgba(244,177,109,0.10);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr .7fr auto;
  gap: 8px;
  margin: 12px 0 14px;
}

.inline-form.two {
  grid-template-columns: 1fr auto;
}

.inline-form input {
  min-width: 0;
  padding: 9px 10px;
}

.entity-list {
  display: grid;
  gap: 10px;
}

.entity-card {
  padding: 10px;
}

.entity-grid {
  display: grid;
  grid-template-columns: 1fr .52fr;
  gap: 8px;
}

.entity-grid input {
  min-width: 0;
  padding: 8px 9px;
}

.entity-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.role-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 5px 8px;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  font-size: .78rem;
}

.check-chip input {
  width: auto;
  box-shadow: none;
}

.structure-view {
  min-height: 520px;
  overflow: auto;
  padding: 2px;
  scrollbar-color: rgba(216,189,123,.35) transparent;
}

.tree {
  display: grid;
  gap: 4px;
}

.node-row {
  --depth: 0;
  min-height: 47px;
  display: grid;
  grid-template-columns: 34px 34px minmax(170px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px calc(8px + (var(--depth) * 24px));
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.034);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.node-row:hover {
  background: rgba(255,255,255,0.075);
  border-color: var(--line-soft);
}

.node-row.selected,
.icon-card.selected,
.list-card.selected {
  border-color: rgba(216, 189, 123, 0.45);
  background:
    linear-gradient(90deg, rgba(216,189,123,0.15), rgba(255,255,255,0.045));
}

.node-row.drag-over,
.icon-card.drag-over,
.list-card.drag-over {
  border-color: rgba(137,169,255,.85);
  background: rgba(137,169,255,.13);
}

.node-row[draggable="true"],
.icon-card[draggable="true"],
.list-card[draggable="true"] {
  cursor: grab;
}

.toggle-btn,
.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255,255,255,0.045);
  display: grid;
  place-items: center;
  padding: 0;
}

.toggle-btn.placeholder {
  visibility: hidden;
}

.node-icon,
.list-card-icon {
  font-size: 1.24rem;
  text-align: center;
  filter: drop-shadow(0 4px 9px rgba(0,0,0,0.25));
}

.node-name-input {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(7, 12, 23, 0.23);
  font-weight: 650;
}

.node-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.row-actions .btn {
  padding: 7px 9px;
  font-size: .78rem;
}

.empty-state {
  padding: 34px 24px;
  color: var(--muted);
  text-align: center;
  background: rgba(255,255,255,0.035);
  border-style: dashed;
}

.path {
  color: var(--muted);
  font-size: .84rem;
  overflow-wrap: anywhere;
}

.mono {
  font-family: var(--mono);
}

/* Listenansicht als Kartenlayout statt schwerfälliger Tabelle */
.list-card-view {
  display: grid;
  gap: 10px;
}

.list-card {
  display: grid;
  grid-template-columns: 42px minmax(220px, 1fr) minmax(120px, 0.45fr) minmax(190px, 0.75fr) minmax(180px, 0.65fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  min-width: 0;
}

.list-card-icon {
  font-size: 1.6rem;
}

.list-card-main,
.list-card-rights,
.list-card-info {
  min-width: 0;
}

.list-card-label {
  display: block;
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 800;
}

.rights-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.rights-wrap .badge {
  white-space: normal;
  line-height: 1.15;
}

.list-card-info {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.list-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: stretch;
  width: 100%;
}

.list-card-actions .btn {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  white-space: normal;
  line-height: 1.12;
  font-size: 0.72rem;
  text-align: center;
}

/* Symbolansichten */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.icon-grid.large {
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}

.icon-card {
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 14px;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  gap: 10px;
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.icon-card.large {
  padding: 18px;
}

.icon-card:hover {
  transform: translateY(-2px);
  border-color: rgba(216,189,123,0.42);
  background: rgba(255,255,255,0.075);
}

.icon-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.icon-card.large .icon-card-icon {
  font-size: 3.2rem;
}

.icon-card input {
  min-width: 0;
  width: 100%;
  padding: 8px 9px;
}

.icon-card .path {
  min-height: 2.5em;
  max-height: 4.6em;
  overflow: auto;
  padding-right: 2px;
}

.icon-card .node-meta {
  justify-content: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.icon-card .row-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  justify-content: stretch;
  align-items: stretch;
  margin-top: 2px;
}

.icon-card .row-actions .btn {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  white-space: normal;
  line-height: 1.12;
  font-size: 0.72rem;
  text-align: center;
}

/* Berechtigungsansicht */
.permission-table,
.print-table {
  width: 100%;
  border-collapse: collapse;
}

.permission-table th,
.permission-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

.permission-table th {
  color: var(--accent-strong);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.permission-table tbody tr:hover {
  background: rgba(255,255,255,0.055);
}

.permission-table .badge {
  max-width: 100%;
  margin: 0 4px 4px 0;
  white-space: normal;
  line-height: 1.15;
}

/* Inspector */
.inspector {
  position: sticky;
  top: 18px;
}

.inspector-section {
  padding: 16px;
  margin-bottom: 14px;
}

.inspector-section h3 {
  margin: 0 0 12px;
  font-size: .93rem;
  color: var(--accent-strong);
}

.detail-grid {
  display: grid;
  gap: 10px;
}

.detail-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .82rem;
}

.detail-grid input,
.detail-grid select,
.detail-grid textarea {
  width: 100%;
}

.detail-grid textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.45;
}

.readonly-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
}

.readonly-line strong {
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}

.permission-list {
  display: grid;
  gap: 8px;
}

.permission-row {
  display: grid;
  grid-template-columns: 1fr minmax(110px, .55fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 8px;
  background: rgba(255,255,255,0.04);
}

.permission-add {
  display: grid;
  grid-template-columns: 1fr .7fr auto;
  gap: 8px;
  margin-top: 12px;
}

.inherit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  padding: 8px 0 13px;
}

.inherit-row input {
  width: auto;
}

.small-note {
  color: var(--muted);
  line-height: 1.48;
  font-size: .88rem;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 16px;
  color: #202230;
  background: linear-gradient(145deg, #f1d998, #d8bd7b);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  font-weight: 750;
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Druckbereich */
.print-area {
  display: none;
}

.print-doc {
  color: #111827;
  background: white;
  font-family: Arial, Helvetica, sans-serif;
}

.print-doc h1 {
  margin: 0 0 4px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.print-doc h2 {
  margin: 28px 0 10px;
  font-size: 18px;
}

.print-doc .subtitle {
  color: #4b5563;
  margin: 0 0 24px;
}

.print-root-line {
  border: 2px solid #111827;
  border-radius: 6px;
  padding: 10px 12px;
  margin: 10px 0 16px;
  background: #f8fafc;
  color: #111827;
}

.print-node-title {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.print-node-icon {
  display: inline-block;
  width: 22px;
  flex: 0 0 22px;
  text-align: center;
}

.print-node-type {
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.print-structure-sections {
  display: grid;
  gap: 14px;
}

.print-first-level-section {
  border: 1.6px solid #94a3b8;
  border-left: 6px solid #334155;
  border-radius: 7px;
  overflow: hidden;
  background: #ffffff;
  break-inside: avoid;
  page-break-inside: avoid;
}

.print-first-level-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 10px 12px;
  background: #e5eaf1;
  border-bottom: 1px solid #94a3b8;
  color: #111827;
}

.print-first-level-heading strong {
  font-size: 14px;
}

.print-section-number {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: #ffffff;
  background: #334155;
  font-size: 11px;
  font-weight: 700;
}

.print-section-children {
  padding: 8px 0 8px;
}

.print-empty-child {
  margin-left: 42px;
  padding: 7px 10px;
  color: #6b7280;
  font-size: 12px;
  font-style: italic;
}

.print-node-group {
  break-inside: auto;
  page-break-inside: auto;
}

.print-tree-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 6px 10px 6px calc(12px + (var(--print-depth, 1) * 30px));
  border-bottom: 1px solid #e5e7eb;
  white-space: normal;
  color: #111827;
  position: relative;
}

.print-tree-line::before {
  content: "";
  position: absolute;
  left: calc(18px + (var(--print-depth, 1) * 30px));
  top: 0;
  bottom: 0;
  border-left: 1px solid #cbd5e1;
}

.print-tree-line > div,
.print-tree-line small {
  position: relative;
  z-index: 1;
}

.print-tree-line small,
.print-root-line small,
.print-first-level-heading small {
  color: #4b5563;
  font-size: 10.5px;
  line-height: 1.35;
}

.print-depth-2 .print-tree-line {
  background: #ffffff;
}

.print-depth-3 .print-tree-line {
  background: #fafafa;
}

.print-depth-4 .print-tree-line,
.print-depth-deep .print-tree-line {
  background: #f8fafc;
}

.print-table th,
.print-table td {
  border: 1px solid #d1d5db;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}

.print-table th {
  background: #f3f4f6;
}

.print-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.print-card {
  border: 1px solid #d1d5db;
  border-radius: 7px;
  padding: 14px;
  background: #f9fafb;
}

@media (max-width: 1320px) {
  .workspace {
    grid-template-columns: 320px 1fr;
  }

  .inspector {
    grid-column: 1 / -1;
    position: static;
    min-height: auto;
  }

  .list-card {
    grid-template-columns: 42px minmax(220px, 1fr) minmax(120px, .5fr);
  }

  .list-card-rights,
  .list-card-actions {
    grid-column: 2 / -1;
  }
}

@media (max-width: 920px) {
  .app-shell {
    width: min(100% - 20px, 1760px);
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .project-strip {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .structure-panel,
  .inspector {
    min-height: auto;
  }

  .node-row {
    grid-template-columns: 30px 30px minmax(120px, 1fr);
  }

  .node-meta,
  .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: calc(60px + (var(--depth) * 24px));
  }

  .list-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .list-card-info,
  .list-card-rights,
  .list-card-actions {
    grid-column: 2 / -1;
  }

  .list-card-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .icon-grid,
  .icon-grid.large {
    grid-template-columns: 1fr;
  }

  .icon-card .row-actions,
  .list-card-actions {
    grid-template-columns: 1fr;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  #printArea,
  #printArea * {
    visibility: visible !important;
  }

  #printArea {
    display: block !important;
    position: absolute;
    inset: 0;
    padding: 18mm;
    background: white;
  }

  .print-first-level-section {
    margin-bottom: 10px;
  }

  .print-doc h2,
  .print-first-level-heading {
    break-after: avoid;
    page-break-after: avoid;
  }

  @page {
    margin: 12mm;
  }
}
