/* Dark Market Watch — review-driven grimdark refinement */
:root {
  color-scheme: dark;
  --black: #080808;
  --dungeon: #111111;
  --stone: #181614;
  --stone-raised: #211d19;
  --stone-soft: #15120f;
  --ledger: #100d0b;
  --parchment: #eee3cd;
  --parchment-soft: #d0c2a5;
  --parchment-dim: #a99b80;
  --tertiary: #7f735f;
  --brass: #c5a059;
  --brass-light: #dfbd74;
  --brass-dark: #765827;
  --blood: #6a1b1b;
  --blood-light: #8b2a2a;
  --success: #52774a;
  --success-light: #92b889;
  --rarity-poor: #858585;
  --rarity-common: #d2c7ad;
  --rarity-uncommon: #4b9a45;
  --rarity-rare: #4679bc;
  --rarity-epic: #7b4aae;
  --rarity-legendary: #c77a2c;
  --rarity-unique: #d3aa3b;
  --panel-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    inset 0 -14px 26px rgba(0, 0, 0, 0.32),
    0 14px 30px rgba(0, 0, 0, 0.5);
  --inset-shadow:
    inset 0 2px 7px rgba(0, 0, 0, 0.68),
    inset 0 0 0 1px rgba(255, 255, 255, 0.012);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--black);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--parchment);
  font-family: "EB Garamond", Baskerville, Georgia, serif;
  font-size: 17px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 18% -10%, rgba(197, 160, 89, 0.06), transparent 32rem),
    radial-gradient(circle at 94% 18%, rgba(106, 27, 27, 0.055), transparent 28rem),
    linear-gradient(180deg, #0c0c0c 0%, var(--dungeon) 54%, #090909 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.16;
  background-image:
    radial-gradient(circle at 12% 21%, rgba(255, 255, 255, 0.08) 0 1px, transparent 1.5px),
    radial-gradient(circle at 71% 17%, rgba(255, 255, 255, 0.05) 0 1px, transparent 1.5px),
    radial-gradient(circle at 46% 76%, rgba(255, 255, 255, 0.04) 0 1px, transparent 1.5px);
  background-size: 173px 173px, 229px 229px, 281px 281px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.62), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.62)),
    radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.48) 100%);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brass-light);
  outline-offset: 3px;
}

.site-shell {
  width: min(1380px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.hidden {
  display: none !important;
}

.primary-panel,
.secondary-panel,
.alert-card,
.feedback-drawer {
  position: relative;
  border: 1px solid rgba(197, 160, 89, 0.42);
  border-radius: 2px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.022), transparent 34%),
    linear-gradient(180deg, var(--stone-raised), var(--stone));
  box-shadow: var(--panel-shadow);
}

.primary-panel::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -1px;
  bottom: -1px;
  left: -1px;
  width: 7px;
  background: linear-gradient(180deg, var(--brass-light), var(--brass) 42%, var(--brass-dark));
  box-shadow: 2px 0 0 rgba(0, 0, 0, 0.42), 4px 0 13px rgba(197, 160, 89, 0.13);
}

.site-header {
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 20px;
  min-height: 112px;
  margin-bottom: 22px;
  padding: 16px 20px 16px 29px;
}

.site-header > * {
  position: relative;
  z-index: 3;
}

