/* ============ 共通スタイル（フラット・絵文字不使用・SVGアイコン） ============ */
:root {
  --ink: #1a1a1a;
  --sub: #666;
  --line: #ddd;
  --bg: #f4f4f2;
  --card: #fff;
  --brand: #1a1a1a;   /* アクセント色。案件に合わせて変更 */
  --danger: #b3261e;
  --ok: #1e6b34;
  --radius: 0px;      /* 角丸。案件に合わせて変更 */
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; color: var(--ink); background: var(--bg); font-size: 14.5px; line-height: 1.7; }
a { color: inherit; }
code { background: #eee; padding: 1px 5px; }

/* ---- レイアウト（左サイドバー方式・WP管理画面風が標準） ---- */
:root { --side-bg: #23282d; --side-ink: #c9ccd1; --side-w: 210px; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-w); flex-shrink: 0; background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; text-decoration: none; font-size: 14px; color: #fff; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.tile { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: var(--brand); border-radius: var(--radius); flex-shrink: 0; }
.snav { flex: 1; padding: 8px 0; }
.snav a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--side-ink); text-decoration: none; font-size: 13.5px; border-left: 3px solid transparent; }
.snav a svg { flex-shrink: 0; opacity: .75; }
.snav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.snav a.on { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--brand); font-weight: 600; }
.snav a.on svg { opacity: 1; color: var(--brand); }
.snav-sep { padding: 12px 16px 4px; font-size: 11px; color: #7d838a; letter-spacing: .08em; }
.sidebar-user { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12.5px; }
.sidebar-username { display: block; color: #fff; font-weight: 600; margin-bottom: 8px; }
.sidebar-user .btn { background: transparent; border-color: #555c63; color: var(--side-ink); }
.sidebar-user .btn:hover { border-color: #fff; color: #fff; }
.sidebar-overlay { display: none; }
.content { flex: 1; min-width: 0; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 22px 22px 60px; }

/* ---- モバイルバー（SPのみ表示） ---- */
.mobilebar { display: none; position: sticky; top: 0; z-index: 30; background: var(--side-bg); color: #fff; align-items: center; gap: 10px; height: 48px; padding: 0 10px; }
.menubtn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: none; border: none; color: #fff; cursor: pointer; padding: 0; }
.mobilebar-title { font-weight: 700; font-size: 14.5px; }

/* ---- SP: サイドバーはハンバーガーで開閉 ---- */
@media (max-width: 782px) {
  .mobilebar { display: flex; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; height: 100%; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 2px 0 12px rgba(0,0,0,.25); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.show { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); }
  .wrap { padding: 16px 14px 60px; }
}
.pagetitle { font-size: 20px; margin: 6px 0 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .two { grid-template-columns: 1fr; } }
.backlink { color: var(--sub); text-decoration: none; font-size: 13px; }
.empty { color: var(--sub); background: var(--card); border: 1px dashed var(--line); padding: 30px; text-align: center; }
.muted { color: var(--sub); font-size: 13px; }

/* ---- ツールバー・検索 ---- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.searchform { display: flex; gap: 8px; }
.searchform input[type="search"] { width: 240px; }

/* ---- フォーム ---- */
.fld { display: block; margin-bottom: 14px; }
.fld span { display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 4px; font-weight: 600; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; width: 100%; }
.searchform input, .searchform select { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.form { max-width: 640px; }
.formactions { display: flex; gap: 10px; margin-top: 6px; }

/* ---- ボタン ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 16px; border: 1px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; border-radius: var(--radius); }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { opacity: .88; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; font-weight: 500; }
.btn.block { display: flex; width: 100%; }

/* ---- テーブル ---- */
table.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); }
table.list th, table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.list th { font-size: 12.5px; color: var(--sub); background: #fafafa; font-weight: 600; }
table.list tr:hover td { background: #fafafa; }
.num { text-align: right !important; }
.badge { display: inline-block; font-size: 12px; padding: 1px 9px; border: 1px solid var(--line); background: var(--bg); }

/* ---- ページ送り ---- */
.pager { display: flex; gap: 6px; margin-top: 16px; }
.pager a, .pager .cur { padding: 4px 11px; border: 1px solid var(--line); text-decoration: none; background: #fff; }
.pager .cur { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---- アラート・トースト ---- */
.alert { padding: 10px 14px; margin-bottom: 14px; border: 1px solid; font-size: 13.5px; }
.alert.err { color: var(--danger); border-color: var(--danger); background: #fdf3f2; }
.alert.ok { color: var(--ok); border-color: var(--ok); background: #f1f8f3; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 20px; font-size: 13.5px; z-index: 99; }

/* ---- ログイン・セットアップ ---- */
.auth-bg { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.auth-card { width: 360px; background: var(--card); border: 1px solid var(--line); padding: 30px 28px; }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-title { font-weight: 700; font-size: 16px; }
.auth-sub { color: var(--sub); font-size: 12.5px; }

/* ---- SP: コンテンツの汎用対応 ---- */
@media (max-width: 640px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .searchform { flex-wrap: wrap; }
  .searchform input[type="search"] { width: 100%; }
  table.list { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ---- 印刷 ---- */
@media print { .noprint { display: none !important; } body { background: #fff; } .wrap { max-width: none; padding: 0; } }

/* ===== ebg_nohin 追加スタイル ===== */
:root { --brand: #1f4e79; }   /* 納品書業務らしい落ち着いた紺 */

.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.tablewrap { overflow-x: auto; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 782px) { .three, .grid2 { grid-template-columns: 1fr; } }

/* サマリーカード */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
@media (max-width: 782px) { .cards { grid-template-columns: repeat(2, 1fr); } }
.card.stat { padding: 14px 16px; }
.stat-label { font-size: 12px; color: #666; margin-bottom: 4px; }
.stat-num { font-size: 24px; font-weight: 700; color: var(--brand); }
.stat-num .unit { font-size: 12px; font-weight: 400; color: #666; margin-left: 3px; }

/* 状態バッジ */
.badge.st-入金待ち { background: #fff3cd; color: #7a5b00; }
.badge.st-発送待ち { background: #d7e9f7; color: #1f4e79; }
.badge.st-出荷済み { background: #d9efd9; color: #1e6b1e; }
.badge.st-キャンセル { background: #eee; color: #888; }

/* 顧客検索の候補 */
.hits { position: relative; }
.hits .hit { display: block; width: 100%; text-align: left; background: #fff; border: 1px solid #ddd;
  border-top: none; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.hits .hit:hover { background: #eef4fa; }

/* 定義リスト風（顧客詳細） */
.dl { display: flex; gap: 10px; padding: 4px 0; border-bottom: 1px dashed #eee; font-size: 13px; }
.dl .dt { flex: 0 0 130px; color: #777; }
.dl .dd { flex: 1; }

/* 受注入力の明細表 */
table.items input.qty { width: 76px; text-align: right; }
table.items tfoot th { font-size: 14px; }

ul.notes { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.9; }
h2.sec { font-size: 14px; margin: 14px 0 8px; padding-left: 8px; border-left: 3px solid var(--brand); }

/* ===== PCメイン運用向け調整（横幅を広く・変な改行をしない） ===== */
.wrap { max-width: none; padding: 22px 30px 60px; }
.form { max-width: 1100px; }

/* 表: 見出し・日付・金額・状態は折り返さない */
table.list th { white-space: nowrap; }
table.list td { white-space: nowrap; }
table.list td.wrapok { white-space: normal; }
.badge { white-space: nowrap; }

/* 受注入力の明細は商品名だけ折返し許可（長い商品名対策） */
table.items td:first-child { white-space: normal; }

/* SP時は従来どおり横スクロールで逃がす */
@media (max-width: 782px) { .wrap { padding: 16px 14px 60px; } }
table.items input.adj { width: 76px; text-align: right; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: #eef4fa; }

/* ユーザー設定ページ: カード幅を統一し、表のセル重なりを防ぐ */
.card.wide { max-width: none; }
table.users-table td { white-space: normal; }
table.users-table td label { white-space: nowrap; }
table.users-table input, table.users-table select { box-sizing: border-box; }
input[type="checkbox"], input[type="radio"] { width: auto; padding: 0; }
.badge.stale-orange { background: #ffe1bd; color: #8a4b00; }
.badge.stale-red { background: #ffd2d2; color: #a01212; }
.prefgrid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
@media (max-width: 1200px) { .prefgrid { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 782px) { .prefgrid { grid-template-columns: repeat(2, 1fr); } }
.prefitem { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.prefitem span { flex: 0 0 60px; }
.ctr, table.list td.ctr, table.list th.ctr { text-align: center; }
.region-block { margin-bottom: 14px; }
.region-title { font-size: 12px; font-weight: 700; color: var(--brand); border-bottom: 1px solid #e3e7ec; padding-bottom: 4px; margin-bottom: 8px; }
/* 在庫表: 商品名ヘッダーは括弧で改行し、横スクロールを抑える */
table.list th.stockhead { white-space: normal; font-size: 12px; line-height: 1.4; vertical-align: bottom; }
/* 在庫入力: 見出し・入力欄・数値をすべて列の中央に揃える */
input.stockinput { width: 84px; text-align: center; display: inline-block; margin: 0 auto; }
table.list th.stockhead { text-align: center; }
.incoming-row { display: grid; grid-template-columns: 170px 1fr 130px 1fr 150px; gap: 12px; align-items: end; }
@media (max-width: 900px) { .incoming-row { grid-template-columns: 1fr 1fr; } }
/* 一覧のソート可能ヘッダー */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #f2f5f8; }
th.sort-asc::after { content: " ▲"; font-size: 10px; color: var(--brand); }
th.sort-desc::after { content: " ▼"; font-size: 10px; color: var(--brand); }

/* フォームの高さ・余白の統一（date/select/textの高さ差と詰まり解消） */
.fld input:not([type="checkbox"]):not([type="radio"]), .fld select { height: 42px; box-sizing: border-box; }
.form h2.sec { margin-top: 22px; }
.form .three { align-items: end; }
.form .two, .form .three { margin-top: 18px; }
.form .tablewrap { margin-bottom: 6px; }
