:root {
  --ink: #202328;
  --muted: #667085;
  --line: #d8dde5;
  --paper: #f6f4ef;
  --panel: #ffffff;
  --accent: #b3261e;
  --accent-2: #0f766e;
  --gold: #c18a2d;
  --soft: #ece7dc;
  --shadow: 0 18px 50px rgba(42, 37, 28, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(179, 38, 30, 0.08), transparent 28%),
    linear-gradient(315deg, rgba(15, 118, 110, 0.1), transparent 24%),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #aeb7c4;
  transform: translateY(-1px);
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.shell {
  min-height: 100vh;
  padding: 22px;
}

.workspace {
  max-width: 1480px;
  min-height: calc(100vh - 44px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 320px 1fr;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 22px;
  background: #25211d;
  color: white;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #241a07;
  font-weight: 800;
}

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

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  font-size: 23px;
}

h2 {
  font-size: 28px;
  max-width: 720px;
}

h3 {
  font-size: 17px;
}

.panel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  padding: 16px;
  margin-top: 14px;
}

.panel label {
  display: block;
  color: #d8d5cf;
  font-size: 13px;
  font-weight: 700;
  margin: 12px 0 7px;
}

.panel label:first-child {
  margin-top: 0;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: white;
}

.compact {
  display: grid;
  gap: 10px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  text-align: center;
  gap: 8px;
}

.stats span {
  display: block;
  color: white;
  font-size: 25px;
  font-weight: 800;
}

.stats small {
  color: #d8d5cf;
}

.main {
  padding: 22px;
  min-width: 0;
}

.toolbar,
.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.actions {
  display: flex;
  gap: 8px;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  margin: 20px 0;
}

.tool,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.queue {
  margin: 14px 0 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
}

.queue li {
  padding: 10px 12px;
  border: 1px solid var(--soft);
  border-radius: 8px;
  background: #fbfaf7;
  color: #34383f;
  font-size: 14px;
}

.checklist {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.checkitem {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.checkitem input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent-2);
}

.table-wrap {
  padding-bottom: 0;
}

.table-wrap input {
  max-width: 340px;
}

.table-scroll {
  overflow: auto;
  margin: 14px -16px 0;
  max-height: 46vh;
}

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

th,
td {
  border-top: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f8f6f1;
  z-index: 1;
  font-size: 12px;
  text-transform: uppercase;
}

td[contenteditable="true"] {
  outline: 2px solid transparent;
}

td[contenteditable="true"]:focus {
  outline-color: rgba(15, 118, 110, 0.35);
  background: #f4fffd;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef6f5;
  color: var(--accent-2);
  font-weight: 700;
  white-space: nowrap;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(760px, calc(100vw - 28px));
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(20, 18, 16, 0.54);
}

form {
  padding: 18px;
}

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

.dialog-head button {
  width: 38px;
  padding: 0;
  font-size: 24px;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: #3f4650;
  font-size: 13px;
  font-weight: 700;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0;
  margin: 18px 0 0;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #25211d;
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

[data-icon] {
  width: 18px;
  height: 18px;
  display: inline-block;
  background: currentColor;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

[data-icon="search"] { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E"); }
[data-icon="copy"] { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect width='14' height='14' x='8' y='8' rx='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E"); }
[data-icon="download"] { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3Cpath d='M12 15V3'/%3E%3C/svg%3E"); }
[data-icon="plus"] { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='M12 5v14'/%3E%3C/svg%3E"); }
[data-icon="trash"] { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3C/svg%3E"); }

@media (max-width: 980px) {
  .shell {
    padding: 0;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 100vh;
  }

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

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

@media (max-width: 620px) {
  .main,
  .sidebar {
    padding: 16px;
  }

  h2 {
    font-size: 23px;
  }

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

  .tool-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-wrap input {
    max-width: none;
  }
}
