:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-alt: #f7fafc;
  --line: #d6dee7;
  --line-dark: #aeb9c5;
  --text: #17212b;
  --muted: #5c6b7a;
  --brand: #0f5d7f;
  --brand-dark: #0b3f58;
  --accent: #d68b2a;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(15, 35, 52, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

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

button {
  min-height: 36px;
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  background: #f7f9fb;
  color: var(--text);
  cursor: pointer;
  padding: 0 13px;
}

button:hover {
  border-color: var(--brand);
}

.primary-btn {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
}

.secondary-btn {
  background: #ffffff;
}

.danger-btn {
  border-color: #e7b2ad;
  color: var(--danger);
  background: #fff7f6;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
}

input,
select {
  min-height: 34px;
  padding: 4px 8px;
}

textarea {
  min-height: 132px;
  padding: 9px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
}

legend {
  color: var(--brand-dark);
  font-weight: 700;
  padding: 0 6px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 18px;
  gap: 14px;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  color: var(--brand-dark);
  font-size: 25px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
}

h3 {
  color: var(--brand-dark);
  font-size: 14px;
}

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

.header-actions,
.button-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.load-panel {
  grid-template-rows: auto auto auto auto minmax(240px, 1fr);
}

.combo-panel {
  grid-template-rows: auto auto auto minmax(360px, 1fr);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.step {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.control-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto auto;
  align-items: end;
  gap: 8px;
}

.paste-box,
.manual-box,
.table-card,
.seismic-box {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.paste-head,
.table-title,
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 500;
}

.check-label input {
  width: auto;
  min-height: auto;
}

.manual-grid {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

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

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 12px;
}

.view-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 12px;
}

.view-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 500;
}

.view-field input {
  width: auto;
  min-height: auto;
}

.seismic-box {
  display: grid;
  gap: 8px;
}

.seismic-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

.table-card {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.table-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #edf1f5;
  padding: 8px 9px;
  text-align: left;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #dfe7ef;
  color: var(--brand-dark);
  font-weight: 800;
}

tbody tr:nth-child(even) {
  background: #f8fbfd;
}

tbody tr.is-selected {
  background: #d7ebff;
  outline: 2px solid #85bff0;
  outline-offset: -2px;
}

.status-bar {
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
}

@media (max-width: 980px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

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

  .settings-grid,
  .seismic-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .control-row,
  .manual-grid,
  .settings-grid,
  .seismic-grid {
    grid-template-columns: 1fr;
  }

  .view-field {
    align-items: flex-start;
    flex-direction: column;
  }
}
