/* ==========================================================================
   飲食店シフト管理アプリ 共通スタイル
   カラーテーマ: ダークグリーン(#1f3329) × クリーム(#f7f4ec) を基調
   ========================================================================== */

:root {
  --color-sidebar-bg: #1f3329;
  --color-sidebar-bg-light: #24402f;
  --color-sidebar-text: #d7e3d5;
  --color-sidebar-text-dim: #8fa596;
  --color-sidebar-active: #2f5940;
  --color-accent: #2f7d52;
  --color-accent-dark: #1f5c3a;
  --color-bg: #f5f2e9;
  --color-card: #ffffff;
  --color-border: #e5e0d3;
  --color-text: #33342f;
  --color-text-dim: #767468;
  --color-red: #d9534f;
  --color-orange: #f5a623;
  --color-pink: #e0459b;
  --color-blue: #4a90d9;
  --color-green: #3cb878;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- レイアウト ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 60px;
}

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

.page-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- サイドバー ---------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--color-sidebar-bg);
  color: var(--color-sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 0 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 18px;
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.sidebar-brand .brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--color-sidebar-text-dim);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a .nav-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--color-sidebar-text);
  letter-spacing: 0.5px;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-sidebar-text);
}

.sidebar-nav a.active {
  background: var(--color-sidebar-active);
  color: #ffffff;
}

.sidebar-nav a.active .nav-badge {
  background: var(--color-accent);
  color: #fff;
}

/* ---------- カード ---------- */
.card {
  background: var(--color-card);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow);
  padding: 18px;
}

.card + .card {
  margin-top: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.stat-card .stat-label {
  font-size: 12px;
  color: var(--color-text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-accent-dark);
}

.stat-card .stat-sub {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-top: 4px;
}

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}

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

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

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

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-danger {
  background: #fff;
  border-color: var(--color-red);
  color: var(--color-red);
}

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

/* ---------- フォーム ---------- */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-text-dim);
  margin-bottom: 5px;
}

.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 140px;
}

input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid var(--color-border);
  background: #fdfcf9;
  font-size: 13.5px;
  color: var(--color-text);
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  background: #fff;
}

/* ---------- テーブル ---------- */
table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table th {
  text-align: left;
  font-size: 12px;
  color: var(--color-text-dim);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 2px solid var(--color-border);
}

table.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13.5px;
}

table.data-table tr:hover td {
  background: #faf9f4;
}

/* ---------- バッジ・タグ ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: #e5f4ea; color: var(--color-accent-dark); }
.badge-gray { background: #f0efe8; color: var(--color-text-dim); }
.badge-orange { background: #fdf1de; color: #b3730c; }
.badge-red { background: #fbe6e5; color: var(--color-red); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* ---------- モーダル ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 30, 25, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.modal-box h2 {
  margin: 0 0 16px;
  font-size: 17px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ---------- カレンダー(シフト管理) ---------- */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 10px;
}

.month-switcher {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}

.month-switcher button {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  padding: 8px 4px 14px;
  color: var(--color-text-dim);
}

.legend .legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-border);
  gap: 1px;
}

.calendar-dow {
  background: #faf9f4;
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-dim);
}

.calendar-dow.sun { color: var(--color-red); }
.calendar-dow.sat { color: var(--color-blue); }

.calendar-cell {
  background: #fff;
  min-height: 118px;
  padding: 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calendar-cell.empty {
  background: #fbfaf6;
}

.calendar-cell .cell-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.calendar-cell.sun .cell-date { color: var(--color-red); }
.calendar-cell.sat .cell-date { color: var(--color-blue); }

.calendar-cell .add-shift-btn {
  border: none;
  background: transparent;
  color: var(--color-text-dim);
  font-size: 14px;
  font-weight: 700;
  padding: 0 3px;
  border-radius: 4px;
}

.calendar-cell .add-shift-btn:hover {
  background: var(--color-bg);
  color: var(--color-accent-dark);
}

.shift-chip {
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.shift-chip .chip-time {
  opacity: 0.85;
  font-weight: 500;
  font-size: 10px;
  margin-left: 3px;
}

.shift-chip.special {
  border: 1px dashed rgba(255, 255, 255, 0.7);
}

/* ---------- 打刻画面 ---------- */
.clock-page {
  min-height: 100vh;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px;
}

.clock-header {
  text-align: center;
  margin-bottom: 30px;
}

.clock-header h1 {
  font-size: 18px;
  color: var(--color-text-dim);
  margin: 0 0 6px;
}

.clock-header .clock-time {
  font-size: 40px;
  font-weight: 700;
  color: var(--color-accent-dark);
}

.clock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 760px;
}

.clock-staff-card {
  background: #fff;
  border: 2px solid var(--color-border);
  border-radius: 12px;
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.clock-staff-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.clock-staff-card.working {
  border-color: var(--color-accent);
  background: #f1f8f3;
}

.clock-staff-card .staff-name {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
}

.clock-staff-card .staff-status {
  font-size: 12px;
  color: var(--color-text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cfd2c8;
}

.status-dot.on {
  background: #3cb878;
  box-shadow: 0 0 0 3px rgba(60, 184, 120, 0.2);
}

/* ---------- ユーティリティ ---------- */
.text-dim { color: var(--color-text-dim); }
.mt-0 { margin-top: 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-dim);
  font-size: 13px;
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .app-main { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .calendar-grid { grid-template-columns: repeat(7, minmax(70px,1fr)); overflow-x: auto; }
}
