:root {
  color-scheme: light;
  --blue: #4a6fa5;
  --blue-dark: #2f527f;
  --orange: #f2a65a;
  --orange-soft: #fff1e0;
  --gray: #e6e6e6;
  --ink: #172033;
  --muted: #667085;
  --line: #d6dce6;
  --surface: #f7f8fa;
  --white: #ffffff;
  --danger: #c84b4b;
  --success: #2e7d5b;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f2f4f8 0%, #e7ebf1 100%);
}

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

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 420px;
  align-items: center;
  gap: 48px;
}

.brand-panel {
  min-height: 360px;
  padding: 54px;
  color: var(--white);
  background: var(--blue);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 24px 70px rgba(47, 82, 127, 0.22);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.muted {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.82);
}

.login-form {
  padding: 28px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 55px rgba(23, 32, 51, 0.12);
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

input,
select {
  height: 44px;
}

textarea {
  min-height: 74px;
  padding-top: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.16);
}

.primary-button,
.ghost-button {
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  color: var(--white);
  background: var(--blue);
  font-weight: 800;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.ghost-button {
  color: var(--blue-dark);
  background: var(--gray);
  font-weight: 700;
}

.ghost-button:hover {
  background: #d8dde5;
}

.ghost-button.active {
  color: var(--white);
  background: var(--blue);
}

.form-message {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

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

#statusPanel {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 0 10px;
}

.topbar .eyebrow {
  color: var(--blue);
}

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

.session-user {
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-strip div {
  min-height: 78px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.summary-strip div:last-child {
  border-right: 0;
}

.summary-strip span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.summary-strip strong {
  font-size: 24px;
  line-height: 1;
}

.notice {
  padding: 12px 14px;
  color: var(--blue-dark);
  background: #edf3fb;
  border: 1px solid #c8d7ea;
  border-radius: 6px;
}

.notice.error {
  color: var(--danger);
  background: #fff1f1;
  border-color: #f0c2c2;
}

.table-wrap {
  position: relative;
  min-height: 260px;
  overflow: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--blue-dark);
  background: #eef3fa;
  font-weight: 800;
}

tbody tr:hover {
  background: #fafcff;
}

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

.status-pill::before {
  width: 8px;
  height: 8px;
  content: "";
  border-radius: 50%;
}

.status-online {
  color: var(--success);
  background: #eaf6f0;
}

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

.status-offline {
  color: var(--danger);
  background: #fff0f0;
}

.status-offline::before {
  background: var(--danger);
}

.money-positive {
  color: var(--success);
  font-weight: 800;
}

.money-negative {
  color: var(--orange);
  font-weight: 800;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.admin-panel {
  display: grid;
  gap: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.admin-card,
.token-result {
  padding: 18px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-card h2,
.token-result h2 {
  margin: 0 0 16px;
  color: var(--blue-dark);
  font-size: 18px;
  line-height: 1.2;
}

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

.admin-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-card-title h2 {
  margin: 0;
}

.admin-table-wrap {
  min-height: 220px;
}

.admin-table-wrap table {
  min-width: 1120px;
}

.id-cell {
  max-width: 320px;
  overflow: hidden;
  color: var(--blue-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 22px, 1180px);
    padding: 18px 0;
  }

  .login-view {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .brand-panel {
    min-height: 220px;
    padding: 32px;
  }

  h1 {
    font-size: 28px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .session-user {
    width: 100%;
    max-width: none;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-strip div:nth-child(2) {
    border-right: 0;
  }

  .summary-strip div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

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