/* ==========================================================
   古澤電機 業務管理システム モックアップ 共通スタイル
   基準：デジタル庁デザインシステム（文字16px以上、押せる部分44px以上、
        文字のコントラスト比4.5:1以上、色だけで意味を伝えない）
   基調色：古澤電機ホームページの #1E1E90
   ========================================================== */
:root {
  /* 色 */
  --c-primary: #1e1e90;
  --c-primary-hover: #15156b;
  --c-primary-bg: #e8f1fe;
  --c-primary-line: #b5c7f5;
  --c-text: #1a1a1a;
  --c-sub: #4d4d4d;
  --c-border: #767676;      /* 入力欄の枠（白地に対して4.5:1） */
  --c-line: #d9d9d9;        /* 区切り線 */
  --c-bg: #f2f2f2;
  --c-white: #ffffff;
  --c-success: #197a4b;
  --c-success-bg: #e6f5ec;
  --c-error: #ce0000;
  --c-error-bg: #fdeeee;
  --c-warn: #7a5f00;
  --c-warn-bg: #fbf5e0;
  --c-night: #eceaf6;       /* 夜間帯の地色 */
  --c-focus: #ffd43d;
  /* 文字 */
  --f-base: 16px;
  --f-large: 18px;
  --f-small: 14px;          /* 表の補足など、場所が足りない所だけ */
  /* 余白と角 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --radius: 8px;
  --radius-l: 12px;
  --tap: 48px;              /* ボタン・入力欄の高さ */
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--f-base); }
body {
  margin: 0;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.4; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.4; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
a { color: var(--c-primary); }
.num { font-variant-numeric: tabular-nums; }
.sub { color: var(--c-sub); }
.small { font-size: var(--f-small); }

:focus-visible {
  outline: 4px solid #000;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--c-focus);
}

/* ---------- 画面の骨組み（パソコン） ---------- */
body.app {
  height: 100vh;
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  grid-template-rows: auto 56px minmax(0, 1fr);
  grid-template-areas: "mock mock" "hdr hdr" "side main";
}
.mockbar {
  grid-area: mock;
  background: var(--c-warn-bg);
  color: var(--c-text);
  border-bottom: 1px solid #d9c36a;
  padding: 6px var(--sp-4);
  font-size: var(--f-small);
  display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap;
}
.mockbar strong { color: var(--c-warn); }
.mockbar a, .mockbar button.linklike { margin-left: auto; }
.hdr {
  grid-area: hdr;
  background: var(--c-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-5);
}
.hdr .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.hdr .brand small { font-weight: 400; font-size: 14px; margin-left: var(--sp-3); opacity: .9; }
.side {
  grid-area: side;
  background: var(--c-white);
  border-right: 1px solid var(--c-line);
  padding: var(--sp-3) var(--sp-2);
  overflow: auto;
}
.side ul { list-style: none; margin: 0; padding: 0; }
.side a {
  display: flex; align-items: center; min-height: var(--tap);
  padding: 0 var(--sp-4);
  border-radius: var(--radius);
  color: var(--c-text); text-decoration: none; font-size: var(--f-large);
}
.side a:hover { background: var(--c-bg); }
.side a[aria-current="page"] {
  background: var(--c-primary-bg); color: var(--c-primary); font-weight: 700;
  box-shadow: inset 4px 0 0 var(--c-primary);
}
.side .group { margin: var(--sp-4) var(--sp-4) var(--sp-1); font-size: var(--f-small); color: var(--c-sub); }
main.main { grid-area: main; overflow: auto; padding: var(--sp-5) var(--sp-5) 0; }

.pagehead { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.pagehead .right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }

/* ---------- 部品 ---------- */
.card {
  background: var(--c-white);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-l);
  padding: var(--sp-4) var(--sp-5);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0 var(--sp-5);
  border-radius: var(--radius);
  border: 2px solid var(--c-primary);
  background: var(--c-white); color: var(--c-primary);
  font: inherit; font-weight: 700; font-size: var(--f-base);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--c-primary-bg); }
