:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --soft: #f5f7fb;
  --panel: #ffffff;
  --accent: #1f7a6b;
  --accent-dark: #16594f;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Microsoft JhengHei", Arial, sans-serif;
  color: var(--ink);
  background: #eef2f7;
}

.mass-site-nav,
.mass-site-footer {
  font-family: "Noto Sans TC", "Segoe UI", "Microsoft JhengHei", Arial, sans-serif;
}

.mass-site-nav {
  position: relative;
  z-index: 10;
  background: #224a63 url("../images/nav.jpg") no-repeat center center;
  background-size: cover;
  box-shadow: 0 2px 15px rgba(15, 23, 42, .18);
  backdrop-filter: blur(10px);
}

.mass-nav-container,
.mass-footer-container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.mass-nav-container {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.mass-logo img {
  width: 174px;
  max-width: 42vw;
  display: block;
}

.mass-nav-right {
  display: flex;
  align-items: center;
}

.mass-nav-menu {
  display: grid;
  gap: 16px;
  justify-items: end;
}

.mass-nav-top,
.mass-nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.mass-nav-top a,
.mass-nav-links a,
.mass-site-footer a {
  color: inherit;
  text-decoration: none;
}

.mass-nav-top {
  color: #fff;
  font-size: 14px;
}

.mass-nav-links {
  margin: 0;
  padding: 0;
  list-style: none;
  color: #fff;
  font-size: 16px;
}

.mass-nav-links a {
  display: block;
  padding: 4px 0;
}

.mass-nav-links a:hover,
.mass-nav-top a:hover,
.mass-site-footer a:hover {
  color: #ffc107;
}

.mass-burger {
  display: none;
  width: 44px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.mass-burger span {
  display: block;
  height: 2px;
  margin: 5px 0;
  background: #222;
}

.mass-site-footer {
  position: relative;
  margin-top: 30px;
  background: #224a63;
  color: #fff;
}

.mass-footer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 0;
}

.mass-footer-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0;
  font-size: 15px;
}

.mass-footer-info span {
  margin-right: 16px;
  line-height: 1.8;
}

.mass-footer-info span:last-child {
  margin-right: 0;
}

.mass-footer-info span:first-child {
  color: #fff;
  font-size: 15px;
  font-weight: 400;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  gap: 18px;
}

.upload-panel,
.processing-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.panel-header,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 20px;
}

.status-badge {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: #edf7f5;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

.type-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.type-button,
.primary-button,
.secondary-button {
  font: inherit;
  cursor: pointer;
}

.type-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-weight: 700;
}

.type-button.active {
  border-color: var(--accent);
  background: #e7f5f1;
  color: var(--accent-dark);
}

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

.drop-zone {
  min-height: 220px;
  border: 2px dashed #a9b5c7;
  border-radius: 8px;
  background: #fbfcfe;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  padding: 24px;
  transition: border-color .15s ease, background .15s ease;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: #eefaf7;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 32px;
  line-height: 1;
}

.drop-title {
  font-size: 20px;
  font-weight: 800;
}

.drop-subtitle,
.file-list,
.message-box {
  color: var(--muted);
}

.file-list {
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.file-list.empty {
  font-size: 14px;
}

.file-pill {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
}

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

.primary-button:disabled {
  cursor: wait;
  opacity: .68;
}

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

.message-box {
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  white-space: pre-line;
}

.message-box.error {
  border-color: #f5b5ad;
  background: #fff1f0;
  color: var(--danger);
}

.processing-panel {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 34px 22px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, .08);
}

.progress-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  overflow: hidden;
  background: #dbeafe;
}

.progress-line::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  background: repeating-linear-gradient(
    -45deg,
    #1787e8 0,
    #1787e8 8px,
    #4fb0ff 8px,
    #4fb0ff 14px
  );
  border-radius: 999px;
  animation: processing-slide 1.2s ease-in-out infinite;
}

.processing-content {
  display: grid;
  justify-items: center;
  gap: 18px;
}

