:root {
  --font-sans: "IBM Plex Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --color-primary-600: #1f4b99;
  --color-primary-700: #173d7f;
  --color-primary-050: #e9f0fb;

  --color-neutral-0: #f7f8fa;
  --color-neutral-50: #f1f3f6;
  --color-neutral-100: #e6eaf0;
  --color-neutral-200: #d1d8e2;
  --color-neutral-300: #b8c2cf;
  --color-neutral-400: #95a3b3;
  --color-neutral-500: #6b7c8f;
  --color-neutral-600: #4e5f73;
  --color-neutral-700: #344657;
  --color-neutral-800: #22313f;
  --color-neutral-900: #121a22;

  --color-success-600: #2e7d5b;
  --color-success-100: #d9efe6;
  --color-warning-600: #b7791f;
  --color-warning-100: #f8ecd2;
  --color-danger-600: #b23a3a;
  --color-danger-100: #f4d7d7;
  --color-info-600: #2f5b8a;
  --color-info-100: #dbe8f3;

  --color-surface: #ffffff;
  --color-border: var(--color-neutral-200);
  --color-text: var(--color-neutral-800);
  --color-text-muted: var(--color-neutral-600);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-9: 40px;
  --space-10: 48px;
  --space-12: 64px;

  --page-narrow: 880px;
  --page-normal: 1160px;
  --page-wide: 1400px;
  --page-full: 100%;
  --topbar-height: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-neutral-0);
  font-size: 14px;
  line-height: 1.5;
}

.auth-page {
  min-height: 100vh;
  background: var(--color-neutral-0);
}

a {
  color: var(--color-primary-600);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-700);
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  color: var(--color-text);
}

h1 {
  font-size: 28px;
  line-height: 36px;
}

h2 {
  font-size: 22px;
  line-height: 30px;
}

h3 {
  font-size: 18px;
  line-height: 26px;
}

h4 {
  font-size: 16px;
  line-height: 24px;
}

p {
  margin: 0;
}

small {
  color: var(--color-text-muted);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.public-shell {
  min-height: 100vh;
  background: var(--color-neutral-0);
}

.public-shell__content {
  padding: var(--space-8);
}

.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  min-height: var(--topbar-height);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
  color: var(--color-text);
}

.topbar__brand a {
  color: var(--color-text);
}

.topbar__brand a:hover {
  color: var(--color-primary-700);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--color-neutral-50);
  box-shadow: var(--shadow-xs);
  object-fit: contain;
  display: block;
}

.brand-name {
  font-size: 16px;
  letter-spacing: 0.01em;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.locale-switch {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.locale-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-neutral-50);
  font-size: 12px;
  color: var(--color-neutral-700);
}

.locale-option.is-active {
  background: var(--color-primary-050);
  color: var(--color-primary-700);
  border-color: rgba(31, 75, 153, 0.3);
}

.locale-flag {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.user-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--color-text-muted);
}

.user-dropdown {
  position: relative;
}

.user-dropdown .user-meta {
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.user-dropdown .user-meta:hover {
  background: var(--color-neutral-50);
}

.user-email {
  display: inline-flex;
  align-items: center;
}

.dropdown-icon {
  width: 16px;
  height: 16px;
  margin-left: var(--space-1);
  transition: transform 0.2s ease;
}

.user-dropdown .user-meta:hover .dropdown-icon {
  transform: translateY(2px);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-2);
  z-index: 50;
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s ease;
}

.dropdown-item:hover {
  background: var(--color-neutral-50);
  color: var(--color-text);
}

.dropdown-item-icon {
  width: 18px;
  height: 18px;
  color: var(--color-neutral-600);
}

.app-shell__body {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
}

.app-sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--space-6) var(--space-4);
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-4);
}

.sidebar-brand__title {
  font-weight: 600;
  color: var(--color-text);
  font-size: 14px;
}

.sidebar-brand__meta {
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.sidebar__nav {
  display: grid;
  gap: var(--space-2);
}

.sidebar__nav--tree {
  gap: var(--space-3);
}

.sidebar-tree__country {
  display: grid;
  gap: 6px;
}

.sidebar-tree__plans {
  margin: 0;
  padding: 0 0 0 var(--space-4);
  list-style: none;
  border-left: 1px solid var(--color-border);
  display: grid;
  gap: 4px;
}

.sidebar-tree__plan {
  margin: 0;
}

.sidebar-tree__plan-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 14px;
}

.nav-item:hover {
  background: var(--color-neutral-50);
}

