:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f8faf9;
  --line: #e1e6e4;
  --line-strong: #cbd3d0;
  --text: #18201e;
  --text-2: #55615d;
  --text-3: #8a9592;
  --accent: #0f766e;
  --accent-hover: #0b5f58;
  --accent-soft: #e3f2ef;
  --danger: #c2410c;
  --danger-soft: #fdeee6;
  --warn: #b45309;
  --side: #10231f;
  --side-text: #cfdcd8;
  --side-active: #1f3a34;

  --st-open: #64748b;   --st-open-bg: #eef1f5;
  --st-doing: #2563eb;  --st-doing-bg: #e7efff;
  --st-resolved: #c27c0e; --st-resolved-bg: #fdf3df;
  --st-done: #15803d;   --st-done-bg: #e5f5ea;
  --internal: #7c3aed;  --internal-bg: #f1ebff;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 35, 31, .06), 0 2px 8px rgba(16, 35, 31, .04);
  --font: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1514; --surface: #161e1c; --surface-2: #1b2422; --line: #26312e; --line-strong: #34413d;
    --text: #e6eeeb; --text-2: #a8b6b1; --text-3: #73817c;
    --accent: #2dd4bf; --accent-hover: #5eead4; --accent-soft: #15322d;
    --danger: #fb923c; --danger-soft: #3a2116; --warn: #fbbf24;
    --side: #0a100f; --side-text: #b9c8c3; --side-active: #18302a;
    --st-open: #94a3b8; --st-open-bg: #232b33;
    --st-doing: #60a5fa; --st-doing-bg: #172540;
    --st-resolved: #fbbf24; --st-resolved-bg: #3a2d12;
    --st-done: #4ade80; --st-done-bg: #14301f;
    --internal: #a78bfa; --internal-bg: #2a2142;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.over { color: var(--danger); font-weight: 700; }
.err-text { color: var(--danger); }

