:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --text: #17202a;
  --muted: #647184;
  --line: #d8e0e7;
  --brand: #0e6f68;
  --brand-dark: #0a514d;
  --brand-soft: #e2f2ef;
  --ok: #13804f;
  --warn: #b76a00;
  --bad: #bf2f24;
  --soft: #edf3f6;
  --shadow: 0 16px 42px rgba(23, 32, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px/1.45 Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    linear-gradient(180deg, #dfe9ec 0, rgba(223, 233, 236, 0) 340px),
    var(--bg);
}

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

button {
  border: 0;
  border-radius: 6px;
  padding: 9px 14px;
  color: white;
  background: var(--brand);
  cursor: pointer;
}

button:hover { background: var(--brand-dark); }
button.secondary { color: var(--text); background: #e8edf2; }
button.secondary:hover { background: #dbe3ea; }
button.danger { background: var(--bad); }
button.icon-btn { width: 32px; height: 32px; padding: 0; background: #e8edf2; color: var(--text); }

.hidden { display: none !important; }

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

.login-panel {
  width: min(430px, 100%);
  padding: 30px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.login-panel h1 { margin: 0 0 8px; font-size: 26px; }
.login-panel p { margin-bottom: 22px; }
label { display: grid; gap: 6px; }
label + label { margin-top: 12px; }
label span { color: var(--muted); font-size: 12px; font-weight: 700; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  background: white;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 111, 104, 0.13);
}

textarea { resize: vertical; }
.error { min-height: 20px; color: var(--bad); }

.app { max-width: 1540px; margin: 0 auto; padding: 26px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 2px; font-size: 28px; }
h2 { margin-bottom: 4px; font-size: 22px; }
h3 { margin-bottom: 8px; font-size: 16px; }
p { color: var(--muted); }

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin-bottom: 20px;
  width: fit-content;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
}

.tabs button {
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.tabs button.active {
  color: white;
  background: var(--brand);
}

.tab { display: none; }
.tab.active { display: block; }

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

.section-head { margin-bottom: 14px; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.04);
}

.summary-card span { color: var(--muted); font-weight: 700; }
.summary-card strong { display: block; margin-top: 4px; font-size: 28px; }
.summary-card p { margin-bottom: 0; }
.summary-card.accent { border-color: rgba(14, 111, 104, 0.35); background: var(--brand-soft); }
.summary-card.danger-card { border-color: rgba(191, 47, 36, 0.35); background: #fff0ee; }

.split-grid {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(560px, 1.1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(23, 32, 42, 0.05);
}

.sprint-panel {
  margin-bottom: 16px;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #344054;
  background: #f0f4f7;
  font-size: 12px;
  font-weight: 800;
}

tr:last-child td { border-bottom: 0; }
td input, td select { min-width: 86px; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; z-index: 2; background: inherit; }
.matrix th:first-child { background: #f0f4f7; }
.matrix td:first-child { font-weight: 800; background: white; }
.compact th, .compact td { padding: 8px 10px; }

.direction-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 800;
}

.hour-input { max-width: 92px; text-align: right; }
.order-input { max-width: 86px; text-align: right; }
.sprint-name { min-width: 120px; margin-bottom: 6px; }
.sprint-dates { display: grid; gap: 5px; }
.sprint-title { font-weight: 800; }
.sprint-actions {
  display: flex;
  gap: 8px;
}
.empty-cell {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.load-cell {
  display: grid;
  gap: 4px;
  min-width: 105px;
  font-size: 12px;
  color: var(--muted);
}

.load-cell span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.leftover.positive { color: var(--ok); }
.leftover.zero { color: var(--muted); }
.leftover.negative { color: var(--bad); font-weight: 800; }
.total-row td { background: #fbfcfd; font-weight: 800; }

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 230px;
  gap: 10px;
  margin-bottom: 14px;
}

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

.task-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.25fr) minmax(190px, 0.8fr) minmax(290px, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 32, 42, 0.04);
}

.task-title { font-weight: 800; font-size: 16px; }
.task-meta { color: var(--muted); font-size: 13px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 4px 8px; border-radius: 999px; color: #24515a; background: var(--soft); font-size: 12px; font-weight: 700; }
.money { margin-bottom: 8px; font-weight: 800; }
.empty { padding: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }

.status-list { display: grid; gap: 5px; font-size: 12px; }

.status {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f2f4f7;
}

.status.deployed { color: var(--ok); background: #e8f6ef; }
.status.planned { color: var(--warn); background: #fff4e5; }

.roadmap-timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.roadmap-column {
  min-height: 280px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.roadmap-column.muted-column {
  background: #f5f7f9;
}

.roadmap-column-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.roadmap-column-head h4 {
  margin: 0;
  font-size: 15px;
}

.roadmap-column-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.roadmap-items {
  display: grid;
  gap: 9px;
}

.roadmap-card {
  display: grid;
  gap: 7px;
  padding: 11px;
  border: 1px solid #dce5eb;
  border-left: 4px solid var(--warn);
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 18px rgba(23, 32, 42, 0.04);
}

.roadmap-card.deployed {
  border-left-color: var(--ok);
}

.roadmap-card.not_deployed {
  border-left-color: var(--muted);
}

.roadmap-card-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.roadmap-status {
  color: var(--brand);
  font-weight: 800;
}

.roadmap-card strong {
  font-size: 14px;
}

.roadmap-card p {
  margin: 0;
  font-size: 12px;
}

.roadmap-placeholder {
  padding: 16px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.roadmap-empty {
  min-width: 420px;
}

.rates-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(560px, 1.2fr);
  gap: 18px;
}

dialog {
  width: min(980px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(23, 32, 42, 0.42); }
.dialog-form { padding: 20px; }
.dialog-head, .dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

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

.effort-grid, .deployment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.deployment-item {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

@media (max-width: 1100px) {
  .split-grid, .rates-layout { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .app { padding: 14px; }
  .topbar, .section-head, .panel-head { align-items: stretch; flex-direction: column; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; }
  .filters, .task-row, .form-grid { grid-template-columns: 1fr; }
  th, td { white-space: normal; }
  .roadmap-timeline { grid-auto-columns: minmax(240px, 86vw); }
}