.brand-crest {
  position: relative;
  display: grid;
  width: 70px;
  height: 82px;
  place-items: center;
  overflow: hidden;
  color: var(--brass-light);
  border: 1px solid rgba(197, 160, 89, 0.7);
  background: linear-gradient(180deg, #28211a, #0f0d0b);
  clip-path: polygon(13% 0, 87% 0, 100% 18%, 100% 68%, 50% 100%, 0 68%, 0 18%);
  box-shadow:
    inset 0 0 0 3px #0b0908,
    inset 0 -14px 18px rgba(0, 0, 0, 0.5),
    0 7px 16px rgba(0, 0, 0, 0.5);
}

.crest-lettering {
  position: relative;
  z-index: 3;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 #000;
}

.crest-blade {
  position: absolute;
  width: 2px;
  height: 59px;
  background: linear-gradient(180deg, #a99c87, #534a3e 74%, #1d1915);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}

.crest-blade::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 41px;
  width: 16px;
  height: 3px;
  background: var(--brass-dark);
}

.crest-blade--left {
  transform: rotate(32deg);
}

.crest-blade--right {
  transform: rotate(-32deg);
}

.brand-kicker,
.panel-kicker {
  display: block;
  color: var(--brass);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-copy h1,
.panel-heading h2,
.section-heading h2,
.feedback-drawer h2 {
  font-family: "Almendra", Baskerville, Georgia, serif;
}

.brand-copy h1 {
  margin: 2px 0 1px;
  color: var(--parchment);
  font-size: clamp(2.15rem, 4vw, 3.45rem);
  line-height: 0.98;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 0 #000, 0 0 14px rgba(197, 160, 89, 0.1);
}

.brand-copy p {
  margin: 0;
  color: var(--parchment-dim);
  font-size: 1rem;
}

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

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid rgba(197, 160, 89, 0.32);
  color: var(--parchment-dim);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #1b1815, #100e0c);
  box-shadow: var(--inset-shadow);
}

.status-chip::before {
  content: "";
  width: 3px;
  align-self: stretch;
  margin: -7px 1px -7px -11px;
  background: var(--brass);
}

.status-chip strong {
  color: var(--brass-light);
  font-size: 0.92rem;
}

.status-chip.active {
  border-color: rgba(82, 119, 74, 0.7);
}

.status-chip.active::before {
  background: var(--success);
}

.status-chip.active strong {
  color: var(--success-light);
}

.auth-slot {
  min-width: 210px;
}

#auth-area {
  margin: 0 !important;
  padding: 10px 11px !important;
  border: 1px solid rgba(197, 160, 89, 0.28) !important;
  border-radius: 1px !important;
  background: #15120f !important;
  box-shadow: var(--inset-shadow) !important;
}

#auth-area > div {
  flex-wrap: nowrap !important;
}

#auth-area strong {
  color: var(--brass-light);
}

#auth-area a {
  min-height: 40px;
  padding: 9px 11px !important;
  border: 1px solid #6f675d;
  border-radius: 1px !important;
  color: var(--parchment) !important;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.72rem;
  text-decoration: none;
  text-transform: uppercase;
  background: linear-gradient(180deg, #4d4741, #302b27) !important;
}

.hub-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(300px, 0.68fr);
  gap: 24px;
  align-items: start;
}

.main-column,
.side-column {
  min-width: 0;
}

.side-column {
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 18px;
}

.alert-form {
  display: grid;
  gap: 20px;
  margin-bottom: 34px;
  padding: 24px 24px 24px 32px;
}

.alert-form > * {
  position: relative;
  z-index: 3;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(197, 160, 89, 0.24);
}

.panel-heading h2,
.section-heading h2 {
  margin: 2px 0 0;
  color: var(--parchment);
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
  line-height: 1;
}

.panel-heading p,
.section-heading p {
  max-width: 60ch;
  margin: 7px 0 0;
  color: var(--parchment-dim);
  font-size: 0.98rem;
}

.panel-heading--small {
  margin-bottom: 12px;
  padding-bottom: 11px;
}

.panel-heading--small h2 {
  font-size: 1.45rem;
}

.panel-sigil {
  color: var(--brass-dark);
  font-size: 1.45rem;
}

.form-stage {
  padding: 4px 0 0;
}

.stage-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.stage-heading h3,
.watch-state h3 {
  margin: 0;
  color: var(--parchment);
  font-family: "Almendra", Baskerville, Georgia, serif;
  font-size: 1.25rem;
  line-height: 1.05;
}

.stage-heading p,
.watch-state p {
  margin: 4px 0 0;
  color: var(--parchment-dim);
  font-size: 0.92rem;
}

.stage-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(197, 160, 89, 0.42);
  color: var(--brass-light);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.72rem;
  background: #15120f;
  box-shadow: var(--inset-shadow);
}

.primary-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(150px, 0.68fr) minmax(160px, 0.68fr);
  gap: 15px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.14);
}

.form-row {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.form-row label,
.feedback-form label {
  margin-bottom: 7px;
  color: var(--brass-light);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 47px;
  padding: 11px 13px;
  border: 1px solid rgba(197, 160, 89, 0.34);
  border-radius: 0;
  outline: none;
  color: var(--parchment);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.016), rgba(0, 0, 0, 0.06)),
    var(--ledger);
  box-shadow: var(--inset-shadow);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

