:root {
  --bg: #f7f2e5;
  --panel: #ffffff;
  --ink: #3b2f1a;
  --muted: #7a6a4a;
  --accent: #8a6b2a;
  --accent-soft: #f3e4c3;
  --todo: #f0a35a;
  --todo-soft: #fdebd4;
  --done: #2f7a45;
  --done-soft: #e6f4ea;
  --not-needed: #8a8a8a;
  --not-needed-soft: #f0f0f0;
  --border: #eadfca;
  --shadow: 0 12px 28px rgba(60, 45, 20, 0.12);
  --ease-smooth: cubic-bezier(0.2, 0.7, 0.2, 1);
  --bg-grad-start: #f7e1a6;
  --bg-grad-mid: #f9f0d5;
  --bg-grad-end: #f6f2e5;
  --nav-btn-bg: #ffffff;
  --nav-active-bg: #6f5320;
  --nav-active-ink: #fff7e1;
  --kpi-bg: rgba(255, 255, 255, 0.52);
  --kpi-ink: #6f5f45;
  --kpi-value: #4a3b20;
  --table-head-bg: #f8f1db;
  --row-hover: #fdf7e8;
  --row-open: #fff8ef;
  --row-open-hover: #fdf0dd;
  --sticky-col-bg: #fffdf7;
  --empty-row-bg: #fffdf7;
  --empty-text: #75684f;
  --toast-bg: rgba(59, 47, 26, 0.92);
  --toast-ink: #fff7e1;
  --modal-backdrop: rgba(20, 18, 14, 0.45);
  --field-bg: #ffffff;
  --icon-ghost: #6f5320;
  --icon-ghost-hover: rgba(111, 83, 32, 0.08);
  --icon-ghost-active-bg: rgba(176, 58, 46, 0.16);
  --icon-ghost-active-ink: #9f3024;
  --chart-wrap-bg: #fffdf7;
  --chart-tooltip-bg: #ffffff;
  --chart-tooltip-border: #cdbd9e;
  --chart-tooltip-ink: #3a2f1f;
  --theme-toggle-dot: #8a6b2a;
}

:root[data-theme="dark"] {
  --bg: #0f141b;
  --panel: #171f2a;
  --ink: #ece6d9;
  --muted: #b6ab96;
  --accent: #c39a4a;
  --accent-soft: #2b2418;
  --todo: #f0a35a;
  --todo-soft: #412621;
  --done: #74c68f;
  --done-soft: #21392b;
  --not-needed: #adb2bb;
  --not-needed-soft: #2b313a;
  --border: #3c3327;
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  --bg-grad-start: #1b2330;
  --bg-grad-mid: #121a23;
  --bg-grad-end: #0f141b;
  --nav-btn-bg: #1c2632;
  --nav-active-bg: #c39a4a;
  --nav-active-ink: #211807;
  --kpi-bg: rgba(19, 25, 33, 0.82);
  --kpi-ink: #d8c8ab;
  --kpi-value: #f5e8ca;
  --table-head-bg: #222d3b;
  --row-hover: #1f2a37;
  --row-open: #32261a;
  --row-open-hover: #3d2d1b;
  --sticky-col-bg: #1a2431;
  --empty-row-bg: #151d27;
  --empty-text: #c0b59f;
  --toast-bg: rgba(10, 14, 20, 0.92);
  --toast-ink: #f5ecda;
  --modal-backdrop: rgba(2, 4, 8, 0.68);
  --field-bg: #1d2733;
  --icon-ghost: #d8bf90;
  --icon-ghost-hover: rgba(195, 154, 74, 0.14);
  --icon-ghost-active-bg: rgba(177, 70, 70, 0.24);
  --icon-ghost-active-ink: #ffb8ad;
  --chart-wrap-bg: #141d28;
  --chart-tooltip-bg: #1a2532;
  --chart-tooltip-border: #4b5a71;
  --chart-tooltip-ink: #f5ecda;
  --theme-toggle-dot: #d9bf87;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Avenir", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--bg-grad-start) 0%, var(--bg-grad-mid) 40%, var(--bg-grad-end) 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 40px;
  background: transparent;
  border-bottom: none;
  position: static;
  box-shadow: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 12px;
  z-index: 10;
}

