:root {
  --ink: #17221d;
  --muted: #66736c;
  --paper: #f5f4ef;
  --card: #fff;
  --green: #164e3b;
  --green2: #28735a;
  --line: #dfe3dc;
  --amber: #b96d19;
  --red: #a64232;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
header {
  height: 76px;
  padding: 0 max(4vw, 24px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--green);
  color: white;
  font-family: serif;
  font-size: 22px;
}
.brand b {
  font-size: 20px;
}
.brand small {
  letter-spacing: 0.18em;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 10px;
}
.identity {
  display: flex;
  align-items: end;
  gap: 8px;
}
.identity label {
  font-size: 12px;
  color: var(--muted);
}
.identity input {
  display: block;
  width: 230px;
  margin-top: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
main {
  max-width: 1440px;
  margin: auto;
  padding: 44px max(4vw, 24px);
}
.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 16px 0 42px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--green2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}
.hero h1 {
  font-family: Georgia, 'Noto Serif TC', serif;
  font-size: clamp(34px, 4vw, 58px);
  line-height: 1.13;
  margin: 0 0 18px;
  font-weight: 500;
}
.hero p:not(.eyebrow) {
  color: var(--muted);
  margin: 0;
}
.primary,
.secondary {
  border-radius: 9px;
  padding: 11px 17px;
  border: 1px solid var(--green);
  font-weight: 700;
}
.primary {
  background: var(--green);
  color: white;
}
.primary:hover {
  background: var(--green2);
}
.primary.ai-unavailable,
.primary.ai-unavailable:hover {
  background: #e7ece8;
  border-color: #9aa79f;
  color: #56645d;
  cursor: help;
  opacity: 0.82;
}
button:disabled {
  cursor: not-allowed;
  filter: saturate(0.55);
  opacity: 0.48;
}
.secondary {
  background: white;
  color: var(--green);
}
.workspace {
  min-height: 610px;
  display: grid;
  grid-template-columns: 340px 1fr;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: white;
  box-shadow: 0 18px 50px #173b2b0d;
}
.hidden {
  display: none !important;
}
aside {
  padding: 25px 20px;
  border-right: 1px solid var(--line);
  background: #fbfbf8;
}
.aside-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.aside-title h2 {
  margin: 0 0 18px;
  font-size: 20px;
}
.aside-title span {
  background: #e5eee9;
  color: var(--green);
  padding: 4px 9px;
  border-radius: 20px;
  font-weight: 700;
}
aside > input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 14px;
}
.case-list {
  display: grid;
  gap: 8px;
}
.case-card {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 14px;
}
.case-card:hover,
.case-card.active {
  background: white;
  border-color: var(--line);
  box-shadow: 0 5px 16px #17221d0a;
}
.case-card h3 {
  margin: 7px 0 4px;
  font-size: 16px;
}
.case-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
}
#detail {
  padding: 36px;
}
.empty {
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.empty-icon {
  margin: auto;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #e5eee9;
  color: var(--green);
  font-family: serif;
  font-size: 24px;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}
.detail-head h2 {
  font:
    500 34px Georgia,
    serif;
  margin: 6px 0;
}
.detail-head p {
  color: var(--muted);
  margin: 0;
}
.steps {
  display: flex;
  gap: 4px;
  margin: 26px 0;
}
.step {
  flex: 1;
  padding: 9px;
  text-align: center;
  background: #f2f3ef;
  color: #89928d;
  font-size: 12px;
}
.step.done {
  background: #dcebe3;
  color: var(--green);
  font-weight: 700;
}
.clause {
  border: 1px solid var(--line);
  border-radius: 13px;
  margin: 13px 0;
  overflow: hidden;
}
.clause summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px;
  cursor: pointer;
}
.clause summary::marker {
  display: none;
}
.clause-num {
  display: grid;
  place-items: center;
  min-width: 29px;
  height: 29px;
  border-radius: 50%;
  background: #edf1ed;
  color: var(--green);
  font-weight: 800;
}
.risk {
  margin-left: auto;
  border-radius: 20px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 800;
}
.risk.high {
  background: #f9e3df;
  color: var(--red);
}
.risk.medium {
  background: #fbecd8;
  color: var(--amber);
}
.risk.low {
  background: #e3efe8;
  color: var(--green2);
}
.clause-body {
  padding: 0 18px 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.panel {
  background: #f7f7f4;
  padding: 15px;
  border-radius: 9px;
}
.panel h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--muted);
}
.panel p {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.65;
}
.final {
  grid-column: 1/-1;
}
.final textarea {
  width: 100%;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  line-height: 1.6;
}
.clause-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.clause-actions button {
  padding: 8px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: white;
}
.clause-actions .accept {
  border-color: var(--green);
  color: var(--green);
}
.history {
  margin-top: 28px;
}
.history li {
  margin: 8px 0;
  color: var(--muted);
}
dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(520px, 92vw);
  box-shadow: 0 30px 80px #0004;
}
dialog::backdrop {
  background: #17221d99;
}
form {
  padding: 30px;
  position: relative;
}
form h2 {
  font:
    500 30px Georgia,
    serif;
  margin: 0 0 22px;
}
form label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin: 13px 0;
}
form input,
form select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.field-help {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}
.entity-confirmation,
.analysis-entity-confirmation {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid #b7d1c9;
  border-radius: 8px;
  background: #f3f9f7;
  color: #26483f;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}
.entity-confirmation input,
.analysis-entity-confirmation input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--green);
}
.analysis-entity-confirmation {
  width: fit-content;
  max-width: 100%;
  margin-top: 14px;
}
.previous-entity {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--green2);
  background: #edf6f2;
  color: #35584f;
  font-size: 12px;
  line-height: 1.5;
}
.case-entity-line {
  margin-top: 6px !important;
  color: #235a4e !important;
}
.version-row .version-entity {
  margin-top: 5px;
  color: #235a4e;
}
.bank-instruction-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 24px 28px 0;
  padding: 18px 20px;
  border: 1px solid #c7ddd5;
  border-radius: 10px;
  background: #f7fbf9;
  color: #26483f;
}
.bank-instruction-card h3 {
  margin: 3px 0 6px;
}
.bank-instruction-card p {
  margin: 0;
}
.bank-card-main {
  flex: 1 1 auto;
  min-width: 0;
}
.bank-card-main > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}
.bank-profile-selector {
  min-width: 0;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}
