* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background: #fff;
  color: #222;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid #333;
  padding: 6px 12px;
  background: #fff;
  flex-wrap: wrap;
}
.brand { font-weight: bold; font-size: 1.05rem; }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }
.mainnav a {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid #999;
  text-decoration: none;
  color: #222;
  background: #f5f5f5;
  font-weight: bold;
}
.mainnav a:hover { background: #e8e8e8; }
.mainnav a.active { background: #333; color: #fff; border-color: #333; }
.badge {
  background: #c62828;
  color: #fff;
  border-radius: 9px;
  padding: 1px 7px;
  font-size: 0.8rem;
  margin-left: 4px;
}
.userarea { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.deptname { font-weight: bold; }

.container { padding: 12px; max-width: 1400px; }
h1 { font-size: 1.25rem; border-left: 6px solid #333; padding-left: 8px; margin: 8px 0 14px; }
h2 { font-size: 1.05rem; margin: 18px 0 8px; }
a { color: #0d47a1; }

.flash { padding: 8px 14px; font-weight: bold; }
.flash-notice { background: #e8f5e9; border: 1px solid #2e7d32; color: #1b5e20; margin: 6px 12px 0; }
.flash-alert  { background: #ffebee; border: 1px solid #c62828; color: #b71c1c; margin: 6px 12px 0; }

.btn, input[type="submit"], button {
  font-size: 0.95rem;
  padding: 6px 14px;
  border: 1px solid #555;
  background: #f5f5f5;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover, input[type="submit"]:hover, button:hover { background: #e0e0e0; }
.btn-primary, input[type="submit"].btn-primary, button.btn-primary {
  background: #1565c0; color: #fff; border-color: #0d47a1;
}
.btn-primary:hover, input[type="submit"].btn-primary:hover, button.btn-primary:hover {
  background: #0d47a1;
}
.btn-small { padding: 3px 8px; font-size: 0.85rem; }
.btn-danger { color: #b71c1c; border-color: #b71c1c; background: #fff; }
.btn-danger:hover { background: #ffebee; }

input[type="text"], input[type="password"], input[type="number"],
input[type="date"], select, textarea {
  font-size: 1rem;
  padding: 6px 8px;
  border: 1px solid #888;
  background: #fff;
  font-family: inherit;
}
textarea { width: 100%; max-width: 640px; }
label { font-weight: bold; }

.form-table { border-collapse: collapse; margin: 8px 0; }
.form-table th, .form-table td { text-align: left; padding: 6px 10px; vertical-align: top; }
.form-table th { white-space: nowrap; }

.list-table { border-collapse: collapse; width: 100%; background: #fff; }
.list-table th, .list-table td { border: 1px solid #999; padding: 6px 8px; text-align: left; }
.list-table th { background: #eee; }
.list-table tr:nth-child(even) td { background: #fafafa; }

.month-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.month-nav .ym { font-size: 1.15rem; font-weight: bold; }
.gantt-wrap { overflow-x: auto; }
.gantt { border-collapse: collapse; table-layout: fixed; }
.gantt th, .gantt td {
  border: 1px solid #888;
  padding: 0;
  height: 30px;
  text-align: center;
  font-size: 0.85rem;
}
.gantt th.rowname, .gantt td.rowname {
  width: 150px; min-width: 150px;
  text-align: left;
  padding: 2px 6px;
  background: #fff;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
}
.gantt th.day { width: 34px; min-width: 34px; background: #eee; }
.gantt th.day.sat { background: #dce9f7; color: #0d47a1; }
.gantt th.day.sun { background: #fbe3e3; color: #b71c1c; }
.gantt td.day-cell { background: #fff; }
.gantt td.today, .gantt th.today { outline: 2px solid #1565c0; outline-offset: -2px; }
.gantt .bar-label {
  display: block;
  font-weight: bold;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: visible;
  text-align: left;
  padding-left: 2px;
}
.gantt td.rowdel { border: none; background: none; }

.panel {
  border: 1px solid #999;
  background: #fafafa;
  padding: 10px 14px;
  margin: 14px 0;
}
.panel h2 { margin-top: 0; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.color-presets { display: inline-flex; gap: 4px; vertical-align: middle; }
.color-presets button {
  width: 24px; height: 24px; padding: 0; border: 1px solid #555;
}

.rework-card { border: 1px solid #999; margin-bottom: 12px; }
.rework-head {
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  background: #eee; padding: 6px 10px; border-bottom: 1px solid #999;
}
.rework-head .item { font-weight: bold; font-size: 1.05rem; }
.rework-steps { display: flex; flex-wrap: wrap; align-items: stretch; padding: 8px 10px; gap: 0; }
.step {
  border: 1px solid #888;
  padding: 6px 10px;
  min-width: 110px;
  text-align: center;
  background: #fff;
}
.step.done { background: #e8f5e9; }
.step.current { background: #fff8e1; border: 2px solid #f9a825; }
.step .dept { font-weight: bold; }
.step .when { font-size: 0.75rem; color: #555; }
.step-arrow { align-self: center; padding: 0 4px; font-weight: bold; color: #555; }
.check-mark { font-size: 1.1rem; color: #2e7d32; font-weight: bold; }

.folders { display: flex; gap: 14px; flex-wrap: wrap; margin: 10px 0; }
.folder {
  display: block;
  width: 170px;
  border: 1px solid #888;
  background: #fffde7;
  padding: 14px 10px;
  text-align: center;
  text-decoration: none;
  color: #222;
  font-weight: bold;
}
.folder:hover { background: #fff9c4; }
.folder .icon { font-size: 2rem; display: block; }
.folder .count { font-weight: normal; font-size: 0.85rem; color: #555; display: block; margin-top: 4px; }

.stat-grid { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-box { border: 1px solid #999; padding: 10px 14px; min-width: 300px; background: #fff; }
.stat-box h2 { margin: 0 0 8px; }
.bar-chart .bar-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.bar-chart .bar-name { width: 130px; white-space: nowrap; font-size: 0.9rem; }
.bar-chart .bar-track { flex: 1; background: #eee; height: 18px; }
.bar-chart .bar-fill { background: #1565c0; height: 18px; }
.bar-chart .bar-val { width: 60px; text-align: right; font-weight: bold; }
.donut-row { display: flex; gap: 24px; flex-wrap: wrap; }
.donut-item { text-align: center; }
.donut-item .name { font-weight: bold; margin-bottom: 4px; }
.muted { color: #666; font-size: 0.85rem; }

.login-box {
  max-width: 420px; margin: 60px auto; border: 1px solid #999; padding: 24px;
}
.login-box h1 { margin-top: 0; }
.login-box .field { margin-bottom: 14px; }
.login-box select, .login-box input[type="password"] { width: 100%; }
