:root {
  --navy: #023f7f;
  --navy-dark: #022c59;
  --orange: #ee6200;
  --bg: #f2f5f9;
  --line: #dde4ec;
  --text: #24303d;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { color: var(--navy); }

/* header */
.topbar { display: flex; align-items: center; gap: 18px; background: var(--navy); color: #fff; padding: 0 18px; flex-wrap: wrap; }
.brand { font-weight: bold; font-size: 18px; padding: 8px 0; display: flex; align-items: center; gap: 8px; }
.brand img { height: 34px; background: #fff; border-radius: 6px; padding: 3px 5px; }
.brand span { font-size: 12px; font-weight: normal; margin-left: 6px; opacity: .85; }
.topbar nav { display: flex; flex-wrap: wrap; }
.topbar nav a { color: #dce7f5; text-decoration: none; padding: 14px 12px; font-size: 13.5px; }
.topbar nav a.on, .topbar nav a:hover { background: var(--navy-dark); color: #fff; border-bottom: 3px solid var(--orange); }
.userbox { margin-left: auto; font-size: 12.5px; }
.userbox a { color: #ffd9b8; margin-left: 8px; }

main { max-width: 1200px; margin: 0 auto; padding: 18px; }
.pagetitle { color: var(--navy); font-size: 20px; margin: 6px 0 16px; }
footer { text-align: center; color: #8a97a5; font-size: 11px; padding: 24px 0 30px; }
.flash { background: #e6f2e6; color: #145214; border: 1px solid #bfe0bf; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }

/* layout */
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.panel { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 4px rgba(20, 40, 70, .08); }
.panel h2 { font-size: 15px; color: var(--navy); border-left: 4px solid var(--orange); padding-left: 8px; margin: 0 0 12px; }
.panel h3 { font-size: 13.5px; color: var(--navy); margin: 14px 0 8px; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: #fff; border-radius: 8px; padding: 14px 16px; box-shadow: 0 1px 4px rgba(20, 40, 70, .08); border-top: 3px solid var(--navy); }
.card.alert { border-top-color: #d33; }
.card.alert .cardnum { color: #d33; }
.cardnum { font-size: 26px; font-weight: bold; color: var(--navy); }
.cardnum small { font-size: 12px; color: #78899b; font-weight: normal; }
.cardlabel { font-size: 12.5px; color: #58687a; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { background: #eef3f9; color: var(--navy); text-align: left; font-size: 12.5px; padding: 7px 8px; border: 1px solid var(--line); }
.tbl td { padding: 7px 8px; border: 1px solid var(--line); vertical-align: top; }
.tbl.wide { background: #fff; box-shadow: 0 1px 4px rgba(20, 40, 70, .08); border-radius: 8px; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl.kv th { width: 110px; white-space: nowrap; }
.datecol { white-space: nowrap; }
.empty { color: #8a97a5; padding: 12px; }
.overdue { color: #c81e1e; font-weight: bold; }
.taskdone { opacity: .55; }
.taskdone td { text-decoration: line-through; }
tr.taskdone td:first-child { text-decoration: none; }

/* table wrap (horizontal scroll) */
.tablewrap { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(20, 40, 70, .08); }
.tbl.nowrap th, .tbl.nowrap td { white-space: nowrap; }

/* toolbar / filters */
.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.viewswitch a { display: inline-block; padding: 6px 14px; border: 1px solid var(--navy); color: var(--navy); text-decoration: none; font-size: 13px; }
.viewswitch a:first-child { border-radius: 4px 0 0 4px; }
.viewswitch a:last-child { border-radius: 0 4px 4px 0; }
.viewswitch a.on { background: var(--navy); color: #fff; }

/* forms */
.btn { display: inline-block; background: var(--navy); color: #fff; border: none; border-radius: 4px; padding: 8px 16px; font-size: 13.5px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--navy-dark); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.gray { background: #7d8b99; }
.form .frow { margin-bottom: 10px; }
.form label { display: block; font-size: 12px; color: #58687a; font-weight: bold; margin-bottom: 3px; }
input, select, textarea { font-family: inherit; font-size: 13.5px; padding: 6px 8px; border: 1px solid #c3cdd8; border-radius: 4px; max-width: 100%; }
.form input, .form select, .form textarea { width: 100%; }
.inline { display: inline; }
.inline select, .inline input { width: auto; }
.addrow { margin-top: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px; }
.chk { font-weight: normal !important; font-size: 12.5px !important; }
.note { color: #667788; font-size: 12.5px; }
.editbox { margin-top: 10px; }
.editbox summary { color: var(--navy); cursor: pointer; font-size: 13px; }

/* phase badge */
.phase-badge { display: inline-block; background: #e3ecf7; color: var(--navy); border-radius: 12px; padding: 2px 10px; font-size: 12px; white-space: nowrap; }
.phst-done td { background: #f3faf3; }
.phst-excluded td { background: #f4f4f4; color: #a5a5a5; }
.phst-active td { background: #fff7ef; }

/* board */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 14px; }
.boardcol { min-width: 200px; width: 200px; background: #e9eef5; border-radius: 8px; padding: 8px; flex-shrink: 0; }
.boardcol.over { outline: 2px dashed var(--orange); }
.boardhead { font-size: 12.5px; font-weight: bold; color: var(--navy); padding: 4px 4px 8px; }
.boardcard { background: #fff; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(20, 40, 70, .12); cursor: grab; border-left: 3px solid var(--orange); }
.boardcard a { font-weight: bold; font-size: 13px; text-decoration: none; }
.cardmeta { font-size: 11.5px; color: #67788a; margin-top: 3px; }

/* tasks */
.taskgroup { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; padding: 0 10px; }
.taskgroup summary { padding: 9px 2px; cursor: pointer; color: var(--navy); font-weight: bold; font-size: 13px; }
.taskcount { float: right; color: #8a97a5; font-weight: normal; font-size: 12px; }
.tasktbl { margin-bottom: 8px; }
.chkbtn { background: none; border: 1px solid #b8c4d0; border-radius: 50%; width: 26px; height: 26px; cursor: pointer; color: var(--navy); font-size: 13px; }
.chkbtn:hover { background: #eef3f9; }

/* timeline */
.timeline { margin-top: 10px; max-height: 420px; overflow-y: auto; }
.tl-item { border-left: 3px solid var(--line); padding: 4px 0 10px 12px; margin-left: 4px; }
.tl-note { border-left-color: var(--orange); }
.tl-date { font-size: 11.5px; color: #8a97a5; margin-right: 8px; }
.tl-user { font-size: 11.5px; color: var(--navy); font-weight: bold; }
.tl-body { font-size: 13px; margin-top: 2px; }

/* gantt */
.ganttwrap { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(20, 40, 70, .08); }
.gantt .gcase { min-width: 200px; }
.gantt .gmonth { text-align: center; min-width: 74px; }
.gantt .gcell { padding: 4px; }
.gantt .gnow { background: #fff7ef; }
.gchip { font-size: 11px; background: #e3ecf7; color: var(--navy); border-radius: 4px; padding: 2px 5px; margin-bottom: 3px; white-space: nowrap; }
.gchip.gst-done { background: #e2f2e2; color: #1d6b1d; }
.gchip.gst-active { background: #ffe8d2; color: #a34a00; }
.gchip.overdue { background: #fde3e3; color: #c81e1e; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { background: #e3ecf7; border-radius: 12px; padding: 3px 10px; font-size: 12.5px; }
.chipx { background: none; border: none; cursor: pointer; color: #a00; font-size: 12px; }

/* login */
.loginbody { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-dark) 100%); }
.loginbox { background: #fff; border-radius: 10px; padding: 34px 30px; width: 360px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); }
.loginlogo { color: var(--navy); font-size: 26px; font-weight: bold; text-align: center; margin-bottom: 18px; }
.loginlogo img { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; }
.loginlogo span { display: block; font-size: 15px; font-weight: bold; color: var(--navy); margin-top: 8px; }
.loginbox label { display: block; font-size: 12px; color: #58687a; font-weight: bold; margin: 12px 0 4px; }
.loginbox input { width: 100%; }
.loginbox button { width: 100%; margin-top: 20px; background: var(--orange); color: #fff; border: none; border-radius: 4px; padding: 11px; font-size: 15px; cursor: pointer; }
.loginbox button:hover { opacity: .92; }
.loginfoot { text-align: center; color: #a5b1bd; font-size: 10.5px; margin-top: 18px; }
.err { background: #fde3e3; color: #c81e1e; padding: 9px 12px; border-radius: 4px; font-size: 13px; }
