:root {
  --ink: #172033;
  --muted: #687789;
  --line: #dce5ee;
  --panel: #ffffff;
  --page: #f4f7fb;
  --blue: #123d66;
  --navy: #071d32;
  --gold: #c99a3c;
  --green: #0f8f67;
  --red: #c73737;
  --amber: #c99a3c;
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.is-hidden {
  display: none !important;
}

.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: clamp(24px, 6vw, 72px);
  align-items: center;
  padding: clamp(24px, 6vw, 84px);
  background:
    radial-gradient(circle at 18% 12%, rgba(201, 154, 60, 0.22), transparent 34%),
    linear-gradient(135deg, #071d32 0%, #123d66 100%);
}

.portal-language {
  position: absolute;
  top: 24px;
  left: clamp(24px, 6vw, 84px);
  right: clamp(24px, 6vw, 84px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.public-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 800;
  line-height: 1;
  padding: 8px 12px;
}

.language-toggle {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.language-toggle button {
  min-width: 44px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  line-height: 1;
}

.language-toggle button.active {
  background: var(--blue);
  color: #fff;
}

.login-copy {
  width: 100%;
  max-width: 680px;
  display: grid;
  justify-self: center;
  justify-items: center;
  align-content: center;
  gap: 14px;
  color: #fff;
  margin: 0 auto;
  text-align: center;
}

.login-logo-box {
  width: 150px;
  height: 164px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  line-height: 0;
}

.login-logo-box img {
  width: 150px;
  height: 164px;
  display: block;
  margin: 0;
  padding: 0;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  transform: translateX(-8px);
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 68px);
  line-height: 1.06;
}

h2 {
  font-size: 26px;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.login-copy p:not(.eyebrow) {
  max-width: 560px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
}

.login-card,
.panel,
.metric-card,
.form-grid,
.row,
.billing-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(23, 32, 51, 0.06);
}

.login-card {
  display: grid;
  gap: 14px;
  padding: 22px;
  color: var(--ink);
}

.login-card label {
  color: var(--muted);
}

.login-card p {
  color: var(--muted);
}

.portal-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 34px;
  padding: 28px;
  background:
    radial-gradient(circle at 72% 0%, rgba(201, 154, 60, 0.16), transparent 34%),
    var(--navy);
  color: #fff;
}

.brand img {
  width: 158px;
  max-width: 100%;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

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

.sidebar button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  text-align: left;
  padding: 0 14px;
  font-weight: 800;
}

.sidebar button.active {
  background: rgba(201, 154, 60, 0.18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}

.workspace {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 28px;
}

.topbar,
.panel-head,
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar-actions,
.row-actions,
.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.secondary-button,
.tiny-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
  line-height: 1;
}

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

.secondary-button,
.tiny-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.tiny-button {
  min-height: 32px;
  font-size: 12px;
}

.tiny-button.danger {
  border-color: rgba(199, 55, 55, 0.28);
  color: var(--red);
}

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

.metric-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.metric-card span,
.metric-card small,
.panel-head p,
.row p,
.form-title p {
  color: var(--muted);
}

.metric-card strong {
  font-size: 28px;
}

.panel {
  padding: 18px;
}

.panel-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.table-list {
  display: grid;
  padding-top: 4px;
}

.row {
  min-height: 76px;
  padding: 14px 0;
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: none;
}

.row:last-child {
  border-bottom: 0;
}

.row strong {
  display: block;
  margin-bottom: 4px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef3f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pill.good {
  background: rgba(15, 143, 103, 0.12);
  color: var(--green);
}

.pill.warn {
  background: rgba(201, 154, 60, 0.14);
  color: #a26f13;
}

.pill.alert {
  background: rgba(199, 55, 55, 0.12);
  color: var(--red);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 16px;
  background: #f7f9fc;
}

.form-title,
.form-actions {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

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

input[readonly] {
  background: #eef3f8;
  color: var(--muted);
}

.switch-field {
  min-height: 64px;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.switch-field input {
  width: 22px;
  min-height: 22px;
  accent-color: var(--blue);
}

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

.billing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding-top: 14px;
}

.billing-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.billing-card strong {
  font-size: 22px;
}

.form-status {
  min-height: 20px;
  font-weight: 800;
}

.form-status.error,
.error {
  color: var(--red);
}

.form-status.good {
  color: var(--green);
}

@media (max-width: 980px) {
  .login-view,
  .portal-view {
    grid-template-columns: 1fr;
  }

  .login-view {
    background:
      radial-gradient(circle at 18% 12%, rgba(201, 154, 60, 0.22), transparent 34%),
      linear-gradient(180deg, #071d32 0%, #123d66 100%);
    padding-top: 76px;
  }

  .sidebar {
    position: static;
  }

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

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

@media (max-width: 640px) {
  .workspace,
  .sidebar,
  .login-view {
    padding: 18px;
  }

  .portal-language {
    left: 18px;
    right: 18px;
    top: 18px;
  }

  .topbar,
  .panel-head,
  .row {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .billing-grid {
    grid-template-columns: 1fr;
  }
}