.brand-mark {
  width: 120px;
  height: 72px;
  border-radius: 0;
  background: transparent;
  display: grid;
  place-items: center;
  border: none;
  overflow: visible;
  padding: 0;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--nav-btn-bg);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  transition: background-color 0.2s var(--ease-smooth), color 0.2s var(--ease-smooth),
    border-color 0.2s var(--ease-smooth), transform 0.2s var(--ease-smooth),
    box-shadow 0.2s var(--ease-smooth);
}

.tab-btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.tab-btn.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-ink);
  border-color: var(--nav-active-bg);
  box-shadow: 0 6px 14px rgba(111, 83, 32, 0.2);
}

.tab-btn:hover {
  transform: translateY(-1px);
}


.content {
  padding: 16px 40px 64px;
}

.kpi-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kpi-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(111, 83, 32, 0.2);
  border-radius: 999px;
  background: var(--kpi-bg);
  color: var(--kpi-ink);
}

.kpi-inline-label {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.9;
}

.kpi-inline-value {
  font-size: 12px;
  font-weight: 800;
  color: var(--kpi-value);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.section-header h1 {
  margin: 0;
  font-size: 26px;
}

.legend {
  display: flex;
  gap: 10px;
  align-items: center;
}

.controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.controls label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
}

.import-info {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alias-panel {
  margin: 8px 20px 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--card-bg) 92%, #fff 8%);
}

.alias-panel-title {
  font-size: 13px;
  font-weight: 800;
}

.alias-panel-note {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.alias-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}

#kdp-ads-alias-table {
  width: 100%;
  border-collapse: collapse;
}

#kdp-ads-alias-table th,
#kdp-ads-alias-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--border-soft);
  vertical-align: middle;
  text-align: left;
  font-size: 13px;
}

#kdp-ads-alias-table th {
  border-top: 0;
  color: var(--muted);
}

#kdp-ads-alias-table td select {
  width: min(520px, 100%);
  min-width: 240px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--ink);
  font-weight: 600;
}

.controls select,
.controls input {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  font-weight: 600;
  color: var(--ink);
}

.btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn.btn-secondary {
  background: var(--field-bg);
  border-color: var(--border);
  color: var(--ink);
}

.btn.btn-secondary:hover {
  background: var(--accent-soft);
}

.btn.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff7e1;
}

.btn.btn-primary:hover {
  filter: brightness(0.95);
}

.btn.btn-danger {
  background: #ffe3df;
  color: #8a1f14;
  border-color: #f3b1a8;
}

.btn.btn-danger:hover {
  background: #ffd7d2;
}

.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.icon-button.ghost {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--icon-ghost);
  transition: background-color 0.2s var(--ease-smooth), color 0.2s var(--ease-smooth),
    transform 0.2s var(--ease-smooth);
}

.icon-button.ghost:hover {
  background: var(--icon-ghost-hover);
  transform: translateY(-1px);
}

.icon-button.ghost.active {
  background: var(--icon-ghost-active-bg);
  color: var(--icon-ghost-active-ink);
}

.theme-toggle {
  width: 34px;
  height: 34px;
  position: relative;
  margin-right: 2px;
}

.theme-toggle .theme-icon {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.theme-toggle .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .theme-icon-moon {
  display: block;
}

.theme-auto-dot {
  position: absolute;
  right: 7px;
  bottom: 7px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  opacity: 0;
  transition: opacity 0.18s var(--ease-smooth), background-color 0.18s var(--ease-smooth);
}

:root[data-theme-mode="auto"] .theme-auto-dot {
  opacity: 1;
  background: var(--theme-toggle-dot);
  border-color: var(--theme-toggle-dot);
}

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

.pagination button {
  border: 1px solid var(--border);
  background: var(--field-bg);
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.pagination button.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-ink);
  border-color: var(--nav-active-bg);
}

.pagination .pager-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  border-radius: 999px;
}

.pagination .pager-info {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  color: var(--muted);
  font-weight: 600;
}

.subtable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 2px;
}

.subtable-header-gap {
  margin-top: 14px;
}

.subtable-header .pagination {
  margin-top: 0;
}

th.sortable {
  cursor: pointer;
}

th.sortable::after {
  content: " ↕";
  font-weight: 400;
  color: var(--muted);
}

.controls button {
  cursor: pointer;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
  animation: tab-fade-in 0.26s var(--ease-smooth);
}

.table-wrap {
  margin-top: 18px;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: auto;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

#projects-table {
  table-layout: fixed;
  min-width: 0;
  width: 100%;
}

