:root {
  color: #162033;
  background: #eef1f6;
  font-family: Inter, "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid #f2bf4b;
  outline-offset: 2px;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 540px) minmax(0, 470px);
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 48px 28px;
  background:
    radial-gradient(circle at 14% 18%, rgb(31 42 124 / 10%), transparent 28%),
    #eef1f6;
}

#boot-view {
  grid-template-columns: minmax(0, 540px);
}

.auth-card,
.auth-assurance {
  border-radius: 22px;
  box-shadow: 0 24px 70px rgb(15 23 42 / 10%);
}

.auth-card {
  padding: 42px;
  border: 1px solid #d8deea;
  background: #fff;
}

.auth-card-compact {
  width: min(540px, 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 42px;
}

.auth-brand .brand-mark {
  color: #fff;
  background: #1f2a7c;
}

.auth-brand strong,
.auth-brand small {
  display: block;
}

.auth-brand small {
  margin-top: 3px;
  color: #66718a;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.auth-description {
  margin-bottom: 26px;
  color: #56637a;
  line-height: 1.7;
}

.login-form,
.blocked-actions {
  display: grid;
  gap: 16px;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field label {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.auth-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #bcc6d6;
  border-radius: 10px;
  color: #162033;
  background: #fff;
}

.auth-submit.primary-button,
.blocked-actions button {
  width: 100%;
  min-height: 48px;
}

.auth-notice {
  margin-bottom: 18px;
  padding: 13px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #1e3a8a;
  background: #eff6ff;
  font-size: 14px;
  line-height: 1.55;
}

.auth-notice-error {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.auth-notice-warning {
  border-color: #fcd34d;
  color: #78350f;
  background: #fffbeb;
}

.auth-footnote {
  margin: 22px 0 0;
  color: #718096;
  font-size: 12px;
  line-height: 1.6;
}

.auth-assurance {
  padding: 42px;
  color: #fff;
  background: #162033;
}

.auth-assurance .eyebrow {
  color: #9eabd0;
}

.auth-assurance ol {
  display: grid;
  gap: 18px;
  margin: 28px 0 0;
  padding: 0;
  counter-reset: assurance;
  list-style: none;
}

.auth-assurance li {
  display: grid;
  position: relative;
  gap: 4px;
  padding-left: 42px;
  counter-increment: assurance;
}

.auth-assurance li::before {
  display: grid;
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  content: counter(assurance);
  color: #162033;
  background: #f2bf4b;
  font-size: 12px;
  font-weight: 900;
}

.auth-assurance li span {
  color: rgb(255 255 255 / 68%);
  font-size: 13px;
  line-height: 1.55;
}

.loading-line {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.loading-line::after {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  content: "";
  background: #1f2a7c;
  animation: loading-slide 1.25s ease-in-out infinite alternate;
}

@keyframes loading-slide {
  from { transform: translateX(0); }
  to { transform: translateX(122%); }
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 240px minmax(0, 1fr);
}

.sidebar {
  display: flex;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-direction: column;
  padding: 24px 18px;
  color: #fff;
  background: #1f2a7c;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgb(255 255 255 / 14%);
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  color: #1f2a7c;
  background: #fff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: rgb(255 255 255 / 64%);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

nav {
  display: grid;
  gap: 6px;
  margin-top: 26px;
}

.nav-item {
  display: block;
  padding: 11px 12px;
  border-radius: 9px;
  color: rgb(255 255 255 / 76%);
  text-decoration: none;
  font-size: 14px;
}

.nav-item.active {
  color: #fff;
  background: rgb(255 255 255 / 13%);
  font-weight: 700;
}

.nav-item.disabled {
  opacity: .46;
}

.sidebar-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 10px;
  color: rgb(255 255 255 / 72%);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f2bf4b;
}

.status-dot.ready {
  background: #71d29c;
}

main {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 38px 44px 60px;
}

.topbar,
.hero,
.safety-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

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

.account-panel {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 13px;
  border: 1px solid #ccd4e2;
  border-radius: 12px;
  background: #fff;
}

.account-panel span,
.account-panel strong,
.account-panel small {
  display: block;
}

.account-panel strong {
  max-width: 220px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
}

.account-panel small {
  margin-top: 2px;
  color: #66718a;
  font-size: 11px;
}

.account-panel .text-button {
  min-height: 44px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -.04em;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(22px, 2.3vw, 31px);
  letter-spacing: -.03em;
}

h3 {
  margin-bottom: 10px;
  font-size: 17px;
}

.eyebrow {
  margin-bottom: 8px;
  color: #66718a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.phase-badge {
  padding: 8px 12px;
  border: 1px solid #ccd4e2;
  border-radius: 999px;
  color: #4e5a72;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.hero {
  margin-top: 34px;
  padding: 34px;
  border: 1px solid #d8deea;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(31 42 124 / 7%);
}

.hero > div:first-child {
  max-width: 680px;
}

.hero p:last-child,
.module-card p,
.safety-panel li {
  color: #66718a;
  line-height: 1.7;
}

.hero-summary {
  display: grid;
  min-width: 150px;
  padding: 22px;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: #1f2a7c;
}

.hero-summary strong {
  font-size: 42px;
  line-height: 1;
}

.hero-summary span {
  margin-top: 8px;
  font-size: 12px;
}

.workspace-card {
  margin-top: 18px;
  padding: 32px;
  border: 1px solid #d8deea;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 14px 40px rgb(31 42 124 / 5%);
}

.section-heading,
.panel-heading,
.publish-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.section-heading > div:first-child {
  max-width: 720px;
}

.section-heading p:last-child,
.panel-heading p,
.publish-bar p {
  margin-bottom: 0;
  color: #56637a;
  line-height: 1.65;
}

.connection-chip,
.limit-label {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid #d8deea;
  border-radius: 999px;
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.connection-chip.connected {
  border-color: #a7f3d0;
  color: #065f46;
  background: #ecfdf5;
}

.connection-chip.connected .status-dot {
  background: #16a36a;
}

.input-type-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.input-type-tab {
  min-height: 78px;
  padding: 15px 18px;
  border: 1px solid #ccd4e2;
  border-radius: 13px;
  color: #334155;
  background: #f8fafc;
  text-align: left;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.input-type-tab:hover {
  border-color: #7f8cc8;
  background: #fff;
}

.input-type-tab.active {
  border-color: #1f2a7c;
  color: #1f2a7c;
  background: #f2f4ff;
  box-shadow: inset 0 0 0 1px #1f2a7c;
}

.input-type-tab span,
.input-type-tab small {
  display: block;
}

.input-type-tab span {
  font-size: 16px;
  font-weight: 800;
}

.input-type-tab small {
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
}

.entry-toolbar {
  display: flex;
  gap: 4px;
  width: fit-content;
  margin-top: 24px;
  padding: 4px;
  border-radius: 11px;
  background: #eef1f6;
}

.mode-button {
  min-height: 44px;
  padding: 9px 15px;
  border: 0;
  border-radius: 8px;
  color: #56637a;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.mode-button.active {
  color: #1f2a7c;
  background: #fff;
  box-shadow: 0 2px 8px rgb(15 23 42 / 9%);
}

.input-notice,
.column-notice {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  color: #1e3a8a;
  background: #eff6ff;
  font-size: 14px;
  line-height: 1.55;
}

.notice-success {
  border-color: #a7f3d0;
  color: #065f46;
  background: #ecfdf5;
}

.notice-warning,
.column-notice {
  border-color: #fcd34d;
  color: #78350f;
  background: #fffbeb;
}

.notice-error {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.entry-panel,
.preview-section {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  background: #fbfcfe;
}

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

.panel-heading h3 {
  margin-bottom: 5px;
}

.panel-heading p {
  font-size: 13px;
}

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

.form-field {
  min-width: 0;
}

.form-field-wide {
  grid-column: span 2;
}

label,
.form-field label {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
}

.form-field label span {
  color: #b42318;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  color: #172033;
  background: #fff;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input {
  min-height: 44px;
  padding: 9px 11px;
}

textarea {
  min-height: 180px;
  padding: 13px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.6;
  tab-size: 4;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #94a3b8;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #1f2a7c;
  box-shadow: 0 0 0 3px rgb(31 42 124 / 12%);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 44px;
  border-radius: 9px;
  font-weight: 750;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.primary-button {
  padding: 10px 18px;
  border: 1px solid #1f2a7c;
  color: #fff;
  background: #1f2a7c;
}

.primary-button:hover:not(:disabled) {
  border-color: #182161;
  background: #182161;
}

.primary-button:disabled {
  border-color: #cbd5e1;
  color: #64748b;
  background: #e2e8f0;
}

.secondary-button {
  padding: 9px 14px;
  border: 1px solid #cbd5e1;
  color: #334155;
  background: #fff;
}

.secondary-button:hover:not(:disabled) {
  border-color: #7f8cc8;
  color: #1f2a7c;
}

.secondary-button:disabled {
  opacity: .5;
}

.preview-section {
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.preview-heading {
  align-items: center;
  margin: 0;
  padding: 22px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 1fr));
  gap: 6px;
}

.summary-grid div {
  display: grid;
  min-width: 64px;
  padding: 8px 10px;
  place-items: center;
  border-radius: 9px;
  color: #334155;
  background: #f1f5f9;
}

.summary-grid span,
.summary-grid small {
  display: block;
}

.summary-grid span {
  font-size: 18px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.summary-grid small {
  margin-top: 1px;
  font-size: 10px;
}

.summary-grid .summary-valid {
  color: #065f46;
  background: #ecfdf5;
}

.summary-grid .summary-invalid {
  color: #991b1b;
  background: #fef2f2;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid #e7ebf1;
  vertical-align: top;
}

th {
  color: #526077;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
}

td {
  color: #334155;
  font-size: 13px;
}

tbody tr:hover {
  background: #fafbff;
}

td strong,
td span {
  display: block;
}

td strong {
  color: #172033;
}

td strong + span {
  margin-top: 4px;
  color: #64748b;
  font-size: 11px;
}

.row-number {
  width: 46px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.row-status {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.status-valid {
  color: #065f46;
  background: #d1fae5;
}

.status-invalid {
  color: #991b1b;
  background: #fee2e2;
}

.status-excluded {
  color: #475569;
  background: #e2e8f0;
}

.row-message {
  max-width: 400px;
  color: #526077;
  line-height: 1.55;
}

.status-invalid + .row-message {
  color: #991b1b;
}

.row-excluded {
  opacity: .65;
}

.row-actions {
  display: flex;
  gap: 5px;
  white-space: nowrap;
}

.text-button {
  min-width: 44px;
  padding: 7px 8px;
  border: 0;
  color: #1f2a7c;
  background: transparent;
  font-size: 12px;
}

.text-button:hover:not(:disabled) {
  background: #eef1ff;
}

.empty-state {
  display: grid;
  min-height: 150px;
  padding: 30px;
  place-items: center;
  align-content: center;
  color: #64748b;
  text-align: center;
}

.empty-state strong {
  margin-bottom: 7px;
  color: #334155;
}

.empty-state span {
  max-width: 480px;
  font-size: 13px;
  line-height: 1.6;
}

.publish-bar {
  align-items: center;
  padding: 18px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.publish-bar p {
  max-width: 700px;
  font-size: 12px;
}

.publish-button {
  flex: 0 0 auto;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.module-card {
  min-height: 190px;
  padding: 24px;
  border: 1px solid #d8deea;
  border-radius: 16px;
  background: #fff;
}

.module-index {
  display: inline-block;
  margin-bottom: 34px;
  color: #1f2a7c;
  font-size: 12px;
  font-weight: 800;
}

.module-card p {
  margin-bottom: 0;
  font-size: 14px;
}

.safety-panel {
  align-items: flex-start;
  margin-top: 18px;
  padding: 30px 34px;
  border-radius: 18px;
  color: #fff;
  background: #162033;
}

.safety-panel .eyebrow,
.safety-panel li {
  color: rgb(255 255 255 / 68%);
}

.safety-panel h2 {
  margin-bottom: 0;
}

.safety-panel ul {
  max-width: 540px;
  margin: 0;
  padding-left: 20px;
}

.safety-panel code {
  color: #fff;
}

@media (max-width: 980px) {
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 720px) {
  .auth-shell {
    display: block;
    padding: 18px;
  }

  .auth-card,
  .auth-assurance {
    padding: 28px 22px;
    border-radius: 17px;
  }

  .auth-assurance {
    margin-top: 14px;
  }

  .auth-brand {
    margin-bottom: 30px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 16px;
  }

  .brand {
    padding-bottom: 14px;
  }

  nav {
    display: none;
  }

  .sidebar-note {
    margin-top: 14px;
  }

  main {
    padding: 26px 18px 40px;
  }

  .topbar,
  .hero,
  .safety-panel,
  .section-heading,
  .panel-heading,
  .publish-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .phase-badge {
    align-self: flex-start;
  }

  .topbar-actions,
  .account-panel {
    width: 100%;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .account-panel {
    justify-content: space-between;
  }

  .hero {
    padding: 26px;
  }

  .hero-summary {
    width: 100%;
  }

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

  .module-card {
    min-height: auto;
  }

  .module-index {
    margin-bottom: 22px;
  }

  .workspace-card {
    padding: 22px 16px;
  }

  .input-type-tabs,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-field-wide {
    grid-column: auto;
  }

  .input-type-tab {
    min-height: 72px;
  }

  .entry-toolbar {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .mode-button {
    padding-inline: 8px;
  }

  .entry-panel {
    padding: 20px 16px;
  }

  input,
  textarea,
  select {
    font-size: 16px;
  }

  .summary-grid {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .summary-grid div {
    min-width: 0;
    padding-inline: 5px;
  }

  .publish-button,
  .form-actions .primary-button {
    width: 100%;
  }

  .form-actions {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }

  .loading-line::after {
    width: 100%;
    animation: none;
  }
}
