/* ==========================================================
   ycars 中古車両販売管理システム 共通スタイル（手書き／前処理器なし）
   Mockup（used-car-sales-mockup-v2_3.html）のデザイントークン・
   暗色サイドバー＋トップバー構成・コンポーネント様式に忠実に準拠。
   一覧テーブルは編程規範 §七（tbody→thead→tfoot／全td）に合わせ
   .t_list thead td を Mockup の th 相当として定義する。
   ========================================================== */

:root{
	--page-bg:#f5f6f8; --surface:#ffffff;
	--ink:#1c1e21; --ink-2:#5b6068; --ink-3:#9096a0;
	--line:#e4e6ea; --line-soft:#eef0f3;
	--accent:#1e4fa3; --accent-soft:#e9f0fb;
	--sidebar:#1b2434;
	--ok:#188a4b;   --ok-soft:#e4f5ec;
	--warn:#b07208; --warn-soft:#fdf3df;
	--info:#1e4fa3; --info-soft:#e9f0fb;
	--gray-soft:#eef0f3;
	--danger:#c0392b; --danger-soft:#fbebe9;
	--radius:10px;
	--shadow:0 1px 2px rgba(20,20,30,.05), 0 6px 20px rgba(20,20,30,.05);
	--font:'Noto Sans JP','Hiragino Kaku Gothic ProN',sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; margin:0; padding:0; }
body{ font-family:var(--font); font-size:13px; background:var(--page-bg); color:var(--ink); min-height:100vh; }
a{ color:var(--accent); text-decoration:none; }
.num{ font-variant-numeric:tabular-nums; }
.muted{ color:var(--ink-3); font-size:12px; }

/* 土台：画面高にロックし、本文（.content）側でスクロール。
   一覧ページは .t_wrap だけが残り高さに収まり内部スクロール →
   見出し・フィルタは自然に上部固定、thead/pager は sticky で滾動容器の上下端に貼り付く。 */
.app{ display:flex; height:100vh; overflow:hidden; }

/* ===== SIDEBAR（暗色・208px固定） ===== */
.sidebar{ width:208px; flex-shrink:0; background:var(--sidebar); color:#c6ccd8;
	position:fixed; top:0; left:0; bottom:0; display:flex; flex-direction:column; z-index:100; }
