input[readonly] { background-color: #f1f5f9; color: #334155; }
    /* PToolsで使用するローカルUIユーティリティ。外部CSSへ依存しません。 */
    *, *::before, *::after { box-sizing: border-box; }
    html { line-height: 1.5; -webkit-text-size-adjust: 100%; }
    body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
    button, input, select { margin: 0; font: inherit; }
    button { border: 0; cursor: pointer; }
    .hidden { display: none !important; }
    .block { display: block; }
    .flex { display: flex; }
    .grid { display: grid; }
    .fixed { position: fixed; }
    .sticky { position: sticky; }
    .absolute { position: absolute; }
    .relative { position: relative; }
    .top-0 { top: 0; }
    .top-2 { top: .5rem; }
    .right-0 { right: 0; }
    .right-2 { right: .5rem; }
    .bottom-0 { bottom: 0; }
    .left-0 { left: 0; }
    .z-10 { z-index: 10; }
    .w-full { width: 100%; }
    .w-4 { width: 1rem; }
    .h-4 { height: 1rem; }
    .max-w-md { max-width: 28rem; }
    .min-h-screen { min-height: 100vh; }
    .mx-auto { margin-left: auto; margin-right: auto; }
    .mt-2 { margin-top: .5rem; }
    .mb-1 { margin-bottom: .25rem; }
    .mb-2 { margin-bottom: .5rem; }
    .p-2 { padding: .5rem; }
    .p-3 { padding: .75rem; }
    .p-4 { padding: 1rem; }
    .px-2 { padding-left: .5rem; padding-right: .5rem; }
    .px-3 { padding-left: .75rem; padding-right: .75rem; }
    .py-1 { padding-top: .25rem; padding-bottom: .25rem; }
    .py-2 { padding-top: .5rem; padding-bottom: .5rem; }
    .py-3 { padding-top: .75rem; padding-bottom: .75rem; }
    .pb-20 { padding-bottom: 5rem; }
    .pr-12 { padding-right: 3rem; }
    .space-y-2 > * + * { margin-top: .5rem; }
    .space-y-3 > * + * { margin-top: .75rem; }
    .space-y-4 > * + * { margin-top: 1rem; }
    .space-x-2 > * + * { margin-left: .5rem; }
    .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .col-span-2 { grid-column: span 2 / span 2; }
    .gap-2 { gap: .5rem; }
    .flex-1 { flex: 1 1 0%; }
    .items-center { align-items: center; }
    .justify-between { justify-content: space-between; }
    .justify-center { justify-content: center; }
    .border { border: 1px solid #d1d5db; }
    .border-t { border-top: 1px solid #e5e7eb; }
    .border-b { border-bottom: 1px solid #e5e7eb; }
    .border-blue-200 { border-color: #bfdbfe; }
    .border-blue-300 { border-color: #93c5fd; }
    .border-red-200 { border-color: #fecaca; }
    .border-yellow-200 { border-color: #fde68a; }
    .rounded { border-radius: .375rem; }
    .rounded-lg { border-radius: .5rem; }
    .bg-white { background-color: #fff; }
    .bg-gray-100 { background-color: #f3f4f6; }
    .bg-gray-50 { background-color: #f9fafb; }
    .bg-blue-50 { background-color: #eff6ff; }
    .bg-blue-100 { background-color: #dbeafe; }
    .bg-blue-600 { background-color: #2563eb; }
    .bg-red-50 { background-color: #fef2f2; }
    .bg-yellow-50 { background-color: #fffbeb; }
    .text-white { color: #fff; }
    .text-gray-600 { color: #4b5563; }
    .text-gray-700 { color: #374151; }
    .text-gray-800 { color: #1f2937; }
    .text-blue-700 { color: #1d4ed8; }
    .text-red-500 { color: #ef4444; }
    .text-red-700 { color: #b91c1c; }
    .text-amber-800 { color: #92400e; }
    .text-center { text-align: center; }
    .text-xs { font-size: .75rem; line-height: 1rem; }
    .text-sm { font-size: .875rem; line-height: 1.25rem; }
    .text-lg { font-size: 1.125rem; line-height: 1.75rem; }
    .font-bold { font-weight: 700; }
    .shadow-sm { box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
    .shadow { box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
    .shadow-md { box-shadow: 0 4px 10px rgba(15, 23, 42, .1); }
    .shadow-lg { box-shadow: 0 10px 20px rgba(15, 23, 42, .13); }
    .hover\:bg-blue-700:hover { background-color: #1d4ed8; }
    .hover\:bg-green-800:hover { background-color: #166534; }
    body {
      -webkit-tap-highlight-color: transparent;
      padding-bottom: calc(5rem + env(safe-area-inset-bottom)) !important;
    }
    input, select { font-size: 16px; }
    button, input:not([type="checkbox"]), select { min-height: 44px; }
    .tab-active { border-bottom: 2px solid #3b82f6; color: #3b82f6; font-weight: bold; }
    .tab-inactive { color: #6b7280; }
    .field-error { border-color: #ef4444; background-color: #fef2f2; }
    .calc-message-success { color: #166534; }
    .calc-message-error { color: #b91c1c; }
    .app-footer { padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); }
    .required-badge {
      display: inline-block;
      margin-left: 0.35rem;
      border-radius: 0.25rem;
      background-color: #dc2626;
      padding: 0.1rem 0.35rem;
      color: #fff;
      font-size: 0.65rem;
      line-height: 1.2;
      vertical-align: middle;
    }
    .optional-panel summary {
      display: flex;
      min-height: 44px;
      align-items: center;
      justify-content: space-between;
      cursor: pointer;
      list-style: none;
    }
    .optional-panel summary::-webkit-details-marker { display: none; }
    .optional-panel summary::after { color: #2563eb; content: "＋"; font-size: 1.15rem; }
    .optional-panel[open] summary::after { content: "−"; }
    .notification {
      position: fixed;
      left: 50%;
      bottom: 5.5rem;
      z-index: 50;
      width: calc(100% - 2rem);
      max-width: 26rem;
      transform: translateX(-50%);
      border-radius: 0.5rem;
      padding: 0.75rem 1rem;
      color: #fff;
      font-weight: 700;
      text-align: center;
      box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
    }
    .notification-success { background-color: #15803d; }
    .notification-error { background-color: #b91c1c; }
    .account-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      border-bottom: 1px solid #dbeafe;
      background: #eff6ff;
      padding: 0.65rem 1rem;
      color: #1e3a8a;
      font-size: 0.75rem;
    }
    .account-bar a {
      color: #1d4ed8;
      font-weight: 700;
      text-decoration: underline;
      text-underline-offset: 0.15rem;
    }
    .carry-message {
      margin-top: 0.5rem;
      border-radius: 0.375rem;
      background: #eff6ff;
      padding: 0.5rem 0.65rem;
      color: #1e40af;
      font-size: 0.75rem;
      font-weight: 700;
    }
    .store-combobox {
      position: static;
    }
    .store-input-wrap {
      position: relative;
    }
    .store-results {
      position: absolute;
      top: calc(100% + 0.25rem);
      right: 0;
      left: 0;
      z-index: 30;
      max-height: min(19rem, 48vh);
      overflow-y: auto;
      border: 1px solid #bfdbfe;
      border-radius: 0.5rem;
      background: #fff;
      padding: 0.3rem;
      box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16);
    }
    .store-option {
      display: flex;
      width: 100%;
      min-height: 48px;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      border-radius: 0.4rem;
      background: #fff;
      padding: 0.55rem 0.65rem;
      color: #1f2937;
      text-align: left;
    }
    .store-option-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) 44px;
      align-items: stretch;
      gap: 0.25rem;
    }
    .store-favorite-button {
      display: grid;
      min-height: 44px;
      place-items: center;
      border-radius: 0.4rem;
      background: #f8fafc;
      color: #64748b;
      font-size: 1.15rem;
    }
    .store-favorite-button.is-favorite {
      background: #fef3c7;
      color: #b45309;
    }
    .store-option:hover,
    .store-option:focus-visible {
      background: #eff6ff;
      outline: none;
    }
    .store-option strong {
      display: block;
      overflow-wrap: anywhere;
    }
    .store-option span {
      flex: 0 0 auto;
      color: #1d4ed8;
      font-size: 0.75rem;
      font-weight: 700;
      white-space: nowrap;
    }
    .store-results-empty {
      margin: 0;
      padding: 0.7rem;
      color: #6b7280;
      font-size: 0.75rem;
    }
    .machine-search-wrap { position: relative; }
    .machine-search-input { width: 100%; min-height: 48px; border: 1px solid #cbd5e1; border-radius: 0.5rem; padding: 0.55rem 0.7rem; background: #fff; color: #111827; }
    .machine-search-results { position: absolute; z-index: 40; top: calc(100% + 0.25rem); right: 0; left: 0; max-height: min(20rem, 52vh); overflow-y: auto; border: 1px solid #bfdbfe; border-radius: 0.65rem; background: #fff; padding: 0.3rem; box-shadow: 0 14px 30px rgba(15, 23, 42, 0.16); }
    .machine-search-option { display: flex; width: 100%; min-height: 52px; flex-direction: column; justify-content: center; gap: 0.1rem; border-radius: 0.5rem; padding: 0.55rem 0.65rem; color: #1f2937; text-align: left; }
    .machine-search-option:hover, .machine-search-option:focus-visible, .machine-search-option.is-active { background: #eff6ff; outline: none; }
    .machine-search-option strong { overflow-wrap: anywhere; font-size: 0.875rem; line-height: 1.35; }
    .machine-search-option span, .machine-search-empty { color: #64748b; font-size: 0.72rem; line-height: 1.4; }
    .machine-search-option.is-custom { margin-top: 0.25rem; border-top: 1px solid #dbeafe; border-radius: 0 0 0.5rem 0.5rem; }
    .machine-search-empty { margin: 0; padding: 0.75rem 0.65rem; }
    .machine-name.machine-native-select { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
    @media (max-width: 600px) {
      .machine-search-results { position: fixed; z-index: 1000; top: auto; right: 0.5rem; bottom: calc(0.5rem + env(safe-area-inset-bottom)); left: 0.5rem; max-height: min(64vh, 500px); border-radius: 1rem; padding: 0.45rem; }
      .machine-search-option { min-height: 56px; }
    }
    .store-shortcuts {
      display: flex;
      gap: 0.4rem;
      margin-top: 0.5rem;
      overflow-x: auto;
      padding: 0.1rem 0 0.25rem;
      scrollbar-width: thin;
    }
    .store-shortcut {
      flex: 0 0 auto;
      min-height: 44px;
      max-width: min(15rem, 78vw);
      overflow: hidden;
      border: 1px solid #bfdbfe;
      border-radius: 999px;
      background: #eff6ff;
      padding: 0.45rem 0.75rem;
      color: #1e40af;
      font-size: 0.75rem;
      font-weight: 700;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .store-shortcut.is-favorite {
      border-color: #fcd34d;
      background: #fffbeb;
      color: #92400e;
    }
    .store-new-panel {
      margin-top: 0.55rem;
      border: 1px solid #fde68a;
      border-radius: 0.5rem;
      background: #fffbeb;
      padding: 0.65rem;
    }
    .store-new-panel strong {
      display: block;
      color: #92400e;
      font-size: 0.75rem;
    }
    .field-help {
      margin: 0.3rem 0 0;
      color: #6b7280;
      font-size: 0.7rem;
    }
    .machine-favorite-button {
      min-height: 40px;
      border: 1px solid #dbeafe;
      border-radius: 0.4rem;
      background: #eff6ff;
      padding: 0.45rem 0.65rem;
      color: #1d4ed8;
      font-size: 0.75rem;
      font-weight: 700;
    }
    .machine-favorite-button.is-favorite {
      border-color: #fcd34d;
      background: #fef3c7;
      color: #92400e;
    }
    .machine-border-source {
      margin: -0.15rem 0 0.65rem;
      color: #64748b;
      font-size: 0.7rem;
      line-height: 1.55;
    }
    .machine-border-source a {
      color: #1d4ed8;
      font-weight: 700;
      text-decoration: underline;
      text-underline-offset: 2px;
    }
    .machine-border-source.is-manual {
      color: #92400e;
    }
    .app-footer {
      gap: 0.5rem;
    }
    .app-footer .save-button {
      background: #15803d;
    }
    .app-footer .copy-button-secondary {
      flex: 0 0 42%;
      border: 1px solid #2563eb;
      background: #fff;
      color: #1d4ed8;
    }
    .cash-report-balance {
      display: flex;
      min-height: 44px;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      margin-top: 0.5rem;
      border-radius: 0.5rem;
      background: #f0fdf4;
      padding: 0.65rem 0.75rem;
      color: #166534;
    }
    .cash-report-balance strong { font-size: 1rem; }
    .cash-report-projection { flex-wrap: wrap; background: #eff6ff; color: #1e40af; }
    .cash-report-projection small { flex-basis: 100%; font-size: 0.7rem; }
    .cash-report-projection strong.is-negative { color: #b91c1c; }
    .cash-report-status {
      margin-top: 0.5rem;
      color: #166534;
      font-size: 0.75rem;
      font-weight: 700;
    }
    .cash-report-status.is-error { color: #b91c1c; }
    .cash-report-quick-actions {
      border: 1px solid #bfdbfe;
      border-radius: 0.5rem;
      background: #eff6ff;
      padding: 0.75rem;
    }
    .cash-report-quick-toggle {
      display: flex;
      min-height: 44px;
      align-items: center;
      gap: 0.5rem;
      margin-top: 0.6rem;
      border-top: 1px solid #bfdbfe;
      padding-top: 0.55rem;
      color: #1e3a8a;
      font-weight: 800;
    }
    .cash-save-action {
      margin: 0.2rem 0 0;
      color: #1e40af;
      font-size: 0.7rem;
      font-weight: 700;
    }
    .exchange-value-help {
      margin: 0;
      border-radius: 0.375rem;
      background: #fff;
      padding: 0.5rem 0.6rem;
      color: #475569;
      font-size: 0.7rem;
    }
    .exchange-value-help.is-auto {
      border: 1px solid #f59e0b;
      background: #fffbeb;
      color: #92400e;
      font-weight: 700;
    }
    .draft-restore-overlay {
      position: fixed;
      inset: 0;
      z-index: 70;
      display: grid;
      place-items: center;
      overflow-y: auto;
      background: rgb(15 23 42 / 62%);
      padding: 1rem;
    }
    .draft-restore-dialog {
      width: min(100%, 26rem);
      border-radius: 0.75rem;
      background: #fff;
      padding: 1rem;
      box-shadow: 0 20px 45px rgb(15 23 42 / 28%);
    }
    .draft-restore-dialog h2 { margin: 0; color: #1e3a8a; font-size: 1rem; }
    .draft-restore-dialog p { margin: 0.55rem 0 0; }
    .draft-restore-meta {
      border-radius: 0.5rem;
      background: #eff6ff;
      padding: 0.65rem;
      color: #1e40af;
      font-size: 0.75rem;
      font-weight: 700;
    }
    .draft-restore-actions {
      display: grid;
      gap: 0.5rem;
      margin-top: 0.85rem;
    }
    .draft-restore-actions button {
      min-height: 48px;
      border-radius: 0.5rem;
      padding: 0.65rem 0.75rem;
      font-weight: 800;
    }
    .draft-use-button { background: #2563eb; color: #fff; }
    .draft-discard-button { border: 1px solid #cbd5e1; background: #fff; color: #334155; }

.ptools-report-page { padding-bottom:calc(88px + env(safe-area-inset-bottom)); }
.report-main { width:min(100%,560px); margin:0 auto; background:#fff; min-height:calc(100dvh - 56px); box-shadow:0 3px 14px #172b4d0a; }
.report-page-title { margin:0; padding:16px 16px 0; font-size:20px; font-weight:800; }
.ptools-report-page .app-footer { max-width:560px; padding-bottom:calc(12px + env(safe-area-inset-bottom)); z-index:20; }
body.ptools-keyboard-open.ptools-report-page .app-footer { position:static; }
body.ptools-keyboard-open.ptools-report-page .draft-restore-dialog { max-height:calc(var(--ptools-visible-height,100dvh) - 24px); overflow:auto; }
@media (pointer:coarse) { .ptools-report-page input, .ptools-report-page select, .ptools-report-page textarea { font-size:16px; } }
@media (orientation:landscape) and (max-height:500px) { .ptools-report-page .app-footer { position:static; } .ptools-report-page { padding-bottom:0; } .draft-restore-dialog { max-height:calc(100dvh - 24px); overflow:auto; } }
