*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  background: #3d3428;
  color: #f0e6d2;
  font-family: Georgia, "Times New Roman", Times, serif;
  line-height: 1.5;
}

a {
  color: #c8a84b;
}

.page {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 16px 32px;
}

.site-header {
  padding: 24px 0 0;
  text-align: center;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #f0e6d2;
}

.logo img,
.rune-name img {
  image-rendering: pixelated;
}

.logo-text {
  font-size: 1.6rem;
  font-weight: normal;
  letter-spacing: 0.02em;
}

.tab-nav {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-top: 10vh;
  border-bottom: 1px solid #6b5a3e;
}

.tab {
  background: #2b2419;
  border: 1px solid #6b5a3e;
  border-bottom: none;
  color: #c8a84b;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  padding: 8px 24px;
  margin-bottom: -1px;
}

.tab:hover {
  background: #3d3428;
}

.tab.active {
  background: #4a3f2f;
  color: #f0e6d2;
  border-color: #8b7355;
}

.content {
  background: #4a3f2f;
  border: 1px solid #6b5a3e;
  border-top: none;
  padding: 20px 24px;
  min-height: 400px;
}

.panel-note {
  margin: 0 0 16px;
  color: #b8a88a;
  font-size: 0.9rem;
}

.panel-details {
  margin-bottom: 14px;
  border: 1px solid #6b5a3e;
  background: rgba(43, 36, 25, 0.25);
}

.panel-details > summary {
  cursor: pointer;
  padding: 10px 14px;
  color: #c8a84b;
  list-style: none;
}

.panel-details > summary::-webkit-details-marker {
  display: none;
}

.panel-details > summary::before {
  content: "▸ ";
  color: #8b7355;
}

.panel-details[open] > summary::before {
  content: "▾ ";
}

.panel-details .panel-note {
  margin: 0;
  padding: 0 14px 12px;
}

.tab-panel .status {
  margin-bottom: 8px;
}

.tab-throughput {
  color: #8b7355;
  font-size: 0.8rem;
}

.tab-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.control-group,
.auth-panel,
.tab-highlight {
  border: 1px solid #6b5a3e;
  background: rgba(43, 36, 25, 0.35);
}

.tab-highlight {
  display: grid;
  gap: 4px 10px;
  padding: 14px 16px;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  align-items: center;
}

.tab-highlight-label {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c8a84b;
}

.tab-highlight-title {
  font-size: 1rem;
  font-weight: normal;
  color: #f0e6d2;
  min-width: 0;
}

.tab-highlight-title .rune-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-highlight-value {
  font-size: 1.15rem;
  color: #f0e6d2;
  text-align: right;
  white-space: nowrap;
}

.tab-highlight-value-gp.gp-positive,
.tab-highlight-gp .tab-highlight-value-gp:not(.gp-negative) {
  color: #8fd4a0;
}

.tab-highlight-value-gp.gp-negative {
  color: #e8a0a0;
}

.tab-highlight-value-xp {
  color: #9ec8eb;
}

.tab-highlight-meta {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: #b8a88a;
  line-height: 1.35;
}

.tab-highlight-empty {
  grid-template-rows: auto auto;
}

.tab-highlight-empty .tab-highlight-meta {
  margin-top: 2px;
}

.tab-setup .controls {
  margin-top: 12px;
}

.tab-filter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 12px 14px 14px;
  font-size: 0.85rem;
  color: #b8a88a;
  cursor: pointer;
}

.table-scroll {
  max-height: min(62vh, 640px);
  overflow: auto;
  border: 1px solid #6b5a3e;
}

.table-scroll .data-table {
  margin: 0;
}

.table-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.data-table-compact .col-detail {
  font-size: 0.88rem;
}

.status {
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: #b8a88a;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 20px;
  align-items: flex-end;
}

.profit-controls {
  align-items: stretch;
  gap: 14px;
}

.control-group {
  display: flex;
  flex: 1 1 260px;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-content: flex-start;
  margin: 0;
  padding: 14px;
}

.control-group legend {
  padding: 0 6px;
  color: #c8a84b;
  font-size: 0.9rem;
}

