/* 勤怠管理アプリ 共通スタイル */
:root {
  --c-bg: #f4f6f8;
  --c-card: #ffffff;
  --c-text: #1f2933;
  --c-muted: #6b7280;
  --c-primary: #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-success: #16a34a;
  --c-warn: #f59e0b;
  --c-danger: #dc2626;
  --c-border: #e5e7eb;
  --c-mode-normal: #2563eb;
  --c-mode-study: #7c3aed;
  --c-mode-snow: #0ea5e9;
  --c-mode-clockout: #6b7280;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.55;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--c-muted); }
.small { font-size: 0.85em; }
.error { color: var(--c-danger); }
code { background: #eef2ff; padding: 1px 6px; border-radius: 4px; }

/* ヘッダー */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #1f2937; color: #fff;
}
.topbar .brand { font-weight: bold; }
.topbar nav a, .topbar nav span { color: #d1d5db; margin-left: 14px; }
.topbar nav a:hover { color: #fff; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px; }

/* ボタン */
.btn-primary, button.btn-primary {
  background: var(--c-primary); color: #fff;
  border: 0; padding: 10px 16px; border-radius: var(--radius);
  cursor: pointer; font-size: 1rem;
}
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-secondary {
  background: #fff; color: var(--c-text);
  border: 1px solid var(--c-border); padding: 8px 14px; border-radius: var(--radius);
  cursor: pointer;
}
.btn-danger {
  background: var(--c-danger); color: #fff; border: 0;
  padding: 8px 14px; border-radius: var(--radius); cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ログイン */
.centered-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e0e7ff, #f4f6f8);
}
.login-card {
  background: var(--c-card); padding: 28px 32px; border-radius: 12px;
  width: 360px; box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.login-card h1 { margin-top: 0; font-size: 1.25rem; }
.login-card label { display:block; margin: 12px 0; }
.login-card input {
  width: 100%; padding: 10px; border: 1px solid var(--c-border);
  border-radius: var(--radius); font-size: 1rem; margin-top: 4px;
}
.login-card button { width: 100%; margin-top: 12px; }

/* メニュー */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.menu-card {
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: 18px; color: var(--c-text);
  transition: transform 0.1s, box-shadow 0.1s;
}
.menu-card:hover { box-shadow: 0 6px 14px rgba(0,0,0,0.08); transform: translateY(-2px); text-decoration: none; }
.menu-card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.menu-card.admin { border-color: #d97706; background: #fffbeb; }

/* タブレット打刻 */
.tablet-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #111827; color: #fff; padding: 12px 16px;
}
.tablet-bar .clock { font-size: 1.2rem; font-family: ui-monospace, Menlo, monospace; }
.dept-tabs { display: flex; gap: 6px; padding: 10px 16px; background: #1f2937; }
.dept-tabs button {
  background: #374151; color: #fff; border: 0; padding: 10px 16px;
  border-radius: 6px; cursor: pointer; font-size: 1rem;
}
.dept-tabs button.active { background: var(--c-primary); }
.mode-bar {
  background: var(--c-mode-normal); color: #fff;
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center;
}
.mode-bar.mode-study        { background: var(--c-mode-study); }
.mode-bar.mode-snow_standby { background: var(--c-mode-snow); }
.mode-bar.mode-clockout     { background: var(--c-mode-clockout); }
.mode-bar .mode-current { font-size: 1.2rem; font-weight: bold; }
.employee-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px; padding: 18px;
}
.employee-grid button {
  background: #fff; border: 1px solid var(--c-border); border-radius: 8px;
  padding: 20px 10px; cursor: pointer; font-size: 1.1rem;
  position: relative;
}
.employee-grid button.working {
  background: #ecfdf5; border-color: #34d399;
}
.employee-grid button.done {
  background: #f1f5f9; border-color: #cbd5e1; color: var(--c-muted);
}
.employee-grid .status-dot {
  position: absolute; top: 6px; right: 8px; width: 10px; height: 10px;
  border-radius: 50%;
}
.employee-grid .status-dot.in  { background: var(--c-success); }
.employee-grid .status-dot.out { background: var(--c-muted); }

/* モーダル */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal {
  background: #fff; padding: 22px 26px; border-radius: 10px; min-width: 340px;
  max-width: 90vw; max-height: 90vh; overflow: auto;
}
.modal h3 { margin-top: 0; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* テーブル */
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--c-border); text-align: left; vertical-align: middle; }
.table th { background: #f9fafb; font-size: 0.9rem; }
.table tr.weekend td { background: #fafafa; }
.table tr.today td { background: #fffbeb; }
.table tr.holiday td { background: #fef2f2; }

/* バッジ */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; }
.badge.in        { background: #d1fae5; color: #065f46; }
.badge.out       { background: #e5e7eb; color: #374151; }
.badge.no-punch  { background: #fee2e2; color: #991b1b; }
.badge.leave     { background: #fef3c7; color: #92400e; }
.badge.holiday   { background: #f3f4f6; color: #6b7280; }
.badge.mode-study        { background: #ede9fe; color: #5b21b6; }
.badge.mode-snow_standby { background: #e0f2fe; color: #075985; }
.badge.req-early         { background: #ede9fe; color: #5b21b6; }
.badge.req-overtime      { background: #fef3c7; color: #92400e; }
.badge.req-holiday_work  { background: #dbeafe; color: #1e40af; }
.badge.pending           { opacity: 0.7; border: 1px dashed currentColor; }

/* リアルタイム */
.rt-summary {
  display: flex; gap: 12px; padding: 10px 16px; background: #1f2937; color: #fff;
}
.rt-summary div { padding: 6px 10px; border-radius: 6px; background: #374151; }
.dept-section { margin: 16px; background: #fff; border: 1px solid var(--c-border); border-radius: 8px; padding: 14px; }
.dept-section h2 { margin: 0 0 8px; font-size: 1rem; }
.person-list { display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  padding: 6px 10px; border-radius: 6px; background: #f3f4f6;
}
.person.in   { background: #d1fae5; }
.person.out  { background: #e5e7eb; color: var(--c-muted); }
.person.no   { background: #fee2e2; color: #991b1b; }
.person.leave{ background: #fef3c7; color: #92400e; }

/* タブレット用追加 */
.tablet-bar .tablet-link {
  color: #93c5fd; padding: 4px 10px; border: 1px solid #374151; border-radius: 6px;
}
.tablet-bar .tablet-link:hover { background: #374151; text-decoration: none; }
.big-choice {
  padding: 18px; border: 0; border-radius: 10px; cursor: pointer;
  font-size: 1.25rem; color: #fff;
}
.big-choice.in  { background: var(--c-success); }
.big-choice.out { background: var(--c-warn);    }
.big-choice:hover { filter: brightness(0.95); }

/* スマホ打刻 */
.mobile-card {
  max-width: 420px; margin: 24px auto; background: #fff;
  border-radius: 12px; padding: 22px; text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.mobile-card .big-btn {
  display: block; width: 100%; padding: 24px; font-size: 1.5rem;
  background: var(--c-primary); color: #fff; border: 0; border-radius: 10px; cursor: pointer;
  margin: 16px 0;
}
.mobile-card .big-btn.out { background: var(--c-warn); }
.mobile-card .big-btn:hover { filter: brightness(0.95); }
.mode-choice { display: flex; gap: 6px; justify-content: center; margin: 10px 0; flex-wrap: wrap; }
.mode-choice label {
  flex: 1 1 calc(33% - 6px); min-width: 100px;
  padding: 8px; border: 1px solid var(--c-border); border-radius: 6px;
  cursor: pointer; background: #fff;
}
.mode-choice label.active { background: var(--c-mode-normal); color: #fff; border-color: var(--c-mode-normal); }
.mode-choice label.active.mode-study        { background: var(--c-mode-study); border-color: var(--c-mode-study); }
.mode-choice label.active.mode-snow_standby { background: var(--c-mode-snow);  border-color: var(--c-mode-snow); }
.mode-choice input { display: none; }

/* レポート */
.report-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--c-border); padding: 0 16px; }
.report-tabs a {
  padding: 10px 14px; color: var(--c-muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.report-tabs a.active { color: var(--c-primary); border-color: var(--c-primary); text-decoration: none; }
.report-block { background: #fff; margin: 16px; border-radius: 8px; padding: 16px; border: 1px solid var(--c-border); }
.progress { display: inline-block; letter-spacing: 2px; }
