/*!
 * セイキュー (Seikyu) — styles.css
 * 画面表示用スタイル。外部リソース（CDN/Webフォント/画像）は一切使用しない。
 * このファイルは印刷時にも読み込まれる（media指定なし）。プレビュー用紙面
 * (.sheet-page 系)の見た目は screen/print で共通の土台とし、print.css は
 * ページ設定・UIの非表示・スケール解除のみを担当する。
 */

/* ---------------------------------------------------------------------- */
/* リセット & 基礎                                                        */
/* ---------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --accent: #4F46E5;
  --accent-dark: #4338CA;
  --accent-light: #EEF2FF;
  --accent-line: #C7D0FB;
  --ink: #1F2330;
  --ink-soft: #545B6E;
  --ink-faint: #8A90A3;
  --border: #E3E6EE;
  --border-strong: #C7CCDC;
  --bg: #FFFFFF;
  --bg-soft: #F7F8FC;
  --bg-tint: #FAFAFD;
  --danger: #DC2626;
  --danger-light: #FEF2F2;
  --success: #15803D;
  --success-light: #F0FDF4;
  --radius: 8px;
  --radius-lg: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo,
    sans-serif;
  --shadow-card: 0 1px 2px rgba(31, 35, 48, 0.04), 0 1px 12px rgba(31, 35, 48, 0.05);
  --shadow-sheet: 0 6px 24px rgba(31, 35, 48, 0.14);
  --shadow-modal: 0 20px 60px rgba(20, 22, 30, 0.28);
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

button {
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 1000;
}

.skip-link:focus {
  left: 0;
}

/* ---------------------------------------------------------------------- */
/* ヘッダー                                                                */
/* ---------------------------------------------------------------------- */

.app-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.app-logo-mark {
  width: 30px;
  height: 30px;
  flex: none;
}

.app-logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--border-strong);
  white-space: nowrap;
}

.status-badge.is-pro {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.mobile-tabs {
  display: none;
  border-top: 1px solid var(--border);
}

.mobile-tab-btn {
  flex: 1 1 50%;
  border: none;
  background: var(--bg);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
  padding: 11px 8px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}

.mobile-tab-btn.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------------- */
/* レイアウト（2ペイン）                                                   */
/* ---------------------------------------------------------------------- */

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(340px, 480px) 1fr;
  gap: 24px;
  align-items: start;
}

.form-pane-inner {
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* preview-pane はgridアイテム、preview-pane-inner/preview-frameはflexアイテムのため、
   既定の min-width:auto のままだと中の紙面(A4幅)がコンテンツ最小幅として
   親を押し広げてしまう。明示的に 0 にして正しく縮小できるようにする。 */
.preview-pane {
  min-width: 0;
}

.preview-pane-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

@media (min-width: 881px) {
  .preview-pane {
    position: sticky;
    top: 78px;
    max-height: calc(100vh - 96px);
    display: flex;
  }

  .preview-pane-inner {
    width: 100%;
    min-height: 0;
  }

  .preview-frame {
    max-height: calc(100vh - 150px);
  }
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .mobile-tabs {
    display: flex;
  }

  .app-shell.tab-input .preview-pane {
    display: none;
  }

  .app-shell.tab-preview .form-pane {
    display: none;
  }
}

/* ---------------------------------------------------------------------- */
/* カード / フォームセクション                                             */
/* ---------------------------------------------------------------------- */

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-row-bottom {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-card);
}

.form-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-card);
  min-width: 0;
}

.form-section legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-dark);
  padding: 0 6px;
  letter-spacing: 0.02em;
}

.pro-section {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--bg) 90px);
}

