:root {
  --ink: #16181b;
  --muted: #4b4f55;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --line: #cfd3d8;
  --line-strong: #9ca4ae;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  --red: #e11922;
  --red-dark: #a30d14;
  --success-bg: #e8f5eb;
  --success-line: #b6d9be;
  --error-bg: #fbe8e8;
  --error-line: #e1b1b1;
  --focus: #2c7be5;
  --card-stack-gap-mobile: 0.875rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", Tahoma, sans-serif;
  line-height: 1.45;
  color: var(--ink);
  background: linear-gradient(180deg, #f2f3f5 0%, #f9f9fa 55%, #edeff2 100%);
}

body.menu-open {
  overflow: hidden;
}

.skip-link {
  position: fixed;
  top: -3rem;
  left: 0.75rem;
  z-index: 100;
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--focus);
  border-radius: 0.5rem;
  padding: 0.5rem 0.75rem;
  text-decoration: none;
  font-weight: 700;
}

.skip-link:focus-visible {
  top: 0.75rem;
}

.page-wrap {
  width: min(1120px, 100% - 1rem);
  margin: 0.85rem auto 1.1rem;
  overflow-x: clip;
}

section,
.panel {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.9rem;
  margin-bottom: 0.85rem;
}

.grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: 1fr;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
}

h2,
h3,
h4 {
  margin-bottom: 0.6rem;
}

h2 {
  font-size: 1.18rem;
}

h3 {
  font-size: 1.05rem;
}

h4 {
  font-size: 0.98rem;
}

p {
  margin-top: 0;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.52rem;
  font-size: 0.94rem;
  vertical-align: middle;
}

th {
  color: #fff;
  background: linear-gradient(100deg, #1b1c1f 0%, #34373d 100%);
  font-weight: 700;
  letter-spacing: 0.01em;
}

tbody tr:nth-child(2n) {
  background: #f4f5f7;
}

form.inline {
  margin-bottom: 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

form.stack-form {
  display: grid;
  gap: 0.6rem;
  max-width: 420px;
}

form.stack-form button {
  justify-self: start;
}

input,
select,
button,
textarea {
  font: inherit;
  font-size: 1rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #b7bcc2;
  background: #fff;
}

input,
select,
button {
  min-height: 44px;
}

button {
  border-color: var(--red-dark);
  background: var(--red);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: #bf121a;
}

a {
  color: #8c0e14;
}

a:hover {
  color: #6f0b11;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.flash {
  margin: 0.3rem 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.flash.success {
  background: var(--success-bg);
  border-color: var(--success-line);
}

.flash.error {
  background: var(--error-bg);
  border-color: var(--error-line);
}

@media (min-width: 700px) {
  .page-wrap {
    margin: 1.2rem auto 1.4rem;
  }

  section,
  .panel {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
  }

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