/* 人事部 タスク */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --col: #eceef2;
  --line: #e2e5ea;
  --line-strong: #cfd4dc;
  --text: #1d2330;
  --muted: #667085;
  --faint: #98a2b3;
  --accent: #0f766e;
  --accent-soft: #e3f2ef;
  --ring: rgba(15, 118, 110, .28);
  --todo: #98a2b3;
  --doing: #2f6fde;
  --done: #1f9d55;
  --danger: #b42318;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-up: 0 10px 24px rgba(16, 24, 40, .14);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* ---------- 上の帯 ---------- */
.topbar {
  height: 56px; flex: none;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: none; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent);
  display: flex; align-items: flex-start; justify-content: center; gap: 3px; padding: 7px 6px;
}
.brand-mark i { display: block; width: 4px; border-radius: 2px; background: #fff; }
.brand-mark i:nth-child(1) { height: 14px; }
.brand-mark i:nth-child(2) { height: 10px; opacity: .8; }
.brand-mark i:nth-child(3) { height: 6px; opacity: .6; }

.filters { flex: 1; display: flex; gap: 8px; align-items: center; justify-content: center; min-width: 0; }
.select, .search, input, textarea {
  height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
  padding: 0 10px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 90px; line-height: 1.6; }
.search { width: min(320px, 100%); }
.select:focus, .search:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }

.menu { position: relative; flex: none; }
.menu summary {
  list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 8px 4px 4px; border-radius: 999px;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--bg); }
.menu-name { font-weight: 600; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-up);
  padding: 6px; display: grid;
}
.menu-pop a, .menu-pop button {
  display: block; text-align: left; padding: 8px 10px; border-radius: 6px;
  color: var(--text); text-decoration: none; background: none; border: 0; cursor: pointer; width: 100%;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--bg); }
.menu-pop form { margin: 0; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }

.avatar {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; background: #7a8699;
}
.avatar.me { width: 30px; height: 30px; font-size: 13px; background: var(--accent); }
.c0 { background: #2f6fde; } .c1 { background: #c2410c; } .c2 { background: #7c3aed; } .c3 { background: #0e7490; }
.c4 { background: #be185d; } .c5 { background: #4d7c0f; } .c6 { background: #b45309; } .c7 { background: #475467; }

/* ---------- ボード ---------- */
.page-board { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.board {
  flex: 1; min-height: 0; width: 100%; max-width: 1560px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  padding: 16px 20px 20px;
}
.col {
  min-height: 0; display: flex; flex-direction: column;
  background: var(--col); border-radius: 14px; padding: 10px 10px 6px;
}
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; min-height: 44px; }
.col-head h2 { margin: 0; font-size: 14px; font-weight: 700; }
.count {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, .8); border-radius: 999px; padding: 0 8px; min-width: 24px; text-align: center;
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dot.todo { background: var(--todo); } .dot.doing { background: var(--doing); } .dot.done { background: var(--done); }
.col-head .icon-btn { margin-left: auto; }

.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--muted); display: grid; place-items: center;
}
.icon-btn:hover { background: rgba(255, 255, 255, .85); color: var(--text); }

