:root {
    --navy: #1f3a5f; --navy-2: #2c5282; --accent: #e8792b; --bg: #f3f5f8; --card: #fff;
    --line: #dfe3ea; --text: #1d2733; --muted: #6b7785; --ok: #2f855a; --ng: #c53030; --warn: #b7791f;
    --radius: 10px;
  }
  * { box-sizing: border-box; }
  html, body { margin: 0; background: var(--bg); color: var(--text);
    font-family: "Hiragino Kaku Gothic ProN", "Meiryo UI", Meiryo, "Noto Sans JP", sans-serif; font-size: 15px; }
  button, input, select, textarea { font: inherit; color: inherit; }
  .hidden { display: none !important; }
  .muted { color: var(--muted); }
  .small { font-size: 12.5px; }
  .center { text-align: center; padding: 40px 16px; }
  .err { color: var(--ng); }
  .ok { color: var(--ok); }

  .topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
    background: var(--navy); color: #fff; padding: 10px 16px; gap: 8px; }
  .brand { font-weight: 700; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
  .logo { color: var(--accent); font-size: 18px; }
  .who { display: flex; align-items: center; gap: 10px; font-size: 13px; min-width: 0; }
  .who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; opacity: .9; }
  .who button { background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; }

  main { max-width: 980px; margin: 0 auto; padding: 16px 14px 120px; }
  .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
  .card h2 { font-size: 17px; margin: 0 0 12px; }
  .card h3 { font-size: 15px; margin: 0 0 10px; }

  .login { max-width: 380px; margin: 8vh auto 0; }
  .login h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }

  label.f { display: block; margin-bottom: 14px; }
  label.f > span { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
  label.f > span em { font-style: normal; color: var(--ng); font-weight: 400; margin-left: 4px; font-size: 12px; }
  .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
  input[type=text], input[type=password], input[type=number], select {
    width: 100%; border: 1px solid #c8cfd9; border-radius: 8px; padding: 10px 12px; background: #fff; min-height: 44px; }
  input:focus, select:focus { outline: 2px solid var(--navy-2); outline-offset: -1px; border-color: transparent; }
  input.invalid { border-color: var(--ng); background: #fff6f6; }
  .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  @media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }

  .date-wrap { position: relative; display: flex; gap: 6px; }
  .date-wrap input[type=text] { flex: 1; }
  .cal-btn { position: relative; width: 48px; min-height: 44px; border: 1px solid #c8cfd9; border-radius: 8px; background: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 20px; overflow: hidden; flex-shrink: 0; }
  .cal-btn input[type=date], .cal-btn input[type=time] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; }
  .cal-btn input[type=date]::-webkit-calendar-picker-indicator, .cal-btn input[type=time]::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }

  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff;
    border-radius: 8px; padding: 10px 16px; min-height: 42px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text); }
  .btn:hover { background: #f7f9fb; }
  .btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
  .btn.primary:hover { background: var(--navy-2); }
  .btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
  .btn.danger { color: var(--ng); border-color: #f0c4c4; }
  .btn.sm { padding: 5px 10px; min-height: 32px; font-size: 13px; font-weight: 500; }
  .btn.block { width: 100%; }
  .btn:disabled { opacity: .5; cursor: not-allowed; }
  .icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 34px; height: 34px; cursor: pointer; font-size: 15px; flex-shrink: 0; }
  .icon-btn.danger { color: var(--ng); }
  .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .actions.end { justify-content: flex-end; }
  .spacer { flex: 1; }

  .stepper { display: flex; gap: 4px; margin-bottom: 14px; }
  .stepper div { flex: 1; text-align: center; padding: 8px 4px; font-size: 12.5px; background: #e4e8ee; color: var(--muted); border-radius: 6px; font-weight: 600; }
  .stepper div.on { background: var(--navy); color: #fff; }
  .stepper div.done { background: #cfdaea; color: var(--navy); }

  .bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); z-index: 15; }
  .bottom-bar .inner { max-width: 980px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }

  .eq-list { display: grid; gap: 10px; }
  .eq { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
  .eq .no { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
  .eq .body { flex: 1; min-width: 0; cursor: pointer; }
  .eq .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #edf2f7; color: var(--muted); font-weight: 600; }
  .badge.ok { background: #e6f4ea; color: var(--ok); }
  .badge.ng { background: #fdecec; color: var(--ng); }
  .badge.warn { background: #fdf3e1; color: var(--warn); }

  .loc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
  .loc-head { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
  .loc-head .no { background: #34495e; color: #fff; border-radius: 6px; padding: 0 8px; height: 34px; display: flex; align-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
  .loc-head input { min-height: 36px; padding: 6px 10px; }
  .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .slot { position: relative; aspect-ratio: 4 / 3; border: 2px dashed #c3ccd8; border-radius: 8px; background: #f8fafc; display: flex; flex-direction: column;
    align-items: center; justify-content: center; cursor: pointer; overflow: hidden; color: var(--muted); font-size: 13px; text-align: center; }
  .slot:hover { border-color: var(--navy-2); }
  .slot .plus { font-size: 26px; line-height: 1; color: #9aa6b5; }
  .slot.filled { border-style: solid; border-color: #cbd5e0; background: #222; }
  .slot img { width: 100%; height: 100%; object-fit: contain; }
  .slot .tag { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.65); color: #fff; font-size: 11.5px; padding: 2px 8px; border-radius: 4px; font-weight: 700; }
  .slot .tag.before { background: rgba(31,58,95,.9); }
  .slot .tag.after { background: rgba(232,121,43,.95); }
  .slot .rm { position: absolute; right: 6px; top: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 14px; }
  .slot.busy::after { content: '処理中…'; position: absolute; inset: 0; background: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; color: var(--text); }

  table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
  table.list th, table.list td { border-bottom: 1px solid var(--line); padding: 9px 8px; text-align: left; vertical-align: middle; }
  table.list th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #f8fafc; }
  table.list td .kana { font-size: 11.5px; color: var(--muted); }
  table.list tr.suspended td { background: #fafafa; color: #8a94a0; }
  .mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .02em; }
  @media (max-width: 720px) {
    table.list thead { display: none; }
    table.list, table.list tbody, table.list tr, table.list td { display: block; width: 100%; }
    table.list tr { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; padding: 6px; background: #fff; }
    table.list td { border: 0; padding: 4px 6px; }
  }

  .tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
  .tabs button { border: 0; background: transparent; padding: 10px 16px; cursor: pointer; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
  .tabs button.on { color: var(--navy); border-bottom-color: var(--accent); }

  .summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
  .summary div { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
  .summary b { display: block; font-size: 20px; color: var(--navy); }
  dl.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 0; }
  dl.kv dt { color: var(--muted); font-size: 13px; }
  dl.kv dd { margin: 0; word-break: break-all; }

  .progress { height: 22px; background: #e4e8ee; border-radius: 99px; overflow: hidden; position: relative; }
  .progress .bar { height: 100%; background: linear-gradient(90deg, var(--navy-2), var(--accent)); width: 0; transition: width .3s; }
  .progress.indeterminate .bar { width: 30% !important; animation: indet 1.2s infinite ease-in-out; }
  @keyframes indet { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
  .pct { font-size: 34px; font-weight: 800; color: var(--navy); text-align: center; margin: 10px 0 2px; }
  .stage-list { list-style: none; padding: 0; margin: 14px 0 0; font-size: 14px; }
  .stage-list li { padding: 4px 0; color: var(--muted); }
  .stage-list li.on { color: var(--text); font-weight: 700; }
  .stage-list li.done { color: var(--ok); }
  .stage-list li::before { content: '○ '; }
  .stage-list li.on::before { content: '▶ '; }
  .stage-list li.done::before { content: '✔ '; }

  .copybox { display: flex; gap: 8px; }
  .copybox input { flex: 1; font-size: 13px; }
  .done-hero { text-align: center; padding: 10px 0 4px; }
  .done-hero .big { font-size: 46px; color: var(--ok); line-height: 1; }

  .modal { position: fixed; inset: 0; background: rgba(15,23,35,.5); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
  .modal .box { background: #fff; border-radius: 12px; max-width: 460px; width: 100%; padding: 20px; max-height: 90vh; overflow: auto; }
  .modal h3 { margin: 0 0 12px; font-size: 17px; }
  .cred { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 10px 0; }
  .cred .mono { font-size: 17px; font-weight: 700; }
  .toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #1d2733; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 60; font-size: 14px; max-width: 90vw; }
  .toast.err { background: var(--ng); }
  .notice { background: #fff8e6; border: 1px solid #f3d9a4; color: #7a5410; border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
  .errors { background: #fff5f5; border: 1px solid #f5c2c2; border-radius: 8px; padding: 10px 14px; }
  .errors li { margin: 3px 0; }
  .errors a { color: var(--ng); cursor: pointer; text-decoration: underline; }
  .filter { display: flex; gap: 8px; margin-bottom: 10px; }
  .filter input { flex: 1; }
  .filter select { width: auto; }


  a.brand { color: #fff; text-decoration: none; }
  textarea { width: 100%; border: 1px solid #c8cfd9; border-radius: 8px; padding: 8px 10px; background: #fff; resize: vertical;
    font-family: "MS Gothic", "Osaka-Mono", ui-monospace, monospace; line-height: 1.5; }
  textarea:focus { outline: 2px solid var(--navy-2); outline-offset: -1px; border-color: transparent; }
  textarea.invalid { border-color: var(--ng); background: #fff6f6; }

  /* 報告書タイプ選択 */
  .types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  @media (max-width: 560px) { .types { grid-template-columns: 1fr; } }
  .type { display: flex; gap: 12px; align-items: center; border: 2px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; background: #fff; }
  .type input { width: 20px; height: 20px; accent-color: var(--navy); flex-shrink: 0; }
  .type.on { border-color: var(--navy); background: #f2f6fb; }
  .type b { display: block; }
  .type .small { color: var(--muted); }
  .mini { width: 54px; height: 62px; flex-shrink: 0; border: 1px solid #c8cfd9; border-radius: 3px; background: #fff; padding: 4px; display: grid; gap: 3px; }
  .mini i { display: block; background: #c9d6e6; border-radius: 1px; }
  .mini.desc { grid-template-columns: 3fr 2fr; grid-template-rows: repeat(3, 1fr); }
  .mini.desc i:nth-child(even) { background: repeating-linear-gradient(#fff 0 2px, #b8c2cf 2px 3px); }
  .mini.pair { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); }
  .mini.pair i:nth-child(even) { background: #f3c9a6; }

  /* 写真＋説明 */
  .item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
  .item-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; }
  @media (max-width: 640px) { .item-body { grid-template-columns: 1fr; } }
  .item label.f { margin-bottom: 8px; }
  .item label.f > span { font-size: 12px; margin-bottom: 3px; }
  .item input[type=text] { min-height: 38px; padding: 7px 10px; }
  .page-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 700; margin: 4px 0 8px; }
  .page-sep::before, .page-sep::after { content: ''; flex: 1; border-top: 1px dashed #c3ccd8; }
  .counter { font-size: 12px; color: var(--muted); text-align: right; }
  .counter.err { color: var(--ng); font-weight: 700; }
  .slot .rot { position: absolute; right: 40px; top: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 15px; }
  .slot .tag.photo { background: rgba(31,58,95,.9); }

  .bulk { display: grid; gap: 10px; }
  .bulk .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .bulk select { width: auto; min-height: 42px; }
  .bulk input[type=text] { flex: 1; min-width: 180px; }
  .drop-hint { border: 2px dashed #c3ccd8; border-radius: 8px; padding: 10px; text-align: center; color: var(--muted); font-size: 13px; }
  body.dragging .drop-hint { border-color: var(--accent); background: #fff7f0; color: var(--accent); }
  @media (hover: none) { .drop-hint { display: none; } }

  /* 一覧 */
  .rep { display: flex; gap: 12px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
  .rep .body { flex: 1; min-width: 0; cursor: pointer; }
  .rep .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rep .sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rep .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  @media (max-width: 560px) { .rep { flex-wrap: wrap; } .rep .acts { width: 100%; } }
  .hero { text-align: center; padding: 8px 0 4px; }
  .hero h1 { font-size: 20px; margin: 0 0 6px; }
  .warns { background: #fff8e6; border: 1px solid #f3d9a4; border-radius: 8px; padding: 10px 14px; margin-top: 10px; color: #7a5410; }
  .warns li { margin: 3px 0; }
  .warns a { color: inherit; cursor: pointer; text-decoration: underline; }
  .big-actions { display: grid; gap: 10px; }
  .big-actions .btn { min-height: 52px; font-size: 16px; }
  .gbtn::before { content: ''; width: 18px; height: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 87.3 78'%3E%3Cpath fill='%230066da' d='m6.6 66.85 3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3l13.75-23.8h-27.5c0 1.55.4 3.1 1.2 4.5z'/%3E%3Cpath fill='%2300ac47' d='m43.65 25-13.75-23.8c-1.35.8-2.5 1.9-3.3 3.3l-25.4 44a9.06 9.06 0 0 0 -1.2 4.5h27.5z'/%3E%3Cpath fill='%23ea4335' d='m73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5h-27.502l5.852 11.5z'/%3E%3Cpath fill='%2300832d' d='m43.65 25 13.75-23.8c-1.35-.8-2.9-1.2-4.5-1.2h-18.5c-1.6 0-3.15.45-4.5 1.2z'/%3E%3Cpath fill='%232684fc' d='m59.8 53h-32.3l-13.75 23.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z'/%3E%3Cpath fill='%23ffba00' d='m73.4 26.5-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3l-13.75 23.8 16.15 28h27.45c0-1.55-.4-3.1-1.2-4.5z'/%3E%3C/svg%3E") center/contain no-repeat; background-color: #fff; border-radius: 3px; padding: 2px; box-sizing: content-box; }
  .footer { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 20px; }
