/* 2026-11-30：hidden を付けたものは必ず隠す（.btn などの display より強くする。付けないと、隠したボタンが見えてしまう） */
[hidden] {
  display: none !important;
}

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #6b7785;
  --border: #dde3e9;
  --accent: #2b6cb0;
  --warn-bg: #fff4e5;
  --warn-text: #b45309;
  --boss-bg: #e6f0fb;
  --boss-text: #1e4f8a;
  --hr-bg: #e9f7ef;
  --hr-text: #1f7a45;
  --staff-bg: #eef0f3;
  --staff-text: #4a5563;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --surface: #1d232a;
    --text: #e6ebf0;
    --muted: #9aa5b1;
    --border: #2d3640;
    --accent: #6ea8e8;
    --warn-bg: #3a2a12;
    --warn-text: #f3b35c;
    --boss-bg: #1c3350;
    --boss-text: #9cc4f2;
    --hr-bg: #173827;
    --hr-text: #8ad3a8;
    --staff-bg: #2a3139;
    --staff-text: #c3ccd5;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.5;
}

.app-header {
  background: var(--accent);
  color: #fff;
  padding: 14px 16px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.15rem;
}

.app-header p {
  margin: 2px 0 0;
  font-size: 0.8rem;
  opacity: 0.85;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.notice {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.filters input,
.filters select {
  font: inherit;
  font-size: 16px; /* スマホで勝手に拡大されないように */
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.filters input {
  flex: 1 1 200px;
  min-width: 0;
}

.filters select {
  flex: 0 0 auto;
}

.result-count {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 4px 0 8px;
}

.employee-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px 14px 16px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card:hover {
  border-color: var(--accent);
}

.card:active {
  transform: scale(0.99);
}

.card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.card-main {
  flex: 1 1 auto;
}

.chevron {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
}

.card-main {
  min-width: 0;
}

.name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.name {
  font-weight: 700;
  font-size: 1.05rem;
}

.kana {
  font-size: 0.75rem;
  color: var(--muted);
}

.meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.badge {
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.role-boss {
  background: var(--boss-bg);
  color: var(--boss-text);
}

.role-hr {
  background: var(--hr-bg);
  color: var(--hr-text);
}

.role-staff {
  background: var(--staff-bg);
  color: var(--staff-text);
}

.leave {
  text-align: right;
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 8px;
}

.leave.low {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.leave-label {
  font-size: 0.7rem;
  color: inherit;
  opacity: 0.8;
}

.leave-value strong {
  font-size: 1.3rem;
}

/* ---- 詳細（下から出てくる画面） ---- */

.detail {
  border: none;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  color: var(--text);
  overflow-y: auto; /* 中身が長いとき（社員の登録など）は、中で動かして見る */
}

.detail::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.detail[open] {
  animation: slide-up 0.2s ease-out;
}

@keyframes slide-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.detail-inner {
  padding: 20px 20px 28px;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.detail-name {
  margin: 0;
  font-size: 1.35rem;
}

.detail-close {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--staff-bg);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
}

.detail-role {
  display: inline-block;
  margin-top: 8px;
}

.detail-leave {
  margin: 16px 0;
  text-align: left;
  padding: 12px 14px;
  background: var(--bg);
}

.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0 0 16px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.detail-list dd {
  margin: 0;
}

.detail-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 8px;
  font-weight: 600;
}

.detail-route {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.detail-route li {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}

.detail-route li + li::before {
  content: "→";
  position: absolute;
  margin-left: -20px;
  color: var(--muted);
}

.detail-route li + li {
  position: relative;
  margin-left: 14px;
}

.route-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

/* ===== ここから：段階1で足した画面の部品 ===== */

/* お試しの帯（本番では出さない） */
.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.8rem;
}

.demo-bar select {
  font: inherit;
  font-size: 14px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
}

.linklike {
  border: none;
  background: none;
  color: inherit;
  text-decoration: underline;
  font: inherit;
  cursor: pointer;
  margin-left: auto;
}

/* メニュー */
.menu {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  position: sticky;
  top: 0;
  z-index: 5;
  scrollbar-width: none;
}

.menu::-webkit-scrollbar {
  display: none;
}

.menu a {
  flex: 0 0 auto;
  padding: 12px 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.menu a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.count {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d64545;
  color: #fff;
  font-size: 0.75rem;
  text-align: center;
}

/* かたまり */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.stat .label {
  font-size: 0.75rem;
  color: var(--muted);
}

.stat .value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.3;
}

.stat .value small {
  font-size: 0.85rem;
  font-weight: 400;
}

.stat .sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.stat.warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

/* ボタン */
.btn {
  display: inline-block;
  font: inherit;
  font-size: 1rem;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}

.btn-danger {
  color: #c53030;
  border-color: #e3a0a0;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-row .btn {
  flex: 1 1 120px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 入力 */
.field {
  margin-bottom: 14px;
}

.field > label,
.field > .label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input[type="date"],
.field input[type="time"],
.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input:not([type]),
.field select,
.field textarea,
.dept-row select {
  font: inherit;
  font-size: 16px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.field textarea {
  min-height: 72px;
  resize: vertical;
}

.field .hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.row2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.field input,
.field select,
.field textarea {
  min-width: 0;
  max-width: 100%;
}

/* 選ぶボタン（1日単位／時間単位 など） */
.seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.seg label {
  flex: 1 1 0;
  text-align: center;
  padding: 10px 6px;
  cursor: pointer;
  font-size: 0.9rem;
  background: var(--surface);
  position: relative;
}

.seg label + label {
  border-left: 1px solid var(--border);
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg label:has(input:checked) {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.error {
  background: #fdecec;
  color: #b42318;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.88rem;
  margin-bottom: 12px;
}

@media (prefers-color-scheme: dark) {
  .error {
    background: #3b1d1d;
    color: #f4a3a3;
  }
}

/* 状態の札 */
.status {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.st-wait {
  background: var(--boss-bg);
  color: var(--boss-text);
}

.st-ok {
  background: var(--hr-bg);
  color: var(--hr-text);
}

.st-ng {
  background: #fdecec;
  color: #b42318;
}

.st-off {
  background: var(--staff-bg);
  color: var(--staff-text);
}

.st-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

/* 届けの一覧 */
.req-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.req-list .card {
  display: block;
}

.req-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.req-what {
  font-weight: 700;
}

.req-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* お知らせ */
.notice-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.notice-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.notice-list li:last-child {
  border-bottom: none;
}

.notice-list .unread::before {
  content: "●";
  color: #d64545;
  margin-right: 4px;
  font-size: 0.7rem;
}

.notice-list time {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

/* カレンダー */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cal-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal .dow {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 4px 0;
}

.cal .day {
  min-height: 74px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
  font-size: 0.7rem;
  overflow: hidden;
  min-width: 0;
}

.cal .day.other {
  opacity: 0.35;
}

.cal .day.today {
  border-color: var(--accent);
  border-width: 2px;
}

.cal .num {
  font-weight: 700;
  font-size: 0.8rem;
}

.cal .sun .num {
  color: #c53030;
}

.cal .sat .num {
  color: #2b6cb0;
}

.cal .who {
  display: block;
  margin-top: 2px;
  padding: 1px 3px;
  border-radius: 4px;
  background: var(--hr-bg);
  color: var(--hr-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal .who.pending {
  background: var(--boss-bg);
  color: var(--boss-text);
}

.legend {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 6px;
}

/* 表 */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

table.grid {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
  white-space: nowrap;
}

table.grid th,
table.grid td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: right;
}

table.grid th:first-child,
table.grid td:first-child,
table.grid th:nth-child(2),
table.grid td:nth-child(2) {
  text-align: left;
}

table.grid thead th {
  background: var(--bg);
  font-size: 0.75rem;
  color: var(--muted);
}

table.grid td.warn {
  color: var(--warn-text);
  font-weight: 700;
}

/* 下に出るお知らせ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: #1f2933;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 50;
  max-width: calc(100% - 32px);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.small {
  font-size: 0.8rem;
  color: var(--muted);
}

/* 2026-11-27 追加：使えない選択肢・期間の中で休む日を選ぶチェック */
.seg label[hidden] {
  display: none;
}

.seg label.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.day-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}

.day-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.9rem;
  cursor: pointer;
}

.day-checks label:has(input:not(:checked)) {
  color: var(--muted);
  text-decoration: line-through;
}

.day-checks label.sun {
  color: #c0392b;
}

.day-checks label.sat {
  color: #2f6fb3;
}

/* 部署と承認の流れ（社員一覧・人事総務室） */
.dept-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.dept-row label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dept-name {
  font-weight: 700;
}

.dept-row select:disabled {
  opacity: 0.5;
}

@media (min-width: 640px) {
  .dept-row {
    grid-template-columns: 10em 1fr 1fr;
    align-items: end;
  }
}

/* 社員の取り込み（import.html）：直していただきたいところ */
.notice-list li.ng {
  color: #b42318;
}
@media (prefers-color-scheme: dark) {
  .notice-list li.ng {
    color: #f4a3a3;
  }
}
details summary {
  cursor: pointer;
  margin-bottom: 8px;
}

/* 付与（grants.html） */
.plan-who {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}
.plan-date {
  white-space: nowrap;
  font-size: 0.88rem;
}
.plan-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  font-size: 0.88rem;
}
.plan-edit .days-input {
  width: 4.5em;
  padding: 6px 8px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: inherit;
}
.plan-edit .reason-input {
  flex: 1 1 200px;
  padding: 6px 8px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: inherit;
}
.warn-text {
  color: var(--warn-text);
}
.check-line {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 12px 0;
  font-size: 0.9rem;
}

/* 使い方（help.html） */
.help-list {
  margin: 0 0 12px;
  padding-left: 1.3em;
  font-size: 0.92rem;
  line-height: 1.8;
}
.help-list li {
  margin-bottom: 4px;
}
section.panel h3 {
  font-size: 0.98rem;
  margin: 14px 0 6px;
}

/* ブラウザにデータを残せない開き方のときの知らせ（js/app.js） */
.notice.notice-ng {
  font-size: 0.9rem;
  background: var(--warn-bg);
  color: var(--warn-text);
  padding: 10px 12px;
  border-radius: 8px;
}
