:root {
  --bg: #f6f0e6;
  --panel: #fff9f0;
  --line: #d7c4a9;
  --text: #1b1712;
  --muted: #6d6155;
  --accent: #9a3f21;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
body.modal-open { overflow: hidden; }
body {
  margin: 0;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(154, 63, 33, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(38, 94, 86, 0.13), transparent 25%),
    var(--bg);
}
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(100%, 460px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(61, 38, 15, 0.08);
  padding: 28px;
}
.wrap { max-width: 1360px; margin: 0 auto; padding: 28px 18px 44px; }
.hero, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 12px 30px rgba(61, 38, 15, 0.08);
}
.hero {
  display: flex; justify-content: space-between; gap: 18px; align-items: end;
  padding: 26px; margin-bottom: 18px;
}
.eyebrow { margin: 0; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; }
h1 { margin: 8px 0 10px; font-size: 38px; }
.desc, .muted { color: var(--muted); }
.actions, .row, .head { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.compact {
  margin: 0;
  font-size: 14px;
}
.card-heading {
  display: grid;
  gap: 4px;
}
.card-heading h2 {
  margin: 0;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
}
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-bottom: 18px; }
.card { padding: 22px; }
.form { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
input, textarea, button { font: inherit; }
input, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: #fff;
}
button {
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text);
  padding: 10px 16px; cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff7f0; }
.proxy-table-card {
  overflow: hidden;
}
.table-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
}
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
th, td {
  text-align: left;
  padding: 11px 8px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}
.proxy-table {
  font-size: 14px;
  line-height: 1.35;
}
thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.proxy-table th:nth-child(4),
.proxy-table th:nth-child(5),
.proxy-table th:nth-child(6),
.proxy-table th:nth-child(7),
.proxy-table td:nth-child(4),
.proxy-table td:nth-child(5),
.proxy-table td:nth-child(6),
.proxy-table td:nth-child(7) {
  text-align: center;
}
.cell-link {
  text-align: center;
}
.cell-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: center;
  width: 100%;
}
.proxy-table th:nth-child(8),
.proxy-table td:nth-child(8) {
  text-align: center;
}
.app-name-cell {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 136px;
}
.app-name-display,
.app-name-inline {
  width: 136px;
  min-width: 0;
  border-radius: 10px;
}
.app-name-display {
  justify-content: flex-start;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid transparent;
  background: rgba(31, 111, 255, 0.08);
  color: #17479e;
  border-radius: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}
.app-name-display:hover {
  background: rgba(31, 111, 255, 0.14);
}
.app-name-display.is-empty {
  background: rgba(109, 97, 85, 0.08);
  color: var(--muted);
}
.app-name-inline {
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid #1f6fff;
  box-shadow: 0 0 0 3px rgba(31, 111, 255, 0.12);
  font-size: 14px;
}
.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  min-height: 34px;
  padding: 7px 13px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.primary-link {
  background: #1f6fff;
  color: #fff;
  border: 1px solid #1f6fff;
  box-shadow: 0 8px 18px rgba(31, 111, 255, 0.18);
}
.primary-link:hover {
  background: #165dde;
  border-color: #165dde;
}
.cell-actions button {
  min-height: 34px;
  padding: 7px 13px;
  font-size: 14px;
  font-weight: 600;
}
.danger-btn {
  border-color: #d67a6b;
  color: #9f2f22;
  background: #fff5f2;
}
.danger-btn:hover {
  background: #ffe9e4;
}
.proxy-table th:nth-child(1) { width: 12%; }
.proxy-table th:nth-child(2) { width: 16%; }
.proxy-table th:nth-child(3) { width: 13%; }
.proxy-table th:nth-child(4) { width: 8%; }
.proxy-table th:nth-child(5) { width: 8%; }
.proxy-table th:nth-child(6) { width: 8%; }
.proxy-table th:nth-child(7) { width: 8%; }
.proxy-table th:nth-child(8) { width: 14%; }
.proxy-table td:nth-child(1),
.proxy-table td:nth-child(2),
.proxy-table td:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
}
.proxy-table td:nth-child(8) {
  overflow: hidden;
}
pre {
  min-height: 200px; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word;
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(27, 23, 18, 0.38);
  backdrop-filter: blur(8px);
}
.modal-card {
  width: min(100%, 560px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 54px rgba(61, 38, 15, 0.18);
  padding: 24px;
}
.modal-card .desc {
  margin: 14px 0 18px;
}
@media (max-width: 980px) {
  .grid.two { grid-template-columns: 1fr; }
  .hero { align-items: start; }
  .table-wrap {
    overflow-x: auto;
  }
  table {
    table-layout: auto;
  }
  th, td {
    white-space: normal;
  }
  .cell-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .app-name-cell {
    width: 100%;
    max-width: none;
  }
  .app-name-display,
  .app-name-inline {
    width: 100%;
  }
}