.nav-item.is-active {
  background: var(--color-primary-050);
  color: var(--color-primary-700);
  font-weight: 600;
}

.nav-item--country {
  font-weight: 600;
}

.nav-item--plan {
  font-size: 13px;
  color: var(--color-neutral-700);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.nav-item--plan::before {
  content: "•";
  color: var(--color-neutral-400);
  margin-right: 6px;
}

.app-shell__content {
  padding: var(--space-6) var(--space-8);
  overflow: auto;
}

.page {
  max-width: var(--page-normal);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.page--narrow {
  max-width: var(--page-narrow);
}

.page--wide {
  max-width: var(--page-wide);
}

.page--full {
  max-width: var(--page-full);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.page-title {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.page-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
}

.page-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.plan-actions {
  align-items: center;
}

.plan-actions__inline-form {
  margin: 0;
}

.plan-actions__button {
  justify-content: center;
}

.wave-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.wave-actions__buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
}

.wave-actions__button-row {
  display: flex;
  justify-content: flex-start;
}

.wave-actions__button-row--right {
  justify-content: flex-end;
}

.wave-actions__inline-form {
  margin: 0;
}

.wave-actions__button {
  justify-content: center;
}

.breadcrumb {
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: 13px;
  color: var(--color-text-muted);
  align-items: center;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.code-chip {
  font-family: var(--font-mono);
  background: var(--color-neutral-50);
  border: 1px solid var(--color-border);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--color-neutral-700);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.card--tight {
  padding: var(--space-4);
  gap: var(--space-2);
}

.card-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.kpi-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.kpi-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kpi-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.kpi-value {
  font-size: 24px;
  font-weight: 600;
  color: var(--color-text);
}

.table-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.table thead th {
  background: var(--color-neutral-50);
  color: var(--color-neutral-600);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-neutral-100);
  vertical-align: middle;
}

.table tbody tr:hover td {
  background: var(--color-neutral-50);
}

.table td .link + .link {
  margin-left: var(--space-3);
}

.table--dense thead th {
  padding: 8px 10px;
}

.table--dense tbody td {
  padding: 8px 10px;
}

.table--striped tbody tr:nth-child(even) td {
  background: #fbfcfe;
}

.table--sticky thead th {
  position: sticky;
  top: 0;
  z-index: 5;
}

.table-sticky {
  position: sticky;
  left: 0;
  background: var(--color-surface);
  z-index: 4;
  border-right: 1px solid var(--color-border);
}

.table-sticky--header {
  background: var(--color-neutral-50);
  z-index: 6;
}

.sticky-col--region {
  min-width: 96px;
  width: 96px;
}

.sticky-col--wave {
  min-width: 64px;
  width: 64px;
}

.sticky-col--progress {
  min-width: 120px;
  width: 120px;
}

.table--matrix thead th {
  text-align: center;
}

.table--matrix tbody td {
  text-align: center;
}

.table--matrix .table-sticky {
  text-align: left;
}

.table--gantt thead th {
  white-space: nowrap;
}

.table--gantt .timeline-col {
  text-align: center;
  min-width: 72px;
}

.table-wrap--global-gantt {
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: none;
  max-height: calc(100dvh - var(--topbar-height) - 80px);
}
.table-wrap--global-gantt::-webkit-scrollbar {
  display: none;
}

.table--global-gantt thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.table--global-gantt thead th {
  background: var(--color-neutral-50);
}

.timeline-col--current {
  position: relative;
}
.timeline-col--current::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #e53e3e;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 5;
}

.gantt-scroll-outer {
  position: relative;
}

.gantt-sticky-scrollbar {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-bottom: 0;
  box-shadow: var(--shadow-xs);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
}

.gantt-sticky-scrollbar.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.gantt-sticky-scrollbar__phantom {
  height: 1px;
}

.table--global-gantt {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.table--global-gantt th,
.table--global-gantt td {
  white-space: nowrap;
}

.table--global-gantt th:nth-child(1),
.table--global-gantt td:nth-child(1) {
  min-width: 88px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--color-surface);
}

.table--global-gantt th:nth-child(2),
.table--global-gantt td:nth-child(2) {
  min-width: 240px;
  position: sticky;
  left: 88px;
  z-index: 2;
  background: var(--color-surface);
  border-right: 2px solid var(--color-neutral-200);
}

/* thead sticky-Spalten: höherer z-index (sticky vertikal + horizontal) */
.table--global-gantt thead th:nth-child(1),
.table--global-gantt thead th:nth-child(2) {
  z-index: 11;
  background: var(--color-neutral-50);
}

.table--global-gantt th:nth-child(3),
.table--global-gantt td:nth-child(3) {
  min-width: 124px;
}

.table--global-gantt th:nth-child(4),
.table--global-gantt td:nth-child(4),
.table--global-gantt th:nth-child(5),
.table--global-gantt td:nth-child(5) {
  min-width: 108px;
}

.table--global-gantt th:nth-child(6),
.table--global-gantt td:nth-child(6),
.table--global-gantt th:nth-child(7),
.table--global-gantt td:nth-child(7) {
  min-width: 72px;
}

.table--global-gantt th:nth-child(8),
.table--global-gantt td:nth-child(8) {
  min-width: 160px;
}

.table--global-gantt .timeline-col {
  min-width: 76px;
  width: 76px;
  padding: 6px 4px;
  border-right: 1px solid var(--color-neutral-100);
}

.table--global-gantt .timeline-col:last-child {
  border-right: none;
}

.table-section--country td {
  background: var(--color-surface);
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 13px;
}

.gantt-country-code {
  margin-left: 8px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.gantt-plan-toggle {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.gantt-plan-toggle__icon {
  display: inline-flex;
  width: 12px;
  flex: 0 0 12px;
  color: var(--color-text-muted);
  transition: transform 0.15s ease;
}

.gantt-plan-toggle[aria-expanded="true"] .gantt-plan-toggle__icon {
  transform: rotate(90deg);
}

.gantt-plan-toggle__meta {
  margin-left: auto;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.02em;
}

.gantt-detail-toggle {
  appearance: none;
  border: 1px solid var(--color-neutral-200);
  background: var(--color-surface);
  padding: 2px 10px;
  margin-left: 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
}

.gantt-detail-toggle:hover {
  background: var(--color-neutral-100);
  color: var(--color-text);
  border-color: var(--color-neutral-300);
}

.gantt-detail-toggle[aria-expanded="true"] {
  background: var(--color-primary-050);
  color: var(--color-primary-600);
  border-color: var(--color-primary-600);
}

.gantt-row--wave-detail td {
  background: var(--color-neutral-0);
  padding: var(--space-4);
}

.wave-detail-timeline {
  padding: var(--space-2) 0;
}

.wave-detail-timeline__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 var(--space-3) 0;
}

.gantt-row--plan td {
  background: #f8fbff;
}
.gantt-row--plan td:nth-child(1),
.gantt-row--plan td:nth-child(2) {
  background: #f8fbff;
}

.gantt-row--wave td:first-child {
  background: var(--color-neutral-50);
}

.gantt-row--wave td:nth-child(2) {
  padding-left: 24px;
  background: var(--color-surface);
}

.timeline-col--active {
  background: #e7f3ea;
}

.timeline-col--plan.timeline-col--active {
  background: #cfe8d5;
}

.timeline-col--wave.timeline-col--active {
  background: #def1e4;
}

.gantt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 20px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 600;
  background: #2e7d5b;
  color: #ffffff;
  white-space: nowrap;
}

.gantt-chip--plan {
  background: #1f4b99;
}

.gantt-chip--link,
.gantt-chip--link:visited {
  color: #ffffff;
  text-decoration: none;
}

.gantt-chip--link:hover,
.gantt-chip--link:focus-visible {
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 0 0 2px rgba(46, 125, 91, 0.25);
}

.gantt-cell-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.gantt-chip--wave-label {
  font-size: 9px;
  min-width: 24px;
  height: 16px;
  padding: 0 4px;
  background: #2e7d5b;
}

.gantt-chip--devices {
  font-size: 8px;
  height: 14px;
  padding: 0 3px;
  background: #e67e22;
}

.gantt-kw-devices {
  font-size: 11px;
  color: #e67e22;
  font-weight: 700;
  margin-top: 2px;
}

.table-group th {
  background: var(--color-neutral-100);
  color: var(--color-neutral-700);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--color-border);
}