select {
  padding-right: 34px;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brass) 50%),
    linear-gradient(135deg, var(--brass) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

select option {
  color: var(--parchment);
  background: #15120f;
}

input::placeholder,
textarea::placeholder {
  color: #766b58;
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(197, 160, 89, 0.55);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brass-light);
  background-color: #17120e;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(197, 160, 89, 0.24),
    0 0 12px rgba(197, 160, 89, 0.08);
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-left: 38px;
}

.input-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  color: var(--brass);
  font-size: 1rem;
  pointer-events: none;
}

.input-with-icon--coin .input-icon {
  font-size: 0.78rem;
}

.stats-section {
  padding-top: 4px;
}

.stats-heading {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.stats-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.14);
}

.stat-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(120px, 0.58fr) 44px;
  gap: 11px;
  align-items: end;
  padding: 11px 0;
  border-bottom: 1px solid rgba(197, 160, 89, 0.13);
}

.stat-filter-row:last-child {
  border-bottom: 0;
}

.stat-filter-row .helper-text {
  grid-column: 1 / 3;
  min-height: 18px;
  margin-top: -3px;
  color: var(--parchment-dim);
  font-size: 0.86rem;
  line-height: 1.35;
}

.watch-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.14);
}

.watch-state > div {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.ledger-check {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(82, 119, 74, 0.56);
  color: var(--success-light);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  background: rgba(82, 119, 74, 0.08);
}

.ledger-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-mark {
  width: 17px;
  height: 17px;
  border: 1px solid rgba(146, 184, 137, 0.7);
  background: #0d0f0c;
  box-shadow: var(--inset-shadow);
}

.ledger-check input:checked + .check-mark::after {
  content: "✓";
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--success-light);
  font-size: 0.85rem;
}

.ledger-check:focus-within {
  outline: 2px solid var(--brass-light);
  outline-offset: 3px;
}

.button,
.add-stat-btn,
.remove-stat-btn,
.alert-card button,
.feedback-submit,
.feedback-toggle,
.feedback-close {
  min-height: 44px;
  border: 1px solid;
  border-radius: 0;
  cursor: pointer;
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    inset 0 -3px 7px rgba(0, 0, 0, 0.34),
    0 4px 9px rgba(0, 0, 0, 0.32);
  transition: transform 0.14s ease, filter 0.14s ease, border-color 0.14s ease;
}

.button:hover,
.add-stat-btn:hover,
.remove-stat-btn:hover,
.alert-card button:hover,
.feedback-submit:hover,
.feedback-toggle:hover,
.feedback-close:hover {
  transform: translateY(-1px);
  filter: brightness(1.07);
}

.button:active,
.add-stat-btn:active,
.remove-stat-btn:active,
.alert-card button:active,
.feedback-submit:active,
.feedback-toggle:active,
.feedback-close:active {
  transform: translateY(0);
}

.button:disabled,
.add-stat-btn:disabled,
.alert-card button:disabled,
.feedback-submit:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  transform: none;
}

