:root {
  color-scheme: light;
  --bg: #f7f3ec;
  --ink: #16211f;
  --muted: #64706d;
  --line: #d9ddd5;
  --panel: #fffefb;
  --teal: #0f766e;
  --amber: #b7791f;
  --blue: #2563eb;
  --shadow: 0 18px 60px rgba(42, 52, 48, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.1), transparent 42%),
    linear-gradient(300deg, rgba(183, 121, 31, 0.12), transparent 48%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(980px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.login-panel,
.portal {
  width: min(760px, 100%);
  background: rgba(255, 254, 251, 0.94);
  border: 1px solid rgba(217, 221, 213, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 44px);
}

.brand,
.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  justify-content: flex-start;
  margin-bottom: 34px;
}

.mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-size: 28px;
  font-weight: 800;
}

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

h1,
h2 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  font-size: clamp(34px, 7vw, 58px);
}

h2 {
  font-size: clamp(28px, 5vw, 42px);
}

.login-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: white;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

#loginButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  background: var(--ink);
  color: white;
  font-weight: 750;
}

button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.message {
  min-height: 24px;
  margin: 0;
  color: #b42318;
  font-weight: 650;
}

.muted {
  margin: 10px 0 0;
  color: var(--muted);
}

.icon-button {
  width: 48px;
  min-width: 48px;
  background: #edf4f2;
  color: var(--teal);
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.portal-link {
  min-height: 176px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.portal-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(42, 52, 48, 0.12);
}

.portal-link.teal {
  border-top: 5px solid var(--teal);
}

.portal-link.amber {
  border-top: 5px solid var(--amber);
}

.portal-link.blue {
  border-top: 5px solid var(--blue);
}

.portal-link h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.portal-link p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.open-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  border-radius: 6px;
  color: var(--teal);
  font-weight: 750;
  text-decoration: none;
}

.action-stack {
  display: grid;
  gap: 8px;
}

.api-row {
  color: var(--blue);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 980px);
    align-items: start;
  }

  .login-panel,
  .portal {
    padding: 24px;
  }

  .brand {
    align-items: flex-start;
  }

  .link-grid {
    grid-template-columns: 1fr;
  }

  .portal-link {
    min-height: 150px;
  }
}
