/* 大日程アプリ - B.ダーク・インダストリアル型（社内アプリ_デザインテンプレート.md準拠） */
:root {
  --red: #D0222A;
  --red-d: #A81920;
  --red-l: #F44336;
  --dark: #1A1A1A;
  --dark2: #242424;
  --dark3: #2E2E2E;
  --gray1: #3D3D3D;
  --gray2: #555;
  --gray3: #888;
  --gray4: #BBB;
  --gray5: #E5E5E5;
  --gray6: #F4F4F4;
  --white: #FFFFFF;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
  font-size: 13px;
  color: var(--dark);
  background: var(--gray6);
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* ログイン画面 */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #1a1a1a 0%, #2e2e2e 55%, #1a1a1a 100%);
}
.login-card {
  width: 320px; background: #fff; border-radius: 14px; padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,.4);
  border-top: 4px solid var(--red);
}
.login-card h1 { font-size: 18px; font-weight: 900; letter-spacing: .08em; margin: 0 0 6px; text-align: center; }
.login-card .sub { text-align: center; color: var(--gray3); font-size: 11px; margin-bottom: 22px; letter-spacing: .05em; }
.login-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px; border: 2px solid var(--gray5); border-radius: 8px; font-size: 14px;
}
.login-card input:focus { outline: none; border-color: var(--red); }
.login-card button.submit {
  width: 100%; padding: 11px; background: var(--red); color: #fff; border: none; border-radius: 8px;
  font-weight: 800; font-size: 14px; margin-top: 6px;
}
.login-card button.submit:active { transform: scale(.97); }
.login-error { color: var(--red-d); font-size: 12px; margin: -4px 0 10px; }

/* 全体レイアウト */
#app { display: flex; flex-direction: column; height: 100vh; }
.topnav {
  height: 48px; background: var(--dark); color: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 0 16px; border-bottom: 3px solid var(--red); flex: none;
}
.topnav .brand { font-weight: 900; letter-spacing: .1em; font-size: 14px; text-transform: uppercase; }
.topnav .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topnav button {
  background: var(--dark3); color: #fff; border: 1px solid var(--gray1); border-radius: 4px;
  padding: 5px 10px; font-size: 11px; font-weight: 700;
}
.topnav button:hover { background: var(--gray1); }
.topnav button.primary { background: var(--red); border-color: var(--red-d); }
.topnav .user { font-size: 11.5px; color: var(--gray4); margin-right: 4px; }