.table-section td {
  background: var(--color-neutral-50);
  color: var(--color-neutral-700);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 12px;
  border-bottom: 1px solid var(--color-border);
}

.table--matrix thead th,
.table--matrix tbody td {
  border-right: 1px solid var(--color-neutral-100);
}

.table--matrix thead th:last-child,
.table--matrix tbody td:last-child {
  border-right: none;
}

.table--matrix thead th div:first-child {
  font-weight: 600;
  color: var(--color-neutral-700);
}

.table--matrix thead th div:last-child {
  font-size: 11px;
  color: var(--color-text-muted);
}

.matrix-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--color-primary-600);
  color: #ffffff;
  font-size: 11px;
  padding: 2px 6px;
  min-height: 20px;
}

.matrix-chip:hover {
  background: var(--color-primary-700);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge--neutral {
  background: var(--color-neutral-50);
  color: var(--color-neutral-700);
}

.badge--info {
  background: var(--color-info-100);
  color: var(--color-info-600);
}

.badge--success {
  background: var(--color-success-100);
  color: var(--color-success-600);
}

.badge--warning {
  background: var(--color-warning-100);
  color: var(--color-warning-600);
}

.badge--danger {
  background: var(--color-danger-100);
  color: var(--color-danger-600);
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--color-neutral-100);
  color: var(--color-neutral-700);
}