.btn.primary { background: var(--c-primary); color: #fff; }
.btn.primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn.quiet { border-color: transparent; text-decoration: underline; padding: 0 var(--sp-3); }
.btn.danger { border-color: var(--c-error); color: var(--c-error); }
.btn.danger:hover { background: var(--c-error-bg); }
.btn.s { min-height: 44px; padding: 0 var(--sp-4); }
.btn.sq { min-width: 44px; min-height: 44px; padding: 0; font-size: 20px; }
button.linklike {
  background: none; border: 0; padding: 0; font: inherit; color: var(--c-primary);
  text-decoration: underline; cursor: pointer;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 0 var(--sp-3);
  border-radius: 999px; border: 1px solid currentColor;
  font-weight: 700; font-size: var(--f-small); white-space: nowrap;
}
.chip.wait { color: var(--c-warn); background: var(--c-warn-bg); }
.chip.ok { color: var(--c-success); background: var(--c-success-bg); }
.chip.info { color: var(--c-primary); background: var(--c-primary-bg); }
.chip.ng { color: var(--c-error); background: var(--c-error-bg); }

.field { display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; }
.field label, .field .label { font-weight: 700; }
.field .hint { font-size: var(--f-small); color: var(--c-sub); }
.input, select.input {
  min-height: var(--tap); width: 100%;
  padding: 0 var(--sp-3);
  border: 1px solid var(--c-border); border-radius: var(--radius);
  background: var(--c-white); color: var(--c-text);
  font: inherit; font-size: var(--f-base);
}
.input[readonly] { background: var(--c-bg); border-color: var(--c-line); }
.input.right { text-align: right; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: middle; }
.tbl thead th { background: var(--c-bg); font-size: var(--f-small); border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.tbl .r { text-align: right; }
.tbl .c { text-align: center; }

/* ---------- 並走型マニュアル（画面の中の案内） ---------- */
.guide {
  background: var(--c-white);
  border: 2px solid var(--c-primary);
  border-radius: var(--radius-l);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-4); align-items: center;
}
.guide .tag {
  background: var(--c-primary); color: #fff; font-weight: 700;
  border-radius: var(--radius); padding: var(--sp-1) var(--sp-3); white-space: nowrap;
}
.guide .now { font-size: var(--f-large); font-weight: 700; }
.guide ol { list-style: none; display: flex; gap: var(--sp-2); margin: var(--sp-2) 0 0; padding: 0; flex-wrap: wrap; }
.guide ol li {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--f-small); color: var(--c-sub);
  padding: 2px var(--sp-3) 2px 2px; border-radius: 999px; border: 1px solid var(--c-line);
}
.guide ol li .n {
  width: 24px; height: 24px; border-radius: 50%; background: var(--c-bg);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.guide ol li.done { color: var(--c-success); border-color: var(--c-success); }
.guide ol li.done .n { background: var(--c-success); color: #fff; }
.guide ol li.cur { color: var(--c-primary); border-color: var(--c-primary); background: var(--c-primary-bg); font-weight: 700; }
.guide ol li.cur .n { background: var(--c-primary); color: #fff; }
/* 案内が指している場所 */
.guide-target { outline: 3px dashed var(--c-primary); outline-offset: 3px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #1a1a1a; color: #fff; padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius); font-weight: 700; z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast[hidden] { display: none; }

/* ==========================================================
   ここから下は、2026年12月3日の拡張で足したもの（設計図 6.11）。
   既存の画面の <style> にあったものは、値を変えずに移した。
   ========================================================== */

/* 隠す（punch.html から） */
[hidden] { display: none !important; }

/* ---------- 骨組みの見出し帯の右側とデモの入口（新規） ---------- */
.hdr .hdr-end, .p-hdr .hdr-end { display: flex; align-items: center; gap: var(--sp-3); position: relative; }
.demo-entry { position: relative; }

/* 携帯の見出し帯（punch.html から） */
.p-hdr { background: var(--c-primary); color: #fff; padding: var(--sp-3) var(--sp-4); display: flex; justify-content: space-between; align-items: center; }
.p-hdr strong { font-size: 18px; }

/* デモの入口のメニュー（新規。見出し帯の右端の下に重ねて出す） */
.demomenu {
  position: absolute; right: 0; top: calc(100% + var(--sp-2)); z-index: 40;
  width: 320px; max-width: calc(100vw - 32px);
  background: var(--c-white); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: var(--radius-l);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3);
  font-weight: 400; text-align: left;
}
.demomenu .btn { white-space: normal; text-align: center; }
.demomenu .group { border-top: 1px solid var(--c-line); padding-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); }
.demomenu .label { font-weight: 700; }
.demomenu .row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

/* オートモードが、これから押す場所に付ける印（新規） */
.demo-focus { outline: 4px solid var(--c-focus); outline-offset: 0; box-shadow: 0 0 0 6px var(--c-text); }
@media (prefers-reduced-motion: no-preference) {
  .demo-focus { animation: fd-demo-blink 1.2s ease-in-out infinite; }
}
@keyframes fd-demo-blink { 50% { outline-color: transparent; } }

/* ---------- 携帯の案内（punch.html の .p-guide から） ---------- */
.guide.phone { display: block; margin-bottom: 0; padding: var(--sp-3) var(--sp-4); }
.guide.phone .tag { display: inline-block; padding: 2px var(--sp-3); font-size: var(--f-small); margin-bottom: var(--sp-1); }
.guide.phone .now { font-size: 18px; font-weight: 700; line-height: 1.5; }

/* ---------- 見出しと操作を横に並べる行（schedule.html から） ---------- */
.toolbar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.toolbar h1 { margin-right: var(--sp-2); }
.toolbar .date { font-size: 20px; font-weight: 700; min-width: 11em; text-align: center; }
.toolbar .right { margin-left: auto; display: flex; gap: var(--sp-3); }

/* つながった押しボタン（schedule.html から） */
.seg { display: inline-flex; border: 2px solid var(--c-primary); border-radius: var(--radius); overflow: hidden; }
.seg button { min-height: 44px; padding: 0 var(--sp-4); border: 0; background: #fff; color: var(--c-primary); font: inherit; font-weight: 700; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--c-primary); }
.seg button[aria-pressed="true"] { background: var(--c-primary); color: #fff; }

/* 種類でしぼる丸い押しボタン（estimate.html から） */
.cats { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0; }
.cats button {
  min-height: 44px; padding: 0 var(--sp-3); border-radius: 999px;
  border: 1px solid var(--c-border); background: #fff; font: inherit; cursor: pointer;
}
.cats button[aria-pressed="true"] { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 700; }

/* 引き出し（schedule.html から） */
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: 380px; max-width: 100vw; z-index: 20;
  background: #fff; border-left: 1px solid var(--c-border); box-shadow: -8px 0 24px rgba(0,0,0,.16);
  padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); overflow: auto;
}
.drawer[hidden] { display: none; }
.drawer dl { margin: 0; display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: var(--sp-2) var(--sp-3); }
.drawer dt { color: var(--c-sub); }
.drawer dd { margin: 0; font-weight: 700; }
.drawer .foot { margin-top: auto; display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* 赤い枠の注意の文（schedule.html から） */
.warn { background: var(--c-error-bg); border: 1px solid var(--c-error); color: var(--c-error); border-radius: var(--radius); padding: var(--sp-2) var(--sp-3); font-weight: 700; }

/* 中身が無いときの、点線の枠の文（estimate.html から） */
.empty { padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--c-sub); border: 2px dashed var(--c-line); border-radius: var(--radius); }

/* 画面の下に張り付く操作の帯（estimate.html から） */
.actionbar {
  position: sticky; bottom: 0; margin: var(--sp-4) calc(var(--sp-5) * -1) 0;
  background: #fff; border-top: 1px solid var(--c-border);
  padding: var(--sp-3) var(--sp-5); display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap;
}
.actionbar .sp { margin-left: auto; }

/* 足した行、変わった行を光らせる（estimate.html から） */
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #fff3b0; } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

/* 表の下の、件数と合計の行（schedule.html から） */
.summary { margin-top: var(--sp-3); display: flex; gap: var(--sp-4); flex-wrap: wrap; align-items: center; }
.summary .btn { margin-left: auto; }

/* 工程表の帯の色（schedule.html から） */
.j1 { background: #dfe0f7; border-color: #1e1e90; color: #14145f; }
.j2 { background: #dcefe4; border-color: #197a4b; color: #0f4a2d; }
.j3 { background: #fde6cc; border-color: #a85a00; color: #5c3200; }
.j4 { background: #f9dfe4; border-color: #a8263c; color: #6b1425; }
.j5 { background: #e6e6e6; border-color: #4d4d4d; color: #1a1a1a; }

/* ---------- 新規の部品 ---------- */
/* 入力欄の下の、赤い文字の理由 */
.field .error { color: var(--c-error); font-size: var(--f-small); font-weight: 700; }
/* 行の下に出す、確かめの文とボタンの並び */
.confirm {
  background: var(--c-error-bg); border: 1px solid var(--c-error); border-radius: var(--radius);
  padding: var(--sp-3); display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center;
}
.confirm p { flex: 1 1 100%; font-weight: 700; }
/* 売上の横棒（i の幅を百分率で指定する） */
.barcell { display: block; min-width: 120px; height: 16px; }
.barcell i { display: block; height: 16px; background: var(--c-primary); border-radius: 2px; }

/* html.embedded：デモの画面の枠の中で開かれたときに付く。ここでは見た目を指定しない */

/* ---------- 印刷のときの共通の指定（新規） ---------- */
@media print {
  .hdr, .side, .guide, .actionbar, .toast, .drawer, .demomenu { display: none !important; }
  body, body.app { background: var(--c-white); }
  /* 画面の高さに合わせた格子と、main のスクロールをやめ、紙に全部が出るようにする */
  body.app { display: block; height: auto; }
  main.main { overflow: visible; }
}
