@font-face {
  font-family: "Poppins";
  src: url("/assets/fonts/poppins-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Poppins";
  src: url("/assets/fonts/poppins-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Oswald";
  src: url("/assets/fonts/oswald-700.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #222222;
  --bg-soft: #2a2a2a;
  --panel: #1f1f1f;
  --ink: #fcefe4;
  --muted: #c0b2a7;
  --line: #343434;
  --accent: #d73f30;
  --accent-hover: #e45749;
  --success: #79b85f;
  --alert: #e38a42;
  --danger: #bb4438;
  --shadow: 0 12px 30px rgb(0 0 0 / 28%);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 84% -5%, rgb(215 63 48 / 15%), transparent 45%),
    radial-gradient(circle at -8% 102%, rgb(252 239 228 / 8%), transparent 36%), var(--bg);
  color: var(--ink);
  font-family: "Poppins", sans-serif;
}

h1,
h2,
h3 {
  margin: 0 0 0.4rem;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.12;
  color: var(--ink);
}

p {
  margin: 0 0 0.8rem;
}

a {
  color: var(--ink);
  text-decoration-color: rgb(252 239 228 / 35%);
}

a:hover {
  color: #fff;
  text-decoration-color: rgb(252 239 228 / 70%);
}

.page-shell {
  min-height: 100dvh;
  position: relative;
}

.build-badge {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  pointer-events: none;
}

.build-badge span {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid rgb(252 239 228 / 10%);
  border-radius: 999px;
  background: rgb(18 18 18 / 58%);
  backdrop-filter: blur(8px);
  color: rgb(252 239 228 / 42%);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.grain {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0.13;
  background-image: radial-gradient(rgb(252 239 228 / 10%) 0.7px, transparent 0.7px);
  background-size: 3px 3px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem 6rem;
}

.topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.brand {
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.2rem;
}

.brand span {
  color: var(--accent);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.nav a {
  text-decoration: none;
  font-family: "Poppins", sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink);
  opacity: 0.92;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  padding: 0.38rem 0.68rem;
  background: rgb(255 255 255 / 1%);
}

.nav a.is-active {
  border-color: var(--accent);
  background: rgb(215 63 48 / 20%);
}

.nav a:hover {
  opacity: 1;
  color: #fff;
}

.logout-form {
  margin: 0;
}

.kicker {
  margin-bottom: 0.5rem;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.page-intro h1 {
  font-size: clamp(2.2rem, 6vw, 4.3rem);
}

.page-intro.compact h1 {
  font-size: clamp(1.7rem, 4.2vw, 2.9rem);
}

.page-intro p {
  color: var(--muted);
}

.page-intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.auth-wrap {
  display: grid;
}

.hero-card {
  margin: 4rem auto 0;
  max-width: 700px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(1.4rem, 3.5vw, 2.6rem);
  background: linear-gradient(150deg, rgb(25 25 25 / 94%), rgb(18 18 18 / 98%));
  box-shadow: var(--shadow);
  animation: rise 380ms ease-out;
}

.hero-card h1 {
  font-size: clamp(2.4rem, 7.8vw, 4.8rem);
  margin-bottom: 0.7rem;
}

.hero-card p {
  color: var(--muted);
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-overview {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgb(252 239 228 / 12%);
}

.dashboard-overview-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
}

.dashboard-overview-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
}

.dashboard-alert-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.dashboard-alert-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  text-decoration: none;
}

.dashboard-alert-link.is-alert {
  border: 1px solid rgb(215 63 48 / 36%);
  color: #ffd4ce;
  background: rgb(215 63 48 / 10%);
}

.dashboard-alert-link.is-ok {
  border: 1px solid rgb(121 184 95 / 36%);
  color: #d7efcc;
  background: rgb(121 184 95 / 10%);
}

.dashboard-alert-link strong {
  font-family: "Poppins", sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.dashboard-alert-link span {
  font-size: 0.8rem;
}

.dashboard-alert-link.is-alert span {
  color: #f2bbb4;
}

.dashboard-alert-link.is-ok span {
  color: #ccebbf;
}

.dashboard-ledger-grid {
  margin-top: 1rem;
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.dashboard-ledger {
  padding: 0 0 0.15rem;
  border-top: 2px solid rgb(252 239 228 / 12%);
}

.dashboard-ledger-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.8rem;
  padding-top: 0.9rem;
}

.dashboard-ledger-head h3 {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
}

.dashboard-inline-meta {
  margin-top: 0.2rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.dashboard-row-list {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0;
}

.dashboard-row-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: start;
  padding: 0.72rem 0;
  border-bottom: 1px solid rgb(252 239 228 / 8%);
}

.dashboard-row-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-row-name.item-with-icon {
  display: flex;
  align-items: flex-start;
  gap: 0.42rem;
}

.dashboard-row-name.item-with-icon .type-icon {
  flex-shrink: 0;
  margin-top: 0.08rem;
}

.dashboard-row-value {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.dashboard-row-more {
  color: var(--muted);
  font-size: 0.8rem;
}

.dashboard-layout {
  margin-top: 1.5rem;
  display: grid;
  gap: 1.5rem;
}

.dashboard-section {
  padding-top: 1rem;
  border-top: 1px solid rgb(252 239 228 / 12%);
  overflow-x: auto;
}

.dashboard-section.warning-panel {
  padding: 1rem;
  border: 1px solid rgb(169 55 42 / 58%);
  border-radius: 12px;
  background: linear-gradient(180deg, rgb(86 31 25 / 28%), #1f1f1f);
}

.dashboard-section.success-panel {
  padding: 1rem;
  border: 1px solid rgb(121 184 95 / 40%);
  border-radius: 12px;
  background: linear-gradient(180deg, rgb(121 184 95 / 14%), #1f1f1f);
}

.dashboard-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.45rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: linear-gradient(180deg, var(--bg-soft), #1f1f1f);
  box-shadow: var(--shadow);
  animation: rise 420ms ease-out;
  overflow-x: auto;
}

.panel.narrow {
  max-width: 740px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 0.8rem;
}

.type-split {
  display: grid;
  gap: 1.2rem;
}

.type-block + .type-block {
  border-top: 1px solid #353535;
  padding-top: 1rem;
}

.type-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.type-head h4 {
  margin: 0;
  font-size: 1rem;
  font-family: "Poppins", sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.type-count {
  border: 1px solid #4a4a4a;
  border-radius: 999px;
  padding: 0.16rem 0.52rem;
  font-size: 0.72rem;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  color: var(--muted);
}

.type-count.is-alert {
  border-color: rgb(215 63 48 / 36%);
  color: #f2bbb4;
  background: rgb(215 63 48 / 10%);
}

.type-count.is-ok {
  border-color: rgb(121 184 95 / 36%);
  color: #ccebbf;
  background: rgb(121 184 95 / 10%);
}

.summary-chips {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.summary-chips + .panel {
  margin-top: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  border: 1px solid #3e3e3e;
  border-radius: 999px;
  padding: 0.28rem 0.56rem;
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip strong {
  font-family: "Poppins", sans-serif;
  font-weight: 400;
  font-size: 0.92rem;
  line-height: inherit;
  letter-spacing: normal;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.link-pill {
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.72rem;
  color: var(--ink);
}

.link-pill:hover {
  border-color: var(--accent);
}

.flash {
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgb(42 42 42 / 90%);
  padding: 0.72rem 0.85rem;
}

.flash.success {
  border-color: rgb(121 184 95 / 52%);
  color: #daefce;
}

.flash.error {
  border-color: rgb(187 68 56 / 60%);
  color: #f4cdc6;
}

.stacked-form {
  display: grid;
  gap: 0.62rem;
}

.stacked-form label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.unit-entry-row {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px);
  align-items: end;
}

.filter-form {
  margin: 1rem 0 0.8rem;
  display: grid;
  gap: 0.9rem;
}

.filter-form label,
.form-hint {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.filter-form label {
  display: block;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.filter-grid {
  display: grid;
  gap: 0.9rem 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.1rem;
}

.form-hint {
  margin: 0;
  letter-spacing: normal;
  text-transform: none;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid #404040;
  border-radius: 8px;
  padding: 0.62rem 0.68rem;
  background: #0f0f0f;
  color: var(--ink);
}

input,
select {
  height: 40px;
  min-height: 40px;
  line-height: 1.2;
  padding-top: 0;
  padding-bottom: 0;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(215 63 48 / 25%);
}

textarea {
  resize: vertical;
}

.btn {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: linear-gradient(115deg, var(--accent), #bc2f22);
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.62rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.btn:hover {
  background: linear-gradient(115deg, var(--accent-hover), #c53a2c);
}

.btn.ghost {
  border-color: #4c4c4c;
  background: transparent;
  color: var(--ink);
}

.filter-actions .btn,
.filter-actions .btn.ghost {
  padding: 0.38rem 0.62rem;
}

.btn.danger {
  border-color: #a2352a;
  background: linear-gradient(115deg, #a9372a, #872b21);
}

.btn.danger:hover {
  background: linear-gradient(115deg, #bb4334, #973228);
}

.btn.success {
  border-color: #a2b0b8;
  background: linear-gradient(115deg, #566269, #4b5961);
}

.btn.success:hover {
  background: linear-gradient(115deg, #65757f, #566269);
}

.button-row {
  display: flex;
  gap: 0.55rem;
}

.inline-activity-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.inline-activity-form select,
.inline-activity-form input {
  width: auto;
  min-width: 86px;
  padding: 0.35rem 0.48rem;
  font-size: 0.74rem;
}

.inline-activity-form .btn {
  padding: 0.38rem 0.6rem;
  font-size: 0.68rem;
}

.product-adjust-form {
  margin-top: 0.5rem;
}

.product-delete-form {
  margin-top: 1.8rem;
}

.product-qty {
  font-weight: 400;
  white-space: nowrap;
}

.warning-panel {
  border-color: rgb(169 55 42 / 58%);
  background: linear-gradient(180deg, rgb(86 31 25 / 28%), #1f1f1f);
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  margin-top: 0.7rem;
}

.filter-form + table {
  margin-top: 1.4rem;
}

.table-legend {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
}

.most-used-table {
  min-width: 0;
}

.most-used-table th:nth-child(2),
.most-used-table td:nth-child(2),
.most-used-table th:nth-child(3),
.most-used-table td:nth-child(3) {
  white-space: nowrap;
}

.usage-insights-table th:nth-child(4),
.usage-insights-table td:nth-child(4),
.usage-insights-table th:nth-child(5),
.usage-insights-table td:nth-child(5) {
  white-space: nowrap;
}

th,
td {
  border-bottom: 1px solid #363636;
  padding: 0.6rem 0.28rem;
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.row-alert {
  background: rgb(215 63 48 / 18%);
}

.row-alert td {
  background: rgb(215 63 48 / 14%);
  border-bottom-color: rgb(215 63 48 / 18%);
}

.row-alert td:first-child {
  box-shadow: inset 3px 0 0 rgb(215 63 48 / 65%);
}

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

.activity-list {
  margin: 0.8rem 0 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  border-bottom: 1px solid #363636;
  padding: 0.72rem 0;
}

.activity-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.activity-main .tag {
  margin-left: 0;
}

.activity-context {
  margin-top: 0.22rem;
  font-size: 0.84rem;
}

.activity-meta {
  margin-top: 0.3rem;
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.item-with-icon {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.38rem;
}

.type-icon {
  display: inline-block;
  font-size: 0.95rem;
  line-height: 1;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  border-radius: 999px;
  min-width: 1.6rem;
  padding: 0.24rem 0.62rem;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

.tag.usage {
  background: rgb(227 138 66 / 20%);
  color: #ffcf98;
}

.tag.restock {
  background: rgb(121 184 95 / 20%);
  color: #ccebbf;
}

.conditional-field.hidden {
  display: none;
}

@media (max-width: 640px) {
  .unit-entry-row {
    grid-template-columns: 1fr;
  }

  .build-badge {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .build-badge span {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

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

@media (max-width: 680px) {
  .dashboard-ledger-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-row-list li {
    grid-template-columns: 1fr;
  }

  .dashboard-row-value {
    text-align: left;
  }

  .dashboard-ledger-head,
  .dashboard-section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  th,
  td {
    font-size: 0.8rem;
  }

  .button-row {
    flex-direction: column;
  }

  .btn,
  .btn.ghost {
    width: 100%;
  }

  .topbar .btn,
  .topbar .btn.ghost {
    width: auto;
  }

  .nav a {
    padding: 0.34rem 0.56rem;
    font-size: 0.72rem;
  }

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

  .inline-activity-form .btn {
    grid-column: 1 / -1;
    width: 100%;
  }
}