.button--primary {
  padding: 10px 18px;
  color: #181106;
  border-color: #8c6a33;
  background: linear-gradient(180deg, #dab76f, var(--brass) 53%, #97723a);
}

.button--utility,
.add-stat-btn,
.button--quiet,
.alert-card .edit-btn,
.alert-card .test-btn,
.alert-card .toggle-btn,
.feedback-toggle,
.feedback-close {
  padding: 9px 13px;
  color: var(--parchment);
  border-color: #625a51;
  background: linear-gradient(180deg, #47413b, #2e2925);
}

.button--quiet {
  color: var(--parchment-soft);
  background: transparent;
  box-shadow: none;
}

.remove-stat-btn,
.alert-card .delete-btn {
  color: #f0d1ca;
  border-color: rgba(139, 42, 42, 0.9);
  background: linear-gradient(180deg, #742323, #491313);
}

.remove-stat-btn {
  width: 44px;
  padding: 0;
  font-size: 1.15rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-top: 4px;
}

.field-error {
  min-height: 20px;
  margin-top: 5px;
  color: #d98f85;
  font-size: 0.86rem;
  line-height: 1.3;
}

.field-error:empty {
  min-height: 0;
  margin-top: 0;
}

.field-error--block {
  margin-top: 8px;
}

.has-error input,
.has-error select {
  border-color: var(--blood-light);
  box-shadow:
    var(--inset-shadow),
    0 0 0 1px rgba(139, 42, 42, 0.35);
}

.alerts-section {
  padding-top: 4px;
}

.section-heading {
  margin-bottom: 14px;
}

.alerts-grid,
#alerts-container {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.alert-card {
  --rarity-color: var(--brass);
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 13px;
  padding: 17px 17px 16px 22px;
  overflow: hidden;
  border-color: rgba(197, 160, 89, 0.28);
}

.alert-card::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: -1px;
  bottom: -1px;
  left: -1px;
  width: 6px;
  background: var(--rarity-color);
  box-shadow: 3px 0 12px color-mix(in srgb, var(--rarity-color) 22%, transparent);
}

.alert-card.rarity-poor { --rarity-color: var(--rarity-poor); }
.alert-card.rarity-common { --rarity-color: var(--rarity-common); }
.alert-card.rarity-uncommon { --rarity-color: var(--rarity-uncommon); }
.alert-card.rarity-rare { --rarity-color: var(--rarity-rare); }
.alert-card.rarity-epic { --rarity-color: var(--rarity-epic); }
.alert-card.rarity-legendary { --rarity-color: var(--rarity-legendary); }
.alert-card.rarity-unique { --rarity-color: var(--rarity-unique); }

.alert-card > * {
  position: relative;
  z-index: 3;
}

.alert-card .card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.alert-title-block {
  min-width: 0;
}

.alert-card .alert-title {
  margin: 0 0 6px;
  color: var(--parchment);
  font-family: "Almendra", Baskerville, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.rarity-badge,
.state-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid currentColor;
  color: var(--rarity-color);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.2);
}

.state-badge {
  flex: 0 0 auto;
  color: var(--success-light);
  border-color: rgba(82, 119, 74, 0.72);
  background: rgba(82, 119, 74, 0.1);
}

.status-disabled .state-badge {
  color: #c8a39f;
  border-color: rgba(106, 27, 27, 0.72);
  background: rgba(106, 27, 27, 0.1);
}

.alert-summary {
  display: grid;
  gap: 10px;
}

.alert-price {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--parchment-soft);
  font-size: 1rem;
}

.coin-mark {
  color: var(--brass-light);
  font-size: 0.76rem;
}

.stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 5px 9px;
  border: 1px solid rgba(197, 160, 89, 0.22);
  color: var(--parchment-soft);
  font-size: 0.9rem;
  line-height: 1.2;
  background: rgba(0, 0, 0, 0.16);
}

.stat-chip--empty {
  color: var(--tertiary);
}

.alert-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 2px;
}

.alert-card button {
  padding: 8px 10px;
  font-size: 0.7rem;
}

.alert-card .delete-btn {
  margin-left: auto;
}

.secondary-panel {
  padding: 18px;
}

.secondary-panel p {
  color: var(--parchment-dim);
  font-size: 0.98rem;
}

.ledger-note {
  margin: 0 0 14px;
}

.rarity-list {
  display: grid;
  gap: 8px;
}

.rarity-mark {
  --mark-color: var(--rarity-common);
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(197, 160, 89, 0.12);
  color: var(--parchment-soft);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.76rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.rarity-mark:last-child {
  border-bottom: 0;
}

.rarity-mark i {
  width: 13px;
  height: 13px;
  border: 1px solid color-mix(in srgb, var(--mark-color) 75%, white 25%);
  background: var(--mark-color);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.32);
}

.rarity-mark--poor { --mark-color: var(--rarity-poor); }
.rarity-mark--common { --mark-color: var(--rarity-common); }
.rarity-mark--uncommon { --mark-color: var(--rarity-uncommon); }
.rarity-mark--rare { --mark-color: var(--rarity-rare); }
.rarity-mark--epic { --mark-color: var(--rarity-epic); }
.rarity-mark--legendary { --mark-color: var(--rarity-legendary); }
.rarity-mark--unique { --mark-color: var(--rarity-unique); }

.field-notes p {
  margin-bottom: 0;
}

