:root {
  --bg: #f6f3ee;
  --ink: #18211f;
  --muted: #68716e;
  --panel: #ffffff;
  --line: #ded8cf;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --danger: #b42318;
  --notice: #1f5f99;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Tahoma, Arial, sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent-dark);
}

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.public-page {
  background:
    linear-gradient(rgba(246, 243, 238, 0.76), rgba(246, 243, 238, 0.92)),
    url("https://images.unsplash.com/photo-1523050854058-8df90110c9f1?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.compact-page {
  background: linear-gradient(135deg, #f6f3ee, #e7f1ef);
}

.panel {
  width: min(720px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(24, 33, 31, 0.12);
}

.request-panel,
.auth-panel {
  padding: 36px;
}

.brand-block h1,
.auth-panel h1,
.admin-header h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 48px);
  line-height: 1.15;
}

.brand-block p:not(.eyebrow) {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-weight: 700;
}

.request-form,
.stack-form {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

label {
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
  font-size: 16px;
  background: #fff;
}

button,
.button {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

.button.secondary {
  background: #1f5f99;
}

.button.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--line);
}

.admin-link {
  display: inline-block;
  margin-top: 22px;
}

.alert,
.notice {
  margin: 18px 0;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, white);
  background: #fff4f2;
  color: var(--danger);
  font-weight: 700;
}

.notice {
  border-color: color-mix(in srgb, var(--notice) 28%, white);
  background: #eef7ff;
  color: var(--notice);
}

.admin-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.header-actions,
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toolbar {
  margin-bottom: 14px;
  display: grid;
  gap: 12px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 280px) minmax(160px, 220px) minmax(150px, 220px) auto;
  gap: 10px;
}

.export-form {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.checkbox input {
  width: auto;
  min-height: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 4px;
}

.stat-card strong {
  font-size: 26px;
}

.conflict-alert {
  display: grid;
  gap: 12px;
}

.conflict-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.conflict-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, white);
  border-radius: 999px;
  background: #fff;
  color: var(--danger);
  text-decoration: none;
  font-weight: 700;
}

.conflict-row {
  background: #fff8f7;
}

.table-wrap th:nth-child(1),
.table-wrap td:nth-child(1) {
  width: 12%;
}

.table-wrap th:nth-child(2),
.table-wrap td:nth-child(2) {
  width: 16%;
}

.table-wrap th:nth-child(3),
.table-wrap td:nth-child(3) {
  width: 14%;
}

.table-wrap th:nth-child(4),
.table-wrap td:nth-child(4) {
  width: 11%;
}

.table-wrap th:nth-child(5),
.table-wrap td:nth-child(5) {
  width: 14%;
}

.table-wrap th:nth-child(6),
.table-wrap td:nth-child(6) {
  width: 11%;
}

.table-wrap th:nth-child(7),
.table-wrap td:nth-child(7),
.table-wrap th:nth-child(8),
.table-wrap td:nth-child(8) {
  width: 6%;
}

.table-wrap th:nth-child(9),
.table-wrap td:nth-child(9) {
  width: 16%;
}

.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 0;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
}

th {
  background: #eef7f5;
  color: #16413d;
}

.actions form {
  margin: 0;
}

.actions button {
  min-height: 34px;
  padding: 6px 10px;
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--line);
}

.actions {
  flex-wrap: wrap;
}

.actions a,
.actions button {
  min-width: 68px;
}

.control {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.control span {
  color: var(--muted);
  font-size: 13px;
}

.editor-form {
  width: min(900px, 100%);
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field small {
  color: var(--danger);
  font-weight: 700;
}

.editor-form button {
  grid-column: 1 / -1;
}

@media (max-width: 760px) {
  body {
    background: #fff;
  }

  .page {
    align-items: stretch;
    justify-items: stretch;
    padding: 0;
  }

  .public-page,
  .compact-page {
    background: var(--panel);
  }

  .request-panel,
  .auth-panel {
    width: 100%;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 28px 18px;
  }

  .brand-block h1,
  .auth-panel h1,
  .admin-header h1 {
    font-size: 31px;
  }

  .brand-block p:not(.eyebrow) {
    font-size: 16px;
  }

  .request-form,
  .stack-form {
    gap: 14px;
  }

  .request-form button,
  .stack-form button {
    width: 100%;
  }

  .admin-shell {
    padding: 16px;
  }

  .admin-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-header {
    gap: 12px;
    margin-bottom: 16px;
  }

  .header-actions {
    gap: 8px;
  }

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

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

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

  .filters {
    gap: 8px;
  }

  .table-wrap {
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(24, 33, 31, 0.07);
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: minmax(96px, 38%) 1fr;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    word-break: break-word;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
  }

  td:last-child {
    border-bottom: 0;
  }

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

  .actions a,
  .actions form,
  .actions button {
    width: 100%;
  }

  .actions a,
  .actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
  }

  .editor-form {
    width: 100%;
    padding: 16px;
    border-radius: 8px;
    box-shadow: none;
  }
}

@media (max-width: 420px) {
  .request-panel,
  .auth-panel {
    padding-inline: 16px;
  }

  .brand-block h1,
  .auth-panel h1,
  .admin-header h1 {
    font-size: 28px;
  }

  .admin-shell {
    padding: 12px;
  }

  td {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
