/* ============================================================
   株式会社 デモシステム - 業務システム スタイルシート
   元デザイン：白/薄グレー背景 + 鮮やかな青いソリッドボタン
   サブページ：仕入明細一覧スタイル統一
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Noto Sans JP', 'Meiryo', 'Yu Gothic', sans-serif;
  background: #f0f4f8;
  color: #1a2a3a;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ============================================================
   ログイン画面
============================================================ */
.login-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0d1b3e 0%, #1a3a5c 50%, #0d1b3e 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.login-box {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  padding: 44px 40px;
  width: 400px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { color: #fff; font-size: 20px; font-weight: 700; margin-bottom: 6px; letter-spacing: .06em; }
.login-logo p  { color: rgba(255,255,255,.6); font-size: 13px; letter-spacing: .1em; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; color: rgba(255,255,255,.75); font-size: 12px; margin-bottom: 7px; }
.form-group label i { margin-right: 5px; color: #5db8d8; }
.form-group input {
  width: 100%; padding: 11px 14px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22);
  border-radius: 7px; color: #fff; font-size: 14px; font-family: inherit;
  outline: none; transition: border-color .2s, background .2s;
}
.form-group input:focus { border-color: #5db8d8; background: rgba(93,184,216,.1); }
.form-group input::placeholder { color: rgba(255,255,255,.35); }
.login-btn {
  width: 100%; padding: 12px; margin-top: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 7px; color: #fff;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: all .2s; letter-spacing: .05em;
}
.login-btn:hover { background: rgba(255,255,255,.25); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.3); }

/* ============================================================
   メインシステム（ティール背景）
============================================================ */
.main-system {
  display: flex; flex-direction: column; min-height: 100vh;
  background: #f0f4f8;
  position: relative;
}

/* ---- タイトルバー（最上部細バー） ---- */
.sys-titlebar {
  background: linear-gradient(90deg, #1b203a, #252d4a);
  height: 36px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sys-titlebar-left  { display: flex; align-items: center; gap: 8px; }
.sys-titlebar-right { display: flex; align-items: center; gap: 8px; }

.tb-btn {
  background: transparent; border: none;
  color: rgba(255,255,255,.7); font-size: 12px; font-family: inherit;
  padding: 3px 8px; cursor: pointer; transition: color .15s;
  display: flex; align-items: center; gap: 4px;
}
.tb-btn:hover { color: #fff; }
.tb-btn i { font-size: 10px; }

/* ナビボタン（タイトルバー内） */
.snav-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 4px;
  color: rgba(255,255,255,.85);
  font-size: 12px; font-weight: 600; font-family: inherit;
  padding: 3px 14px; height: 26px;
  cursor: pointer; transition: all .15s;
  display: flex; align-items: center; gap: 5px;
}
.snav-btn:hover  { background: rgba(255,255,255,.2); color: #fff; }
.snav-btn.active {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.5);
  color: #fff;
}
.snav-logout {
  background: rgba(255,100,80,.15) !important;
  border-color: rgba(255,120,100,.35) !important;
  color: rgba(255,180,160,.9) !important;
}
.snav-logout:hover { background: rgba(255,100,80,.28) !important; }

/* ログイン状態 */
.sys-login-status {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.65); font-size: 11px;
  margin-left: 10px; padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,.2);
}
.sys-login-user { color: #b2ebf2; font-weight: 600; font-size: 12px; }
.sys-icon { color: rgba(255,255,255,.6); font-size: 14px; }

/* ---- 警告バナー ---- */
.sys-alert {
  background: rgba(243,156,18,.85);
  color: #fff; padding: 6px 20px;
  display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 500;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.sys-alert button {
  margin-left: auto; background: transparent; border: none;
  color: rgba(255,255,255,.8); cursor: pointer; font-size: 13px;
  padding: 2px 6px;
}
.sys-alert button:hover { color: #fff; }

/* ---- 時計（右下固定） ---- */
.sys-clock-wrap {
  position: fixed; bottom: 12px; right: 16px;
  z-index: 10;
}
.sys-clock {
  color: #555; font-size: 13px;
  font-variant-numeric: tabular-nums; font-weight: 500;
  letter-spacing: .06em;
}

/* ============================================================
   メインコンテンツ
============================================================ */
.sys-main { flex: 1; padding: 14px 20px 40px; }

/* セクション見出し */
.menu-section-title {
  color: #1a3a5c;
  font-size: 15px; font-weight: 700; letter-spacing: .08em;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 8px;
}
.menu-section-deco {
  display: inline-block;
  width: 4px; height: 16px;
  background: #0074c4;
  border-radius: 2px;
}

/* ---- グリッドレイアウト ---- */
.menu-grid {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* 各列 */
.menu-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 160px;
  flex: 1;
}

/* ============================================================
   メニューボタン（青いソリッドボタン）
============================================================ */
.mbtn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #0074c4;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  text-align: left;
  min-height: 46px;
  width: 100%;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,116,196,.25);
}
.mbtn:hover {
  background: #005fa3;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,116,196,.4);
}
.mbtn:active { transform: scale(.97); }

/* アクティブ（仕入ハイライト） */
.mbtn-active {
  background: #005fa3;
  box-shadow: 0 2px 8px rgba(0,95,163,.4);
}

/* 出勤退勤ボタン */
.mbtn-kintai {
  background: #0c4a7e;
}
.mbtn-kintai:hover {
  background: #0a3d6b;
}

/* お知らせ・一斉配信ボタン */
.mbtn-notice {
  background: #2e8b57;
  box-shadow: 0 2px 6px rgba(46,139,87,.3);
}
.mbtn-notice:hover {
  background: #246945;
  box-shadow: 0 4px 14px rgba(46,139,87,.45);
}

/* 報告書提出ボタン */
.mbtn-report {
  background: #7b3fa0;
  box-shadow: 0 2px 6px rgba(123,63,160,.3);
}
.mbtn-report:hover {
  background: #63328a;
  box-shadow: 0 4px 14px rgba(123,63,160,.45);
}

/* ボタン内アイコン */
.mbtn-icon {
  font-size: 18px;
  color: #fff;
  width: 22px; text-align: center;
  flex-shrink: 0;
}

/* ボタン内ラベル */
.mbtn-label {
  display: flex; flex-direction: column; line-height: 1.3;
}

/* サブテキスト */
.mbtn-sub {
  font-size: 10px; font-weight: 400;
  color: rgba(255,255,255,.85);
  margin-top: 1px;
}

/* タブレットバッジ */
.mbtn-sub-badge {
  display: inline-block;
  background: rgba(255,255,255,.25);
  border-radius: 3px;
  font-size: 9px; font-weight: 700;
  padding: 1px 5px; margin-left: 5px;
  vertical-align: middle;
}

/* ============================================================
   サブページ（仕入明細スタイル）
============================================================ */
.sub-overlay {
  position: fixed; inset: 0;
  background: #f0f4f8;
  z-index: 500; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sub-page { display: flex; flex-direction: column; min-height: 100%; }

/* ---- サブタイトルバー ---- */
.sub-titlebar {
  background: linear-gradient(90deg, #1a2744, #2c3e60);
  height: 34px; padding: 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.sub-titlebar-left { display: flex; align-items: center; gap: 12px; }
.sys-name { color: #7fc8e8; font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.sub-breadcrumb { color: rgba(255,255,255,.6); font-size: 11px; }

/* ---- サブヘッダー ---- */
.sub-header {
  background: #fff; border-bottom: 2px solid #d0dde8;
  padding: 0 20px; display: flex; align-items: center;
  min-height: 54px; gap: 16px; flex-shrink: 0;
}
.sub-header-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.sub-title { font-size: 22px; font-weight: 700; color: #1a3a6c; white-space: nowrap; }
.sub-breadcrumb-nav {
  font-size: 13px; color: #4a6080;
  display: flex; align-items: center; gap: 6px;
}
.sub-breadcrumb-nav a { color: #2980b9; text-decoration: none; cursor: pointer; }
.sub-breadcrumb-nav a:hover { text-decoration: underline; }
.sub-header-right { display: flex; align-items: center; gap: 6px; }

/* ヘッダーボタン */
.shbtn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 18px; height: 38px;
  border: none; border-radius: 6px;
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: filter .15s, transform .1s;
  letter-spacing: .03em; color: #fff;
}
.shbtn:active { transform: scale(.96); }
.shbtn:hover  { filter: brightness(1.1); }
.shbtn-blue  { background: #2471a3; }
.shbtn-red   { background: #e74c3c; }
.shbtn-dblue { background: #1a5f7a; }
.shbtn-gray  { background: #5d7a96; }

/* ---- ページネーション ---- */
.sub-pager {
  background: #f5f8fb; border-bottom: 1px solid #d8e6f0;
  padding: 6px 18px;
  display: flex; align-items: center; justify-content: flex-end; gap: 4px;
}
.pgbtn {
  background: #fff; border: 1px solid #c4d4e0; border-radius: 4px;
  width: 28px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px; color: #3a5a7a; transition: background .12s;
}
.pgbtn:hover { background: #d6eaf8; }
.pg-current {
  background: #1a5f7a; color: #fff;
  border-radius: 4px; width: 28px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

/* ---- ツールバー ---- */
.sub-toolbar {
  background: #fff; border-bottom: 1px solid #e0eaf2;
  padding: 8px 18px; display: flex; align-items: center; gap: 8px;
}
.stb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 14px; border: 1px solid #b8ccd8; border-radius: 5px;
  background: #fff; font-size: 13px; font-family: inherit;
  cursor: pointer; color: #2c4a6a; font-weight: 500;
  transition: background .12s, border-color .12s;
}
.stb-btn:hover { background: #eaf4fb; border-color: #5db8d8; }
.stb-btn i { color: #2980b9; }
.sub-result-count { margin-left: auto; font-size: 12px; color: #5a7a9a; font-weight: 500; }

/* ---- サブ本体 ---- */
.sub-body { flex: 1; padding: 14px 18px 0; overflow-x: auto; min-height: 200px; }

/* ---- サブデータテーブル ---- */
.sub-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #c8dcea;
}
.sub-data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px; white-space: nowrap; background: #fff;
}
.sub-data-table thead tr {
  background: linear-gradient(180deg, #2c5f8a, #1e4f78);
}
.sub-data-table thead th {
  color: #fff; padding: 9px 12px; text-align: center;
  font-weight: 600; font-size: 12px;
  border-right: 1px solid rgba(255,255,255,.18); cursor: pointer;
  position: sticky; top: 0; z-index: 2;
}
.sub-data-table thead .th-fix { width: 50px; }
.sub-data-table thead th:last-child { border-right: none; }
.sub-data-table thead th:hover { background: rgba(255,255,255,.1); }
.sub-data-table tbody tr { border-bottom: 1px solid #e4eef5; transition: background .1s; }
.sub-data-table tbody tr:hover { background: #eaf5fb !important; }
.sub-data-table tbody tr:nth-child(even) { background: #f6fafd; }
.sub-data-table tbody td {
  padding: 8px 10px; border-right: 1px solid #e8f0f6;
  color: #2c3e60; vertical-align: middle;
}
.sub-data-table tbody td:last-child { border-right: none; }
.td-c { text-align: center; }
.td-r { text-align: right; }

/* 修正ボタン */
.btn-fix {
  background: #e67e22; color: #fff; border: none;
  border-radius: 4px; padding: 3px 10px;
  font-size: 12px; font-weight: 700; font-family: inherit; cursor: pointer;
}
.btn-fix:hover { background: #d35400; }

/* 伝票区分バッジ */
.badge-buy {
  display: inline-block; border: 2px solid #e67e22; color: #e67e22;
  border-radius: 4px; padding: 1px 6px; font-size: 12px; font-weight: 700;
}

/* 状態ランプ */
.status-lamp {
  display: inline-block; width: 28px; height: 16px;
  background: #7ec850; border-radius: 4px; border: 1px solid #5aaa30;
}

/* 仕入先セル */
.supplier-cell { display: flex; align-items: center; gap: 5px; }
.supplier-cd { color: #4a7aaa; font-size: 12px; min-width: 28px; }
.supplier-search { color: #2980b9; font-size: 12px; cursor: pointer; }
.supplier-search:hover { color: #1a5f7a; }

/* ---- サマリーカード ---- */
.sum-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
  gap: 10px; margin-bottom: 14px;
}
.sum-card {
  background: #fff; border-radius: 7px; padding: 14px;
  text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.05);
  border-top: 3px solid #2471a3;
}
.sum-card.green  { border-top-color: #27ae60; }
.sum-card.orange { border-top-color: #e67e22; }
.sum-card.red    { border-top-color: #e74c3c; }
.sum-card.teal   { border-top-color: #1abc9c; }
.sum-val   { font-size: 22px; font-weight: 700; color: #1a3a5c; margin-bottom: 3px; }
.sum-label { font-size: 11px; color: #7a8fa0; font-weight: 500; }

/* ---- バッジ ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.badge-green  { background: #d4efdf; color: #1e8449; }
.badge-blue   { background: #d6eaf8; color: #1a6fa0; }
.badge-orange { background: #fdebd0; color: #b7770d; }
.badge-red    { background: #fce4e4; color: #c0392b; }
.badge-gray   { background: #eaecee; color: #5d6d7e; }

/* ---- 合計バー ---- */
.sub-total-bar {
  padding: 12px 18px; display: flex; justify-content: center; background: #f5f8fb;
  border-top: 1px solid #dde8f0;
}
.sub-total-btn {
  background: linear-gradient(90deg, #b8d4e8, #c8e0f0);
  border: 1px solid #90b8d8; border-radius: 6px;
  padding: 8px 56px; font-size: 14px; font-weight: 700;
  color: #1a3a5c; font-family: inherit; cursor: pointer;
  transition: background .15s, box-shadow .15s; letter-spacing: .1em;
}
.sub-total-btn:hover { background: linear-gradient(90deg, #a0c4dc, #b8d8ec); box-shadow: 0 3px 10px rgba(0,0,0,.1); }
.sub-total-panel {
  background: #fff; border: 1px solid #c8dcea;
  border-radius: 8px; padding: 14px 18px; margin: 0 18px 12px;
}
.sub-total-panel h4 { font-size: 13px; color: #1a5f7a; font-weight: 700; margin-bottom: 10px; border-bottom: 1px solid #d0e6f0; padding-bottom: 5px; }
.total-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 10px; }
.total-card { background: #f0f8fc; border-radius: 6px; padding: 10px 12px; text-align: center; border: 1px solid #c8e0f0; }
.total-card .tc-val { font-size: 18px; font-weight: 700; color: #1a3a5c; }
.total-card .tc-lbl { font-size: 11px; color: #6a8aaa; margin-top: 2px; }

/* ---- 戻るバー ---- */
.sub-back-bar { padding: 12px 18px 20px; background: #f5f8fb; border-top: 1px solid #dde8f0; }
.sub-back-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 22px; background: #1a5f7a; color: #fff;
  border: none; border-radius: 7px; font-size: 13px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: filter .15s;
}
.sub-back-btn:hover { filter: brightness(1.1); }

/* ---- Toast ---- */
#toast-wrap {
  position: fixed; top: 14px; right: 14px; z-index: 99999;
  display: flex; flex-direction: column; gap: 7px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   レスポンシブ
============================================================ */
@media (max-width: 1024px) {
  .menu-grid { flex-wrap: wrap; }
  .menu-col  { min-width: 150px; flex: 0 0 calc(33% - 12px); }
}
@media (max-width: 768px) {
  .menu-col { flex: 0 0 calc(50% - 8px); }
  .sys-login-status { display: none; }
  .mbtn { min-height: 52px; }
}
@media (max-width: 480px) {
  .menu-col { flex: 0 0 100%; }
  .login-box { width: 92vw; padding: 32px 20px; }
  .sub-header { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .sub-header-right { flex-wrap: wrap; }
}