#projects-table th,
#projects-table td {
  padding: 7px 8px;
}

#projects-table th:nth-child(1),
#projects-table td:nth-child(1) {
  width: 11%;
}

#projects-table th:nth-child(2),
#projects-table td:nth-child(2) {
  width: 7.5%;
}

#projects-table th:nth-child(3),
#projects-table td:nth-child(3) {
  width: 5%;
}

#projects-table th:nth-child(4),
#projects-table td:nth-child(4) {
  width: 18%;
}

#projects-table th:nth-child(5),
#projects-table td:nth-child(5) {
  width: 6%;
}

#projects-table th:nth-child(n + 6),
#projects-table td:nth-child(n + 6) {
  width: 6.5%;
}

#stats-open-table,
#stats-paid-table {
  table-layout: fixed;
}

#stats-open-table th:first-child,
#stats-open-table td:first-child,
#stats-paid-table th:first-child,
#stats-paid-table td:first-child {
  width: 40%;
}

#stats-open-table th:not(:first-child),
#stats-open-table td:not(:first-child),
#stats-paid-table th:not(:first-child),
#stats-paid-table td:not(:first-child) {
  width: 20%;
  text-align: right;
}

.table-wrap th,
.table-wrap td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

td.name-cell {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-link {
  display: inline-block;
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.table-wrap th {
  background: var(--table-head-bg);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

th.sortable {
  cursor: pointer;
  position: sticky;
}

th.sortable::after {
  content: "↕";
  font-size: 12px;
  margin-left: 6px;
  color: var(--accent);
}

th.sortable.asc::after {
  content: "↑";
}

th.sortable.desc::after {
  content: "↓";
}

.table-wrap tbody tr:hover {
  background: var(--row-hover);
}

.table-wrap tbody tr td {
  transition: background-color 0.16s var(--ease-smooth);
}

#projects-table tbody tr.project-row-open td {
  background: var(--row-open);
}

#projects-table tbody tr.project-row-open:hover td {
  background: var(--row-open-hover);
}

.empty-row td,
.empty-row:hover td {
  background: var(--empty-row-bg) !important;
}

.empty-row td:first-child {
  position: static !important;
  left: auto !important;
  z-index: 1 !important;
  box-shadow: none !important;
}

.empty-state-cell {
  padding: 14px 12px !important;
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state-text {
  color: var(--empty-text);
  font-weight: 600;
}

.empty-state-reset {
  padding: 6px 10px;
  font-size: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.pill.todo {
  background: var(--todo-soft);
  color: #b06b17;
  border: 1px solid #f1d2a7;
}

.pill.done {
  background: var(--done-soft);
  color: var(--done);
  border: 1px solid #c9e7cf;
}

.pill.not_needed {
  background: var(--not-needed-soft);
  color: var(--not-needed);
  border: 1px solid #d8dde3;
}

.pill.not_yet {
  background: #e3e6ea;
  color: #565c65;
  border: 1px solid #c7cdd6;
}

.status-select {
  padding: 3px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  min-width: 70px;
}

#projects-table .status-select {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.status-select.todo {
  background: #ffe3df;
  border-color: #f3b1a8;
  color: #8a1f14;
}

.status-select.not_needed {
  background: #eceff2;
  border-color: #d6dbe1;
  color: #6d737a;
}

.status-select.not_yet {
  background: #e0e3e7;
  border-color: #c1c7cf;
  color: #4f5660;
}

.status-select.done {
  background: #e4f6e8;
  border-color: #bfe3c7;
  color: #256b2e;
}

.isbn-cell {
  min-width: 210px;
  white-space: nowrap;
}

#projects-table .isbn-cell {
  min-width: 0;
}

th.launch-col,
td.launch-col {
  min-width: 110px;
  white-space: nowrap;
}

#projects-table th.launch-col,
#projects-table td.launch-col {
  min-width: 0;
}

.isbn-lines {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.isbn-lines span {
  color: var(--ink);
  font-weight: 600;
}

.isbn-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.isbn-copy.copied {
  color: #1f7a3a;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--toast-bg);
  color: var(--toast-ink);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  pointer-events: none;
}

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

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.4fr);
  gap: 24px;
  margin-top: 20px;
}

.card {
  background: var(--panel);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  animation: card-fade-in 0.24s var(--ease-smooth);
}

