:root {
  --bg: #f4f1ea;
  --ink: #16191f;
  --muted: #69717f;
  --line: #d9d4c9;
  --panel: #fffdf8;
  --blue: #2457d6;
  --green: #0f8a5f;
  --red: #c2412d;
  --amber: #b77711;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  min-height: 42px;
  padding: 0 16px;
}

button:hover {
  filter: brightness(0.96);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
}

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

.hidden {
  display: none !important;
}

.login-panel {
  min-height: calc(100vh - 48px);
  display: grid;
  align-content: center;
  gap: 22px;
  max-width: 420px;
}

.login-panel h1,
.topbar h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.08;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-form {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
}

.error-text {
  min-height: 20px;
  margin: 0;
  color: var(--red);
}

.dashboard {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}

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

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metrics article,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.metrics article {
  padding: 16px;
  display: grid;
  gap: 8px;
}

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

.metrics strong {
  font-size: 24px;
}

.ok {
  color: var(--green);
}

.warn {
  color: var(--amber);
}

.panel {
  overflow: hidden;
}

.panel-head {
  padding: 16px 18px 0;
}

.panel h2 {
  margin: 0;
  font-size: 18px;
}

.address-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) minmax(120px, 0.9fr) 96px;
  gap: 10px;
  padding: 16px 18px;
}

.account-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) 118px 118px;
  gap: 10px;
  padding: 16px 18px 0;
}

.hint-text {
  margin: 10px 18px 16px;
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 13px 18px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.chat-link {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.chat-link:hover {
  text-decoration: underline;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.pill.green {
  color: #fff;
  background: var(--green);
}

.pill.red {
  color: #fff;
  background: var(--red);
}

.pill.gray {
  color: var(--muted);
  background: #ebe6dc;
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.actions button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  background: #ece6dc;
}

.split-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
}

.detail-body {
  border-top: 1px solid var(--line);
  padding: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbf7ef;
  min-width: 0;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.detail-address {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  overflow-wrap: anywhere;
}

.detail-body h3 {
  margin: 20px 0 10px;
  font-size: 15px;
}

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

.context-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.context-item.out {
  border-color: rgba(36, 87, 214, 0.35);
  background: #f3f6ff;
}

.context-item div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.context-open {
  margin-left: 8px;
  font-weight: 800;
}

.context-item p {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.empty-text {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 18px, 1120px);
    padding: 14px 0;
  }

  .topbar,
  .login-form {
    grid-template-columns: 1fr;
    display: grid;
  }

  .metrics,
  .address-form,
  .account-form,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .login-panel h1,
  .topbar h1 {
    font-size: 28px;
  }
}
