:root {
  --orange: #FF4712;
  --blue: #005078;
  --gray: #EBECEC;
  --dark: #101417;
  --dark2: #1a2126;
  --white: #FFFFFF;
  --muted: #5a6268;
  --green: #2fa84f;
  --yellow: #d69a00;
  --red: #c00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Ubuntu', Arial, sans-serif;
  background: var(--gray);
  color: var(--dark);
}

a { color: inherit; text-decoration: none; }

/* Header / nav */

.site-header {
  background: var(--dark);
  color: var(--white);
}

.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header__logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.site-header__title {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.site-header__title-accent {
  color: var(--orange);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-actions__link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: underline;
}

.header-actions__link:hover { color: var(--white); }

.logout-btn {
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--white);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
}

.logout-btn:hover { border-color: var(--orange); color: var(--orange); }

.site-nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 0;
  display: flex;
  gap: 8px;
}

.nav-link {
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  color: var(--white);
  background: var(--dark2);
  border-radius: 8px 8px 0 0;
}

.nav-link--active {
  background: var(--orange);
  color: var(--white);
}

.nav-link:not(.nav-link--active):hover { background: #262f36; }

/* Page layout */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.section {
  background: var(--white);
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 28px;
}

.section__label {
  color: var(--orange);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.section__title {
  font-size: 26px;
  font-weight: 800;
  text-transform: uppercase;
  margin: 0 0 20px;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 12px 0;
}

/* Attention cards */

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 8px;
  border-left: 4px solid var(--yellow);
  background: #fff9e6;
}

.alert-card--critical {
  border-left-color: var(--red);
  background: #ffecec;
}

.alert-card__main { display: flex; flex-direction: column; gap: 4px; }

.alert-card__project { font-weight: 700; font-size: 15px; }

.alert-card__cabinet { font-size: 13px; color: var(--muted); }

.alert-card__metric {
  font-weight: 700;
  font-size: 15px;
  text-align: right;
  white-space: nowrap;
}

.alert-card--critical .alert-card__metric { color: var(--red); }
.alert-card--attention .alert-card__metric { color: var(--yellow); }

/* Budgets table */

.budgets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.budgets-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--dark);
  color: var(--white);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.budgets-table th:first-child { border-radius: 8px 0 0 0; }
.budgets-table th:last-child { border-radius: 0 8px 0 0; }

.budgets-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray);
}

.budgets-table tr:last-child td { border-bottom: none; }

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
}

.status-dot--ok { background: var(--green); }
.status-dot--attention { background: var(--yellow); }
.status-dot--critical { background: var(--red); }
.status-dot--unconfigured { background: var(--muted); }

.muted { color: var(--muted); }

/* Login */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
}

.login-card {
  background: var(--white);
  border-radius: 10px;
  padding: 40px;
  width: 100%;
  max-width: 360px;
}

.login-card h1 {
  font-size: 20px;
  text-transform: uppercase;
  font-weight: 800;
  margin: 0 0 24px;
}

.form input[type="text"],
.form input[type="password"] {
  display: block;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--gray);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form button {
  width: 100%;
  padding: 12px 14px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  cursor: pointer;
}

.form button:hover { opacity: 0.9; }

.login-card input {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--gray);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
  cursor: pointer;
}

.remember-me input {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.login-card button {
  width: 100%;
  padding: 12px 14px;
  background: var(--orange);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 14px;
  cursor: pointer;
}

.login-card button:hover { opacity: 0.9; }

.login-error {
  color: #c00;
  font-size: 13px;
  margin-bottom: 14px;
  min-height: 16px;
}

/* Buttons */

.btn-primary {
  background: var(--orange);
  color: var(--white);
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  cursor: pointer;
}

.btn-primary:hover { opacity: 0.9; }

.btn-secondary {
  background: transparent;
  color: var(--dark);
  border: 1px solid var(--gray);
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.btn-secondary:hover { border-color: var(--muted); }

.section__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section__header-row .section__title { margin-bottom: 0; }

.refresh-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.refresh-controls__time {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--gray);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--dark);
  background: var(--white);
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.and-mark {
  display: inline-block;
  font-weight: 700;
}

.and-mark--ok { color: var(--green); }
.and-mark--bad { color: var(--red); }

.manual-status-select {
  padding: 3px 8px;
  border: 1px solid var(--gray);
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--dark);
}

