:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #18212f;
  --muted: #657184;
  --line: #d9dee7;
  --line-strong: #b8c0cc;
  --primary: #176b5c;
  --primary-dark: #105346;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: inherit;
}

.app-header {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.page {
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px;
}

.page-title {
  align-items: flex-end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-title h1 {
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 6px;
}

.page-title p {
  color: var(--muted);
  margin: 0;
}

.button {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  text-decoration: none;
  white-space: nowrap;
}

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

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
}

.button-danger {
  background: var(--danger-bg);
  border-color: #f0b8b0;
  color: var(--danger);
}

.table-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}

.data-table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #eef2f5;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.actions-cell {
  text-align: right !important;
  width: 120px;
}

.empty-state,
.alert,
.beam-head,
.index-total,
.search-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.empty-state {
  padding: 38px;
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  color: var(--muted);
  margin: 0;
}

.alert {
  background: var(--danger-bg);
  border-color: #f0b8b0;
  color: var(--danger);
  margin-bottom: 16px;
  padding: 14px 18px;
}

.alert ul {
  margin: 8px 0 0;
}

.beam-form {
  display: grid;
  gap: 16px;
}

.search-form {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-bottom: 16px;
  padding: 16px;
}

.search-actions {
  display: flex;
  gap: 10px;
}

.index-total {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.index-total span {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.index-total strong {
  font-size: 22px;
}

.beam-head {
  align-items: end;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(220px, 1fr) auto;
  padding: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--text);
  font: inherit;
  min-height: 36px;
  padding: 7px 9px;
  width: 100%;
}

output {
  color: #273447;
  display: inline-block;
  min-height: 22px;
  min-width: 74px;
}

.summary {
  display: grid;
  gap: 4px;
  text-align: right;
}

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

.summary strong {
  font-size: 22px;
}

.item-table select {
  min-width: 132px;
}

.item-table input {
  min-width: 110px;
}

.row-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 5px;
  max-width: 260px;
}

.icon-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--danger);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 720px) {
  .app-header,
  .page-title,
  .beam-head,
  .index-total,
  .search-form {
    align-items: stretch;
    flex-direction: column;
  }

  .app-header {
    gap: 12px;
    padding: 14px 18px;
  }

  .page {
    padding: 18px;
  }

  .page-title {
    display: grid;
  }

  .beam-head {
    grid-template-columns: 1fr;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .search-actions {
    display: grid;
  }

  .index-total {
    display: grid;
  }

  .summary {
    text-align: left;
  }

  .form-actions {
    justify-content: stretch;
  }

  .form-actions .button {
    width: 100%;
  }
}
