:root {
  --page: #dededc;
  --shell: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #ededeb;
  --ink: #090909;
  --text: #222222;
  --muted: #777774;
  --line: #e5e5e2;
  --line-strong: #d7d7d2;
  --dark: #252524;
  --green: #188052;
  --amber: #b17a1e;
  --blue: #315f98;
  --danger: #bd3328;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.1);
  --soft-shadow: 0 16px 42px rgba(0, 0, 0, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
  min-width: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1340px, calc(100vw - 72px));
  min-height: calc(100vh - 88px);
  margin: 44px auto;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  background: var(--shell);
  border-radius: 34px;
  box-shadow: 0 38px 95px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.sidebar {
  padding: 36px 18px 28px;
  background: linear-gradient(180deg, #fbfbfa 0%, #f0f0ed 100%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 34px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
  line-height: 1.08;
}

.brand strong {
  font-size: 18px;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

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

.nav-item {
  border: 0;
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 10px;
  background: transparent;
  color: #747470;
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}

.nav-item.active,
.nav-item:hover {
  background: var(--dark);
  color: white;
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.18);
}

.icon {
  width: 20px;
  color: currentColor;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  min-height: 148px;
  padding: 20px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 55% 24%, #fdfdfc 0 7px, transparent 8px),
    linear-gradient(145deg, #ffffff, #e5e5e1);
  box-shadow: var(--soft-shadow);
  color: var(--text);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  font-size: 13px;
  font-weight: 750;
}

.status-dot {
  width: 9px;
  height: 9px;
  margin-bottom: 3px;
  border-radius: 50%;
  background: #26b46f;
  box-shadow: 0 0 0 4px rgba(38, 180, 111, 0.14);
}

.main {
  min-width: 0;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "top"
    "metrics"
    "search"
    "work";
  gap: 16px;
}

.topbar {
  grid-area: top;
  min-height: 238px;
  padding: 46px 48px;
  border-radius: 30px;
  background: var(--surface);
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(260px, 1fr) auto;
  gap: 24px;
  align-items: center;
  box-shadow: var(--shadow);
}

.topbar-copy {
  min-width: 0;
}

.topbar h1,
.panel h2 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
}

.topbar h1 {
  max-width: 410px;
  font-size: clamp(34px, 4.2vw, 56px);
  line-height: 0.98;
}

.topbar p,
.panel p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.topbar-inline,
.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-inline {
  margin-top: 22px;
}

.top-actions {
  align-self: start;
}

.hero-object {
  position: relative;
  height: 190px;
  min-width: 280px;
  filter: drop-shadow(0 22px 22px rgba(0, 0, 0, 0.16));
}

.orb,
.block,
.disk {
  position: absolute;
  display: block;
}

.orb {
  width: 50px;
  height: 50px;
  left: 48%;
  top: 2px;
  border-radius: 50%;
  background: linear-gradient(150deg, #f7f7f5, #aaa9a7 56%, #dededb);
  box-shadow: inset -8px -8px 16px rgba(0, 0, 0, 0.12);
}

.block {
  transform: skewY(-24deg) rotate(0deg);
  background: linear-gradient(145deg, #f8f8f6, #bcbcb8);
  border: 1px solid #d5d5d1;
}

.block-one {
  width: 170px;
  height: 92px;
  left: 64px;
  top: 78px;
}

.block-two {
  width: 118px;
  height: 74px;
  left: 202px;
  top: 86px;
  background: linear-gradient(145deg, #e0dfdc, #8e8e8a);
}

.block-three {
  width: 72px;
  height: 24px;
  left: 236px;
  top: 52px;
  background: linear-gradient(145deg, #f3f3f1, #b6b6b2);
}

.disk-one {
  width: 66px;
  height: 22px;
  left: 88px;
  top: 120px;
  border-radius: 50%;
  background: linear-gradient(#ffffff, #d6d6d2);
}

.disk-two {
  width: 58px;
  height: 58px;
  left: 178px;
  top: 132px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #ffffff 0 22px, #bbb 23px 30px, #f5f5f3 31px);
}

.primary-button,
.secondary-button,
.icon-button {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  transition: 160ms ease;
  font-weight: 760;
}

.primary-button {
  border-color: var(--dark);
  background: var(--dark);
  color: white;
}

.primary-button:hover {
  background: #050505;
}

.secondary-button:hover,
.icon-button:hover {
  background: var(--surface-2);
}

.icon-button {
  width: 44px;
  padding: 0;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metrics {
  grid-area: metrics;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.metrics article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.metrics article {
  min-height: 106px;
  padding: 22px;
  border-radius: 16px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 29px;
  line-height: 1;
}

.workspace {
  grid-area: work;
  display: grid;
  grid-template-columns: minmax(440px, 0.95fr) minmax(420px, 1.05fr);
  gap: 16px;
  min-width: 0;
  align-items: start;
}

.config-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.content-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.entry-panel {
  grid-column: 1;
  min-width: 0;
}

.records-panel {
  grid-column: 1;
  min-width: 0;
}

.panel {
  padding: 22px;
  border-radius: 18px;
  min-width: 0;
}

.panel-heading,
.table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.field-editor,
.entry-form {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  min-width: 0;
}

.field-editor {
  margin-top: 0;
}

label {
  display: grid;
  gap: 7px;
  color: #575752;
  font-size: 12px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 45px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fbfbfa;
  color: var(--ink);
  padding: 0 13px;
  outline: none;
  font-size: 14px;
}

input:focus,
select:focus {
  border-color: #222;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.checkbox-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--dark);
}

.full {
  width: 100%;
}

.field-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafaf8;
}

.field-item strong {
  display: block;
  font-size: 14px;
}

.field-item span {
  color: var(--muted);
  font-size: 12px;
}

.field-item button,
.record-delete {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 900;
  width: 30px;
}

.entry-form {
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  align-items: end;
}

.entry-form .submit-row {
  display: flex;
  gap: 10px;
}

.entry-form .wide {
  grid-column: span 3;
}

.save-state {
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
}

.filters {
  display: grid;
  grid-template-columns: 126px 150px minmax(180px, 1fr);
  gap: 10px;
  align-items: end;
  min-width: min(520px, 100%);
}

.records-panel .table-heading {
  align-items: flex-start;
  flex-direction: column;
}

.records-panel .filters {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
}

.records-panel .search-field {
  grid-column: span 2;
}

.summary-panel {
  padding-bottom: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.summary-card,
.summary-empty {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafaf8;
  padding: 14px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

.summary-card em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.summary-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.summary-card small {
  border-radius: 999px;
  background: var(--surface-2);
  color: #4a4a46;
  padding: 5px 8px;
  font-weight: 800;
}

.summary-empty {
  color: var(--muted);
  font-weight: 750;
}

.table-wrap {
  margin-top: 16px;
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

th {
  color: #4a4a46;
  background: #efefec;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  color: #252522;
}

tbody tr:hover {
  background: #fbfbfa;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-weight: 850;
  font-size: 12px;
}

.badge.neu {
  background: #e7f2ec;
  color: var(--green);
}

.badge.pruefung {
  background: #fff0d6;
  color: var(--amber);
}

.badge.frei {
  background: #e8eff9;
  color: var(--blue);
}

.empty {
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.metrics::after {
  content: "Status";
  display: none;
}

.search-panel {
  grid-area: search;
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.6fr) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 22px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--soft-shadow);
}

.search-panel h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.search-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.global-search span {
  color: #575752;
  font-size: 12px;
  font-weight: 850;
}

.global-search input {
  min-height: 52px;
  font-size: 16px;
}

.quick-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: end;
}

.search-chip {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fafaf8;
  color: var(--text);
  min-height: 32px;
  padding: 0 11px;
  font-weight: 800;
  font-size: 12px;
}

.search-chip:hover {
  background: var(--dark);
  color: white;
  border-color: var(--dark);
}

@media (max-width: 1120px) {
  .app-shell {
    width: min(100vw - 32px, 920px);
    grid-template-columns: 1fr;
    overflow-x: hidden;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    overflow-x: auto;
    width: 100%;
    max-width: 100vw;
    padding: 14px;
  }

  .brand {
    flex: 0 0 auto;
    padding: 0;
  }

  .nav-list {
    display: flex;
    min-width: 0;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

  .main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "metrics"
      "search"
      "work";
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.8fr) auto;
    padding: 34px;
  }

  .search-panel {
    grid-template-columns: 1fr 1fr;
  }

  .global-search,
  .quick-search {
    grid-column: span 2;
  }

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

  .field-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 26px;
    border-radius: 22px;
  }

  .topbar h1 {
    font-size: 38px;
  }

  .hero-object {
    order: -1;
    min-width: 0;
    height: 156px;
    transform: scale(0.82);
    transform-origin: left center;
  }

  .topbar-inline,
  .top-actions,
  .panel-heading,
  .table-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-inline,
  .top-actions {
    display: grid;
  }

  .metrics,
  .search-panel,
  .entry-form,
  .filters,
  .field-list {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 820px;
  }

  .records-panel .filters,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .records-panel .search-field {
    grid-column: auto;
  }

  .entry-form .wide {
    grid-column: auto;
  }

  .panel {
    border-radius: 16px;
    padding: 18px;
  }
}