.processing-icons {
  display: flex;
  align-items: center;
  gap: 28px;
  color: #1d2939;
}

.document-icon {
  position: relative;
  width: 64px;
  height: 78px;
  border: 3px solid #1688e8;
  border-radius: 8px;
  background: #fff;
}

.document-icon::before {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  border-left: 3px solid #1688e8;
  border-bottom: 3px solid #1688e8;
  background: #fff;
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.document-icon::after {
  content: "";
  position: absolute;
  left: 14px;
  top: 26px;
  width: 34px;
  height: 26px;
  background:
    linear-gradient(#4fb0ff, #4fb0ff) 0 0 / 28px 4px no-repeat,
    linear-gradient(#4fb0ff, #4fb0ff) 0 11px / 34px 4px no-repeat,
    linear-gradient(#4fb0ff, #4fb0ff) 0 22px / 34px 4px no-repeat;
}

.result-icon {
  border-color: #5f83ff;
}

.result-icon::before {
  border-left-color: #5f83ff;
  border-bottom-color: #5f83ff;
}

.result-icon::after {
  background:
    linear-gradient(#7b9aff, #7b9aff) 0 0 / 28px 4px no-repeat,
    linear-gradient(#7b9aff, #7b9aff) 0 11px / 34px 4px no-repeat,
    linear-gradient(#7b9aff, #7b9aff) 0 22px / 34px 4px no-repeat;
}

.arrow-icon {
  font-size: 42px;
  line-height: 1;
}

.processing-text {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0;
}

@keyframes processing-slide {
  0% {
    transform: translateX(-100%);
  }

  50% {
    transform: translateX(95%);
  }

  100% {
    transform: translateX(220%);
  }
}

.result-view {
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.result-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  font-size: 14px;
}

.result-table th,
.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.result-table th {
  background: #f1f4f8;
  font-weight: 800;
  white-space: nowrap;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
}

.permit-grid,
.document-grid,
.general-data-grid {
  display: grid;
  gap: 16px;
}

.permit-card {
  display: grid;
  grid-template-columns: minmax(280px, 45%) 1fr;
  gap: 18px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.permit-image-box {
  min-height: 220px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
}

.permit-image-box img {
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: contain;
}

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

.permit-field {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.permit-field span {
  color: var(--muted);
  font-size: 13px;
}

.permit-field strong {
  color: var(--ink);
  font-size: 17px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.document-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.document-preview {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  overflow: hidden;
}

.document-preview img {
  width: 100%;
  height: 360px;
  display: block;
  object-fit: contain;
  background: #f8fafc;
}

.document-preview figcaption {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.general-data-grid {
  margin-top: 16px;
}

.general-data-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  padding: 14px;
}

.general-data-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
  letter-spacing: 0;
}

.general-block-list {
  display: grid;
  gap: 10px;
}

.general-block {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.general-block-label {
  color: var(--accent-dark);
  font-weight: 800;
}

.general-block pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  color: var(--ink);
}

.table-block {
  background: #f8fbff;
}

.general-warnings {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
}

.empty-card {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 820px) {
  .mass-nav-container {
    min-height: 72px;
  }

  .mass-burger {
    display: block;
  }

  .mass-nav-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: 72px;
    display: none;
    justify-items: stretch;
    padding: 16px;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 14px 24px rgba(15, 23, 42, .12);
  }

  .mass-nav-menu.open {
    display: grid;
  }

  .mass-nav-top,
  .mass-nav-links {
    color: #0c5fa1;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .mass-footer-container {
    align-items: flex-start;
  }

  .mass-footer-info {
    justify-content: flex-start;
  }

  .permit-card {
    grid-template-columns: 1fr;
  }

  .permit-detail {
    grid-template-columns: 1fr;
  }

  .general-block {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .upload-panel,
  .result-panel {
    padding: 16px;
  }

  .panel-header,
  .result-header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  h1 {
    font-size: 24px;
  }
}
