/* ============================================================
   在宅勤務管理システム - スタイルシート
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --sidebar-bg: #1e293b;
  --sidebar-width: 240px;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 14px;
}

/* ============================================================
   レイアウト
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* サイドバー */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 16px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  letter-spacing: 0.5px;
}

.sidebar-nav { flex: 1; padding: 10px 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
  border-radius: 0;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar-nav .nav-icon { width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-section-label {
  padding: 12px 16px 4px;
  font-size: 10px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-user-name { font-weight: 600; font-size: 13px; color: #fff; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.45); margin-top: 2px; }

.logout-btn {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
}
.logout-btn:hover { color: rgba(255,255,255,0.8); }

/* メインコンテンツ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 28px 40px;
  min-height: 100vh;
}

/* ============================================================
   ページヘッダー
   ============================================================ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ============================================================
   カード
   ============================================================ */

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title { font-size: 15px; font-weight: 600; }

/* ============================================================
   統計グリッド
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--primary); }

/* ============================================================
   ボタン
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #b45309; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

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

/* ============================================================
   ステータスバッジ
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending   { background: #fef3c7; color: #92400e; }
.badge-accepted  { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #e0f2fe; color: #0369a1; }
.badge-completed { background: #d1fae5; color: #065f46; }
.badge-approved  { background: #dcfce7; color: #166534; }
.badge-rejected  { background: #fee2e2; color: #991b1b; }

/* 優先度 */
.priority-high   { color: var(--danger); font-weight: 600; }
.priority-normal { color: var(--text-muted); }
.priority-low    { color: #94a3b8; }

/* ============================================================
   テーブル
   ============================================================ */

.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11.5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--primary-light); }

/* ============================================================
   フォーム
   ============================================================ */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 5px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-control::placeholder { color: #94a3b8; }

textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { cursor: pointer; }

.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ============================================================
   アラート
   ============================================================ */

.alert {
  padding: 11px 14px;
  border-radius: 7px;
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ============================================================
   ログインページ
   ============================================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-box {
  background: #fff;
  border-radius: 14px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo h1 { font-size: 18px; font-weight: 700; }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 5px; }

/* ============================================================
   業務指示カード
   ============================================================ */

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  text-decoration: none;
  color: inherit;
}

.task-item:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  border-color: var(--primary);
}

.task-item-main { flex: 1; min-width: 0; }
.task-item-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.task-item-meta  { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   コメント
   ============================================================ */

.comment {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.comment-author { font-weight: 600; font-size: 13px; }
.comment-time   { font-size: 12px; color: var(--text-muted); }
.comment-body   { font-size: 14px; white-space: pre-wrap; line-height: 1.7; }

.comment-report {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 8px;
  font-size: 13px;
  color: #166534;
}

/* ============================================================
   ファイル添付
   ============================================================ */

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  background: #fafafa;
}

.file-item a { color: var(--primary); text-decoration: none; }
.file-item a:hover { text-decoration: underline; }
.file-icon { color: var(--text-muted); flex-shrink: 0; }

/* ============================================================
   出退勤
   ============================================================ */

.clock-display {
  font-size: 52px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 3px;
  text-align: center;
  padding: 20px 0;
  font-variant-numeric: tabular-nums;
}

.attendance-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
}

.status-working    { background: #dbeafe; color: #1e40af; }
.status-not-started{ background: #f1f5f9; color: #64748b; }
.status-finished   { background: #dcfce7; color: #166534; }

/* ============================================================
   フィルターバー
   ============================================================ */

.filter-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-btn {
  padding: 5px 13px;
  border-radius: 99px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============================================================
   アバター
   ============================================================ */

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-sm { width: 26px; height: 26px; font-size: 11px; }

/* ============================================================
   ローディング / 空状態
   ============================================================ */

.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

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

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

.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ============================================================
   区切り線 / ユーティリティ
   ============================================================ */

.divider { height: 1px; background: var(--border); margin: 20px 0; }

.text-muted   { color: var(--text-muted); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-sm      { font-size: 12px; }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }

.flex           { display: flex; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

.w-full { width: 100%; }
.hidden { display: none; }

/* ============================================================
   タスク詳細ページ
   ============================================================ */

.task-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.task-detail-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  flex: 1;
}

.task-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.task-meta-item { }
.task-meta-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; font-weight: 500; }
.task-meta-value { font-size: 13.5px; font-weight: 500; }

/* 承認アクションエリア */
.approval-actions {
  display: flex;
  gap: 10px;
  padding: 16px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================================
   レスポンシブ
   ============================================================ */

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .login-box { width: 92%; padding: 28px 20px; }
}