.feedback-control {
  position: fixed;
  z-index: 40;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 10px;
}

.feedback-toggle {
  min-width: 178px;
}

.feedback-drawer {
  width: min(390px, calc(100vw - 32px));
  padding: 18px;
  border-color: rgba(197, 160, 89, 0.38);
}

.feedback-drawer[hidden] {
  display: none;
}

.feedback-drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.feedback-drawer h2 {
  margin: 0 0 3px;
  font-size: 1.5rem;
  line-height: 1;
}

.feedback-drawer p {
  margin: 0;
  color: var(--parchment-dim);
  font-size: 0.92rem;
}

.feedback-close {
  min-width: 44px;
  padding: 0;
  font-size: 1.1rem;
}

.feedback-form {
  display: grid;
  gap: 8px;
}

.feedback-input {
  min-height: 82px;
  max-height: 230px;
  resize: none;
  overflow-y: hidden;
}

.feedback-meta {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--tertiary);
  font-size: 0.82rem;
}

.feedback-status {
  color: var(--success-light);
}

.feedback-status.error {
  color: #d98f85;
}

.feedback-submit {
  justify-self: start;
  padding: 9px 14px;
  color: #181106;
  border-color: #8c6a33;
  background: linear-gradient(180deg, #dab76f, var(--brass) 53%, #97723a);
}

.feedback-drawer.is-error {
  border-color: rgba(139, 42, 42, 0.82);
  box-shadow: var(--panel-shadow), 0 0 16px rgba(106, 27, 27, 0.18);
}

.toast-region {
  position: fixed;
  z-index: 60;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  min-width: 240px;
  padding: 11px 14px;
  border: 1px solid rgba(82, 119, 74, 0.72);
  color: var(--parchment);
  text-align: center;
  background: #151a13;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.48);
  animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.note {
  color: var(--parchment-dim);
}

@media (max-width: 1120px) {
  .site-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .status-area {
    grid-column: 2;
    justify-content: flex-start;
  }

  .auth-slot {
    grid-row: 1 / 3;
    grid-column: 3;
  }

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

  .side-column {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .site-shell {
    width: min(100% - 22px, 1380px);
    padding-top: 14px;
  }

  .site-header {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
    padding: 14px 14px 14px 23px;
  }

  .brand-crest {
    width: 58px;
    height: 68px;
  }

  .brand-copy h1 {
    font-size: 2.1rem;
  }

  .brand-copy p {
    display: none;
  }

  .status-area {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .auth-slot {
    grid-row: auto;
    grid-column: 1 / -1;
    min-width: 0;
  }

  #auth-area > div {
    flex-wrap: wrap !important;
  }

  .alert-form {
    padding: 19px 17px 19px 24px;
  }

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

  .stats-heading {
    grid-template-columns: auto 1fr;
  }

  .stats-heading .add-stat-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .stat-filter-row {
    grid-template-columns: minmax(0, 1fr) minmax(105px, 0.45fr) 44px;
  }

  .alerts-grid,
  #alerts-container {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 540px) {
  body {
    font-size: 16px;
  }

  .brand-kicker {
    font-size: 0.62rem;
  }

  .brand-copy h1 {
    font-size: 1.78rem;
  }

  .status-chip {
    flex: 1 1 130px;
    justify-content: center;
  }

  .panel-heading {
    align-items: flex-start;
  }

  .panel-sigil {
    display: none;
  }

  .stage-heading,
  .watch-state > div {
    gap: 9px;
  }

  .watch-state {
    align-items: stretch;
    flex-direction: column;
  }

  .ledger-check {
    justify-content: center;
  }

  .stat-filter-row {
    grid-template-columns: 1fr 44px;
  }

  .stat-filter-row .stat-select-field {
    grid-column: 1 / -1;
  }

  .stat-filter-row .stat-min-field {
    grid-column: 1;
  }

  .stat-filter-row .remove-stat-btn {
    grid-column: 2;
  }

  .stat-filter-row .helper-text {
    grid-column: 1 / -1;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .button {
    width: 100%;
  }

  .alert-card .delete-btn {
    width: 100%;
    margin-left: 0;
  }

  .feedback-control {
    right: 12px;
    bottom: 12px;
  }

  .feedback-toggle {
    min-width: 160px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