/* ---------- form controls ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 7px; padding: 7px 10px; min-height: 36px; width: 100%;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-2); }
label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); font-weight: 400; }
label.check input { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); }

.btn {
  font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 7px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #062421; } }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn.danger { color: var(--danger); }
.btn.link { border: 0; background: none; color: var(--accent); }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 12px; }
.icon-btn { border: 0; background: none; color: var(--text-3); font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.small { font-size: 15px; padding: 2px 6px; margin-left: auto; }

/* ---------- auth ---------- */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px 28px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 6px 0 14px; }
.brand-mark { font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; background: linear-gradient(90deg, var(--side) 0 220px, transparent 220px); }
.side { background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 2px; text-decoration: none !important; }
.side-client { font-size: 12px; padding: 0 10px 16px; color: #8fb7ad; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 9px 10px; border-radius: 8px; text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--side-active); }
.side nav a.active { background: var(--side-active); color: #fff; }
.side nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid #22403a; padding-top: 12px; }
.side-foot .btn.ghost { color: var(--side-text); justify-content: flex-start; }
.side-foot .btn.ghost:hover { background: var(--side-active); border-color: transparent; }
.me-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: #fff; font: inherit; cursor: pointer; padding: 6px 8px; border-radius: 8px; text-align: left; }
.me-btn:hover { background: var(--side-active); }
.me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.avatar.sm { width: 22px; height: 22px; font-size: 11px; background: var(--accent-soft); color: var(--accent); }
.main { min-width: 0; }
.content { padding: 24px 28px 48px; max-width: 1400px; }
.demo-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 28px; background: var(--internal-bg); color: var(--text); border-bottom: 1px solid var(--line); font-size: 13px; }
.demo-bar label { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.demo-bar select { width: auto; min-height: 30px; padding: 3px 8px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.head-actions select { width: auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head.pad { padding: 16px 20px 0; }
.empty { color: var(--text-3); text-align: center; padding: 28px 12px !important; }
.notice { background: var(--st-resolved-bg); border: 1px solid color-mix(in srgb, var(--st-resolved) 30%, transparent); padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; font-size: 13px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile.warn { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.tile.warn .tile-val { color: var(--danger); }
.tile-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.tile-val { font-size: 28px; font-weight: 700; line-height: 1.3; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile-val small { font-size: 13px; font-weight: 500; color: var(--text-2); margin-left: 2px; }
.tile-val.sm { font-size: 20px; padding-top: 6px; }
.tile-sub { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.stackbar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--line); gap: 1px; min-width: 80px; }
.stackbar span.st-open { background: var(--st-open); }
.stackbar span.st-doing { background: var(--st-doing); }
.stackbar span.st-resolved { background: var(--st-resolved); }
.stackbar span.st-done { background: var(--st-done); }
.progress { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; vertical-align: middle; }
.progress span { display: block; height: 100%; background: var(--st-done); }
.progress-num { font-size: 12px; margin-left: 6px; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2); background: var(--surface-2); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: var(--surface-2); }
table.grid tr.dim td { opacity: .55; }
table.grid tr.pending-row td { background: var(--st-resolved-bg); }
table.grid td select { min-height: 30px; padding: 3px 8px; min-width: 120px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
.title-cell a { color: var(--text); font-weight: 500; }
.title-cell a:hover { color: var(--accent); }
.bar-cell { min-width: 120px; }
.prog-cell { white-space: nowrap; }
.key { font-family: var(--mono); font-size: 12px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; white-space: nowrap; }
.key.big { font-size: 13px; }
.cmt { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.result-sum { font-size: 12px; color: var(--text-2); margin: 0 0 8px 2px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); line-height: 1.7; }
.badge.st-open { background: var(--st-open-bg); color: var(--st-open); border-color: transparent; }
.badge.st-doing { background: var(--st-doing-bg); color: var(--st-doing); border-color: transparent; }
.badge.st-resolved { background: var(--st-resolved-bg); color: var(--st-resolved); border-color: transparent; }
.badge.st-done { background: var(--st-done-bg); color: var(--st-done); border-color: transparent; }
.badge.internal { background: var(--internal-bg); color: var(--internal); border-color: transparent; }
.badge.type { border-radius: 4px; background: transparent; }
.badge.ty-bug { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.badge.ty-req { color: var(--st-doing); border-color: color-mix(in srgb, var(--st-doing) 35%, transparent); }
.badge.ty-task { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.prio { font-size: 12px; font-weight: 500; white-space: nowrap; }
.prio.pr-high { color: var(--danger); }
.prio.pr-mid { color: var(--text-2); }
.prio.pr-low { color: var(--text-3); }
.due { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-2); }
.due.over { color: var(--danger); font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.st-open { background: var(--st-open); } .dot.st-doing { background: var(--st-doing); }
.dot.st-resolved { background: var(--st-resolved); } .dot.st-done { background: var(--st-done); }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters select, .filters input[type=search] { width: auto; min-height: 34px; padding: 5px 9px; font-size: 13px; max-width: 220px; }
.filters input[type=search] { width: 200px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 12px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-3); cursor: pointer; }
.chip.on { border-color: transparent; font-weight: 500; }
.chip.on.st-open { background: var(--st-open-bg); color: var(--st-open); }
.chip.on.st-doing { background: var(--st-doing-bg); color: var(--st-doing); }
.chip.on.st-resolved { background: var(--st-resolved-bg); color: var(--st-resolved); }
.chip.on.st-done { background: var(--st-done-bg); color: var(--st-done); }

/* ---------- mini list ---------- */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li a { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.mini-list li:last-child a { border-bottom: 0; }
.mini-list li a:hover { background: var(--surface-2); }
.mini-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 300px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 700; font-size: 13px; }
.col-count { margin-left: auto; font-weight: 500; color: var(--text-3); font-size: 12px; }
.col-body { padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.col-empty { color: var(--text-3); font-size: 12px; text-align: center; padding: 16px 0; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--line-strong); }
.kcard:focus-visible { outline: 2px solid var(--accent); }
.kcard[draggable=true] { cursor: grab; }
.kcard.dragging { opacity: .4; }
.kcard-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kcard-title { font-weight: 500; margin: 6px 0 4px; line-height: 1.5; }
.kcard-client { font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.kcard-foot { display: flex; align-items: center; gap: 8px; }
.kcard-foot .avatar { margin-left: auto; }

/* ---------- issue detail ---------- */
.crumbs { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.issue-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.issue-key-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.issue-title { font-size: 22px; line-height: 1.45; }
.issue-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; align-items: start; }
.issue-side { padding: 6px 18px; }
.prop { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.prop:last-child { border-bottom: 0; }
.prop-label { color: var(--text-2); font-size: 12px; }
.prop-val { text-align: right; }
.desc { white-space: pre-wrap; word-break: break-word; line-height: 1.8; }
.comments { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.comment { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: var(--surface); }
.comment.internal { background: var(--internal-bg); border-color: color-mix(in srgb, var(--internal) 25%, transparent); }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.comment-body { white-space: pre-wrap; word-break: break-word; margin-top: 6px; line-height: 1.75; }
.comment-form textarea { margin-bottom: 8px; }
.comment-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 180px; }
.inline-form .key-input { flex: 0 1 140px; font-family: var(--mono); text-transform: uppercase; }
.inline-form .btn { flex: none; }
.inline-form .check { flex: none; white-space: nowrap; }
.inline-form .check input { flex: none; width: auto; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(10, 20, 18, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px 20px 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ---------- toast ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: rise .2s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .issue-layout { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 260px); }
}
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); background: none; }
  .shell > * { min-width: 0; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 16px; }
  .side-client { display: none; }
  .side nav { flex-direction: row; order: 3; width: 100%; min-width: 0; overflow-x: auto; }
  .side nav a svg { display: none; }
  .side nav a { padding: 7px 10px; white-space: nowrap; gap: 6px; }
  .side nav a span { font-size: 13px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile-val { font-size: 24px; }
  .tile-val.sm { font-size: 16px; }
  .mini-list .small { display: none; }
  .demo-bar label { flex: 1; }
  .demo-bar select { flex: 1; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; border: 0; padding: 0; }
  .me-name { display: none; }
  .content { padding: 18px 16px 40px; }
  .demo-bar { padding: 10px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .filters select, .filters input[type=search] { flex: 1 1 140px; max-width: none; }
}

/* =====================================================================
   製品版（Miseboard）の追加スタイル
   ===================================================================== */
:root { --g-weekend: rgba(100, 116, 139, .07); --g-grid: rgba(100, 116, 139, .10); --row-h: 36px; }
@media (prefers-color-scheme: dark) { :root { --g-weekend: rgba(148, 163, 184, .07); --g-grid: rgba(148, 163, 184, .08); } }
h3 { font-size: 13px; margin: 6px 0 8px; font-weight: 700; }
.pre { white-space: pre-wrap; }
.push { margin-left: auto; }
.center-pad { display: grid; place-items: center; padding: 80px 0; }
.hint { margin: -4px 0 10px 2px; }
.section-h { margin: 26px 0 12px; font-size: 16px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.card, .tile { min-width: 0; }
.two-col > .card { margin-bottom: 18px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:disabled { opacity: .4; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.role-admin { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.role-editor { background: var(--st-doing-bg); color: var(--st-doing); border-color: transparent; }
.badge.role-viewer { background: var(--st-open-bg); color: var(--st-open); border-color: transparent; }
.role-chip { display: inline-block; margin-left: 4px; font-size: 10px; padding: 0 6px; border-radius: 999px; background: #1f3a34; color: #a7d7cc; }
.modal.wide { width: min(860px, 100%); }
.refresh-hint { position: fixed; left: 50%; transform: translateX(-50%); top: 12px; z-index: 70; border: 0; background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.seg button { font: inherit; font-size: 13px; border: 0; background: var(--surface); color: var(--text-2); padding: 0 14px; min-height: 34px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.group-h { margin: 14px 0 4px; font-size: 12px; color: var(--text-2); }
.group-h.over { color: var(--danger); }
.group-h.today { color: var(--warn); }
.group-h:first-of-type { margin-top: 0; }
.child-mark { color: var(--text-3); margin-right: 4px; font-size: 12px; }
.kids { font-size: 11px; color: var(--accent); background: var(--accent-soft); padding: 0 6px; border-radius: 999px; margin-left: 4px; }
.kcard-ms { font-size: 11px; color: var(--text-2); margin-bottom: 4px; }
.tabs.inline { margin: -4px 0 14px; }
.cal-title { font-size: 15px; min-width: 96px; text-align: center; }

/* ---- milestone list ---- */
.ms-list { list-style: none; margin: 0; padding: 0; }
.ms-list li + li { border-top: 1px solid var(--line); }
.ms-link { width: 100%; background: none; border: 0; font: inherit; color: var(--text); text-align: left; padding: 10px 4px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.ms-link:hover { background: var(--surface-2); }
.ms-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ms-top .due { margin-left: auto; }
.ms-ico { color: var(--st-resolved); }
.ms-bottom { display: flex; align-items: center; gap: 10px; }

/* ---- usage ---- */
.usage { display: grid; grid-template-columns: auto 1fr; gap: 6px 20px; align-items: center; }
.usage .muted { grid-column: 1 / -1; }
.usage .tile-val { font-size: 24px; }
.usage-bar, .usage-mini { display: block; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.usage-mini { display: inline-block; width: 70px; vertical-align: middle; height: 6px; }
.usage-bar span, .usage-mini span { display: block; height: 100%; background: var(--accent); }
.usage-bar span.full, .usage-mini span.full { background: var(--danger); }
.role-help { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }

/* ---- files / dropzone / history ---- */
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px 4px 10px; background: var(--surface-2); font-size: 13px; max-width: 100%; }
.file-chip .link-btn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-chip .icon-btn.small { margin-left: 0; }
.dropzone { display: block; margin-top: 14px; border: 1.5px dashed var(--line-strong); border-radius: 8px; padding: 14px; text-align: center; color: var(--text-3); font-size: 12px; cursor: pointer; flex-direction: row; font-weight: 400; }
.dropzone:hover, .dropzone.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: 0; }
.h-head { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.h-change { font-size: 13px; padding-left: 30px; color: var(--text-2); }
.h-field { display: inline-block; min-width: 84px; color: var(--text-3); font-size: 12px; }
.h-change .arrow { color: var(--text-3); margin: 0 4px; }
.h-change b { color: var(--text); }

/* ---- gantt ---- */
.gantt { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.g-scroll { overflow: auto; max-height: calc(100vh - 250px); min-height: 300px; position: relative; }
.g-scroll:focus-visible { outline: 2px solid var(--accent); }
.g-inner { position: relative; }
.g-head { display: flex; position: sticky; top: 0; z-index: 4; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.g-head .g-left-h { font-size: 12px; color: var(--text-2); font-weight: 500; display: flex; align-items: flex-end; padding-bottom: 8px; background: var(--surface-2); z-index: 5; }
.g-head-time { position: relative; height: 50px; flex: none; }
.g-head-top, .g-head-bottom { position: absolute; left: 0; right: 0; }
.g-head-top { top: 0; height: 24px; }
.g-head-bottom { top: 24px; height: 26px; }
.g-ht { position: absolute; top: 0; height: 24px; border-left: 1px solid var(--line); font-size: 12px; font-weight: 700; overflow: hidden; }
.g-ht span { position: sticky; left: calc(var(--left) + 6px); padding: 4px 6px; display: inline-block; white-space: nowrap; }
.g-hb { position: absolute; top: 0; height: 26px; font-size: 11px; color: var(--text-2); text-align: center; line-height: 1.1; padding-top: 3px; border-left: 1px solid var(--line); overflow: hidden; white-space: nowrap; }
.g-hb small { display: block; font-size: 9px; color: var(--text-3); }
.g-hb.we { color: var(--danger); }
.g-hb.wk, .g-hb.mo { text-align: left; padding: 6px 4px 0; }
.g-body { position: relative; }
.g-row { display: flex; height: var(--row-h); border-bottom: 1px solid var(--line); }
.g-row:hover .g-left { background: var(--surface-2); }
.g-left { position: sticky; left: 0; z-index: 3; width: var(--left); flex: none; background: var(--surface); border-right: 1px solid var(--line); display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px; font-size: 13px; overflow: hidden; }
.g-title { display: flex; gap: 6px; align-items: center; color: var(--text); min-width: 0; flex: 1; text-decoration: none; }
.g-title:hover { color: var(--accent); }
.g-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.g-title .key { margin-right: 6px; font-size: 11px; padding: 0 4px; }
.is-parent .g-title { font-weight: 700; }
.g-branch { color: var(--text-3); font-size: 11px; }
.g-who { flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.g-time { position: relative; flex: none; }
.g-group { background: var(--surface-2); height: 32px; }
.g-group .g-left { background: var(--surface-2); font-weight: 700; }
.g-msrow .g-left { color: var(--text-2); font-size: 12px; }
.g-ms-ico { color: var(--st-resolved); }
.g-bar { position: absolute; top: 9px; height: 18px; border-radius: 5px; background: var(--st-open); opacity: .9; cursor: pointer; overflow: hidden; }
.g-bar.st-open { background: var(--st-open); }
.g-bar.st-doing { background: var(--st-doing); }
.g-bar.st-resolved { background: var(--st-resolved); }
.g-bar.st-done { background: var(--st-done); opacity: .55; }
.g-bar.over { box-shadow: 0 0 0 2px var(--danger); }
.g-bar.parent { top: 12px; height: 12px; background: var(--text-2); border-radius: 3px; }
.g-bar.parent .g-prog { position: absolute; left: 0; top: 0; bottom: 0; background: var(--st-done); }
.g-bar.derived { background: transparent !important; border: 2px dashed var(--text-3); cursor: default; }
.g-bar.drag { cursor: grab; touch-action: none; }
.g-bar.dragging { cursor: grabbing; opacity: 1; box-shadow: 0 4px 12px rgba(0,0,0,.25); z-index: 2; }
.g-h { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.g-h.l { left: 0; } .g-h.r { right: 0; }
.g-bar:hover .g-h { background: rgba(255,255,255,.35); }
.g-label { position: absolute; top: 9px; font-size: 12px; line-height: 18px; white-space: nowrap; color: var(--text-2); pointer-events: none; }
.g-label em { font-style: normal; color: var(--st-done); font-weight: 700; }
.g-nodate { position: absolute; top: 9px; font-size: 11px; color: var(--text-3); line-height: 18px; white-space: nowrap; }
.g-ms { position: absolute; top: 6px; transform: translateX(-9px); display: flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--text); z-index: 1; }
.g-ms i { width: 14px; height: 14px; background: var(--st-resolved); transform: rotate(45deg); border-radius: 2px; display: block; margin: 4px; }
.g-ms.closed i { background: var(--st-done); }
.g-ms span { font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--surface); padding: 0 4px; border-radius: 4px; }
.g-ms-span { position: absolute; top: 15px; height: 6px; background: color-mix(in srgb, var(--st-resolved) 25%, transparent); border-radius: 3px; }
.g-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--danger); z-index: 2; pointer-events: none; }
.g-today span { position: sticky; top: 0; display: inline-block; white-space: nowrap; transform: translateX(-50%); background: var(--danger); color: #fff; font-size: 10px; padding: 0 6px; border-radius: 0 0 4px 4px; }

/* ---- calendar ---- */
.cal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-head div { padding: 8px; font-size: 12px; color: var(--text-2); text-align: center; font-weight: 500; }
.cal-head .we { color: var(--danger); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 4px 5px 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.we { background: var(--g-weekend); }
.cal-cell.out { opacity: .45; }
.cal-cell.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.cal-date { font-size: 12px; font-weight: 700; color: var(--text-2); padding: 0 2px; }
.cal-cell.today .cal-date { color: #fff; background: var(--accent); border-radius: 999px; width: 22px; height: 22px; display: grid; place-items: center; padding: 0; }
.cal-item, .cal-ms, .cal-more { font: inherit; font-size: 11px; text-align: left; border: 0; border-radius: 4px; padding: 2px 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }
.cal-item { border-left: 3px solid var(--st-open); background: var(--st-open-bg); color: var(--text); }
.cal-item.st-doing { border-color: var(--st-doing); background: var(--st-doing-bg); }
.cal-item.st-resolved { border-color: var(--st-resolved); background: var(--st-resolved-bg); }
.cal-item.st-done { border-color: var(--st-done); background: var(--st-done-bg); }
.cal-item.done { opacity: .6; text-decoration: line-through; }
.cal-item.over { box-shadow: inset 0 0 0 1px var(--danger); }
.cal-item[draggable=true] { cursor: grab; }
.cal-item.dragging { opacity: .4; }
.cal-item .key { font-size: 10px; padding: 0 3px; margin-right: 4px; }
.cal-ms { background: var(--st-resolved-bg); color: var(--st-resolved); font-weight: 700; }
.cal-ms.closed { background: var(--st-done-bg); color: var(--st-done); }
.cal-more { background: none; color: var(--accent); padding-left: 4px; }

@media (max-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .g-who, .g-branch { display: none; }
  .cal-grid { grid-template-rows: none !important; }
  .cal-cell { min-height: 70px; }
  .cal-item .key { display: none; }
  .usage { grid-template-columns: 1fr; }
}

/* ---- お問い合わせ ---- */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #c2410c; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.badge.new-reply { background: var(--danger-soft); color: var(--danger); border-color: transparent; margin-left: 6px; }
.thread-card { padding-top: 8px; }
.thread { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; max-width: 88%; }
.msg.client { align-self: flex-start; background: var(--surface); }
.msg.bistro { align-self: flex-end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.msg-head { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.msg-body { white-space: pre-wrap; word-break: break-word; margin-top: 6px; line-height: 1.8; }
.avatar.bistro { background: #7A2E2A; color: #fff; }
.auth-card .stack .btn { width: 100%; }
.status-table input.st-name { width: 160px; min-height: 30px; padding: 3px 8px; }
.status-table select { min-width: 110px; }
.section-sub { margin: 20px 0 8px; font-size: 14px; }

/* ---- お気に入り・ウォッチ ---- */
.star { background: none; border: 0; cursor: pointer; font-size: 16px; line-height: 1; color: var(--text-3); padding: 2px 4px; margin-right: 2px; }
.star:hover { color: #d97706; }
.star.on { color: #f59e0b; }
.star.mini { font-size: 13px; padding: 0 2px; }
.btn.fav-on { color: #b45309; border-color: #f59e0b; background: #fef3c7; }
.btn.watch-on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
@media (prefers-color-scheme: dark) { .btn.fav-on { background: #3a2d12; color: #fbbf24; } }
.watchers { display: inline-flex; gap: 2px; vertical-align: middle; }
.card-head.mt { margin-top: 18px; }
.span-all { grid-column: 1 / -1; }
.empty.small { padding: 12px !important; font-size: 12px; text-align: left; }
