@font-face {
  font-family: "Museo";
  font-style: normal;
  font-weight: 300 500;
  font-display: swap;
  src: url("../fonts/Museo_300.woff") format("woff");
}

@font-face {
  font-family: "Museo";
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
  src: url("../fonts/Museo_700.woff") format("woff");
}

:root {
  --font-sans: "Museo", "Trebuchet MS", sans-serif;
  --bg: #ffffff;
  --bg-elevated: #f3f4f6;
  --header-bg: #94b021;
  --header-text: #ffffff;
  --border-subtle: #d1d5db;
  --accent: #4d7c0f;
  --accent-soft: rgba(189, 216, 73, 0.2);
  --text: #111827;
  --text-dim: #6b7280;
  --danger: #b91c1c;
}

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

html {
  font-size: 14px;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select,
.btn {
  font-family: var(--font-sans);
}

.page {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page-header {
  background: var(--header-bg);
  color: var(--header-text);
  border-radius: 14px;
  padding: 12px 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.15);
}

.page-header-content {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.page-header-logo {
  max-height: 56px;
  width: auto;
  display: block;
  border-radius: 12px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.1vw, 1.7rem);
}

.page-header-title-link,
.header-link {
  color: #fff;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-header p,
.header-user {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
}

.header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.header-actions-row,
.filters,
.toolbar,
.detail-head,
.inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header-actions-row form,
.inline {
  margin: 0;
}

.header-button {
  background: transparent;
  color: #fff;
  border: 0;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
}

.inline select {
  width: auto;
  min-width: 16rem;
  flex: 1 1 16rem;
}

.card {
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.card--narrow {
  max-width: 460px;
}

.card-title,
h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-dim);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="date"],
textarea,
select {
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  padding: 6px 8px;
  font-size: 0.95rem;
  min-height: 32px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(148, 176, 33, 0.22);
}

.btn {
  border: 1px solid var(--border-subtle);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
}

.btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn-primary {
  background: var(--header-bg);
  border-color: rgba(0, 0, 0, 0.12);
  color: #fff;
}

.btn-primary:hover {
  background: #a8c929;
  color: #fff;
}

.btn-danger {
  color: var(--danger);
  border-color: #fecaca;
}

.btn-small {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

#assign-inventory {
  margin-top: 6px;
}

.btn-block {
  width: 100%;
}

.lead,
.hint {
  color: var(--text-dim);
  margin-top: 0;
}

.flash-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--accent-soft);
}

.flash--error {
  background: #fee2e2;
  color: var(--danger);
}

.stats,
.split,
.grid-2 {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.split,
.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.stat-num {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-label {
  color: var(--text-dim);
}

.toolbar {
  justify-content: space-between;
}

.filters input,
.filters select {
  width: auto;
  min-width: 160px;
}

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

.mailbox-list {
  padding: 0;
}

.mailbox {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.mailbox:last-child {
  border-bottom: 0;
}

.mailbox-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.mailbox-address {
  overflow-wrap: break-word;
}

.mailbox-head .hint {
  margin: 2px 0 0;
}

.mailbox-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mailbox-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 18px;
  margin-top: 10px;
}

.mailbox-facts ul {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.mailbox-facts li,
.mailbox-facts .hint {
  overflow-wrap: break-word;
  margin: 0;
}

.mailbox-empty {
  margin: 0;
  padding: 12px 14px;
}

.merge-table label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 500;
}

.merge-table input[type="radio"] {
  width: auto;
  min-height: 0;
  margin-top: 3px;
}

.merge-both {
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  font-size: 0.82rem;
  color: var(--text-dim);
}

a {
  color: var(--accent);
  font-weight: 600;
}

.plain {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.plain li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.found-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.found-table col.w-add { width: 7.6rem; }
.found-table col.w-card { width: 14rem; }
.found-table col.w-go { width: 6.2rem; }
.found-table col.w-ignore { width: 6.6rem; }

.found-table td {
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.found-table form {
  margin: 0;
}

.found-table select {
  width: 100%;
  min-width: 0;
}

.found-table .found-add,
.found-table .found-go,
.found-table .found-ignore {
  white-space: nowrap;
}

.found-table .btn {
  width: 100%;
}

.pill {
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill--obcy {
  background: #fee2e2;
  color: #991b1b;
}

.pill--gap {
  background: #fef3c7;
  color: #92400e;
}

.stack-flag {
  border-radius: 8px;
  padding: 6px 8px;
}

.stack-flag--warn {
  background: #fef3c7;
  color: #92400e;
}

.stack-flag--bad {
  background: #fee2e2;
  color: #991b1b;
}

.stack-flag a {
  color: inherit;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.secret {
  font-family: ui-monospace, monospace;
  background: #f3f4f6;
  padding: 4px 8px;
  border-radius: 8px;
}

.label-preview {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 84px;
  image-rendering: pixelated;
  background: #fff;
  border: 1px dashed var(--border-subtle);
  border-radius: 12px;
}

.code-big {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.save-bar {
  position: sticky;
  bottom: 8px;
}

.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.photos figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photos img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--bg-elevated);
}

.photos figcaption {
  font-size: 0.9rem;
}

.article-body {
  white-space: pre-wrap;
  line-height: 1.5;
}

.article-html {
  line-height: 1.5;
}

.article-html p,
.article-html ul,
.article-html ol,
.article-html blockquote {
  margin: 0 0 0.7em;
}

.article-html ul,
.article-html ol {
  padding-left: 1.3em;
}

.article-html h2,
.article-html h3 {
  font-size: 1.05rem;
  margin: 0.8em 0 0.3em;
}

.wysiwyg-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wysiwyg {
  min-height: 220px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  line-height: 1.5;
}

.wysiwyg:focus {
  outline: 2px solid var(--accent);
}

.button-row,
form.restore-row {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  gap: 8px;
}

.button-row form,
form.restore-row .btn {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  margin: 0;
  flex: 0 0 auto;
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plain li .inline input[type="text"] {
  min-width: 12rem;
  flex: 1;
}

@media (max-width: 800px) {
  .found-table,
  .found-table tbody,
  .found-table tr,
  .found-table td {
    display: block;
    width: auto;
  }

  .found-table .btn {
    width: auto;
  }

  .page {
    padding: 12px;
  }

  .page-header-content,
  .detail-head {
    grid-template-columns: 1fr;
    display: grid;
  }

  .header-actions,
  .header-actions-row {
    align-items: flex-start;
  }

  .page-header-logo {
    max-height: 56px;
  }

  .filters input,
  .filters select,
  .filters .btn {
    width: 100%;
  }

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