﻿* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft JhengHei", Arial, sans-serif;
  color: #243042;
  background: #f4f7fb;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

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

.upload-area {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 220px;
  padding: 24px;
  border: 2px dashed #8aa4c8;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.upload-area:hover,
.upload-area.dragging {
  border-color: #2563eb;
  background: #eef5ff;
  transform: translateY(-2px);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  color: #ffffff;
  font-weight: 700;
}

.xlsx-icon {
  background: #1f7a4d;
}

.docx-icon {
  background: #2457a6;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
}

h2 {
  margin-bottom: 10px;
  font-size: 20px;
}

p {
  line-height: 1.6;
}

.info-bar,
.tenant-panel {
  margin: 18px 0 16px;
  padding: 12px 14px;
  border-left: 4px solid #2563eb;
  border-radius: 6px;
  background: #ffffff;
}

.tenant-panel {
  border-left-color: #1f7a4d;
}

.tenant-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.tenant-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #d7e0ee;
  border-radius: 8px;
  background: #f9fbfe;
}

.tenant-name {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.result-panel {
  min-width: 0;
}

.table-wrap,
.contract-wrap {
  overflow: auto;
  height: 58vh;
  border: 1px solid #d7e0ee;
  border-radius: 8px;
  background: #ffffff;
}

.contract-wrap {
  padding: 18px;
  white-space: pre-wrap;
  line-height: 1.8;
}

.variable-mark {
  display: inline-block;
  padding: 0 5px;
  border-radius: 5px;
  color: #7a3300;
  background: #FCFF61;
  font-weight: 700;
}

.preview-title {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #d7e0ee;
  color: #2457a6;
  font-weight: 700;
}

.download-button,
.small-download-button {
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: #2457a6;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.download-button {
  margin-top: 12px;
  padding: 11px 16px;
}

.small-download-button {
  flex: 0 0 auto;
  padding: 8px 12px;
}

.download-button:disabled,
.small-download-button:disabled {
  background: #9aa9bd;
  cursor: not-allowed;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th,
td {
  padding: 10px 12px;
  border: 1px solid #e3e9f2;
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #172033;
  background: #eaf1fb;
  font-weight: 700;
}

tr:nth-child(even) td {
  background: #f9fbfe;
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding: 20px 0;
  }

  .upload-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .tenant-item {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 22px;
  }

  .upload-area {
    min-height: 190px;
    padding: 22px;
  }
}
