:root {
  color-scheme: light;
  --ink: #202020;
  --muted: #69645e;
  --line: #dfd8ce;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --gold: #b7812c;
  --gold-dark: #835918;
  --green: #2f7d63;
  --blue: #355c7d;
  --red: #a5483d;
  --shadow: 0 18px 48px rgba(44, 37, 29, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

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

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 44px);
  background: rgba(251, 250, 247, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: white;
  background: var(--ink);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

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

.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tab,
.ghost,
.secondary,
.share-actions button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--ink);
  background: #f1ece5;
  border: 1px solid transparent;
  border-radius: 8px;
}

.tab.active {
  color: white;
  background: var(--ink);
}

.hero {
  position: relative;
  min-height: clamp(420px, 58vh, 620px);
  overflow: hidden;
  isolation: isolate;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(24, 22, 19, 0.82), rgba(24, 22, 19, 0.52) 42%, rgba(24, 22, 19, 0.12));
}

.hero-copy {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 32px));
  padding: clamp(68px, 10vw, 118px) clamp(16px, 4vw, 44px);
  color: white;
}

.hero-copy p {
  margin: 0 0 12px;
  color: #f4d28d;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(38px, 7vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
  max-width: 720px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.primary,
.secondary {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  font-weight: 800;
}

.primary {
  color: white;
  background: var(--gold-dark);
}

.secondary {
  color: white;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

main {
  padding-bottom: 54px;
}

.view {
  display: none;
  width: min(1440px, calc(100% - 32px));
  margin: 28px auto 0;
}

.view.active {
  display: block;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.stat {
  padding: 18px;
}

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

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.workbench,
.grid.two {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.8fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel.compact {
  align-self: start;
}

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

h2 {
  margin: 0;
  font-size: 21px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 8px;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: #3c352d;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide,
.full {
  grid-column: 1 / -1;
}

.form-panel .primary {
  width: 100%;
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: #eee8df;
}

.status.ready {
  color: #164d3d;
  background: #dcefe7;
}

.status.waiting {
  color: #765007;
  background: #fff0c9;
}

.status.issued {
  color: #fff;
  background: var(--blue);
}

.cards {
  display: grid;
  gap: 12px;
}

.item-card {
  padding: 14px;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.item-card h3 {
  margin: 0;
  font-size: 18px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.card-actions button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  background: #efe8df;
}

.card-actions .danger {
  color: #fff;
  background: var(--red);
}

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

.share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

pre {
  overflow-x: auto;
  padding: 16px;
  background: #25211d;
  color: #fff2d9;
  border-radius: 8px;
}

.sync-status {
  margin: 12px 0 0;
  color: var(--muted);
}

@media (max-width: 980px) {
  .topbar,
  .workbench,
  .grid.two,
  .stats {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  .tabs {
    justify-content: start;
  }
}

@media (max-width: 640px) {
  .hero-copy {
    padding-top: 56px;
  }

  .hero-overlay {
    background: linear-gradient(180deg, rgba(24, 22, 19, 0.84), rgba(24, 22, 19, 0.42));
  }

  .form-grid,
  .share-actions {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }
}