.pro-section-desc {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.form-row {
  margin-top: 14px;
}

.form-row:first-of-type {
  margin-top: 12px;
}

.form-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

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

.form-field-narrow {
  max-width: 120px;
}

.form-row-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="tel"],
.form-row input[type="email"],
.form-row input[type="number"],
.form-row select,
.form-row textarea,
.form-field input,
.form-field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-row textarea {
  resize: vertical;
  font-family: inherit;
  line-height: 1.6;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.checkbox-label-tight {
  margin-bottom: 8px;
}

.checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  flex: none;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.radio-label input[type="radio"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.field-hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
  line-height: 1.6;
}

.field-hint-muted {
  color: var(--ink-faint);
}

.field-hint.is-warning {
  color: #B45309;
}

.field-error {
  font-size: 12.5px;
  color: var(--danger);
  margin-top: 8px;
  font-weight: 700;
}

.field-success {
  font-size: 12.5px;
  color: var(--success);
  margin-top: 8px;
  font-weight: 700;
}

.inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.inline-controls:first-of-type {
  margin-top: 0;
}

.inline-controls select {
  flex: 1 1 160px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  min-width: 0;
}

.pro-row {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

/* ---------------------------------------------------------------------- */
/* PROバッジ / ボタン                                                      */
/* ---------------------------------------------------------------------- */

.pro-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
  background: var(--accent-light);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 1px 7px;
  vertical-align: middle;
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.05s ease, background-color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.btn-secondary {
  background: var(--bg);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.btn-secondary:hover {
  background: var(--accent-light);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: var(--bg-soft);
}

.btn-upgrade {
  background: var(--accent-light);
  border-color: var(--accent-line);
  color: var(--accent-dark);
}

.btn-upgrade:hover {
  background: var(--accent-line);
}

.btn-danger-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background: var(--danger-light);
  border-color: var(--danger);
}

.btn-small {
  padding: 6px 11px;
  font-size: 12.5px;
}

.btn-block {
  display: flex;
  width: 100%;
}

@media (max-width: 480px) {
  .btn-block-mobile {
    width: 100%;
  }
}

.btn[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------------- */
/* 品目行                                                                  */
/* ---------------------------------------------------------------------- */

.items-table-head {
  display: grid;
  grid-template-columns: 1fr 56px 96px 116px 52px 122px;
  gap: 6px;
  padding: 0 4px 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-faint);
}

.items-table-head.wh-hidden {
  grid-template-columns: 1fr 56px 96px 116px 122px;
}

.items-table-head .col-wh {
  text-align: center;
}

#items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 56px 96px 116px 52px 122px;
  gap: 6px;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}

#items-list.wh-hidden .item-row {
  grid-template-columns: 1fr 56px 96px 116px 122px;
}

.item-row:last-child {
  border-bottom: none;
}

.item-row input,
.item-row select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  min-width: 0;
  font-size: 13px;
}

.item-row input:focus,
.item-row select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}

.item-cell-wh {
  display: flex;
  justify-content: center;
}

.item-cell-wh input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

/* 源泉徴収OFF時は列ごと畳む（grid-template-columns の5列版と対にする） */
#items-list.wh-hidden .cell-wh {
  display: none;
}

.item-cell-actions {
  display: flex;
  gap: 3px;
  justify-content: flex-end;
}

.item-icon-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  border-radius: 6px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
}

.item-icon-btn:hover {
  background: var(--bg-soft);
}

.item-icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.item-icon-btn.is-danger {
  color: var(--danger);
}

.item-icon-btn.is-danger:hover {
  background: var(--danger-light);
  border-color: var(--danger);
}

.item-icon-btn svg {
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.cell-label {
  display: none;
}

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

@media (max-width: 640px) {
  .items-table-head {
    display: none;
  }

  .item-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name name"
      "qty price"
      "rate wh"
      "actions actions";
    gap: 8px;
    background: var(--bg-tint);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
  }

  .item-row .cell-name {
    grid-area: name;
  }

  .item-row .cell-qty {
    grid-area: qty;
  }

  .item-row .cell-price {
    grid-area: price;
  }

  .item-row .cell-rate {
    grid-area: rate;
  }

  .item-row .cell-wh {
    grid-area: wh;
  }

  .item-row .cell-actions {
    grid-area: actions;
  }

  .item-row .item-cell-actions {
    justify-content: flex-end;
  }

  .item-row .item-cell-wh {
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
  }

  #items-list.wh-hidden .item-row {
    grid-template-areas:
      "name name"
      "qty price"
      "rate rate"
      "actions actions";
  }

  .cell-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-faint);
    margin-bottom: 3px;
  }
}

/* ---------------------------------------------------------------------- */
/* 取引先・品目マスタ / 保存書類一覧                                        */
/* ---------------------------------------------------------------------- */

