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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  min-height: 100vh;
  font-size: 13px;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.app-header {
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left h1 {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.header-right {
  white-space: nowrap;
}

.nav-btn {
  background: #fff;
  border: 1px solid #d1d1d6;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-btn:hover { background: #f0f0f0; }
.nav-today { font-weight: 600; }

.date-range {
  font-size: 13px;
  color: #6e6e73;
  margin-left: 8px;
}

/* ─── Tabs ────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  padding: 0 24px;
}

.tab {
  background: none;
  border: none;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #6e6e73;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: #1d1d1f; }
.tab.active {
  color: #0071e3;
  border-bottom-color: #0071e3;
}

/* ─── Panels ──────────────────────────────────────────────────────────────── */

.panel { display: none; }
.panel.active { display: block; }

/* ─── Grid ────────────────────────────────────────────────────────────────── */

.grid-wrapper {
  overflow-x: auto;
  padding: 16px;
}

.task-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  overflow: hidden;
}

.task-grid th,
.task-grid td {
  border: 1px solid #e5e5e5;
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
}

.task-grid th {
  background: #f9f9fb;
  font-weight: 600;
  font-size: 12px;
  color: #6e6e73;
  position: sticky;
  top: 0;
  z-index: 1;
}

.task-grid th.row-header {
  width: 160px;
  min-width: 160px;
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f9f9fb;
}

.task-grid td.row-header {
  width: 160px;
  min-width: 160px;
  font-weight: 600;
  font-size: 12px;
  background: #fafafa;
  position: sticky;
  left: 0;
  z-index: 1;
}

.task-grid th.date-col {
  text-align: center;
  min-width: 140px;
}

.task-grid th.today {
  background: #e8f2ff;
  color: #0071e3;
}

.task-grid td.today {
  background: #f0f6ff;
}

.task-grid td.date-cell {
  min-width: 140px;
  min-height: 60px;
  cursor: pointer;
  transition: background 0.1s;
}

.task-grid td.date-cell:hover {
  background: #f0f4ff;
}

/* ─── Task chips ──────────────────────────────────────────────────────────── */

.task-chip {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 3px 6px;
  margin-bottom: 3px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  background: #f0f0f5;
  transition: background 0.1s;
}

.task-chip:hover {
  background: #e0e0ea;
}

.task-chip.completed {
  opacity: 0.5;
  text-decoration: line-through;
}

.task-chip .chip-check {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 1.5px solid #aaa;
  border-radius: 3px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  background: #fff;
  transition: all 0.15s;
}

.task-chip .chip-check:hover {
  border-color: #0071e3;
}

.task-chip.completed .chip-check {
  background: #0071e3;
  border-color: #0071e3;
}

.task-chip.completed .chip-check::after {
  content: '✓';
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.chip-label {
  flex: 1;
  min-width: 0;
}

.chip-staff {
  font-weight: 600;
  color: #0071e3;
  font-size: 11px;
}

.chip-case {
  font-weight: 600;
  color: #0071e3;
  font-size: 11px;
}

.chip-content {
  display: block;
  word-break: break-all;
}

.add-task-btn {
  display: inline-block;
  margin-top: 2px;
  font-size: 11px;
  color: #999;
  cursor: pointer;
  border: none;
  background: none;
  padding: 2px 4px;
  border-radius: 3px;
  transition: all 0.15s;
}

.add-task-btn:hover {
  color: #0071e3;
  background: #e8f2ff;
}

/* ─── Staff settings ──────────────────────────────────────────────────────── */

.settings-card {
  max-width: 640px;
  margin: 24px auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e5e5;
  padding: 24px;
}

.settings-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
}

.staff-form {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.staff-table {
  width: 100%;
  border-collapse: collapse;
}

.staff-table th,
.staff-table td {
  border: 1px solid #e5e5e5;
  padding: 8px 12px;
  text-align: left;
  font-size: 13px;
}

.staff-table th {
  background: #f9f9fb;
  font-weight: 600;
  font-size: 12px;
  color: #6e6e73;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

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

.btn-primary {
  background: #0071e3;
  color: #fff;
}
.btn-primary:hover { background: #0077ed; }

.btn-secondary {
  background: #f0f0f5;
  color: #1d1d1f;
  border: 1px solid #d1d1d6;
}
.btn-secondary:hover { background: #e5e5ea; }

.btn-danger {
  background: #ff3b30;
  color: #fff;
}
.btn-danger:hover { background: #e0332b; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  color: #999;
  border-radius: 4px;
}
.btn-icon:hover { background: #f0f0f5; color: #ff3b30; }

/* ─── Form inputs ─────────────────────────────────────────────────────────── */

.form-input {
  padding: 6px 10px;
  border: 1px solid #d1d1d6;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-input:focus {
  border-color: #0071e3;
}

/* ─── Modal ───────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: #fff;
  border-radius: 12px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e5e5;
}

.modal-header h3 { font-size: 15px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  padding: 4px;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-body label {
  font-size: 12px;
  font-weight: 600;
  color: #6e6e73;
  margin-top: 4px;
}

.modal-body .form-input {
  width: 100%;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid #e5e5e5;
}

/* ─── Toast ───────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1d1d1f;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}

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

/* ─── Utility ─────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
