* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #f4f5f7;
  color: #1a1d23;
  font-size: 14px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---- ログイン画面 ---- */
.login-gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #16233b 0%, #1c3559 100%);
}
.login-card {
  background: #fff; border-radius: 12px; padding: 40px 44px; text-align: center;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18); min-width: 320px;
}
.login-logo { font-size: 20px; font-weight: 700; color: #1c3559; margin-bottom: 4px; }
.login-desc { color: #6b7280; margin: 0 0 20px; font-size: 13px; }
.login-note { color: #9aa2ad; font-size: 12px; margin-top: 16px; }

/* ---- 全体レイアウト ---- */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 10px 20px;
  background: #1c3559; color: #fff; flex-shrink: 0;
}
.topbar-brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand-mark { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11px; color: #a8bbd6; }
.topnav { display: flex; gap: 4px; flex: 1; }
.nav-btn {
  background: transparent; border: none; color: #cdd8ea; padding: 8px 16px;
  border-radius: 6px; font-size: 13px; font-weight: 500;
}
.nav-btn:hover { background: rgba(255,255,255,0.08); }
.nav-btn.active { background: #fff; color: #1c3559; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #cdd8ea; }

.view { flex: 1; padding: 16px 20px; overflow: auto; }

/* ---- ツールバー ---- */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-filters select, .toolbar-filters input {
  padding: 7px 10px; border: 1px solid #d7dbe2; border-radius: 6px; background: #fff;
}
.toolbar-filters input { width: 240px; }
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.view-toggle { display: flex; border: 1px solid #d7dbe2; border-radius: 6px; overflow: hidden; }
.toggle-btn { border: none; background: #fff; padding: 7px 14px; font-size: 13px; color: #6b7280; }
.toggle-btn.active { background: #1c3559; color: #fff; }

.btn-primary { background: #2f6fed; color: #fff; border: none; border-radius: 6px; padding: 8px 16px; font-size: 13px; font-weight: 500; }
.btn-primary:hover { background: #1f5cd6; }
.btn-secondary { background: #fff; border: 1px solid #d7dbe2; border-radius: 6px; padding: 8px 14px; font-size: 13px; }
.btn-secondary:hover { background: #f4f5f7; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.3); color: #fff; border-radius: 6px; padding: 6px 12px; font-size: 12px; }
.btn-danger { background: #fff; border: 1px solid #e2534a; color: #c0392b; border-radius: 6px; padding: 8px 14px; font-size: 13px; }

/* ---- カンバン ---- */
.kanban { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { flex: 0 0 220px; background: #eceff3; border-radius: 8px; padding: 8px; max-height: calc(100vh - 190px); display: flex; flex-direction: column; }
.kanban-col-head { font-size: 12px; font-weight: 700; color: #4b5563; padding: 6px 8px 8px; display: flex; justify-content: space-between; }
.kanban-col-count { color: #9aa2ad; font-weight: 400; }
.kanban-col-body { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.kanban-card {
  background: #fff; border-radius: 8px; padding: 10px 12px; border-left: 3px solid #2f6fed;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06); flex: 0 0 auto; cursor: pointer;
}
.kanban-card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.12); }
.kc-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.kc-sub { font-size: 11px; color: #6b7280; }
.kc-badges { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-size: 10px; padding: 2px 6px; border-radius: 10px; background: #eef1f5; color: #4b5563; }
.badge.on { background: #dbe9ff; color: #1a56db; }

/* ---- テーブル ---- */
.table-wrap { background: #fff; border-radius: 8px; overflow: auto; border: 1px solid #e2e5ea; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 12px; background: #f4f5f7; color: #6b7280; font-weight: 600; border-bottom: 1px solid #e2e5ea; white-space: nowrap; }
.data-table td { padding: 9px 12px; border-bottom: 1px solid #eef0f3; white-space: nowrap; }
.data-table tr:hover td { background: #f8f9fb; cursor: pointer; }
.stage-pill { font-size: 11px; padding: 3px 8px; border-radius: 10px; background: #eef1f5; color: #4b5563; }

/* ---- モーダル ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,25,35,0.5); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 100;
}
.modal-box { background: #fff; border-radius: 10px; width: 100%; max-width: 640px; padding: 20px 24px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; color: #9aa2ad; }
.modal-section { margin-bottom: 16px; }
.modal-section h4 { font-size: 12px; color: #6b7280; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #4b5563; }
.field-grid input, .field-grid select, .field-grid textarea { padding: 7px 9px; border: 1px solid #d7dbe2; border-radius: 6px; }
.stage-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; border-top: 1px solid #eef0f3; padding-top: 14px; }
.error-msg { color: #c0392b; font-size: 12px; margin-top: 6px; }
.stock-list { max-height: 220px; overflow-y: auto; border: 1px solid #e2e5ea; border-radius: 6px; margin-top: 8px; }
.stock-item { padding: 8px 10px; border-bottom: 1px solid #eef0f3; font-size: 12px; display: flex; justify-content: space-between; cursor: pointer; }
.stock-item:hover { background: #f4f5f7; }
.assigned-vehicle { background: #eef7f1; border: 1px solid #cfe8d9; border-radius: 6px; padding: 8px 10px; font-size: 12px; }

/* ---- 日報 ---- */
.nippo-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.nippo-header input[type=date] { padding: 7px 10px; border: 1px solid #d7dbe2; border-radius: 6px; }
.nippo-summary { display: flex; gap: 10px; flex-wrap: wrap; }
.nippo-summary .stat { background: #fff; border: 1px solid #e2e5ea; border-radius: 6px; padding: 6px 12px; font-size: 12px; }
.nippo-summary .stat b { display: block; font-size: 16px; color: #1c3559; }
.nippo-layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; }
.nippo-form { background: #fff; border: 1px solid #e2e5ea; border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.nippo-form select, .nippo-form textarea { padding: 7px 9px; border: 1px solid #d7dbe2; border-radius: 6px; }
.nippo-list { display: flex; flex-direction: column; gap: 10px; }
.nippo-entry { background: #fff; border: 1px solid #e2e5ea; border-radius: 8px; padding: 12px 14px; }
.nippo-entry-head { display: flex; justify-content: space-between; font-size: 12px; color: #6b7280; margin-bottom: 6px; }
.nippo-entry p { margin: 4px 0; font-size: 13px; white-space: pre-wrap; }
.nippo-entry .taisaku { color: #1a6b4a; }
.empty-hint { color: #9aa2ad; font-size: 13px; padding: 20px; text-align: center; }