/* Compact project card */

.project-card {
  border: 1px solid var(--gray);
  border-radius: 8px;
  padding: 10px 14px;
}

.project-card--attention { border: 1px solid var(--yellow); background: #fffcf2; }
.project-card--critical { border: 1px solid var(--red); background: #fff8f8; }

.project-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-card__info {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.project-card__title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 12px;
  margin-top: 6px;
  align-items: center;
}

.project-card__and-row {
  margin-top: 4px;
}

.and-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.and-toggle-btn:hover { color: var(--dark); }

.and-directions-list {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.and-direction-item {
  border: 1px solid var(--gray);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
}

.and-direction-item--attention { border-color: var(--yellow); background: #fffcf2; }
.and-direction-item--critical { border-color: var(--red); background: #fff8f8; }

.and-direction-item__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.and-direction-item__type {
  text-decoration: underline;
  color: var(--dark);
}

.and-direction-item__status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.and-status--ok { color: var(--green); }
.and-status--attention { color: var(--yellow); }
.and-status--critical { color: var(--red); }

.and-value--missing {
  color: var(--red);
  font-weight: 600;
}

.and-direction-item__table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  color: var(--dark);
  white-space: pre-line;
  border: 1px solid var(--muted);
  border-radius: 6px;
  overflow: hidden;
}

.and-direction-item__col-head {
  font-weight: 700;
  text-align: center;
  font-size: 12px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--muted);
  border-right: 1px solid var(--muted);
  background: var(--gray);
}

.and-direction-item__col-value {
  padding: 8px 10px;
  border-right: 1px solid var(--gray);
}

.and-direction-item__col-head:nth-child(3n),
.and-direction-item__col-value:nth-child(3n) {
  border-right: none;
}

/* Modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 23, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--white);
  border-radius: 10px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin: 0 0 20px;
  font-size: 20px;
  text-transform: uppercase;
  font-weight: 800;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.field-label input,
.field-label select {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border: 1px solid var(--gray);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--dark);
  text-transform: none;
  font-weight: 400;
}

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

/* Launch cards */

.launch-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.launch-card {
  border: 1px solid var(--gray);
  border-radius: 10px;
  padding: 20px;
}

.launch-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.launch-card__title {
  font-weight: 700;
  font-size: 16px;
}

.launch-card__meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.launch-card__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--gray);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  text-decoration: none;
}

.icon-btn:hover { background: #dcdedd; }
.icon-btn--danger:hover { background: #ffdada; }

.launch-card__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  font-size: 14px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray);
}

.checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.checklist__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--gray);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.checklist__item--auto {
  cursor: default;
  opacity: 0.7;
}

.checklist__item--done {
  background: #e3f5e8;
  color: var(--green);
}

.checklist__box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

.checklist__item--done .checklist__box {
  border-color: var(--green);
  background: var(--green);
  color: var(--white);
}

/* Dashboard stats */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

.stats-grid--3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.stats-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stats-col__divider {
  border-top: 1px solid var(--gray);
  margin: 6px 0;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  padding: 2px 0;
}

.stat-row__value {
  font-weight: 700;
}

.stats-col--metric {
  background: var(--gray);
  border-radius: 8px;
  padding: 14px 16px;
}

.stat-metric {
  font-size: 20px;
  font-weight: 800;
  margin-top: 4px;
}

.delta--good { color: var(--green); font-weight: 600; }
.delta--bad { color: var(--red); font-weight: 600; }

.dynamics-summary {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray);
  font-size: 14px;
  color: var(--dark);
  line-height: 1.5;
}

.subsection__title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 24px 0 10px;
}

.subsection__title:first-of-type {
  margin-top: 4px;
}

.alert-list + .subsection__title {
  margin-top: 24px;
}