.role-badge--admin {
  background: var(--color-danger-100);
  color: var(--color-danger-600);
}

.role-badge--planner {
  background: var(--color-info-100);
  color: var(--color-info-600);
}

.role-badge--internal {
  background: var(--color-primary-050);
  color: var(--color-primary-700);
}

.progress {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--color-text-muted);
}

.progress__track {
  width: 96px;
  height: 6px;
  border-radius: 999px;
  background: var(--color-neutral-100);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--color-primary-600);
  transition: width 0.3s ease;
}

.progress__value {
  font-variant-numeric: tabular-nums;
}

.progress--lg .progress__track {
  width: 128px;
  height: 10px;
}

.progress--success .progress__bar {
  background: var(--color-success-600);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
}

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

.btn--primary:hover {
  background: var(--color-primary-700);
}

.btn--secondary {
  background: var(--color-neutral-50);
  border-color: var(--color-border);
  color: var(--color-neutral-700);
}

.btn--secondary:hover {
  background: var(--color-neutral-100);
}

.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-neutral-600);
}

.btn--ghost:hover {
  color: var(--color-text);
  background: var(--color-neutral-50);
}

.btn--danger {
  background: var(--color-danger-600);
  color: #ffffff;
}

.btn--danger:hover {
  background: #992f2f;
}

.link {
  color: var(--color-primary-600);
  font-weight: 600;
  font-size: 13px;
}

.link:hover {
  color: var(--color-primary-700);
  text-decoration: underline;
}

.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-neutral-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.input {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
}

.input:focus {
  outline: none;
  border-color: var(--color-primary-600);
  box-shadow: 0 0 0 3px rgba(31, 75, 153, 0.15);
}

.field-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.field-error {
  font-size: 12px;
  color: var(--color-danger-600);
  margin-top: 4px;
}

.field {
  margin-bottom: var(--space-4);
}

.plan-notes {
  margin-top: var(--space-2);
  width: min(720px, 100%);
}

.plan-notes__row {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}

.plan-notes__input {
  min-height: 84px;
  resize: vertical;
  flex: 1;
}

.plan-notes__save {
  white-space: nowrap;
  align-self: flex-start;
  padding: 6px 10px;
  font-size: 12px;
  min-height: 34px;
}

.public-share-url-row {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.public-share-url {
  font-family: var(--font-mono);
  font-size: 13px;
  flex: 1;
  min-width: 0;
}

.public-share-copy {
  white-space: nowrap;
  flex-shrink: 0;
}

.kw-datepicker {
  position: relative;
}

.kw-datepicker__display {
  cursor: pointer;
}

.kw-datepicker__popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: 320px;
  max-width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-2);
}

.kw-datepicker__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.kw-datepicker__month {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-neutral-800);
  text-transform: capitalize;
}

.kw-datepicker__nav {
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-neutral-700);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.kw-datepicker__nav:hover {
  background: var(--color-neutral-50);
}

.kw-datepicker__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.kw-datepicker__weekday {
  padding: 4px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
}

.kw-datepicker__weekday--kw {
  width: 36px;
}

.kw-datepicker__week-number {
  width: 36px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary-700);
  background: var(--color-primary-050);
  border-radius: 4px;
}

.kw-datepicker__day-cell {
  text-align: center;
  padding: 2px 0;
}

.kw-datepicker__day {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.kw-datepicker__day:hover {
  background: var(--color-neutral-50);
}

.kw-datepicker__day.is-outside {
  color: var(--color-neutral-400);
}

.kw-datepicker__day.is-today {
  border-color: var(--color-primary-600);
}

.kw-datepicker__day.is-selected {
  background: var(--color-primary-600);
  color: #ffffff;
  border-color: var(--color-primary-600);
}

.field-label-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.field-label-row .label {
  margin-bottom: 0;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-neutral-50);
  color: var(--color-neutral-600);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  position: relative;
  cursor: help;
}