/* 未配置カードプール */
.pool-wrap { background: var(--dark2); border-bottom: 3px solid var(--gray1); flex: none; }
.pool-header {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 14px;
  color: var(--gray4); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
}
.pool-header input {
  background: var(--dark3); border: 1px solid var(--gray1); color: #fff; border-radius: 4px; padding: 4px 8px; font-size: 11.5px;
}
.pool-list { display: flex; gap: 8px; padding: 0 14px 10px; overflow-x: auto; min-height: 66px; }
.pool-card {
  flex: none; width: 168px; background: #fff; border-radius: 8px; padding: 8px 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); cursor: grab; border-left: 4px solid var(--gray3);
  transition: box-shadow .15s, transform .15s;
}
.pool-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,.4); transform: translateY(-2px); }
.pool-card:active { cursor: grabbing; }
.pool-card .p-title { font-weight: 800; font-size: 12px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-card .p-sub { font-size: 10.5px; color: var(--gray2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-card .p-due {
  display: inline-block; font-size: 9.5px; color: var(--red-d); font-weight: 800; margin-top: 4px;
  padding: 2px 7px; border-radius: 999px; background: rgba(168,25,32,.1);
}
.pool-card .p-due.overdue { background: var(--red-d); color: #fff; }
.pool-empty { color: var(--gray3); font-size: 12px; padding: 10px 4px; }

/* ガントチャート */
.gantt-scroll { flex: 1; overflow: auto; position: relative; background: var(--gray6); }
.gantt-inner { position: relative; }
.g-timeline { position: sticky; top: 0; z-index: 5; background: var(--dark); display: flex; }
.g-labelcol { position: sticky; left: 0; z-index: 6; width: 130px; flex: none; background: var(--dark); }
.g-tl-months { display: flex; height: 20px; }
.g-tl-days { display: flex; height: 22px; border-top: 1px solid var(--gray1); }
.g-month-cell { color: #fff; font-size: 10.5px; font-weight: 800; padding-left: 4px; border-left: 1px solid var(--gray1); white-space: nowrap; }
/* 半日セル(g-half-cell)：AM側にのみ日付を表示、PM側は境界線のみ薄く（サンテック小日程と同じ表現） */
.g-half-cell { flex: none; text-align: center; font-size: 10px; color: var(--gray4); border-left: 1px solid rgba(255,255,255,.06); line-height: 22px; }
.g-half-cell:nth-child(odd) { border-left: 1px solid var(--gray1); }
.g-half-cell.sat { color: #7dd3fc; }
.g-half-cell.sun { color: #fca5a5; }
.g-half-cell.today { background: rgba(208,34,42,.35); color: #fff; font-weight: 800; }

.g-body { display: flex; }
/* 修正: 背景色未指定のため白文字が背景(--gray6)に同化し判読不能になっていた */
.g-rowlabels { position: sticky; left: 0; z-index: 4; width: 130px; flex: none; background: var(--dark); }
.g-rowlabel {
  min-height: 56px; display: flex; flex-direction: column; justify-content: center; padding: 6px 10px; font-weight: 800; font-size: 12px;
  color: #fff; border-bottom: 1px solid var(--gray1); border-right: 3px solid; gap: 3px;
}
.g-rowlabel.type-sep { border-bottom: 3px solid var(--red); }
.g-rowlabel .rl-kind {
  display: inline-block; font-size: 8.5px; font-weight: 800; padding: 1px 6px; border-radius: 3px; color: #fff;
  align-self: flex-start; letter-spacing: .03em;
}
.g-rowlabel .rl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-lanes { position: relative; }
.g-lane {
  position: relative; min-height: 56px; border-bottom: 1px solid var(--gray5);
}
.g-lane.type-sep { border-bottom: 3px solid var(--red-l); }
.g-lane.drop-target { background: rgba(208,34,42,.16); outline: 2px dashed var(--red); outline-offset: -2px; }
.g-gridlines { position: absolute; inset: 0; display: flex; pointer-events: none; }
.col-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--gray5); }
.col-line.day { background: #d8dde3; }
.bg-today, .bg-sat, .bg-sun { position: absolute; top: 0; bottom: 0; pointer-events: none; }
.bg-today { background: rgba(208,34,42,.05); }
.bg-sat { background: rgba(59,130,246,.05); }
.bg-sun { background: rgba(239,68,68,.045); }
.g-todayline { position: absolute; top: 0; bottom: 0; width: 2px; background: #ef4444; box-shadow: 0 0 8px rgba(239,68,68,.7); z-index: 3; }

/* ドラッグ中のゴースト要素（プールのカード／バーいずれもmousedown+ゴースト方式で統一） */
.drag-ghost {
  position: fixed; z-index: 999; background: var(--dark); color: #fff; padding: 6px 12px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.5); pointer-events: none; white-space: nowrap;
  border: 1px solid var(--red);
}
.pool-card.drag-source { opacity: .4; }

.g-bar {
  position: absolute; height: 44px; border-radius: 6px; color: #fff; font-size: 11px;
  padding: 4px 8px; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: grab; z-index: 2;
  transition: box-shadow .15s;
}
.g-bar:hover { box-shadow: 0 4px 14px rgba(0,0,0,.4); z-index: 3; }
.g-bar:active { cursor: grabbing; }
.g-bar .b-title { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-bar .b-sub { font-size: 9.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-bar .b-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.g-bar .b-handle.left { left: 0; border-radius: 6px 0 0 6px; }
.g-bar .b-handle.right { right: 0; border-radius: 0 6px 6px 0; }
.g-bar .b-handle:hover { background: rgba(255,255,255,.4); }
.g-bar.dragging { opacity: .75; }
.g-bar .b-unplace {
  position: absolute; top: 2px; right: 2px; width: 15px; height: 15px; line-height: 13px; text-align: center;
  border-radius: 999px; background: rgba(0,0,0,.28); border: none; font-size: 11px; padding: 0; opacity: 0;
  transition: opacity .12s;
}
.g-bar:hover .b-unplace { opacity: 1; }
.g-bar .b-unplace:hover { background: rgba(0,0,0,.55); }

/* コンテキストメニュー */
.ctx-menu {
  position: fixed; z-index: 50; background: var(--dark); color: #fff; border-radius: 6px;
  box-shadow: 0 10px 32px rgba(0,0,0,.4); font-size: 12px; overflow: hidden; min-width: 160px;
}
.ctx-menu button { display: block; width: 100%; text-align: left; padding: 9px 14px; background: none; border: none; color: #fff; font-size: 12px; }
.ctx-menu button:hover { background: var(--gray1); }

/* トースト */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--dark); color: #fff;
  padding: 10px 20px; border-radius: 8px; font-size: 12.5px; box-shadow: 0 10px 24px rgba(0,0,0,.35); z-index: 100; }
.toast.success { background: #15803d; }
.toast.error { background: var(--red-d); }

/* モーダル(マスタ管理) */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal { width: 480px; max-width: 92vw; background: #fff; border-radius: 10px; overflow: hidden; max-height: 84vh; display: flex; flex-direction: column; }
.modal-head { background: var(--dark); color: #fff; padding: 12px 16px; font-weight: 800; font-size: 13px; display: flex; justify-content: space-between; align-items: center; text-transform: uppercase; letter-spacing: .04em; }
.modal-head button { background: none; border: none; color: #fff; font-size: 16px; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-foot { padding: 10px 16px; background: var(--gray6); display: flex; justify-content: flex-end; gap: 8px; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--gray5); }
.cat-row input[type=text] { flex: 1; padding: 5px 8px; border: 1px solid var(--gray5); border-radius: 4px; }
.cat-row .rl-kind { color: #fff; }
.cat-row .cat-order { display: flex; flex-direction: column; }
.cat-row .cat-order button { padding: 0 4px; font-size: 9px; background: var(--gray6); border: 1px solid var(--gray5); }
.btn { padding: 7px 14px; border-radius: 6px; border: none; font-weight: 700; font-size: 12.5px; }
.btn-primary { background: var(--red); color: #fff; }
.btn-plain { background: var(--gray6); color: var(--dark); border: 1px solid var(--gray5); }
.btn-danger { background: #fff; color: var(--red-d); border: 1px solid var(--red-l); }