.quick-add { margin: 0 0 8px; }
.quick-add input { width: 100%; background: rgba(255, 255, 255, .7); border-style: dashed; }
.quick-add input:focus { background: #fff; border-style: solid; }

.list {
  flex: 1; min-height: 60px; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 8px; padding: 2px 2px 10px;
}
.empty {
  margin: 0; padding: 18px 10px; text-align: center; font-size: 12.5px; color: var(--faint);
  border: 1.5px dashed var(--line-strong); border-radius: 10px;
}
.is-dragging .empty { border-color: var(--accent); color: var(--accent); background: rgba(255, 255, 255, .5); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px 9px; box-shadow: var(--shadow);
  cursor: grab; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: box-shadow .15s, border-color .15s;
}
.card:hover { border-color: var(--line-strong); box-shadow: 0 4px 12px rgba(16, 24, 40, .08); }
.card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.card-title { font-weight: 600; font-size: 14px; line-height: 1.45; word-break: break-word; }
.card-memo {
  margin-top: 3px; color: var(--muted); font-size: 12.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 12px; min-height: 22px; }
.who { display: inline-flex; align-items: center; gap: 6px; color: #475467; min-width: 0; }
.who-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9em; }
.who.none { color: var(--faint); }
.due { padding: 1px 8px; border-radius: 999px; background: #f2f4f7; color: #475467; white-space: nowrap; font-weight: 600; }
.due.soon { background: #fff4e0; color: #93370d; }
.due.today { background: #fdecc8; color: #9a4a06; }
.due.over { background: #fde5e3; color: var(--danger); }
.tag { padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.card.is-done { background: #fafbfc; }
.card.is-done .card-title { color: var(--muted); }
.card.is-done .card-title::before { content: "✓ "; color: var(--done); font-weight: 700; }

.card.ghost { opacity: .45; background: var(--accent-soft); border: 1.5px dashed var(--accent); box-shadow: none; }
.card.ghost > * { visibility: hidden; }
.card.chosen { box-shadow: var(--shadow-up); }
.card.drag { transform: rotate(1.5deg); }

.link-btn {
  margin: 2px 4px 6px; background: none; border: 0; padding: 6px 4px; cursor: pointer;
  color: var(--muted); font-size: 12.5px; text-align: left;
}
.link-btn:hover { color: var(--accent); text-decoration: underline; }

.tabs { display: none; }

/* ---------- ボタン・入力 ---------- */
.btn {
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: #fff; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger.ghost { border-color: transparent; background: transparent; color: var(--danger); }
.btn.danger.ghost:hover { background: #fde5e3; }
.btn.wide { width: 100%; height: 40px; }

label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: #344054; }
label input, label select, label textarea { font-weight: 400; font-size: 14px; color: var(--text); width: 100%; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; height: auto; }
.stack { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row.wrap { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.row.wrap label { flex: 1 1 220px; }
.alert { margin: 0; padding: 9px 12px; border-radius: 8px; background: #fde5e3; color: var(--danger); font-size: 13px; }
.ok { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- 編集の窓 ---------- */
.dlg {
  width: min(600px, 94vw); max-height: 90vh; border: 0; border-radius: 16px; padding: 18px 20px 16px;
  box-shadow: 0 24px 48px rgba(16, 24, 40, .25);
}
.dlg::backdrop { background: rgba(16, 24, 40, .45); }
.dlg-head { display: flex; align-items: center; }
.dlg-head h3 { margin: 0; font-size: 16px; flex: 1; }
.dlg-foot { display: flex; align-items: center; gap: 8px; }
.history { border-top: 1px solid var(--line); padding-top: 10px; font-size: 12.5px; }
.history summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.history ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; max-height: 180px; overflow: auto; }
.history li { display: flex; gap: 10px; color: #475467; }
.history time { color: var(--faint); font-variant-numeric: tabular-nums; flex: none; width: 5.5em; }
.history b { flex: none; }

/* ---------- お知らせ ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 14px; max-width: min(560px, 92vw);
  background: #1d2330; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-up);
  font-size: 13.5px;
}
.toast.err { background: var(--danger); }
.toast-btn { background: none; border: 0; color: #7fe0cf; font-weight: 700; cursor: pointer; padding: 2px 4px; }

/* ---------- ログイン・ふつうのページ ---------- */
.page-login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 26px 22px; box-shadow: var(--shadow-up); display: grid; gap: 16px;
}
.login-brand { justify-content: center; margin-bottom: 4px; }
.login-card .small { margin: 0; text-align: center; }

.plain { max-width: 1000px; margin: 28px auto 60px; padding: 0 20px; }
.plain.narrow { max-width: 520px; }
.plain h1 { font-size: 20px; margin: 0 0 6px; }
.plain > .muted { margin: 0 0 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; }
.secret { margin-top: 14px; padding: 14px 16px; border-radius: 10px; background: #fff8e6; border: 1px solid #f5d48a; }
.secret p { margin: 0 0 8px; }
.secret-row { display: flex; gap: 10px; align-items: center; }
.secret code { font-size: 18px; letter-spacing: .06em; background: #fff; border: 1px solid #f0d9a6; border-radius: 8px; padding: 6px 12px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.table td.actions { text-align: right; display: flex; gap: 6px; justify-content: flex-end; }
.table .btn { height: 30px; padding: 0 10px; font-size: 12.5px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #f2f4f7; color: #475467; }
.pill.admin { background: var(--accent-soft); color: var(--accent); }
.pill.off { background: #fde5e3; color: var(--danger); }
tr.is-off td { color: var(--faint); }

/* ---------- スマホ（列を横にスライド） ---------- */
@media (max-width: 760px) {
  .topbar { padding: 0 12px; gap: 10px; }
  .brand-name, .menu-name { display: none; }
  .filters { justify-content: flex-start; }
  .filters .select { width: 7.5em; flex: none; }
  .filters .search { flex: 1; width: auto; min-width: 0; }
  .tabs {
    display: flex; gap: 6px; padding: 8px 12px 0; flex: none; overflow-x: auto;
  }
  .tabs button {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
    font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap;
  }
  .tabs button.on { color: var(--text); border-color: var(--line-strong); box-shadow: var(--shadow); }
  .tabs b { font-size: 12px; color: var(--faint); }
  .board {
    display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
    gap: 12px; padding: 10px 12px 14px; scroll-padding: 0 12px;
  }
  .col { flex: 0 0 86vw; scroll-snap-align: start; }
  .row { grid-template-columns: 1fr 1fr; }
  .row label:first-child { grid-column: 1 / -1; }
  .dlg { padding: 16px; }
}