.controls label,
.stack-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: #b8a88a;
}

.stack-form label small {
  color: #8b7355;
  font-weight: normal;
}

.controls input[type="number"],
.controls select,
.stack-form input,
.stack-form textarea {
  background: #2b2419;
  border: 1px solid #6b5a3e;
  border-radius: 2px;
  color: #f0e6d2;
  font-family: inherit;
  font-size: 1rem;
}

.controls input[type="number"],
.controls select {
  min-height: 32px;
  padding: 5px 9px;
  width: 150px;
}

.controls select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #c8a84b 50%),
    linear-gradient(135deg, #c8a84b 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 13px,
    calc(100% - 9px) 13px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 28px;
  width: 210px;
}

.stack-form input,
.stack-form textarea {
  padding: 8px 10px;
}

.stack-form textarea {
  resize: vertical;
  min-height: 140px;
}

.controls input[type="number"]:focus,
.controls select:focus {
  border-color: #c8a84b;
  outline: 1px solid rgba(200, 168, 75, 0.35);
}

.controls input[type="number"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.controls input[type="number"] {
  appearance: textfield;
}

.controls input[type="number"]::-webkit-outer-spin-button,
.controls input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.controls .toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-height: 32px;
  padding-top: 18px;
}

.controls .toggle input {
  width: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  border: 1px solid #6b5a3e;
  padding: 6px 12px;
  text-align: left;
}

.data-table th {
  background: #2b2419;
  color: #c8a84b;
  font-weight: normal;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.12);
}

.data-table tbody tr.unavailable {
  opacity: 0.45;
}

.data-table tbody tr.profit-best {
  background: rgba(200, 168, 75, 0.12);
}

.data-table tbody tr.profit-best-xp {
  background: rgba(120, 180, 220, 0.1);
}

.data-table tbody tr.profit-best.profit-best-xp {
  background: linear-gradient(
    90deg,
    rgba(200, 168, 75, 0.12) 0%,
    rgba(120, 180, 220, 0.1) 100%
  );
}

.data-table tbody tr .profit-best-cell.gp-positive {
  color: #8fd4a0;
  font-weight: bold;
}

.data-table tbody tr .profit-best-xp-cell {
  color: #9ec8eb;
  font-weight: bold;
}

.rune-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gp-positive,
.trend-up,
.btn-complete {
  color: #6b8;
}

.gp-negative,
.trend-down,
.status-error {
  color: #c66;
}

.trend-flat {
  color: #b8a88a;
}

.site-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: #8b7355;
}

.page-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: normal;
  color: #f0e6d2;
}

.home-title {
  margin-bottom: 4px;
}

.home-intro {
  margin-bottom: 18px;
}

.auth-content {
  margin: 20vh auto 0;
  min-height: 420px;
  max-width: 480px;
}

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.user-label {
  color: #b8a88a;
  font-size: 0.85rem;
}

.auth-panel {
  padding: 16px;
}

.auth-panel-narrow {
  max-width: 420px;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn {
  display: inline-block;
  background: #2b2419;
  border: 1px solid #8b7355;
  color: #f0e6d2;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 16px;
  text-decoration: none;
}

.btn:hover {
  background: #3d3428;
}

.btn-secondary {
  color: #c8a84b;
}

.btn-small {
  font-size: 0.85rem;
  padding: 4px 10px;
}

.issue-body-preview {
  margin-top: 6px;
  color: #b8a88a;
  font-size: 0.85rem;
  white-space: pre-wrap;
}

.issue-status {
  margin-top: 10px;
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-complete {
  border-color: #4a6b4a;
}

.btn-delete {
  color: #c66;
  border-color: #6b4a4a;
}

@media (max-width: 900px) {
  .tab-panel .col-detail {
    display: none;
  }

  .tab-panel .col-method {
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .controls input[type="number"],
  .controls select {
    width: 100%;
  }

  .control-group {
    flex-basis: 100%;
  }

  .data-table {
    font-size: 0.85rem;
  }

  .data-table th,
  .data-table td {
    padding: 4px 6px;
  }

  .tab-highlights {
    grid-template-columns: 1fr;
  }
}
