:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #f7f8f5;
  --text: #17211d;
  --muted: #66736d;
  --line: #dce2dd;
  --primary: #124f45;
  --primary-2: #0d3b34;
  --gold: #b9893b;
  --success: #11724f;
  --success-bg: #e9f6ef;
  --danger: #a33a35;
  --danger-bg: #fff0ee;
  --neutral: #eef1ee;
  --shadow: 0 18px 42px rgba(21, 36, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

body.locked {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

body.locked .topbar,
body.locked main {
  display: none;
}

.access-gate {
  width: min(100%, 480px);
  padding: 22px;
}

body.unlocked .access-gate {
  display: none;
}

.access-card {
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.access-card h1 {
  font-size: 30px;
}

.access-card p,
.access-card small {
  color: var(--muted);
}

.access-card small {
  min-height: 18px;
  color: var(--danger);
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 30px;
  border-bottom: 1px solid var(--line);
  background: #fbfbf8;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 17px;
  line-height: 1.2;
}

main {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.domain-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(185, 137, 59, 0.45);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--primary-2);
  background: #fffaf0;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.status-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
  white-space: nowrap;
}

.module-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.module-nav a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.module-nav a.active,
.module-nav a:hover {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

:target {
  scroll-margin-top: 18px;
}

.controls,
.kpi-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.controls {
  grid-template-columns: 180px 150px minmax(260px, 1fr) 160px;
  align-items: end;
}

.kpi-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

label,
.hotel-form {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 0 10px;
}

button {
  cursor: pointer;
  padding: 0 14px;
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  font-weight: 800;
}

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

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(18, 79, 69, 0.22);
  outline-offset: 2px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  padding: 16px;
}

.metric span,
.metric small {
  color: var(--muted);
}

.metric strong {
  font-size: 24px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric.qn {
  border-color: rgba(185, 137, 59, 0.5);
}

.metric.success {
  background: var(--success-bg);
}

.metric.danger {
  background: var(--danger-bg);
}

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

.side-stack {
  display: grid;
  align-content: start;
  gap: 16px;
}

.panel {
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-header.compact {
  margin-bottom: 10px;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.table-wrap {
  max-height: calc(100vh - 330px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
}

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

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f9faf7;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr:hover td {
  background: #fbfcf9;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
}

th.sticky-col {
  z-index: 4;
  background: #f9faf7;
}

.date-cell {
  width: 138px;
}

.date-cell strong,
.date-cell span,
.diff-cell strong,
.diff-cell span {
  display: block;
}

.date-cell span,
.diff-cell span {
  color: var(--muted);
  font-size: 12px;
}

.qn-head {
  color: var(--primary-2);
  background: #f8f1e4;
}

.rate-cell {
  min-width: 168px;
}

.rate-cell input,
.rate-cell select {
  min-height: 34px;
  font-size: 13px;
}

.rate-cell input {
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.qn-cell {
  background: #fffaf0;
}

.rate-cell.manual {
  background: #eef7ff;
}

.rate-cell.unavailable,
.rate-cell.soldout {
  background: var(--neutral);
}

.diff-cell {
  min-width: 130px;
  font-variant-numeric: tabular-nums;
}

.diff-cell.cheap {
  color: var(--success);
  background: var(--success-bg);
}

.diff-cell.expensive {
  color: var(--danger);
  background: var(--danger-bg);
}

.diff-cell.neutral {
  color: var(--muted);
  background: var(--neutral);
}

.hotel-form {
  grid-template-columns: 1fr 110px;
  margin-bottom: 12px;
}

.hotel-form button {
  grid-column: 1 / -1;
}

.import-box {
  display: grid;
  gap: 10px;
}

.import-box textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.import-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.file-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.file-button input {
  display: none;
}

.import-result {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hotels-list {
  display: grid;
  gap: 8px;
}

.hotel-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 82px;
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.hotel-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.hotel-main p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.hotel-main a {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.hotel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hotel-meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.hotel-row input,
.hotel-row select,
.hotel-row button {
  min-height: 36px;
  font-size: 13px;
}

.executive-summary {
  color: var(--text);
  font-weight: 650;
}

.rule-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

.rule-list div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

dd {
  margin: 2px 0 0;
  font-weight: 750;
}

@media (max-width: 1200px) {
  .controls,
  .kpi-grid,
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .table-panel,
  .side-stack {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar,
  .top-actions,
  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  h1 {
    font-size: 28px;
  }

  .hotel-row {
    grid-template-columns: 1fr;
  }

  .import-actions {
    grid-template-columns: 1fr;
  }
}