.info-icon::after,
.info-icon::before {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  position: absolute;
  left: 50%;
}

.info-icon::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: var(--color-neutral-900);
  color: #ffffff;
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 30;
  box-shadow: var(--shadow-xs);
}

.info-icon::before {
  content: "";
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border-width: 4px 4px 0 4px;
  border-style: solid;
  border-color: var(--color-neutral-900) transparent transparent transparent;
  z-index: 29;
}

.info-icon:hover::after,
.info-icon:hover::before,
.info-icon:focus::after,
.info-icon:focus::before {
  opacity: 1;
}

.form-group {
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-neutral-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-control {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-surface);
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary-600);
  box-shadow: 0 0 0 3px rgba(31, 75, 153, 0.15);
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

.option-list {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-neutral-50);
}

.option-title {
  font-weight: 600;
  color: var(--color-text);
  font-size: 14px;
  cursor: pointer;
}

.inline-form {
  display: inline;
}

.option-body {
  flex: 1;
}

.file-input {
  width: 100%;
  font-size: 13px;
  color: var(--color-text-muted);
}

.file-input::file-selector-button {
  margin-right: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  background: var(--color-neutral-50);
  color: var(--color-neutral-700);
  font-weight: 600;
}

.file-input::file-selector-button:hover {
  background: var(--color-neutral-100);
}

.alert {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 13px;
  margin-bottom: var(--space-4);
}

.alert--success {
  background: var(--color-success-100);
  border-color: var(--color-success-600);
  color: var(--color-success-600);
}

.alert--danger {
  background: var(--color-danger-100);
  border-color: var(--color-danger-600);
  color: var(--color-danger-600);
}

.callout {
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  justify-content: space-between;
  flex-wrap: wrap;
  background: var(--color-neutral-50);
  margin-top: var(--space-4);
}

.callout__content {
  flex: 1;
  min-width: 200px;
}

.callout--warning {
  background: var(--color-warning-100);
  border-color: var(--color-warning-600);
  color: var(--color-warning-600);
}

.callout--info {
  background: var(--color-info-100);
  border-color: var(--color-info-600);
  color: var(--color-info-600);
}

.callout--danger {
  background: var(--color-danger-100);
  border-color: var(--color-danger-600);
  color: var(--color-danger-600);
}

.callout ul {
  margin: 0;
  padding-left: 18px;
}

.empty-state {
  text-align: center;
  padding: var(--space-8);
  color: var(--color-text-muted);
  display: grid;
  gap: var(--space-3);
  justify-items: center;
}

.empty-state::before {
  content: "";
  width: 44px;
  height: 44px;
  background: url("../images/icon.svg") center/contain no-repeat;
  opacity: 0.4;
}

.data-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--space-2) var(--space-6);
  font-size: 13px;
}

.data-grid dt {
  color: var(--color-text-muted);
}

.data-grid dd {
  margin: 0;
  font-weight: 600;
  color: var(--color-text);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--color-neutral-300);
}

.status-dot--pending {
  background: var(--color-neutral-300);
}

.status-dot--processing {
  background: var(--color-warning-600);
  animation: status-pulse 1.6s ease-in-out infinite;
}

.status-dot--completed {
  background: var(--color-success-600);
}

.status-dot--failed {
  background: var(--color-danger-600);
}

@keyframes status-pulse {
  0% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.5;
  }
}

.timeline {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow-x: auto;
}

.timeline__grid {
  position: relative;
  --day-count: 1;
}

.timeline__grid::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: calc(100% / var(--day-count)) 100%;
  background-image: linear-gradient(to right, var(--color-neutral-100) 1px, transparent 1px);
  pointer-events: none;
  z-index: 1;
}

.timeline__today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-danger-600);
  left: calc((var(--today-col) - 0.5) * (100% / var(--day-count)));
  z-index: 2;
  pointer-events: none;
}

.timeline__week-header {
  display: grid;
  grid-template-columns: repeat(var(--day-count), minmax(48px, 1fr));
  gap: 0;
  margin-bottom: var(--space-1);
  padding-bottom: var(--space-1);
  border-bottom: 1px dashed var(--color-border);
  position: relative;
  z-index: 2;
}

.timeline__week {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
}

