:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --ink: #202a38;
  --muted: #647181;
  --line: #e5e9ef;
  --soft: #eff6ff;
  font-family: Helvetica, 'Helvetica Neue', Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #a9b5bd; font-size: 16px; line-height: 1.55; }
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #93c5fd;
  outline-offset: 4px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
.icon { flex-shrink: 0; vertical-align: middle; }
.page-backdrop {
  position: fixed;
  inset: -5px;
  z-index: -1;
  background: url('ttja-taust.jpg') center 55% / cover no-repeat;
  filter: blur(1.5px);
}
.page-backdrop::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .1); }
.site-shell {
  width: min(1040px, calc(100% - 64px));
  margin: 48px auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 70px rgba(0, 0, 0, .2);
  overflow: hidden;
}
.site-header { padding: 28px 40px 12px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: block; flex-shrink: 0; }
.brand img { display: block; width: 232px; height: auto; }
.header-actions { display: flex; align-items: center; gap: 18px; color: var(--muted); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: transparent; color: var(--muted); border-radius: 7px; }
.icon-button:hover { color: var(--primary-hover); background: #f5f8fc; }
.icon-button .icon { width: 21px; height: 21px; }
.logout-button { display: flex; align-items: center; gap: 8px; min-height: 40px; background: transparent; color: var(--muted); font-size: 14px; }
.logout-button .icon { width: 18px; height: 18px; }
.logout-button:hover { color: var(--primary-hover); }
.workspace-intro { padding: 31px 40px 34px; text-align: center; }
.quarter-badge { font-size: 14px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.workspace-intro h1 { font-size: 36px; font-weight: 700; line-height: 1.2; letter-spacing: -.8px; }
.workspace-intro p { margin-top: 13px; font-size: 17px; color: var(--muted); }
.actions-section { padding: 29px 40px 32px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-heading h2 { font-size: 18px; font-weight: 700; }
.section-heading > span { color: var(--muted); font-size: 14px; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.action-card { display: flex; flex-direction: column; padding: 24px; background: white; border: 1px solid #dfe5ec; border-radius: 10px; }
.action-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.action-icon { display: inline-flex; color: var(--primary); }
.action-icon .icon { width: 29px; height: 29px; stroke-width: 1.5; }
.source-tag { color: #788594; font-size: 13px; }
.action-title { font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -.35px; text-wrap: initial; }
.action-description { font-size: 15px; line-height: 1.55; color: var(--muted); margin-top: 13px; margin-bottom: 24px; }
.action-button, .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 11px 13px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  transition: background-color .15s, border-color .15s;
}
.action-button { width: 100%; margin-top: auto; }
.action-button .icon, .primary-button .icon { width: 17px; height: 17px; }
.action-button:hover:not(:disabled), .primary-button:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.action-button:active:not(:disabled), .primary-button:active { background: #1e40af; }
.action-button:disabled { background: #edf0f4; border-color: #edf0f4; color: #8993a0; }
.action-disabled { background: #fafbfc; border-color: #e8ebf0; }
.action-disabled .action-title { color: #8c96a3; }
.action-disabled .action-description, .action-disabled .action-icon, .action-disabled .source-tag { color: #9aa3ae; }
.action-card.is-running { border-color: #93c5fd; }
.action-button.is-running { background: var(--primary); border-color: var(--primary); color: white; }
.action-button.is-running .action-arrow { display: none; }
.results-section { margin: 0 40px 32px; padding: 24px; border: 1px solid #dfe5ec; border-radius: 10px; background: #fbfcfe; }
.result-title { display: flex; align-items: center; gap: 11px; }
.result-badge { font-size: 12px; color: #7b8795; }
.result-badge.running { color: #1d4ed8; }
.result-badge.done { color: #16805c; }
.result-badge.error { color: #be3941; }
.empty-state { display: flex; align-items: center; justify-content: center; gap: 20px; min-height: 123px; padding: 22px; }
.empty-state > .icon { width: 33px; height: 33px; color: #9aa9bb; stroke-width: 1.4; }
.empty-state h3 { font-size: 17px; font-weight: 400; }
.empty-state p { margin-top: 7px; font-size: 15px; color: var(--muted); }
.workspace-footer { display: flex; align-items: center; justify-content: center; gap: 7px; border-top: 1px solid var(--line); padding: 17px 24px; color: #82909f; font-size: 13px; }
.workspace-footer .icon { width: 14px; height: 14px; }
.login-shell { max-width: 520px; }
.login-shell .site-header { padding: 30px 32px 0; gap: 12px; }
.login-shell .brand img { width: 232px; }
.login-shell .header-actions { gap: 0; }
.login-wrap { padding: 28px 38px 32px; }
.login-card { text-align: center; }
.login-icon { display: flex; justify-content: center; color: var(--primary); margin: 10px auto 20px; }
.login-icon .icon { width: 30px; height: 30px; stroke-width: 1.5; }
.login-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1.25; }
.login-card > p { color: var(--muted); font-size: 16px; margin-top: 14px; }
.login-form { margin-top: 30px; text-align: left; }
.login-form label { display: block; font-size: 15px; margin-bottom: 9px; }
.login-form input { display: block; width: 100%; height: 48px; border: 1px solid #d6deea; border-radius: 7px; padding: 0 13px; font-size: 16px; background: white; color: var(--ink); }
.login-form .primary-button { margin-top: 18px; width: 100%; font-size: 16px; }
.login-card .login-note { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 13px; color: #82909f; margin-top: 23px; }
.login-note .icon { width: 15px; height: 15px; }
.login-error { font-size: 14px; color: #c33e47; margin-top: 12px; }
.demo-link { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--primary-hover); border-top: 1px solid var(--line); padding-top: 20px; margin-top: 23px; }
.demo-link .icon { width: 16px; height: 16px; }
.help-dialog { border: 1px solid var(--line); border-radius: 14px; padding: 28px; max-width: 520px; width: calc(100% - 36px); color: var(--ink); box-shadow: 0 30px 100px rgba(0,0,0,.2); }
.help-dialog::backdrop { background: rgba(0,0,0,.4); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.dialog-heading h2 { font-size: 22px; font-weight: 700; }
.dialog-heading .icon-button { font-size: 28px; }
.help-dialog p, .help-dialog li { font-size: 16px; line-height: 1.6; color: var(--muted); }
.help-dialog ul { padding-left: 19px; display: grid; gap: 12px; margin: 20px 0; }
.help-dialog .primary-button { margin-top: 24px; width: 100%; font-size: 16px; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #202a38; color: #fff; box-shadow: 0 5px 25px rgba(0,0,0,.2); padding: 13px 22px; border-radius: 8px; font-size: 15px; z-index: 20; max-width: calc(100% - 32px); text-align: center; }
.spinner { width: 17px; height: 17px; display: inline-block; border: 2px solid #bfdbfe; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
.action-button .spinner { border-color: #ffffff66; border-top-color: white; }
@keyframes spin { to { transform: rotate(360deg); } }
.working-state { display: flex; align-items: center; gap: 19px; padding: 27px; border: 1px solid #dbeafe; background: #f5f7fb; border-radius: 9px; }
.working-state > .spinner { width: 27px; height: 27px; }
.working-state h3 { font-size: 17px; font-weight: 700; }
.working-state p { color: var(--muted); font-size: 15px; margin-top: 7px; }
.result-alert { padding: 19px 21px; border-radius: 8px; background: #fff1f2; border: 1px solid #fecdd3; color: #a32e3b; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.result-alert.warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.result-summary { padding: 18px 20px; border: 1px solid #dbeafe; background: #eff6ff; border-radius: 8px; margin-bottom: 20px; font-size: 16px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.result-fields { display: grid; gap: 18px; }
.field-block { padding: 19px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.field-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.field-heading label { font-size: 16px; font-weight: 700; }
.copy-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: #fff; color: #526175; border: 1px solid #dce4ef; border-radius: 6px; font-size: 14px; padding: 8px 12px; min-height: 40px; white-space: nowrap; }
.copy-button:hover, .secondary-button:hover { border-color: #93c5fd; color: var(--primary-hover); background: #f7f9fc; }
.copy-button svg, .secondary-button svg { width: 15px; height: 15px; }
.result-textarea, .result-subject { display: block; width: 100%; padding: 12px 14px; background: #f8fafc; border: 1px solid #e6ebf2; border-radius: 6px; color: #435166; font-size: 16px; line-height: 1.65; resize: vertical; overflow-wrap: anywhere; }
.result-textarea { min-height: 86px; }
.result-textarea.letter-body { min-height: 330px; }
.result-subject { min-height: 64px; }
.table-section { margin-top: 18px; background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.hs-accordion-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 19px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 700; text-align: left; }
.hs-accordion-toggle .icon { width: 18px; height: 18px; transition: transform .15s; }
.hs-accordion.active .hs-accordion-toggle .icon { transform: rotate(90deg); }
.hs-accordion-content { overflow: hidden; }
.hs-accordion-content.hidden { display: none; }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 15px; white-space: nowrap; }
.data-table th { background: #f8fafc; font-weight: 400; color: #647181; padding: 13px 19px; border-block: 1px solid var(--line); }
.data-table td { padding: 14px 19px; border-bottom: 1px solid #f0f3f7; max-width: 500px; overflow: hidden; text-overflow: ellipsis; }
.data-table td:first-child { font-weight: 700; color: #43536a; }
.download-row { display: flex; justify-content: flex-end; margin-top: 16px; }
.completed-note { font-size: 14px; color: var(--muted); margin-top: 15px; }
.empty-table-note { padding: 18px; color: var(--muted); font-size: 15px; }
.result-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.result-tab { font-size: 14px; padding: 8px 12px; min-height: 40px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--muted); }
.result-tab.active { color: var(--primary-hover); background: var(--soft); border-color: #bfdbfe; }
@media (max-width: 1050px) {
  .site-shell { width: calc(100% - 48px); margin-block: 32px; }
  .site-header { padding-inline: 30px; }
  .workspace-intro { padding-inline: 30px; }
  .workspace-intro h1 { font-size: 33px; }
  .actions-section { padding-inline: 30px; }
  .results-section { margin-inline: 30px; }
  .action-grid { gap: 14px; }
  .action-card { padding: 20px; }
  .action-title { font-size: 21px; }
  .action-button { font-size: 13px; padding-inline: 10px; gap: 7px; }
}
@media (max-width: 760px) {
  .site-shell { width: calc(100% - 28px); margin: 20px auto; border-radius: 12px; }
  .site-header { padding: 25px 22px 8px; gap: 12px; flex-wrap: wrap; }
  .brand img { width: 200px; }
  .header-actions { gap: 8px; margin-left: auto; }
  .quarter-badge { font-size: 13px; }
  .icon-button { width: 44px; height: 44px; }
  .logout-button { justify-content: center; min-width: 36px; min-height: 44px; }
  .logout-button span { display: none; }
  .workspace-intro { padding: 30px 23px; }
  .workspace-intro h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.6px; }
  .workspace-intro p { font-size: 16px; margin-top: 14px; }
  .actions-section { padding: 25px 22px 28px; }
  .action-grid { grid-template-columns: 1fr; gap: 16px; }
  .action-card { padding: 24px; }
  .action-top { margin-bottom: 16px; }
  .action-title { font-size: 23px; }
  .action-description { font-size: 16px; margin: 11px 0 23px; }
  .action-button { font-size: 16px; min-height: 48px; }
  .results-section { margin: 0 22px 28px; padding: 20px; }
  .results-heading { flex-wrap: wrap; }
  .section-heading > span { font-size: 13px; }
  .empty-state { padding: 15px 0; align-items: flex-start; gap: 14px; justify-content: flex-start; }
  .empty-state > .icon { width: 28px; height: 28px; margin-top: 2px; }
  .empty-state h3 { font-size: 17px; }
  .empty-state p { font-size: 15px; }
  .workspace-footer { font-size: 13px; }
  .field-block { padding: 15px; }
  .field-heading { flex-wrap: wrap; }
  .copy-button, .secondary-button { font-size: 14px; min-height: 44px; }
  .result-summary { padding: 15px; }
  .working-state { padding: 19px 16px; align-items: flex-start; gap: 13px; }
  .working-state > .spinner { margin-top: 3px; width: 23px; height: 23px; }
  .working-state h3 { font-size: 16px; }
  .working-state p { font-size: 15px; }
  .result-tab { min-height: 44px; }
  .login-shell .site-header { padding: 25px 24px 0; }
  .login-shell .brand img { width: 220px; }
  .login-wrap { padding: 25px 24px 28px; }
  .login-card h1 { font-size: 27px; }
  .help-dialog { padding: 23px; }
}
@media (max-width: 380px) {
  .brand img { width: 190px; }
  .header-actions { gap: 5px; }
  .site-header { padding-inline: 19px; }
  .workspace-intro h1 { font-size: 28px; }
  .login-shell .brand img { width: 210px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