.tab.active .card:nth-of-type(1) { animation-delay: 0.01s; }
.tab.active .card:nth-of-type(2) { animation-delay: 0.03s; }
.tab.active .card:nth-of-type(3) { animation-delay: 0.05s; }
.tab.active .card:nth-of-type(4) { animation-delay: 0.07s; }
.tab.active .card:nth-of-type(5) { animation-delay: 0.09s; }
.tab.active .card:nth-of-type(6) { animation-delay: 0.11s; }
.tab.active .card { animation-fill-mode: both; }

.card:hover {
  box-shadow: 0 14px 30px rgba(60, 45, 20, 0.14);
  transition: box-shadow 0.2s var(--ease-smooth);
}

.card > .section-header {
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.card > .section-header h2 {
  margin: 0;
}

.card.collapsed > :not(.section-header) {
  display: none;
}

.collapse-toggle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--field-bg);
  cursor: pointer;
  position: relative;
}

.collapse-toggle::after {
  content: "▾";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 14px;
  transition: transform 0.18s var(--ease-smooth), color 0.18s var(--ease-smooth);
}

.card.collapsed .collapse-toggle::after {
  transform: rotate(-90deg);
}

#delivery .card + .card {
  margin-top: 32px;
}

#kdp .card + .card {
  margin-top: 32px;
}

#stats .card + .card {
  margin-top: 32px !important;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 0;
}

form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

form input,
form select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: var(--field-bg);
  color: var(--ink);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  gap: 12px;
}

.form-actions button {
  padding: 10px 16px;
}

.inline-select {
  padding: 3px 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
  min-width: 95px;
  background: var(--field-bg);
  color: var(--ink);
  transition: border-color 0.16s var(--ease-smooth), background-color 0.16s var(--ease-smooth),
    color 0.16s var(--ease-smooth), box-shadow 0.16s var(--ease-smooth);
}

.inline-select option {
  color: var(--ink);
}

.inline-select.todo {
  background: #ffe3df;
  border-color: #f3b1a8;
  color: #8a1f14;
}

.inline-select.beauftragt,
.inline-select.in_progress {
  background: #fff0d5;
  border-color: #f3c48a;
  color: #9b5a06;
}

.inline-select.done {
  background: #e4f6e8;
  border-color: #bfe3c7;
  color: #256b2e;
}

.inline-select.not_needed,
.inline-select.dash {
  background: #eceff2;
  border-color: #d6dbe1;
  color: #6d737a;
}

.inline-select.abgebrochen {
  background: #ffdada;
  border-color: #f0a7a7;
  color: #a32626;
}

.inline-input {
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 12px;
  width: 110px;
  background: var(--field-bg);
  color: var(--ink);
  transition: border-color 0.16s var(--ease-smooth), box-shadow 0.16s var(--ease-smooth),
    background-color 0.16s var(--ease-smooth);
}

#delivery-table {
  table-layout: fixed;
  width: 100%;
}

#delivery-table th,
#delivery-table td {
  padding: 4px 6px;
  white-space: nowrap;
}

#delivery-table th:not(:first-child),
#delivery-table td:not(:first-child) {
  width: 82px;
}

#delivery-table td input.inline-input {
  width: 74px;
}

#delivery .table-wrap {
  overflow-x: hidden;
}


#kdp-ads-table,
#kdp-roy-table {
  table-layout: fixed;
  width: 100%;
}

#kdp-ads-table th,
#kdp-ads-table td,
#kdp-roy-table th,
#kdp-roy-table td {
  padding: 4px 6px;
  white-space: nowrap;
}

#kdp-ads-table th:not(:first-child),
#kdp-ads-table td:not(:first-child),
#kdp-roy-table th:not(:first-child),
#kdp-roy-table td:not(:first-child) {
  width: 96px;
}

#kdp-ads-table td:first-child,
#kdp-roy-table td:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#kdp-ads-table th:last-child,
#kdp-ads-table td:last-child,
#kdp-roy-table th:last-child,
#kdp-roy-table td:last-child {
  width: 130px;
}

#kdp-ads-table td input.inline-input,
#kdp-roy-table td input.inline-input {
  width: 84px;
}

#sole-table {
  table-layout: fixed;
  width: 100%;
}

#sole-table th,
#sole-table td {
  padding: 4px 6px;
  white-space: nowrap;
}