.sb-logo{ padding:20px 20px 16px; border-bottom:1px solid #2a3448; color:#fff; font-weight:700; font-size:14px; line-height:1.4; }
.sb-logo small{ display:block; font-weight:400; font-size:10px; color:#8a93a5; letter-spacing:.08em; margin-top:2px; }
.sb-nav{ padding:12px 10px; flex:1; overflow-y:auto; }
.sb-sec{ font-size:10px; letter-spacing:.1em; color:#6d7789; padding:14px 12px 6px; }
.sb-item{ display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px;
	cursor:pointer; font-size:13px; margin-bottom:2px; transition:background .15s; color:#c6ccd8; }
.sb-item:hover{ background:#242f45; color:#fff; text-decoration:none; }
.sb-item.active{ background:#2e3c58; color:#fff; font-weight:500; }
.sb-item .ic{ width:18px; text-align:center; opacity:.9; }
.sb-user{ border-top:1px solid #2a3448; padding:14px 16px; display:flex; align-items:center; gap:10px; cursor:pointer; position:relative; }
.sb-user:hover{ background:#212b40; }
.avatar{ width:32px; height:32px; border-radius:50%; background:#3a4a6b; color:#fff;
	display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; flex-shrink:0; }
.sb-user .nm{ color:#fff; font-size:12px; font-weight:500; }
.sb-user .rl{ font-size:10px; color:#8a93a5; }
.user-menu{ display:none; position:absolute; bottom:64px; left:10px; right:10px;
	background:var(--surface); border:1px solid var(--line); border-radius:10px;
	box-shadow:0 10px 30px rgba(0,0,0,.25); overflow:hidden; z-index:50; }
.user-menu.open{ display:block; }
.user-menu .um-item{ padding:11px 14px; font-size:13px; color:var(--ink); cursor:pointer; display:flex; gap:9px; align-items:center; }
.user-menu .um-item:hover{ background:var(--line-soft); text-decoration:none; }
.user-menu .um-item + .um-item{ border-top:1px solid var(--line-soft); }
.user-menu .um-item.danger{ color:var(--danger); }

/* ===== MAIN ===== */
.main{ margin-left:208px; flex:1; display:flex; flex-direction:column; min-width:0; height:100vh; }
.topbar{ background:var(--surface); border-bottom:1px solid var(--line); padding:0 28px; height:56px; flex:0 0 auto;
	display:flex; align-items:center; justify-content:space-between; z-index:20; }
.crumb{ font-size:13px; color:var(--ink-2); }
.crumb b{ color:var(--ink); font-weight:500; }
.bell{ position:relative; cursor:pointer; font-size:17px; color:var(--ink-2);
	width:36px; height:36px; border-radius:8px; display:flex; align-items:center; justify-content:center; }
.bell:hover{ background:var(--line-soft); text-decoration:none; }
.bell .dot{ position:absolute; top:5px; right:6px; width:15px; height:15px; border-radius:50%;
	background:#d24545; color:#fff; font-size:9px; font-weight:700; display:flex; align-items:center; justify-content:center; }
.content{ padding:24px 28px; max-width:1220px; width:100%;
	flex:1 1 auto; min-height:0; overflow:auto; display:flex; flex-direction:column; }
.content > *{ flex:0 0 auto; }                       /* 見出し・フィルタ等は自然高で固定 */
.content > .t_wrap{ flex:0 1 auto; min-height:0; }   /* 一覧本体だけ残り高さ・内部スクロール */
.page-head{ display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:18px; gap:16px; flex-wrap:wrap; }
.page-title{ font-size:19px; font-weight:700; }
.page-sub{ font-size:12px; color:var(--ink-3); margin-top:3px; }
.page-actions{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }

/* ===== ボタン ===== */
.btn{ display:inline-flex; align-items:center; gap:6px; font-family:inherit; font-size:13px; font-weight:500;
	border-radius:8px; border:1px solid var(--line); background:var(--surface); color:var(--ink);
	padding:8px 16px; cursor:pointer; transition:filter .15s, background .15s; }
.btn:hover{ background:var(--line-soft); text-decoration:none; }
.btn.primary{ background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.primary:hover{ filter:brightness(1.1); background:var(--accent); }
.btn.sm{ padding:5px 11px; font-size:12px; border-radius:7px; }
.btn.ghost-danger{ color:var(--danger); border-color:var(--line); }
.btn.ghost-danger:hover{ background:var(--danger-soft); }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ===== パネル ===== */
.panel{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.panel + .panel{ margin-top:16px; }
.panel-head{ padding:14px 18px; border-bottom:1px solid var(--line-soft); display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.panel-title{ font-size:14px; font-weight:700; }
.panel-body{ padding:18px; }

/* ===== 一覧テーブル（編程規範 §七：tbody→thead→tfoot／全td） ===== */
.t_wrap{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:auto;
	max-height:100%; }   /* 高さは .content の flex で律速。本体のみスクロール */
.t_list{ width:100%; border-collapse:collapse; font-size:13px; }
.t_list td{ padding:11px 12px; border-bottom:1px solid var(--line-soft); vertical-align:middle; text-align:left; }
.t_list thead td{ font-size:11px; font-weight:500; color:var(--ink-3);
	padding:10px 12px; border-bottom:1px solid var(--line); background:#fafbfc; white-space:nowrap; position:sticky; top:0; z-index:2; }
.t_list tbody tr:last-child td{ border-bottom:none; }
.t_list tbody tr.clickable{ cursor:pointer; transition:background .12s; }
.t_list tbody tr.clickable:hover td{ background:#f6f9ff; }
.t_list .t-right{ text-align:right; }
.t_list .center{ text-align:center; }
.t_list thead td.sortable{ cursor:pointer; user-select:none; }
.t_list thead td.sortable:hover{ color:var(--accent); }
.t_list thead td .arw{ font-size:9px; margin-left:3px; color:var(--accent); }

/* ===== 在庫日数の色分け ===== */
.age{ display:inline-block; border-radius:6px; padding:3px 9px; font-size:12px; font-weight:500; }
.age.ok{ color:var(--ink-2); }
.age.warn{ background:var(--warn-soft); color:var(--warn); }
.age.danger{ background:var(--danger-soft); color:var(--danger); }

/* ===== フィルタバー ===== */
.filterbar{ display:flex; gap:10px; align-items:center; flex-wrap:wrap;
	background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
	padding:12px 14px; margin-bottom:16px; box-shadow:var(--shadow); }
.search{ display:flex; align-items:center; gap:8px; border:1px solid var(--line); border-radius:8px;
	background:#fafbfc; padding:7px 12px; min-width:230px; color:var(--ink-3); }
.search input{ border:none; outline:none; background:transparent; font-family:inherit; font-size:13px; width:100%; color:var(--ink); }
select.flt{ font-family:inherit; font-size:12px; padding:7px 10px; border:1px solid var(--line); border-radius:8px; background:#fff; color:var(--ink-2); }
.count-note{ margin-left:auto; font-size:12px; color:var(--ink-3); }
.count-note b{ color:var(--accent); font-size:14px; }

/* ===== ステータスバッジ（在庫/商談中/売却済/輸送中/納車済/キャンセル） ===== */
.st{ display:inline-block; font-size:11px; font-weight:500; border-radius:6px; padding:3px 9px; white-space:nowrap; }
.st.stock{ background:var(--gray-soft); color:var(--ink-2); }
.st.nego{ background:var(--warn-soft); color:var(--warn); }
.st.sold{ background:var(--info-soft); color:var(--info); }
.st.ship{ background:#efe9fb; color:#6b46c1; }
.st.done{ background:var(--ok-soft); color:var(--ok); }
.st.cancel{ background:#f2f2f2; color:#8a8f98; text-decoration:line-through; }

/* ===== 権限バッジ・有効/無効ピル ===== */
.role{ display:inline-block; font-size:11px; font-weight:500; border-radius:6px; padding:3px 9px; }
.role.sys{ background:#fbe9e9; color:#b83232; }
.role.adm{ background:var(--info-soft); color:var(--info); }
.role.stf{ background:var(--gray-soft); color:var(--ink-2); }
.pill{ display:inline-block; font-size:11px; border-radius:6px; padding:3px 9px; }
.pill.on{ background:var(--ok-soft); color:var(--ok); }
.pill.off{ background:var(--gray-soft); color:var(--ink-3); }

/* ===== 詳細ヘッダ・タブ ===== */
.detail-head{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
	box-shadow:var(--shadow); padding:18px 20px; margin-bottom:16px;
	display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.dh-title{ font-size:18px; font-weight:700; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.dh-meta{ display:flex; gap:22px; margin-top:12px; flex-wrap:wrap; }
.dh-meta .kv b{ display:block; font-size:10px; color:var(--ink-3); font-weight:400; margin-bottom:2px; }
.dh-meta .kv span{ font-size:13px; font-weight:500; }
.tabs{ display:flex; gap:2px; border-bottom:1px solid var(--line); margin-bottom:16px; flex-wrap:wrap; }
.tab{ padding:9px 16px; font-size:13px; color:var(--ink-2); cursor:pointer; border-bottom:2px solid transparent; margin-bottom:-1px; text-decoration:none; }
.tab:hover{ color:var(--ink); text-decoration:none; }
.tab.active{ color:var(--accent); border-bottom-color:var(--accent); font-weight:700; }

/* ===== フォーム ===== */
.form-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:14px 18px; }
.fg{ display:flex; flex-direction:column; gap:5px; }
.fg.wide{ grid-column:1 / -1; }
.fg label{ font-size:11px; color:var(--ink-2); font-weight:500; }
.fg label .req{ color:var(--danger); margin-left:3px; }
.fg input, .fg select, .fg textarea{ font-family:inherit; font-size:13px; padding:8px 10px; border:1px solid var(--line);
	border-radius:8px; background:#fff; color:var(--ink); width:100%; }
.fg input:focus, .fg select:focus, .fg textarea:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(30,79,163,.12); }
.fg input[readonly]{ background:#fafbfc; color:var(--ink-2); }
.fg textarea{ resize:vertical; min-height:64px; }
.form-actions{ display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }
.suffix-wrap{ display:flex; align-items:center; gap:6px; }
.suffix-wrap input{ flex:1; }
.suffix-wrap .sfx{ font-size:12px; color:var(--ink-2); white-space:nowrap; }
.field-error{ display:none; font-size:11px; color:var(--danger); background:var(--danger-soft);
	border-radius:6px; padding:6px 9px; margin-top:2px; line-height:1.5; }
.field-error a{ color:var(--danger); font-weight:700; }
.field-error.show{ display:block; }
input.err{ border-color:var(--danger) !important; box-shadow:0 0 0 3px rgba(192,57,43,.1) !important; }
.hint{ background:var(--accent-soft); border:1px solid #cddcf5; color:var(--accent); border-radius:8px; padding:9px 12px; font-size:12px; margin-bottom:14px; }

/* ===== KPI ===== */
.kpis{ display:grid; grid-template-columns:repeat(auto-fit,minmax(155px,1fr)); gap:12px; margin-bottom:16px; }
.kpi{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:14px 16px; box-shadow:var(--shadow); }
.kpi .lb{ font-size:11px; color:var(--ink-3); margin-bottom:6px; }
.kpi .vl{ font-size:18px; font-weight:700; }

/* ===== 通知 ===== */
.notif{ display:flex; gap:12px; padding:14px 18px; border-bottom:1px solid var(--line-soft); background:var(--surface); cursor:pointer; color:var(--ink); }
.notif:hover{ background:#f6f9ff; text-decoration:none; }
.notif.unread{ background:#f4f8ff; }
.notif:last-child{ border-bottom:none; }
.n-ic{ width:34px; height:34px; border-radius:8px; flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:15px; }
.n-ic.b1{ background:var(--warn-soft); } .n-ic.b2{ background:var(--info-soft); }
.n-ic.b3{ background:var(--ok-soft); }  .n-ic.b4{ background:#efe9fb; } .n-ic.b5{ background:var(--danger-soft); }
.n-tt{ font-size:13px; font-weight:500; }
.n-tt .undot{ display:inline-block; width:7px; height:7px; border-radius:50%; background:var(--accent); margin-left:6px; vertical-align:middle; }
.n-tx{ font-size:12px; color:var(--ink-2); margin-top:2px; }
.n-tm{ margin-left:auto; font-size:11px; color:var(--ink-3); white-space:nowrap; }

/* ===== 件数表示＋ページャ（全一覧共通：pager_bar / tfoot 内 pager_cell） ===== */
.pager_bar{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin:14px 2px; flex-wrap:wrap; }
.pager_cnt{ font-size:12px; color:var(--ink-3); font-variant-numeric:tabular-nums; }
.pager_left{ display:flex; align-items:center; gap:10px; }
.per_form{ display:flex; align-items:center; gap:6px; }
.per_lbl{ font-size:12px; color:var(--ink-3); white-space:nowrap; }
select.per_sel{ height:28px; box-sizing:border-box; background:var(--surface); border:1px solid var(--line); border-radius:7px;
	padding:0 8px; font-family:inherit; font-size:12px; color:var(--ink-2); outline:none; cursor:pointer; }
.t_list tfoot td.pager_cell{ background:var(--surface); border-top:1px solid var(--line); border-bottom:none; padding:10px 14px;
	position:sticky; bottom:0; z-index:3; }
.t_list tfoot tr:hover td.pager_cell{ background:var(--surface); }
.pager_cell .pager_bar{ margin:0; }
.pager{ display:flex; gap:4px; justify-content:flex-end; margin:0; flex-wrap:wrap; }
.pager a,.pager span{ display:inline-flex; align-items:center; justify-content:center;
	min-width:28px; padding:4px 10px; border:1px solid var(--line); border-radius:7px;
	background:var(--surface); font-size:12px; color:var(--ink-2); text-decoration:none; }
.pager a:hover{ background:var(--line-soft); }
.pager .cur{ background:var(--accent); color:#fff; border-color:var(--accent); }
.pager .gap{ border:none; background:none; min-width:auto; padding:4px 2px; }

/* ===== モーダル（temp1.inc / 各画面内モーダル） ===== */
.modal_overlay{ position:fixed; inset:0; background:rgba(20,24,32,.45); display:none; z-index:200; }
.modal_overlay.show{ display:block; }
.pop_frame{ position:fixed; top:50%; left:50%; transform:translate(-50%,-50%);
	width:min(680px,92vw); max-height:88vh; overflow:auto; background:var(--surface); border-radius:14px;
	box-shadow:0 20px 60px rgba(0,0,0,.25); z-index:201; display:none; }
.pop_frame.show{ display:block; }
.pop_header{ display:flex; align-items:flex-start; justify-content:space-between; padding:16px 22px 12px; border-bottom:1px solid var(--line-soft); }
.pop_header h3{ margin:0; font-size:15px; font-weight:700; }
.pop_header .sub{ color:var(--ink-3); font-size:12px; }
.modal_close{ cursor:pointer; font-size:16px; color:var(--ink-3); line-height:1; padding:2px 6px; }
.pop_in{ padding:20px 22px; }
.popbottom{ padding:14px 22px; border-top:1px solid var(--line-soft); display:flex; gap:10px; justify-content:flex-end; }

/* ===== トースト ===== */
.toast{ position:fixed; bottom:24px; right:24px; z-index:999; background:#20293a; color:#fff;
	font-size:13px; border-radius:10px; padding:12px 18px; box-shadow:0 10px 30px rgba(0,0,0,.3);
	opacity:0; transform:translateY(8px); transition:all .25s; pointer-events:none; max-width:380px; }
.toast.show{ opacity:1; transform:translateY(0); }

/* ===== ログイン等の素枠 ===== */
.bare_wrap{ min-height:100vh; display:flex; align-items:center; justify-content:center;
	background:linear-gradient(150deg,#f5f6f8 0%, #e8edf5 60%, #dfe7f2 100%); padding:24px; }

/* ===== ハンバーガー（狭幅のみ表示） ===== */
.hamburger{ display:none; align-items:center; justify-content:center; width:36px; height:36px; flex-shrink:0;
	border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink-2);
	font-size:16px; cursor:pointer; }
.hamburger:hover{ background:var(--line-soft); }
.sb-overlay{ display:none; position:fixed; inset:0; background:rgba(20,24,32,.45); z-index:299; }
.sb-overlay.show{ display:block; }

/* ===== レスポンシブ（狭幅：サイドバーはハンバーガーで開くドロワーに） ===== */
@media (max-width: 860px){
	.sidebar{ transform:translateX(-100%); transition:transform .2s ease; z-index:300;
		box-shadow:0 0 40px rgba(0,0,0,.35); }
	.sidebar.open{ transform:translateX(0); }
	.main{ margin-left:0; }
	.hamburger{ display:flex; }
}
