:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #18211f;
  --muted: #63706b;
  --line: #d8e0dd;
  --accent: #176b5d;
  --accent-strong: #0d4f45;
  --accent-soft: #dcefeb;
  --warn: #a94d16;
  --danger: #b3261e;
  --shadow: 0 12px 40px rgba(28, 39, 35, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.65;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #15211e;
  color: #f7fbf9;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .muted {
  color: #b9c7c2;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #79cbbc;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.12;
}

h2 {
  font-size: 18px;
}

.muted {
  color: var(--muted);
  margin: 6px 0 0;
}

.app-version {
  font-size: 12px;
  font-weight: 700;
}

.sidebar .app-version {
  margin-top: auto;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tabs button,
.ghost,
.primary {
  min-height: 40px;
  border-radius: 7px;
  padding: 0 14px;
  font-weight: 700;
}

.tabs button {
  background: transparent;
  color: #dfe9e5;
  text-align: left;
}

.tabs button.active,
.tabs button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.primary:hover {
  background: var(--accent-strong);
}

.ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-button {
  color: var(--danger);
}

.link-button {
  background: transparent;
  color: var(--accent-strong);
  font-weight: 800;
  padding: 0;
  text-align: left;
}

.link-button:hover {
  text-decoration: underline;
}

.sidebar .ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.15);
  margin-top: auto;
}

.workspace {
  padding: 28px;
  overflow: min(100vw, auto);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 20px;
}

.toolbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.actions,
.filter-row,
.inline-fields {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-row select[multiple] {
  min-width: 160px;
  min-height: 104px;
}

.filter-stack {
  display: grid;
  gap: 12px;
  min-width: min(760px, 100%);
}

.project-filter-top {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 38px;
  gap: 10px;
  align-items: center;
}

.time-filters {
  margin-top: 10px;
}

#timeEntryTables {
  display: grid;
  gap: 12px;
}

.time-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.time-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
}

.time-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.specific-head-title {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.compact-checkbox {
  font-size: 13px;
  font-weight: 500;
}

.filter-field {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.small-reset {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.sort-button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  padding: 0;
  text-align: left;
}

.sort-button.active::after {
  content: attr(data-sort-indicator);
  margin-left: 6px;
  color: var(--accent-strong);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.sub-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.analysis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.analysis-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.analysis-table {
  min-width: 860px;
}

.travel-allowance {
  margin: 0 20px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 12px;
}

.travel-allowance strong {
  color: var(--accent-strong);
}

.compact-head {
  margin-bottom: 12px;
}

.compact-head h2 {
  font-size: 16px;
}

.grid {
  display: grid;
  gap: 20px;
}

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

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.form-grid.compact {
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  min-height: 38px;
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
}

.inline-fields > label {
  min-width: 160px;
  flex: 1;
}

.inline-fields > .wide {
  flex: 2;
}

.checkbox {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  flex-direction: row;
  color: var(--text);
}

.checkbox input {
  width: 18px;
  min-height: 18px;
}

.table-panel {
  padding: 0;
  overflow: hidden;
}

.table-panel > h2,
.table-panel > .section-head {
  padding: 18px 20px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

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

.positions-table {
  min-width: 1320px;
}

.positions-table input {
  min-width: 86px;
}

.positions-table select {
  min-width: 160px;
}

.positions-table td:nth-child(4) input {
  min-width: 220px;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: var(--surface-2);
  color: #3a4843;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.header-toggle {
  min-height: 30px;
  border-radius: 6px;
  padding: 0 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.header-toggle.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

td {
  color: #26332f;
}

.status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #e9eef0;
  font-size: 12px;
  font-weight: 800;
}

.status.offen,
.status.nicht-begonnen {
  background: #fff2d8;
  color: #74470a;
}

.status.in-arbeit {
  background: #dcefeb;
  color: #0d4f45;
}

.status.abgeschlossen {
  background: #e5f4e8;
  color: #216337;
}

.status.storniert {
  background: #f5e3e1;
  color: #8a231d;
}

.pill {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-radius: 999px;
  font-weight: 800;
  padding: 6px 10px;
  white-space: nowrap;
}

.status-line {
  margin: 12px 0 0;
  color: var(--accent-strong);
  font-weight: 700;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.detail-list div {
  display: grid;
  gap: 4px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  font-weight: 800;
}

.error {
  color: var(--danger);
  min-height: 20px;
  margin: 0;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kpi strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.bar-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bar-item {
  display: grid;
  gap: 6px;
}

.bar-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e5ece9;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 5;
  max-width: min(420px, calc(100vw - 40px));
  background: #14211e;
  color: #ffffff;
  padding: 14px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.folder-path {
  max-width: 260px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.range-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 56px;
  align-items: center;
  gap: 12px;
}

.range-row input {
  padding-inline: 0;
}

.progress-cell {
  min-width: 140px;
}

.progress-meter {
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: #e5ece9;
  overflow: hidden;
}

.progress-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .grid.two,
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 18px;
  }

  .toolbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }
}
