:root {
  color-scheme: light;
  --bg: #f7f3ec;
  --ink: #221f1b;
  --muted: #716a60;
  --line: #d9d0c2;
  --panel: #fffdf9;
  --panel-strong: #f0e7d7;
  --accent: #246b61;
  --accent-dark: #174d45;
  --danger: #a33b2f;
  --gold: #a87423;
  --header-red: #8c1a11;
  --shadow: 0 18px 44px rgba(39, 31, 20, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(36, 107, 97, 0.12), transparent 32rem),
    linear-gradient(260deg, rgba(168, 116, 35, 0.14), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 700;
  min-height: 2.55rem;
  padding: 0.65rem 0.9rem;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.secondary {
  background: #e8dfd0;
  color: var(--ink);
}

button.secondary:hover {
  background: #d9cebd;
}

button.danger {
  background: transparent;
  color: var(--danger);
  min-height: 2.2rem;
  padding: 0.4rem 0.5rem;
}

button.danger:hover {
  background: rgba(163, 59, 47, 0.1);
}

.app-shell {
  width: min(1680px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
}

.topbar {
  display: grid;
  justify-items: center;
  margin-bottom: 1.25rem;
}

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

h1 {
  color: var(--header-red);
  font-family: "Alegreya SC", Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 6vw, 4.8rem);
  line-height: 0.95;
  margin-bottom: 0.25rem;
}

.logo-heading {
  line-height: 1;
  max-width: min(34rem, 100%);
}

.logo-heading img {
  display: block;
  height: auto;
  max-width: 100%;
}

h2 {
  color: var(--header-red);
  font-family: "Alegreya SC", Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

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

.sync-status {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  text-align: center;
}

.summary-strip {
  align-items: center;
  background: rgba(255, 253, 249, 0.8);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(3, minmax(8rem, 1fr));
  overflow: hidden;
}

.summary-strip div {
  border-left: 1px solid var(--line);
  padding: 1rem;
}

.summary-strip div:first-child {
  border-left: 0;
}

.summary-strip span {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
}

.summary-strip small {
  color: var(--muted);
}

.workspace {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 2fr) minmax(20rem, 1fr);
  align-items: start;
}

.primary-column {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.sidebar-column {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.app-footer {
  padding-top: 1rem;
}

.panel {
  background: rgba(255, 253, 249, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
  padding: 1rem;
}

.section-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 0.35rem;
}

input,
select {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  min-height: 2.55rem;
  padding: 0.55rem 0.7rem;
  width: 100%;
}

td button {
  min-width: 0;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(36, 107, 97, 0.16);
}

.claims-list {
  display: grid;
  gap: 0.7rem;
}

.claim-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
}

.claim-card h3 {
  font-size: 1rem;
  margin: 0;
}

.table-wrap {
  max-width: 100%;
  overflow: hidden;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
  padding: 0.55rem 0.35rem;
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

table {
  table-layout: fixed;
}

.roster-table th:nth-child(1),
.roster-table td:nth-child(1) {
  width: 26%;
}

.roster-table th:nth-child(2),
.roster-table td:nth-child(2),
.roster-table th:nth-child(3),
.roster-table td:nth-child(3),
.roster-table th:nth-child(4),
.roster-table td:nth-child(4),
.roster-table th:nth-child(5),
.roster-table td:nth-child(5) {
  width: 15%;
}

.roster-table th:nth-child(6),
.roster-table td:nth-child(6) {
  width: 14%;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td strong {
  display: block;
}

td input,
td select {
  font-size: 0.95rem;
  min-width: 0;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

td input[type="text"] {
  min-width: 0;
}

.add-row {
  background: rgba(240, 231, 215, 0.5);
}

.add-row td {
  border-bottom: 1px solid var(--line);
}

.add-row input {
  background: #fffaf2;
}

.number-pair {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  align-items: center;
  background: #e8dfd0;
  color: var(--ink);
  display: inline-flex;
  font-size: 1rem;
  justify-content: center;
  min-height: 2.2rem;
  padding: 0;
  width: 2.2rem;
}

.icon-button:hover {
  background: #d9cebd;
}

.icon-button.success {
  background: var(--accent);
  color: white;
}

.icon-button.success:hover {
  background: var(--accent-dark);
}

.edit-actions {
  display: flex;
  gap: 0.35rem;
}

.loot-records {
  display: grid;
  gap: 0.75rem;
}

.loot-entry-strip {
  align-items: end;
  background: rgba(240, 231, 215, 0.62);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(18rem, 1fr) 5.5rem 7rem 7rem minmax(7rem, 10rem);
  padding: 0.8rem;
}

.loot-entry-strip button {
  min-height: 2.55rem;
  width: 100%;
}

.loot-record {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0.55rem;
  padding: 0.65rem 0;
}

.loot-record-main {
  align-items: center;
  display: grid;
  gap: 0.65rem;
  grid-template-columns: 2.2rem minmax(14rem, 1fr) 6rem 7rem 7rem auto;
}

.loot-record-claim {
  align-items: start;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(12rem, 18rem) 4.5rem 6rem 2.2rem minmax(12rem, 1fr);
  padding-left: 2.85rem;
}

.loot-name strong {
  display: block;
  font-size: 1.05rem;
  white-space: normal;
  word-break: break-word;
}

.loot-stat small {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.loot-stat strong {
  display: block;
}

.remaining-good {
  color: var(--accent-dark);
  font-weight: 800;
}

.remaining-bad {
  color: var(--danger);
  font-weight: 800;
}

.claim-card {
  align-items: center;
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
}

.claim-meta {
  color: var(--muted);
  overflow: hidden;
  margin: 0.2rem 0 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  background: rgba(240, 231, 215, 0.72);
  border: 1px dashed #c7bba7;
  border-radius: 8px;
  padding: 1rem;
}

@media (max-width: 1050px) {
  .workspace {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .loot-entry-strip,
  .loot-record-main,
  .loot-record-claim {
    grid-template-columns: 1fr;
  }

  .loot-record-claim {
    padding-left: 0;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding-top: 0.5rem;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-strip div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .summary-strip div:first-child {
    border-top: 0;
  }

  .claim-card {
    display: grid;
  }
}