#sole-table th:not(:first-child),
#sole-table td:not(:first-child) {
  width: 72px;
}

#sole-table td input.inline-input {
  width: 64px;
}

.sole-result-row td {
  background: var(--table-head-bg);
  font-weight: 700;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.status-chip.todo {
  background: #ffe3df;
  color: #8a1f14;
  border: 1px solid #f3b1a8;
}

.status-chip.beauftragt {
  background: #ffe9cc;
  color: #9c5b07;
  border: 1px solid #f3c48a;
}

.status-chip.done {
  background: #e4f6e8;
  color: #256b2e;
  border: 1px solid #bfe3c7;
}

.status-chip.not_needed,
.status-chip.due,
.status-chip.dash {
  background: #eceff2;
  color: #6d737a;
  border: 1px solid #d6dbe1;
}

.status-chip.abgebrochen {
  background: #ffdada;
  color: #a32626;
  border: 1px solid #f0a7a7;
}

.status-chip.in_progress {
  background: #fff0d5;
  color: #9b5a06;
  border: 1px solid #f3c48a;
}

@keyframes tab-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.step-control {
  display: grid;
  gap: 6px;
  min-width: 130px;
}

.cost-row {
  position: relative;
  display: flex;
  align-items: center;
}

.cost-paid {
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  appearance: none;
  border: 2px solid #c9b27a;
  border-radius: 4px;
  background: #fff8e6;
  cursor: pointer;
  background: transparent;
}

.cost-paid::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 2px;
  background: transparent;
}

.cost-paid:checked {
  border-color: #2f7a45;
  background: #e6f4ea;
}

.cost-paid:checked::after {
  content: "✓";
  display: grid;
  place-items: center;
  color: #2f7a45;
  font-size: 12px;
  font-weight: 700;
}

.cost-row .inline-input {
  padding-right: 44px;
}

.step-control select,
.step-control input {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 11px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--modal-backdrop);
}

.modal-panel {
  position: relative;
  background: var(--panel);
  border-radius: 20px;
  padding: 24px;
  width: min(900px, 92vw);
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow);
  z-index: 1;
}

.assets-panel {
  width: min(1120px, 96vw);
}

.assets-controls {
  margin-bottom: 8px;
}

.assets-controls label {
  flex: 1 1 420px;
}

.assets-controls label input {
  min-width: 360px;
}

.assets-folder-status {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.assets-folder-status.error {
  color: #b84a3f;
}

.assets-nav-controls {
  margin-bottom: 10px;
  align-items: center;
  gap: 8px;
}

.assets-nav-icon {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.assets-breadcrumbs {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.assets-breadcrumb-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.assets-breadcrumb-btn.active {
  background: var(--field-bg);
  cursor: default;
  opacity: 0.85;
}

.assets-breadcrumb-sep {
  color: var(--muted);
  font-size: 11px;
}

.assets-folder-tree-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--field-bg);
  margin-bottom: 10px;
  padding: 8px 10px;
}

.assets-folder-tree-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--muted);
}

.assets-folder-tree {
  max-height: 180px;
  overflow: auto;
}

.assets-tree-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.assets-tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.assets-tree-toggle {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 16px;
  min-width: 16px;
  padding: 0;
  cursor: pointer;
}

.assets-tree-toggle.placeholder {
  cursor: default;
}

.assets-tree-node {
  border: 0;
  background: transparent;
  text-align: left;
  width: auto;
  flex: 1 1 auto;
  color: var(--ink);
  font-size: 12px;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.assets-tree-node:hover {
  background: color-mix(in srgb, var(--field-bg) 70%, var(--panel) 30%);
}

.assets-tree-node.active {
  background: var(--panel);
  font-weight: 700;
}

.assets-tree-node.ancestor {
  color: var(--muted);
}

.assets-profile {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--field-bg);
}

.assets-profile-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.assets-profile-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px 14px;
}

.assets-profile-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.assets-profile-grid input,
.assets-profile-grid textarea {
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  font-size: 13px;
}

.assets-profile-grid textarea {
  min-height: 110px;
  resize: vertical;
}

.assets-profile-wide {
  grid-column: 1 / -1;
}

.assets-profile-actions {
  margin-top: 10px;
}

.assets-upload-controls {
  margin-bottom: 8px;
}

.assets-upload-controls label {
  min-width: 260px;
}

