:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --text: #1a1f2b;
  --muted: #687385;
  --line: #dbe1e8;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --danger: #b42318;
  --warning: #b54708;
  --ok: #067647;
  --shadow: 0 16px 40px rgba(22, 34, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans TC", sans-serif;
  letter-spacing: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  padding: 22px;
  background: #111827;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand small,
.sidebar-user a {
  display: block;
  color: #aab4c3;
  margin-top: 4px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a {
  color: #e5e7eb;
  padding: 11px 12px;
  border-radius: 8px;
}

.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.main {
  margin-left: 244px;
  padding: 32px;
}

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

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

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

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

.metrics article {
  padding: 18px;
}

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

.metrics strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.panel {
  padding: 20px;
  margin-bottom: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 38px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.ghost {
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
}

code {
  background: #eef2f6;
  border: 1px solid #dde5ee;
  border-radius: 6px;
  padding: 3px 6px;
  font-family: Consolas, monospace;
  word-break: break-all;
}

.token {
  display: block;
  padding: 12px;
  margin-bottom: 14px;
}

.small-token {
  display: inline-block;
  max-width: 280px;
}

.url-token {
  display: inline-block;
  max-width: 420px;
}

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

.api-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.badge {
  display: inline-flex;
  min-width: 62px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge.active {
  color: var(--ok);
  background: #dcfae6;
}

.badge.used {
  color: #175cd3;
  background: #d1e9ff;
}

.badge.void {
  color: var(--warning);
  background: #fef0c7;
}

.badge.pending {
  color: var(--warning);
  background: #fef0c7;
}

.badge.approved {
  color: var(--ok);
  background: #dcfae6;
}

.badge.rejected,
.badge.disabled {
  color: var(--danger);
  background: #fee4e2;
}

.form {
  display: grid;
  gap: 14px;
}

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

.form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

.form .wide {
  grid-column: 1 / -1;
}

.notice,
.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 700;
}

.notice {
  color: var(--ok);
  background: #dcfae6;
  border: 1px solid #abefc6;
}

.alert {
  color: var(--danger);
  background: #fee4e2;
  border: 1px solid #fecdca;
}

.login-card {
  width: min(880px, 100%);
  display: grid;
  grid-template-columns: 1fr 360px;
  overflow: hidden;
}

.login-copy {
  padding: 42px;
  background: #111827;
  color: #fff;
}

.login-copy h1 {
  margin-top: 20px;
}

.login-copy p {
  color: #cbd5e1;
}

.login-card .form {
  padding: 42px;
}

.inline-form {
  margin: 0;
}

.inline-approve-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 8px;
  margin: 0;
}

.inline-approve-form select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 28px;
}

@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .main {
    margin-left: 0;
    padding: 20px;
  }

  .metrics,
  .api-grid,
  .grid-form,
  .login-card {
    grid-template-columns: 1fr;
  }

  .page-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
