:root {
  color-scheme: light;
  font-family: "Noto Sans JP", "Yu Gothic UI", sans-serif;
  color: #1d2b45;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1d2b45;
  --muted: #78849a;
  --line: #e7ebf2;
  --blue: #4774e8;
  --green: #2f9d79;
  --shadow: 0 16px 50px rgba(37, 57, 91, .08);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.loading { padding: 18vh 24px; color: var(--muted); text-align: center; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); }
.auth-intro { display: flex; flex-direction: column; justify-content: space-between; padding: 50px 7vw; color: #fff; background: radial-gradient(circle at 15% 82%, #86a4ff 0, transparent 30%), linear-gradient(145deg, #253f89, #416cde 67%, #7394f6); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 15px; font-weight: 700; letter-spacing: .025em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.4); border-radius: 12px; font-weight: 700; }
.intro-copy { max-width: 590px; padding: 55px 0; }
.eyebrow { margin: 0 0 12px; color: #7692ee; font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.auth-intro .eyebrow { color: #bdcdfd; }
.intro-copy h1 { margin: 0; max-width: 520px; font-size: clamp(36px, 5vw, 58px); line-height: 1.28; letter-spacing: -.04em; }
.intro-copy > p:last-child { max-width: 440px; margin-top: 21px; color: rgba(255,255,255,.76); font-size: 15px; line-height: 1.9; }
.auth-foot { color: rgba(255,255,255,.65); font-size: 12px; }
.auth-panel { display: grid; place-items: center; padding: 40px; }
.auth-card { width: min(100%, 390px); }
.auth-card h2 { margin: 0 0 10px; font-size: 29px; letter-spacing: -.035em; }
.auth-card > p { margin: 0 0 32px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.auth-card form, .user-create-form { display: grid; gap: 17px; }
label { display: grid; gap: 8px; color: #4a5870; font-size: 12px; font-weight: 600; }
input, select { width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid #dfe5ef; border-radius: 8px; outline: 0; color: var(--ink); background: #fff; font-size: 14px; }
input:focus, select:focus { border-color: #7d9aef; box-shadow: 0 0 0 3px rgba(71,116,232,.12); }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 0 15px; border: 0; border-radius: 8px; font-size: 13px; font-weight: 600; transition: .15s ease; }
.button-primary { color: #fff; background: var(--blue); box-shadow: 0 5px 12px rgba(71,116,232,.2); }
.button-primary:hover { background: #3b66d5; transform: translateY(-1px); }
.button-quiet { color: #5b6880; background: #f0f3f8; }
.button-quiet:hover { background: #e8edf5; }
.auth-card .button { min-height: 48px; margin-top: 3px; }
.notice { margin: 0 0 20px; padding: 11px 13px; border: 1px solid #f1d4d0; border-radius: 8px; color: #a44d45; background: #fff6f5; font-size: 12px; line-height: 1.6; }
.notice.success { border-color: #cceadd; color: #287455; background: #f0faf5; }
.hint { color: var(--muted); font-size: 11px; font-weight: 400; }

.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 5vw, 76px); border-bottom: 1px solid var(--line); background: #fff; }
.topbar .brand { color: var(--ink); }
.topbar .brand-mark { border: 0; color: #fff; background: #4774e8; }
.account { display: flex; align-items: center; gap: 13px; }
.account-copy { display: grid; gap: 2px; text-align: right; }
.account-copy strong { font-size: 12px; }
.account-copy span { color: var(--muted); font-size: 10px; }
.logout { padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: #66738a; background: #fff; font-size: 11px; }
.main-content { width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(27px, 4vw, 36px); letter-spacing: -.04em; }
.page-heading .eyebrow { margin-bottom: 8px; }
.heading-note { margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.role-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid #dbe5fd; border-radius: 20px; color: #5474c4; background: #f5f8ff; font-size: 11px; font-weight: 600; white-space: nowrap; }
.role-pill.viewer { border-color: #dce8e4; color: #4b8573; background: #f4faf7; }
.view-tabs { display: flex; width: fit-content; gap: 4px; margin: -7px 0 20px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #eef1f6; }
.view-tab { min-height: 34px; padding: 0 13px; border: 0; border-radius: 6px; color: #718098; background: transparent; font-size: 11px; font-weight: 600; }
.view-tab.active { color: #365ab6; background: #fff; box-shadow: 0 1px 4px rgba(37,57,91,.12); }
.view-tab:focus-visible { outline: 2px solid #7795ef; outline-offset: 2px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 21px; }
.metric, .panel { border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 2px 6px rgba(37,57,91,.02); }
.metric { display: flex; align-items: center; gap: 14px; padding: 16px 19px; }
.metric-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; color: #5377dd; background: #eff3ff; font-size: 17px; }
.metric:nth-child(2) .metric-icon { color: #d39a43; background: #fff7e9; }
.metric:nth-child(3) .metric-icon { color: #36a17b; background: #eaf8f2; }
.metric-label { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; }
.metric-value { font-size: 20px; font-weight: 700; }
.panel { overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; gap: 10px; }
.panel-title h2 { margin: 0; font-size: 14px; }
.panel-subtitle { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.tree-legend { display: flex; align-items: center; gap: 15px; color: var(--muted); font-size: 10px; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #bec7d6; }
.status-dot.in_progress { background: #e6aa49; }
.status-dot.done { background: #49ad84; }
.tree { padding: 14px 20px 20px; overflow-x: auto; }
.tree-list { min-width: 620px; }
.tree-node { position: relative; }
.tree-children { position: relative; margin-left: 21px; padding-left: 22px; border-left: 1px solid #dfe5ef; }
.tree-children > .tree-node::before { position: absolute; top: 28px; left: -22px; width: 22px; border-top: 1px solid #dfe5ef; content: ""; }
.node-row { min-height: 54px; display: grid; grid-template-columns: minmax(175px, 1fr) 112px 112px 108px auto; align-items: center; gap: 11px; padding: 6px 9px; border-bottom: 1px solid #f0f2f6; }
.node-name { min-width: 0; display: flex; align-items: center; gap: 8px; }
.node-title { overflow: hidden; color: #35435c; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.node-row.is-root { margin: 0 -7px; padding: 8px 16px; border: 0; border-radius: 9px; background: #f5f7fc; }
.node-row.is-root .node-title { color: #27395e; font-size: 14px; }
.node-status { width: fit-content; display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 20px; color: #818da1; background: #f4f6f9; font-size: 10px; white-space: nowrap; }
.node-status.in_progress { color: #ac7527; background: #fff7e9; }
.node-status.done { color: #267c5b; background: #eaf8f2; }
.node-meta { overflow: hidden; color: #7d899d; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.node-actions { display: flex; justify-content: flex-end; gap: 3px; opacity: .65; }
.node-row:hover .node-actions { opacity: 1; }
.icon-button { width: 29px; height: 29px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 7px; color: #8490a3; background: transparent; font-size: 17px; }
.icon-button:hover { color: #4168ca; background: #edf2ff; }
.icon-button.danger:hover { color: #bb5651; background: #fff0ef; }
.icon-button:disabled { display: none; }
.collapse-button { width: 19px; height: 19px; display: inline-grid; place-items: center; padding: 0; border: 1px solid #e1e6ef; border-radius: 5px; color: #78859b; background: #fff; font-size: 11px; }
.collapse-spacer { width: 19px; flex: 0 0 19px; }
.empty-tree { padding: 36px 10px; color: var(--muted); text-align: center; font-size: 12px; }
.schedule-overview { display: grid; grid-template-columns: minmax(150px, auto) minmax(120px, 1fr) 48px; align-items: center; gap: 15px; padding: 16px 21px; border-bottom: 1px solid var(--line); }
.schedule-progress-copy { display: flex; flex-direction: column; gap: 3px; }
.schedule-progress-copy strong { font-size: 11px; }
.schedule-progress-copy span { color: var(--muted); font-size: 10px; }
.schedule-progress-track { height: 8px; overflow: hidden; border-radius: 8px; background: #edf0f5; }
.schedule-progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6d8df0, #49ad84); transition: width .25s ease; }
.schedule-progress-percent { color: #3b5fb9; font-size: 14px; text-align: right; }
.schedule-hint { margin: 0; padding: 10px 20px; border-bottom: 1px solid var(--line); color: #7d899d; background: #fbfcfe; font-size: 10px; }
.schedule-scroll { overflow: auto; max-height: min(68vh, 760px); }
.schedule-canvas { --label-width: 280px; position: relative; width: max-content; min-width: 100%; }
.schedule-axis, .schedule-row { display: grid; grid-template-columns: var(--label-width) var(--timeline-width); width: max-content; min-width: 100%; }
.schedule-sticky-heading, .schedule-task-label { position: sticky; left: 0; z-index: 4; width: var(--label-width); border-right: 1px solid var(--line); background: #fff; }
.schedule-sticky-heading { display: flex; min-height: 34px; align-items: center; padding: 0 14px; color: #76839a; font-size: 10px; font-weight: 600; }
.schedule-month-axis { border-bottom: 1px solid var(--line); background: #f7f8fb; }
.schedule-month-axis .schedule-sticky-heading { background: #f7f8fb; }
.schedule-months, .schedule-days { display: flex; width: var(--timeline-width); }
.schedule-month { display: flex; height: 34px; flex: 0 0 auto; align-items: center; padding-left: 9px; border-left: 1px solid #e6eaf1; color: #4d5e7b; background: #f7f8fb; font-size: 10px; font-weight: 600; white-space: nowrap; }
.schedule-day-axis { border-bottom: 1px solid var(--line); }
.schedule-day-axis .schedule-sticky-heading { min-height: 31px; }
.schedule-day { display: grid; width: 36px; height: 31px; flex: 0 0 36px; place-items: center; border-left: 1px solid #f0f2f6; color: #8792a5; font-size: 9px; }
.schedule-day.weekend { color: #a47c7b; background: #fcf8f8; }
.schedule-day.today { color: #fff; background: #718ce2; font-weight: 700; }
.schedule-row { min-height: 47px; }
.schedule-task-label { display: flex; min-height: 47px; align-items: center; gap: 7px; padding-right: 7px; border-bottom: 1px solid #f0f2f6; }
.schedule-row:first-child .schedule-task-label { background: #f8f9fd; }
.schedule-row:first-child .schedule-task-name { color: #27395e; font-weight: 700; }
.schedule-task-name { min-width: 0; flex: 1; overflow: hidden; color: #46546d; font-size: 10px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.schedule-collapse, .schedule-collapse-spacer { width: 17px; height: 18px; flex: 0 0 17px; }
.schedule-collapse { display: grid; place-items: center; padding: 0; border: 1px solid #e1e6ef; border-radius: 4px; color: #78859b; background: #fff; font-size: 10px; }
.schedule-collapse-spacer { display: block; }
.schedule-actions { display: flex; flex: 0 0 auto; gap: 1px; opacity: 0; }
.schedule-task-label:hover .schedule-actions, .schedule-actions:focus-within { opacity: 1; }
.schedule-action { width: 22px; height: 24px; padding: 0; border: 0; border-radius: 4px; color: #77859b; background: transparent; font-size: 13px; }
.schedule-action:hover { color: #4168ca; background: #edf2ff; }
.schedule-track { position: relative; min-height: 47px; border-bottom: 1px solid #f0f2f6; background-image: repeating-linear-gradient(to right, transparent 0, transparent 35px, #eef1f6 35px, #eef1f6 36px); }
.schedule-row:first-child .schedule-track { background-color: #f8f9fd; }
.schedule-bar { position: absolute; top: 16px; z-index: 1; display: flex; height: 15px; align-items: center; justify-content: center; overflow: hidden; border-radius: 8px; color: #fff; font-size: 8px; font-weight: 700; white-space: nowrap; }
.schedule-bar.not_started { background: #aab4c4; }
.schedule-bar.in_progress { background: #e0a344; }
.schedule-bar.done { background: #45a27c; }
.schedule-bar.milestone { top: 19px; height: 9px; border-radius: 5px; }
.schedule-unscheduled { position: absolute; top: 17px; left: 9px; color: #a4adbb; font-size: 9px; }
.schedule-rows { position: relative; }
.schedule-today-marker { position: absolute; top: 0; bottom: 0; z-index: 3; width: 2px; background: rgba(224, 99, 91, .72); pointer-events: none; }
.schedule-today-marker::before { position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: #e0635b; content: ""; }
.user-panel { margin-top: 20px; }
.user-create-form { grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.2fr) 145px auto; align-items: end; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.user-create-form label { font-size: 10px; }
.user-create-form input, .user-create-form select { min-height: 39px; font-size: 12px; }
.user-create-form .button { min-height: 39px; }
.user-list { padding: 3px 20px; }
.user-row { min-height: 51px; display: grid; grid-template-columns: minmax(100px, 1fr) minmax(160px, 1fr) auto; align-items: center; gap: 12px; border-bottom: 1px solid #f0f2f6; }
.user-row:last-child { border-bottom: 0; }
.user-name { font-size: 12px; font-weight: 600; }
.user-id { color: var(--muted); font-size: 10px; }
.user-role-select { width: auto; min-height: 32px; padding: 0 9px; font-size: 11px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 3; max-width: min(400px, calc(100% - 32px)); padding: 12px 16px; border-radius: 9px; color: #fff; background: #25334e; box-shadow: var(--shadow); font-size: 12px; animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.dialog { width: min(440px, calc(100% - 28px)); padding: 24px; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 24px 80px rgba(27,39,62,.24); }
.dialog::backdrop { background: rgba(26,37,59,.42); backdrop-filter: blur(2px); }
.dialog form { display: grid; gap: 16px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 3px; }
.dialog-heading h2 { margin: 0; font-size: 21px; }
.dialog .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }

@media (max-width: 780px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-intro { min-height: 300px; padding: 27px 26px; }
  .intro-copy { padding: 45px 0 25px; }
  .intro-copy h1 { font-size: 37px; }
  .auth-foot { display: none; }
  .auth-panel { align-items: start; padding: 38px 26px 52px; }
  .main-content { width: min(100% - 30px, 650px); padding-top: 29px; }
  .topbar { height: 62px; padding: 0 17px; }
  .metrics { gap: 8px; }
  .metric { gap: 9px; padding: 12px 10px; }
  .metric-icon { width: 32px; height: 32px; font-size: 14px; }
  .metric-value { font-size: 17px; }
  .metric-label { font-size: 9px; }
  .page-heading { align-items: flex-start; }
  .tree-legend { display: none; }
  .schedule-canvas { --label-width: 230px; }
  .schedule-overview { grid-template-columns: 1fr 40px; gap: 9px 12px; padding: 13px 15px; }
  .schedule-progress-track { grid-column: 1; grid-row: 2; }
  .schedule-progress-percent { grid-column: 2; grid-row: 1 / span 2; }
  .schedule-actions { opacity: 1; }
  .user-create-form { grid-template-columns: 1fr 1fr; }
  .user-create-form .button { grid-column: span 2; }
}
@media (max-width: 420px) {
  .account-copy { display: none; }
  .page-heading { gap: 8px; }
  .role-pill { padding: 7px 8px; font-size: 10px; }
  .metrics { grid-template-columns: 1fr; }
  .metric { padding: 10px 13px; }
}
