:root {
  color-scheme: light;
  --ink: #11141a;
  --muted: #747a86;
  --line: rgba(62, 70, 85, 0.13);
  --glass: rgba(250, 251, 253, 0.68);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; min-height: 100%; background: #edf0f5; }
body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(135deg, #f4f5f7, #e7ebf2 58%, #f7f7f8);
  font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.auth-background,
.auth-wash {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
.auth-background { object-fit: cover; object-position: center; }
.auth-wash {
  background:
    linear-gradient(120deg, rgba(246, 248, 252, 0.88), rgba(239, 242, 248, 0.56)),
    radial-gradient(circle at 75% 20%, rgba(255,255,255,.7), transparent 42%);
  backdrop-filter: blur(5px);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr minmax(360px, 470px);
  align-items: center;
  gap: 80px;
  margin: 0 auto;
  padding: 54px 0;
}
.auth-brand {
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  width: max-content;
}
.auth-brand > img { width: 76px; height: 76px; object-fit: contain; }
.auth-brand span { width: min(260px, 26vw); display: block; }
.auth-brand span img { width: 100%; display: block; }

.auth-card {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  padding: clamp(34px, 4vw, 54px);
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 34px;
  background: var(--glass);
  box-shadow: 0 34px 110px rgba(67, 76, 96, .18);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}
.auth-heading > span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .24em;
}
.auth-heading h1 {
  margin: 17px 0 10px;
  font-size: clamp(36px, 4vw, 52px);
  font-weight: 300;
  letter-spacing: -.055em;
}
.auth-heading p { margin: 0; color: var(--muted); line-height: 1.7; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 32px 0 24px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(238, 241, 246, .6);
}
.auth-tabs button {
  padding: 11px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.auth-tabs button.is-active {
  color: var(--ink);
  background: rgba(255,255,255,.86);
  box-shadow: 0 8px 24px rgba(61, 70, 89, .09);
}

.auth-form { display: grid; gap: 17px; }
.auth-form label { display: grid; gap: 8px; }
.auth-form label > span {
  color: #343840;
  font-size: 13px;
  font-weight: 500;
}
.auth-form small { color: var(--muted); font-size: 11px; }
.auth-form input {
  width: 100%;
  min-height: 49px;
  padding: 0 15px;
  border: 1px solid rgba(72, 80, 96, .15);
  border-radius: 14px;
  outline: 0;
  color: var(--ink);
  background: rgba(255,255,255,.72);
  transition: border .2s ease, box-shadow .2s ease, background .2s ease;
}
.auth-form input:focus {
  border-color: rgba(86, 104, 146, .42);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(102, 121, 164, .09);
}
.auth-submit {
  min-height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: #15181e;
  cursor: pointer;
  transition: transform .25s var(--ease), opacity .2s ease;
}
.auth-submit:hover { transform: translateY(-2px); }
.auth-submit:disabled { opacity: .55; cursor: wait; transform: none; }

.auth-notice {
  margin: 0 0 20px;
  padding: 13px 15px;
  border: 1px solid rgba(56, 118, 86, .18);
  border-radius: 13px;
  color: #226040;
  background: rgba(224, 244, 233, .72);
  font-size: 13px;
  line-height: 1.55;
}
.auth-notice.is-error {
  border-color: rgba(154, 66, 66, .18);
  color: #8e3535;
  background: rgba(250, 231, 231, .78);
}
.auth-footnote {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.admin-page { padding: 34px; }
.admin-shell { position: relative; z-index: 1; width: min(1320px, 100%); margin: 0 auto; }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.admin-header h1 { margin: 0; font-size: clamp(32px, 4vw, 52px); font-weight: 300; letter-spacing: -.05em; }
.admin-header p { margin: 8px 0 0; color: var(--muted); }
.admin-actions { display: flex; gap: 10px; }
.admin-actions a, .admin-actions button, .admin-button {
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255,255,255,.66);
  cursor: pointer;
}
.admin-button.primary {
  border-color: #181b21;
  color: #fff;
  background: #181b21;
}
.admin-button:disabled { opacity: .52; cursor: wait; }
.admin-tabs {
  display: inline-flex;
  gap: 6px;
  margin-bottom: 22px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.48);
}
.admin-tabs button {
  min-width: 126px;
  padding: 11px 17px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.admin-tabs button.is-active {
  color: #fff;
  background: #181b21;
  box-shadow: 0 8px 22px rgba(24,27,33,.16);
}
.admin-panel {
  padding: 24px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 26px;
  background: var(--glass);
  box-shadow: 0 24px 80px rgba(67,76,96,.13);
  backdrop-filter: blur(24px);
}
.admin-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-summary span {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.62);
  font-size: 12px;
}
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 900px; }
.admin-table th, .admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}
.admin-table th { color: var(--muted); font-size: 10px; letter-spacing: .13em; }
.admin-user strong, .admin-user small { display: block; }
.admin-user small { margin-top: 4px; color: var(--muted); }
.status-badge { display: inline-block; padding: 6px 9px; border-radius: 999px; font-size: 11px; }
.status-badge.pending { color: #86651d; background: #fbf1d2; }
.status-badge.active { color: #236243; background: #ddf2e6; }
.status-badge.disabled { color: #8a3b3b; background: #f8dfdf; }
.quota-editor { display: flex; align-items: center; gap: 7px; }
.quota-editor input {
  width: 76px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.72);
}
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.row-actions button {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.72);
  cursor: pointer;
}
.row-actions button.danger { color: #8a3b3b; }
.admin-empty { padding: 42px; text-align: center; color: var(--muted); }

.provider-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin: 4px 0 22px;
}
.provider-intro h2 {
  margin: 0 0 8px;
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 350;
  letter-spacing: -.035em;
}
.provider-intro p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.provider-security {
  flex: 0 0 min(360px, 34vw);
  padding: 14px 16px;
  border: 1px solid rgba(56,118,86,.16);
  border-radius: 14px;
  background: rgba(224,244,233,.62);
}
.provider-security strong,
.provider-security span { display: block; }
.provider-security strong { margin-bottom: 5px; color: #226040; font-size: 12px; }
.provider-security span { color: #48705a; font-size: 11px; line-height: 1.55; }
.provider-grid { display: grid; gap: 18px; }
.provider-route-card {
  padding: 23px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 23px;
  background: var(--glass);
  box-shadow: 0 20px 62px rgba(67,76,96,.1);
  backdrop-filter: blur(22px);
}
.provider-route-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.provider-route-card h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 450;
  letter-spacing: -.025em;
}
.provider-route-card > header p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.provider-route-card > header button {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.72);
  cursor: pointer;
}
.provider-functions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 17px 0;
}
.provider-functions > span {
  margin-right: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .1em;
}
.provider-functions small {
  padding: 6px 9px;
  border-radius: 999px;
  color: #535a68;
  background: rgba(255,255,255,.64);
  font-size: 10px;
}
.provider-profiles { display: grid; gap: 10px; }
.provider-profile,
.provider-profile-empty {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(247,248,251,.64);
}
.provider-profile.is-active {
  border-color: rgba(45,119,82,.26);
  background: rgba(235,247,240,.68);
}
.provider-profile > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.provider-profile > header > div {
  display: flex;
  align-items: center;
  gap: 9px;
}
.provider-profile > header > small { color: var(--muted); font-size: 10px; }
.provider-active-badge {
  padding: 5px 8px;
  border-radius: 999px;
  color: #236243;
  background: #d8eee1;
  font-size: 10px;
}
.provider-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 18px;
  margin-top: 14px;
}
.provider-meta-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  min-width: 0;
}
.provider-meta-row > span { color: var(--muted); font-size: 10px; }
.provider-meta-row strong,
.provider-meta-row code {
  overflow: hidden;
  color: #30353e;
  font-size: 11px;
  font-weight: 450;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.provider-profile-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.provider-profile-actions button {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.72);
  cursor: pointer;
  font-size: 11px;
}
.provider-profile-actions button.danger { color: #8a3b3b; }
.provider-profile-empty { color: var(--muted); font-size: 12px; text-align: center; }

.admin-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100svh - 32px);
  padding: 0;
  border: 1px solid rgba(255,255,255,.84);
  border-radius: 24px;
  color: var(--ink);
  background: rgba(246,248,251,.96);
  box-shadow: 0 36px 120px rgba(36,43,57,.28);
  overflow: auto;
}
.admin-dialog::backdrop {
  background: rgba(28,33,43,.36);
  backdrop-filter: blur(8px);
}
.dialog-card {
  display: grid;
  gap: 15px;
  padding: 25px;
}
.dialog-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 3px;
}
.dialog-card > header span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .18em;
}
.dialog-card h2 { margin: 7px 0 0; font-size: 27px; font-weight: 350; letter-spacing: -.035em; }
.dialog-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(255,255,255,.72);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}
.dialog-card > label {
  display: grid;
  gap: 7px;
}
.dialog-card > label > span { color: #343840; font-size: 12px; font-weight: 500; }
.dialog-card > label > small { color: var(--muted); font-size: 10px; }
.dialog-card input:not([type="checkbox"]),
.dialog-card select,
.dialog-card textarea {
  width: 100%;
  min-height: 45px;
  padding: 10px 13px;
  border: 1px solid rgba(72,80,96,.16);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: rgba(255,255,255,.78);
}
.dialog-card textarea { resize: vertical; word-break: break-all; }
.dialog-card input:focus,
.dialog-card select:focus,
.dialog-card textarea:focus {
  border-color: rgba(86,104,146,.42);
  box-shadow: 0 0 0 4px rgba(102,121,164,.09);
}
.dialog-check {
  grid-template-columns: auto 1fr;
  align-items: center;
  width: max-content;
}
.dialog-check input { width: 16px; height: 16px; accent-color: #181b21; }
.dialog-card footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 5px;
}
.dialog-description { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

@media (max-width: 780px) {
  .auth-shell { grid-template-columns: 1fr; align-items: start; padding-top: 30px; }
  .auth-brand { grid-column: 1; grid-row: 1; }
  .auth-card { grid-column: 1; grid-row: 2; margin-top: 40px; }
  .auth-brand > img { width: 58px; height: 58px; }
  .auth-brand span { width: 190px; }
  .admin-page { padding: 20px 14px; }
  .admin-header { align-items: flex-start; flex-direction: column; }
  .provider-intro { align-items: stretch; flex-direction: column; }
  .provider-security { flex-basis: auto; }
  .provider-route-card > header { flex-direction: column; }
  .provider-meta { grid-template-columns: 1fr; }
  .provider-profile > header { align-items: flex-start; flex-direction: column; }
  .admin-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
  .auth-background { display: none; }
}