.timeline__header {
  display: grid;
  grid-template-columns: repeat(var(--day-count), minmax(48px, 1fr));
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
  position: relative;
  z-index: 2;
}

.timeline__day {
  text-align: center;
  font-size: 11px;
  color: var(--color-text-muted);
}

.timeline__day.is-off {
  background: var(--color-neutral-50);
  border-radius: var(--radius-sm);
}

.timeline__day div:first-child {
  font-weight: 600;
  color: var(--color-neutral-700);
}

.timeline__day div:last-child {
  font-size: 10px;
}

.timeline__row {
  display: grid;
  grid-template-columns: repeat(var(--day-count), minmax(48px, 1fr));
  align-items: center;
  height: 28px;
  margin-bottom: 6px;
  position: relative;
  z-index: 2;
}

.timeline__bar {
  height: 24px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.timeline__bar--editable {
  cursor: pointer;
}

.timeline__bar--editable:hover {
  filter: brightness(0.95);
}

.timeline__bar--complete {
  background: var(--color-success-600);
}

.timeline__bar--planned {
  background: var(--color-primary-600);
}

.timeline__bar--overdue {
  background: var(--color-danger-600);
}

.checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

.task-completion-cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.task-name-toggle {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.task-name-toggle:hover {
  color: var(--color-primary-700);
  text-decoration: underline;
}

.task-name-toggle.is-open {
  color: var(--color-primary-700);
}

.task-tracking__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-neutral-50);
  color: var(--color-neutral-700);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  user-select: none;
}

.task-tracking__toggle:hover {
  background: var(--color-neutral-100);
}

.task-tracking__toggle.is-open {
  background: var(--color-primary-600);
  border-color: var(--color-primary-600);
  color: #ffffff;
}

.task-tracking__form {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.task-tracking__form[hidden] {
  display: none;
}

.task-tracking-row[hidden] {
  display: none;
}

.task-tracking-row td {
  background: var(--color-neutral-50);
}

.task-tracking__panel {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-1) 0;
}

.task-tracking__list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.task-tracking__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.task-tracking__input {
  min-width: 220px;
  max-width: 280px;
  padding: 6px 8px;
  font-size: 13px;
}

.task-tracking__save {
  padding: 6px 10px;
}

.task-tracking__value {
  display: block;
  color: var(--color-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.task-tracking__delete-form {
  margin: 0;
}

.task-tracking__delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-danger-600);
  background: var(--color-danger-600);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  cursor: pointer;
}

.task-tracking__delete:hover {
  background: #992f2f;
  border-color: #992f2f;
}

.row-success td {
  background: var(--color-success-100);
}

.row-success:hover td {
  background: var(--color-success-100);
}

.row-overdue td {
  background: var(--color-danger-100);
}

.row-overdue:hover td {
  background: var(--color-danger-100);
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
}

.auth-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 1fr);
  gap: var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-8);
}

.auth-panel {
  background: linear-gradient(135deg, rgba(31, 75, 153, 0.08), rgba(47, 91, 138, 0.02));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: grid;
  gap: var(--space-4);
  align-content: start;
}

.auth-logo {
  width: 48px;
  height: 48px;
}

.auth-title {
  font-size: 22px;
  line-height: 30px;
  font-weight: 600;
  color: var(--color-text);
}

.auth-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
}

.auth-meta {
  display: grid;
  gap: var(--space-3);
  font-size: 12px;
  color: var(--color-text-muted);
}

.auth-meta strong {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-neutral-700);
}

.auth-form {
  display: grid;
  gap: var(--space-4);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--color-text-muted);
}

.auth-links {
  font-size: 13px;
}

@media (max-width: 900px) {
  .auth-card {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 1100px) {
  .app-shell__body {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    position: static;
    height: auto;
  }

  .sidebar__nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(160px, 1fr);
    overflow-x: auto;
  }

  .sidebar__nav--tree {
    display: block;
    overflow-x: visible;
  }

  .sidebar__nav--tree > .nav-item {
    margin-bottom: var(--space-2);
  }

  .table--global-gantt .timeline-col {
    min-width: 76px;
    width: 76px;
  }
}

@media (max-width: 720px) {
  .topbar__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .plan-notes__row {
    flex-direction: column;
  }

  .plan-notes__save {
    align-self: flex-start;
  }
}

.density-compact .table thead th,
.density-compact .table tbody td {
  padding: 6px 10px;
}

.density-compact .input {
  padding: 6px 10px;
}

.density-compact .btn {
  padding: 6px 12px;
  font-size: 12px;
}