.bank-profile-selector legend {
  margin-bottom: 8px;
  color: #185f53;
  font-size: 13px;
  font-weight: 800;
}
.bank-profile-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.bank-profile-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #cbded7;
  border-radius: 9px;
  background: white;
  cursor: pointer;
}
.bank-profile-option:has(input:checked) {
  border-color: #197262;
  outline: 2px solid #cfe8df;
  background: #eff8f4;
}
.bank-profile-option:has(input:focus-visible) {
  outline: 3px solid #a8d7c8;
  outline-offset: 2px;
}
.bank-profile-option.unavailable {
  cursor: not-allowed;
  opacity: 0.58;
}
.bank-profile-option input {
  flex: 0 0 auto;
  margin: 3px 0 0;
  accent-color: #0c6555;
}
.bank-profile-option span,
.bank-profile-option small {
  display: block;
  min-width: 0;
}
.bank-profile-option strong {
  color: #174d43;
  font-size: 14px;
}
.bank-profile-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.bank-profile-prompt {
  margin-top: 12px !important;
  padding: 10px 12px;
  border: 1px dashed #a8c8bd;
  border-radius: 8px;
  color: #5f756e;
  font-size: 12px;
}
.bank-safe-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.bank-safe-summary span {
  display: inline-flex;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid #d6e5df;
  border-radius: 7px;
  background: white;
  color: #405d55;
  font-size: 12px;
}
.bank-safe-summary b {
  color: #185f53;
}
.bank-setup-warning {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #efc17c;
  border-radius: 8px;
  background: #fff7e9;
  color: #80520b;
  font-size: 12px;
}
.bank-card-action {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.bank-card-action small {
  max-width: 210px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  text-align: right;
}
.bank-card-action button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.upload {
  border: 1px dashed #9eaaa3;
  border-radius: 10px;
  padding: 16px;
}
.upload input {
  border: 0;
  padding: 8px 0;
}
.upload span {
  color: var(--muted);
  font-weight: 400;
}
.form-message {
  margin-top: 14px;
  padding: 11px 12px;
  border: 1px solid #d68478;
  border-radius: 8px;
  background: #fff0ed;
  color: #8b2d20;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}
.form-message.success {
  border-color: #8ebcaf;
  background: #e8f5ef;
  color: #164e3b;
}
.close {
  position: absolute;
  right: 20px;
  top: 18px;
  border: 0;
  background: none;
  font-size: 25px;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}
@media (max-width: 760px) {
  .bank-instruction-card {
    align-items: stretch;
    flex-direction: column;
  }
  .bank-card-action {
    align-items: stretch;
  }
  .bank-card-action small {
    max-width: none;
    text-align: left;
  }
  .bank-profile-options {
    grid-template-columns: 1fr;
  }
}
.notice {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 9px;
  background: #fff3cd;
  color: #744d00;
}
.chatgpt-web-action {
  border-color: #73a89b;
  background: #f1f8f5;
  color: var(--green);
}
.chatgpt-web-dialog {
  width: min(620px, 92vw);
}
.chatgpt-web-shell {
  position: relative;
  padding: 30px;
  color: #193d35;
}
.chatgpt-web-shell h2 {
  margin: 4px 0 12px;
  font:
    500 30px Georgia,
    serif;
}
.chatgpt-web-shell > p:not(.eyebrow) {
  line-height: 1.7;
}
.chatgpt-web-state {
  display: inline-flex;
  margin: 0 0 10px;
  padding: 5px 10px;
  border: 1px solid #efc17c;
  border-radius: 16px;
  background: #fff7e9;
  color: #80520b;
  font-size: 12px;
  font-weight: 800;
}
.chatgpt-web-shell ol {
  margin: 18px 0;
  padding-left: 22px;
  line-height: 1.8;
}
.chatgpt-case-reference {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #c8ddd6;
  border-radius: 9px;
  background: #f3f8f6;
}
.chatgpt-case-reference span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.chatgpt-case-reference code {
  overflow-wrap: anywhere;
  color: var(--green);
  font-weight: 800;
}
.chatgpt-web-shell > small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
}
.chatgpt-open-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
@media (max-width: 800px) {
  header {
    height: auto;
    padding: 14px;
    align-items: flex-start;
  }
  .identity {
    display: block;
  }
  .identity input {
    width: 190px;
  }
  .identity button {
    margin-top: 6px;
  }
  .hero {
    align-items: flex-start;
    gap: 24px;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #detail {
    padding: 22px;
  }
  .clause-body {
    grid-template-columns: 1fr;
  }
  .final {
    grid-column: auto;
  }
}