.assets-dropzone {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
  background: var(--field-bg);
}

.assets-dropzone.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--field-bg) 70%, var(--accent-soft) 30%);
  color: var(--ink);
}

.assets-requirements {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.assets-list-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.assets-required-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: var(--field-bg);
}

.assets-required-item.done {
  border-color: #9bd1a8;
  background: var(--done-soft);
  color: #23663a;
}

.assets-required-item.pending {
  border-color: #e7c79b;
  background: #fff3df;
  color: #8a5f22;
}

.assets-table-wrap {
  max-height: 52vh;
}

#assets-table th:nth-child(1),
#assets-table td:nth-child(1) {
  width: 38%;
}

#assets-table th:nth-child(2),
#assets-table td:nth-child(2) {
  width: 10%;
}

#assets-table th:nth-child(3),
#assets-table td:nth-child(3) {
  width: 12%;
  text-align: right;
}

#assets-table th:nth-child(4),
#assets-table td:nth-child(4) {
  width: 16%;
}

#assets-table th:nth-child(5),
#assets-table td:nth-child(5),
#assets-table th:nth-child(6),
#assets-table td:nth-child(6) {
  width: 12%;
}

.assets-entry-link {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.assets-entry-link:hover {
  text-decoration: underline;
}

.assets-entry-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assets-entry-icon {
  width: 18px;
  text-align: center;
  flex: 0 0 18px;
  opacity: 0.85;
}

.asset-row {
  cursor: default;
}

.asset-row:hover {
  background: color-mix(in srgb, var(--field-bg) 72%, var(--panel) 28%);
}

.asset-row.selected {
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--panel) 45%);
}

#assets-table td {
  user-select: none;
}

#assets-table td:nth-child(6) {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.asset-open-btn {
  padding: 5px 8px;
  font-size: 11px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-close {
  border: 1px solid var(--border);
  background: var(--field-bg);
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--ink);
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
.table-wrap td strong {
  display: inline-block;
  white-space: nowrap;
}

.meta-button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  cursor: pointer;
  display: inline-block;
  position: relative;
}

.meta-button::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.15;
}

.contrib-title-cell {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}

.contrib-title-cell .meta-button {
  width: 14px;
  height: 14px;
  border-width: 1.5px;
}

.contrib-title-cell .meta-button::after {
  inset: 3px;
}

.contrib-chart-panel {
  width: min(1120px, 96vw);
}

.contrib-chart-controls {
  margin-bottom: 10px;
}

.contrib-chart-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.contrib-overview-block {
  margin: 0 0 14px;
}

.contrib-overview-controls {
  margin-bottom: 10px;
}

.contrib-overview-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-wrap {
  position: relative;
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--chart-wrap-bg);
  padding: 8px;
}

.chart-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 92px;
  padding: 8px 10px;
  border: 1px solid var(--chart-tooltip-border);
  border-radius: 8px;
  background: var(--chart-tooltip-bg);
  color: var(--chart-tooltip-ink);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
  pointer-events: none;
  z-index: 5;
}

.chart-tooltip.active {
  display: flex;
}

.chart-tooltip-amount {
  font-weight: 700;
  line-height: 1.2;
}

.chart-tooltip-month {
  font-size: 12px;
  opacity: 0.85;
  line-height: 1.2;
}

/* Sticky first column for major data tables */
:is(
  #projects-table,
  #monthly-table,
  #stats-revenue-table,
  #contrib-table,
  #stats-open-table,
  #stats-paid-table,
  #delivery-table,
  #kdp-ads-table,
  #kdp-roy-table,
  #sole-table
) th:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--table-head-bg);
  box-shadow: 1px 0 0 var(--border);
}

:is(
  #projects-table,
  #monthly-table,
  #stats-revenue-table,
  #contrib-table,
  #stats-open-table,
  #stats-paid-table,
  #delivery-table,
  #kdp-ads-table,
  #kdp-roy-table,
  #sole-table
) td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--sticky-col-bg);
  box-shadow: 1px 0 0 var(--border);
}

:is(
  #projects-table,
  #monthly-table,
  #stats-revenue-table,
  #contrib-table,
  #stats-open-table,
  #stats-paid-table,
  #delivery-table,
  #kdp-ads-table,
  #kdp-roy-table,
  #sole-table
) tbody tr:hover td:first-child {
  background: var(--row-hover);
}