.saved-docs-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.saved-docs-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
}

.saved-docs-list .saved-doc-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}

.saved-docs-list .saved-doc-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.saved-docs-empty {
  font-size: 12px;
  color: var(--ink-faint);
  padding: 6px 2px;
}

/* ---------------------------------------------------------------------- */
/* プレビュー                                                              */
/* ---------------------------------------------------------------------- */

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-toolbar-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
}

.preview-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-tint);
  padding: 20px;
  overflow: auto;
  flex: 1;
  min-height: 300px;
  min-width: 0;
}

.invoice-sheet-root {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sheet-page-frame {
  overflow: hidden;
  margin: 0 auto 20px;
  box-shadow: var(--shadow-sheet);
  background: #fff;
  flex: none;
}

.sheet-page-frame:last-child {
  margin-bottom: 0;
}

.sheet-page {
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  color: #16181f;
  font-family: var(--font-sans);
  padding: 15mm;
  box-sizing: border-box;
  transform-origin: top left;
  position: relative;
}

.sheet-page[data-theme="green"] {
  --sheet-accent: #0F7B4B;
  --sheet-accent-light: #EAFAF1;
}

.sheet-page[data-theme="gray"] {
  --sheet-accent: #3A3F4B;
  --sheet-accent-light: #F1F2F5;
}

.sheet-page:not([data-theme="green"]):not([data-theme="gray"]) {
  --sheet-accent: #4F46E5;
  --sheet-accent-light: #EEF2FF;
}

.sheet-copy-badge {
  position: absolute;
  top: 15mm;
  left: 15mm;
  font-size: 11px;
  font-weight: 700;
  color: var(--sheet-accent);
  border: 1px solid var(--sheet-accent);
  border-radius: 4px;
  padding: 2px 8px;
}

.sheet-head {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  font-size: 11.5px;
  color: #3a3d47;
  margin-bottom: 6px;
}

.sheet-head dl {
  display: flex;
  gap: 6px;
  margin: 0;
}

.sheet-head dt::after {
  content: "：";
}

.sheet-head dt,
.sheet-head dd {
  margin: 0;
}

.sheet-title {
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  margin: 4px 0 22px;
  color: #14161c;
}

.sheet-parties {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 18px;
}

.party-recipient {
  min-width: 0;
  flex: 1 1 55%;
}

.recipient-name {
  font-size: 17px;
  font-weight: 700;
  border-bottom: 2px solid #14161c;
  padding-bottom: 7px;
  display: inline-block;
  min-width: 210px;
}

.recipient-addr {
  font-size: 11.5px;
  color: #3a3d47;
  margin-top: 8px;
  line-height: 1.7;
}

.party-sender {
  flex: 1 1 40%;
  font-size: 11.5px;
  line-height: 1.75;
  color: #23252c;
  min-width: 0;
  max-width: 280px;
  position: relative;
  padding-right: 46px;
}

.sender-name {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.sender-regnum {
  margin-top: 2px;
  font-weight: 600;
}

.sender-seal {
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.sheet-logo {
  max-width: 140px;
  max-height: 44px;
  object-fit: contain;
  margin-bottom: 8px;
}

.sheet-total-banner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  background: var(--sheet-accent-light);
  border: 1px solid var(--sheet-accent);
  border-radius: 6px;
  padding: 12px 18px;
  margin: 4px 0 14px;
}

.total-label {
  font-size: 13.5px;
  font-weight: 700;
  color: #14161c;
}

.total-amount {
  font-size: 25px;
  font-weight: 800;
  color: var(--sheet-accent);
  letter-spacing: 0.02em;
}

.total-amount .unit {
  font-size: 13px;
  font-weight: 700;
  margin-left: 2px;
}

.sheet-due {
  text-align: right;
  font-size: 12px;
  margin-bottom: 14px;
  color: #23252c;
}

.sheet-due strong {
  font-weight: 700;
}

table.sheet-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  margin-bottom: 6px;
}

table.sheet-items thead th {
  background: #f3f4f8;
  border-top: 1.5px solid #14161c;
  border-bottom: 1.5px solid #14161c;
  padding: 7px 8px;
  font-weight: 700;
  text-align: left;
}

table.sheet-items thead th.col-qty,
table.sheet-items thead th.col-price,
table.sheet-items thead th.col-amount {
  text-align: right;
}

table.sheet-items tbody td {
  border-bottom: 1px solid #d7d9e2;
  padding: 6px 8px;
  vertical-align: top;
  break-inside: avoid;
}

table.sheet-items tbody tr {
  break-inside: avoid;
}

table.sheet-items td.col-qty,
table.sheet-items td.col-price,
table.sheet-items td.col-amount {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

table.sheet-items tbody tr.item-row-empty td {
  color: var(--ink-faint);
  text-align: center;
}

.sheet-reduced-note {
  font-size: 10.5px;
  color: #3a3d47;
  text-align: right;
  margin-bottom: 16px;
}

.sheet-summary {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}

table.summary-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 300px;
}

table.summary-table th,
table.summary-table td {
  padding: 5px 4px;
  text-align: right;
  font-weight: 400;
}

table.summary-table th {
  text-align: left;
  color: #3a3d47;
  font-weight: 600;
  white-space: nowrap;
  padding-right: 18px;
}

table.summary-table td {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.summary-table tr.summary-subtotal th,
table.summary-table tr.summary-subtotal td {
  border-top: 1px solid #d7d9e2;
  padding-top: 8px;
}

table.summary-table tr.summary-total th,
table.summary-table tr.summary-total td {
  border-top: 1.5px solid #14161c;
  padding-top: 8px;
  font-size: 14px;
  font-weight: 700;
}

table.summary-table tr.summary-withholding th,
table.summary-table tr.summary-withholding td {
  color: var(--danger);
}

table.summary-table tr.summary-payment th,
table.summary-table tr.summary-payment td {
  border-top: 1.5px solid #14161c;
  padding-top: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--sheet-accent);
}

.sheet-bottom {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 11px;
  color: #23252c;
}

.sheet-bank,
.sheet-notes {
  flex: 1 1 50%;
  min-width: 0;
}

.sheet-bottom h3 {
  font-size: 11px;
  font-weight: 700;
  color: #3a3d47;
  margin-bottom: 4px;
}

.sheet-bank pre,
.sheet-notes pre {
  font-family: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  line-height: 1.7;
}

.sheet-transfer-fee-note {
  margin-top: 4px;
  color: #3a3d47;
}

/* ---------------------------------------------------------------------- */
/* Proモーダル                                                             */
/* ---------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 30, 0.5);
}

.modal-panel {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  max-width: 420px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 28px 26px 24px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: var(--bg-soft);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--border);
}

.modal-panel h2 {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  padding-right: 30px;
  margin-bottom: 8px;
}

.modal-panel > p {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.pro-feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pro-feature-list li {
  font-size: 13px;
  color: var(--ink);
  padding-left: 22px;
  position: relative;
}

.pro-feature-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.pro-activate {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.pro-activate label {
  font-size: 12.5px;
}

.license-input-row {
  display: flex;
  gap: 8px;
}

.license-input-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.license-input-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.pro-manage {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------------- */
/* トースト                                                                */
/* ---------------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  z-index: 200;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast[hidden] {
  display: none;
}

.toast.is-error {
  background: var(--danger);
}

/* Pro有効時は各所のPROバッジを畳んで表示をすっきりさせる */
body.is-pro-active .pro-badge {
  display: none;
}

/* ---------------------------------------------------------------------- */
/* フッター                                                                */
/* ---------------------------------------------------------------------- */

.app-footer {
  max-width: 1400px;
  margin: 8px auto 0;
  padding: 20px 24px 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.app-footer-nav a {
  color: var(--ink-faint);
  font-size: 12.5px;
  text-decoration: none;
}

.app-footer-nav a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.app-footer-copyright {
  font-size: 12px;
  color: var(--ink-faint);
}

@media (max-width: 480px) {
  .form-row-split {
    grid-template-columns: 1fr;
  }

  .form-field-narrow {
    max-width: none;
  }

  .app-header-inner {
    padding: 12px 14px;
  }

  .app-logo-text {
    font-size: 16px;
  }

  .status-badge {
    display: none;
  }
}
