:root {
  --navy: #0b2d5b;
  --navy-mid: #143f7a;
  --navy-dark: #071e3d;
  --emerald: #164634;
  --emerald-bright: #059669;
  --emerald-hover: #047857;
  --gold: #d4a853;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-tint: #f0f6ff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-sub: #334155;
  --muted: #64748b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 16px rgba(11, 45, 91, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 50px rgba(7, 30, 61, 0.22);

  --st-green-bg: #ecfdf5;
  --st-green-fg: #047857;
  --st-green-bd: #a7f3d0;

  --st-amber-bg: #fffbeb;
  --st-amber-fg: #b45309;
  --st-amber-bd: #fde68a;

  --st-red-bg: #fef2f2;
  --st-red-fg: #b91c1c;
  --st-red-bd: #fecaca;

  --st-blue-bg: #eff6ff;
  --st-blue-fg: #1d4ed8;
  --st-blue-bd: #bfdbfe;

  --st-orange-bg: #fff7ed;
  --st-orange-fg: #c2410c;
  --st-orange-bd: #fed7aa;

  --st-gray-bg: #f1f5f9;
  --st-gray-fg: #64748b;
  --st-gray-bd: #cbd5e1;

  --st-conflict-bg: #fef9c3;
  --st-conflict-fg: #9a3412;
  --st-conflict-bd: #ef4444;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

/* ==================== TOP BAR ==================== */
.topbar {
  background: linear-gradient(90deg, var(--navy-dark) 0%, var(--navy) 55%, #12386c 100%);
  color: #ffffff;
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 2px 12px rgba(7, 30, 61, 0.18);
}
.topbar-inner {
  max-width: 1520px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-title {
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #10b981, var(--emerald));
  border: 1.5px solid var(--gold);
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}
.brand-sub {
  font-size: 11px;
  color: #bfdbfe;
  font-weight: 500;
  display: block;
  margin-top: 1px;
}

.nav-tabs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nav-tab {
  background: rgba(255, 255, 255, 0.09);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
}
.nav-tab:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.nav-tab.active {
  background: #ffffff;
  color: var(--navy);
  border-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-chip { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.user-name { font-weight: 700; }
.sse-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #a7f3d0; font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em;
}
.sse-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}
.role-tag {
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(212, 168, 83, 0.2); color: #fde68a; border: 1px solid rgba(212, 168, 83, 0.5);
}
.btn-ghost-light {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.26);
}
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.22); }

/* ==================== CONTAINERS & COMMON UI ==================== */
.container {
  max-width: 1520px;
  margin: 0 auto;
  padding: 16px 18px 28px;
}
.container-sm { max-width: 580px; margin: 28px auto; padding: 0 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 14px; }
.card-title {
  margin: 0 0 12px;
  font-size: 15.5px;
  font-weight: 800;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.14s ease;
  min-height: 36px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--navy-dark); }
.btn-emerald { background: var(--emerald-bright); color: #fff; box-shadow: 0 2px 8px rgba(5, 150, 105, 0.24); }
.btn-emerald:hover:not(:disabled) { background: var(--emerald-hover); transform: translateY(-1px); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-warn { background: #d97706; color: #fff; }
.btn-warn:hover:not(:disabled) { background: #b45309; }
.btn-outline { background: #fff; border-color: var(--border-strong); color: var(--text-sub); }
.btn-outline:hover:not(:disabled) { background: var(--surface-soft); border-color: var(--navy); color: var(--navy); }
.btn-soft { background: #eef4fb; color: var(--navy); border-color: #d6e4f5; }
.btn-soft:hover:not(:disabled) { background: #e0ecfa; }
.btn-sm { padding: 5px 11px; font-size: 12px; min-height: 31px; border-radius: 7px; }
.btn-xs { padding: 3px 8px; font-size: 11.5px; min-height: 26px; border-radius: 6px; }

.input, .select, .textarea {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(11, 45, 91, 0.1);
}
.textarea { width: 100%; resize: vertical; line-height: 1.55; }

/* ==================== DISPATCH TOP TOOLBAR ==================== */
.dispatch-toolbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.service-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.svc-pill {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  color: var(--text-sub);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}
.svc-pill:hover { border-color: var(--navy); color: var(--navy); background: #fff; }
.svc-pill.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
  box-shadow: 0 2px 6px rgba(11, 45, 91, 0.22);
}

.view-switcher {
  display: inline-flex;
  background: #e9eff6;
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
  margin-left: auto;
}
.view-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 800;
  padding: 6px 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
  word-break: keep-all;
}
.view-btn:hover { color: var(--navy); }
.view-btn.active {
  background: #ffffff;
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 2px;
}

/* ==================== SPLIT DISPATCH WORKSPACE ==================== */
.dispatch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 416px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1120px) {
  .dispatch-layout {
    grid-template-columns: 1fr;
  }
}

/* ==================== LEFT: FULL INTEGRATED MONTH CALENDAR ==================== */
.cal-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cal-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}
.cal-nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-month-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--navy);
  letter-spacing: -0.03em;
  min-width: 118px;
  text-align: center;
}
.cal-kpi-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.kpi-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-sub);
}
.kpi-pill strong { color: var(--navy); font-weight: 800; }
.kpi-pill.kpi-blue { background: var(--st-blue-bg); border-color: var(--st-blue-bd); color: var(--st-blue-fg); }
.kpi-pill.kpi-blue strong { color: var(--st-blue-fg); }
.kpi-pill.kpi-green { background: var(--st-green-bg); border-color: var(--st-green-bd); color: var(--st-green-fg); }
.kpi-pill.kpi-green strong { color: var(--st-green-fg); }
.kpi-pill.kpi-conflict { background: var(--st-conflict-bg); border-color: var(--st-conflict-bd); color: var(--st-conflict-fg); }

.cal-dow-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.cal-dow {
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.cal-dow.sun { color: #dc2626; }
.cal-dow.sat { color: #2563eb; }

.cal-month-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--border);
  gap: 1px;
}
.cal-day-blank {
  background: #f8fafc;
  min-height: 116px;
}
.cal-day {
  background: #ffffff;
  min-height: 122px;
  padding: 7px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: background 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  min-width: 0;
}
.cal-day:hover {
  background: #f8fbff;
  z-index: 2;
}
.cal-day.is-past {
  background: #fafbfc;
}
.cal-day.is-today {
  background: #f5fbf8;
}
.cal-day.is-selected {
  background: var(--surface-tint);
  box-shadow: inset 0 0 0 2.5px var(--navy);
  z-index: 3;
}
.cal-day-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.cal-date-num {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cal-date-num.sun { color: #dc2626; }
.cal-date-num.sat { color: #2563eb; }
.cal-day.is-today .cal-date-num {
  background: var(--navy);
  color: #ffffff;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 11.5px;
  justify-content: center;
}
.cal-day-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 3-Slot Compact Availability Bars inside each Calendar Day */
.cal-slot-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}
.cal-slot-chip {
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 2px;
  font-size: 10.5px;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.1s ease;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-slot-chip:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
}
.cal-slot-chip.tier-open { background: var(--st-green-bg); color: var(--st-green-fg); border-color: var(--st-green-bd); }
.cal-slot-chip.tier-low { background: var(--st-amber-bg); color: var(--st-amber-fg); border-color: var(--st-amber-bd); }
.cal-slot-chip.tier-full { background: var(--st-red-bg); color: var(--st-red-fg); border-color: var(--st-red-bd); }
.cal-slot-chip.tier-booked { background: var(--st-blue-bg); color: var(--st-blue-fg); border-color: var(--st-blue-bd); }
.cal-slot-chip.tier-conflict { background: var(--st-conflict-bg); color: var(--st-conflict-fg); border-color: var(--st-conflict-bd); }
.cal-slot-chip.tier-past { background: var(--st-gray-bg); color: #94a3b8; border-color: #e2e8f0; }

/* Confirmed Booking Event Pills inside Calendar Cells (Google Calendar feel!) */
.cal-events-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 1px;
  min-width: 0;
}
.cal-event-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: none;
  border-left: 3px solid #2563eb;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 4px;
  padding: 2.5px 5px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: inherit;
}
.cal-event-pill:hover { background: #dbeafe; }
.cal-event-pill.is-confirmed { border-left-color: #059669; background: #ecfdf5; color: #065f46; }
.cal-event-pill.is-conflict { border-left-color: #dc2626; background: #fef9c3; color: #9a3412; }
.cal-event-more {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  padding-left: 4px;
}

.cal-footer-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
}
.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ==================== RIGHT: STICKY INSTANT DISPATCH PANEL ==================== */
.dispatch-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 72px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 90px);
}
@media (max-width: 1120px) {
  .dispatch-side {
    position: static;
    max-height: none;
  }
}
.side-head {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  color: #ffffff;
  padding: 14px 16px;
}
.side-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.side-date-title {
  font-size: 17.5px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.side-date-sub {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 3px;
}
.side-slot-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.side-slot-tab {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-sub);
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
  font-family: inherit;
}
.side-slot-tab:hover { border-color: var(--navy); }
.side-slot-tab.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}
.side-slot-tab .cnt {
  display: block;
  font-size: 10.5px;
  font-weight: 600;
  opacity: 0.85;
  margin-top: 1px;
}

.side-body {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.team-dispatch-card {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 12px;
  background: #ffffff;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.team-dispatch-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 3px 12px rgba(11, 45, 91, 0.07);
}
.tdc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.tdc-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sync-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.sync-indicator.ok { background: #10b981; }
.sync-indicator.bad { background: #ef4444; }
.tdc-meta {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px;
}
.tdc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 7px 0 9px;
}

.tdc-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.tdc-slot-btn {
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 7px 5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.25;
  transition: all 0.12s ease;
  font-family: inherit;
  min-height: 52px;
}
.tdc-slot-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.1);
}
.tdc-slot-btn:disabled { cursor: default; opacity: 0.85; }
.tdc-slot-btn .sl-time { font-size: 11px; font-weight: 700; opacity: 0.85; }
.tdc-slot-btn .sl-state { font-size: 12.5px; font-weight: 900; margin-top: 1px; }
.tdc-slot-btn .sl-sub {
  font-size: 10px;
  font-weight: 600;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-bookings-box {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
}
.side-section-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mini-booking-card {
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--st-blue-bd);
  background: #f8fbff;
  margin-bottom: 7px;
  cursor: pointer;
  transition: background 0.12s;
}
.mini-booking-card:hover { background: #eff6ff; }
.mini-booking-card.is-conflict {
  border-color: var(--st-conflict-bd);
  background: var(--st-conflict-bg);
}

/* ==================== VIEW 2: WEEKLY INTEGRATED MATRIX ==================== */
.week-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.week-scroll {
  overflow-x: auto;
}
table.week-matrix {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}
table.week-matrix th {
  background: #f8fafc;
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 800;
  padding: 10px 8px;
  border-bottom: 1.5px solid var(--border);
  border-right: 1px solid var(--border);
  text-align: center;
}
table.week-matrix th.is-today { background: #ecfdf5; color: var(--emerald-hover); }
table.week-matrix th.is-selected { background: var(--surface-tint); box-shadow: inset 0 -3px 0 var(--navy); }
table.week-matrix th.team-col {
  text-align: left;
  width: 220px;
  position: sticky;
  left: 0;
  z-index: 4;
  background: #f1f5f9;
}
table.week-matrix td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
}
table.week-matrix td.team-col {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #ffffff;
  padding: 10px 12px;
  border-right: 1.5px solid var(--border-strong);
}
table.week-matrix tr:hover td { background: #fafcff; }
table.week-matrix tr:hover td.team-col { background: #f8fbff; }

.wm-stack {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wm-slot {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.08s ease;
  text-align: left;
}
.wm-slot:hover:not(:disabled) { transform: scale(1.02); }
.wm-slot:disabled { cursor: default; opacity: 0.85; }
.wm-slot .wm-site {
  font-size: 10px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 78px;
}

/* ==================== VIEW 3: DAY TABLE ==================== */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table.grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}
table.grid th {
  background: #f8fafc;
  color: var(--navy);
  font-size: 12.5px;
  font-weight: 800;
  padding: 12px 10px;
  border-bottom: 1.5px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
table.grid td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.grid tr:hover td { background: #f8fbff; }
.slot-col { text-align: center !important; width: 152px; }

.company-btn {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--navy); font-weight: 800; font-size: 14px; cursor: pointer; text-align: left;
  font-family: inherit;
}
.company-btn:hover { text-decoration: underline; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-block; padding: 2px 7px; border-radius: 5px;
  font-size: 11px; font-weight: 700; background: #eff4fa; color: #1e3a5f;
}
.chip-reg { background: #edf7f2; color: #164634; }

/* Slot Status Buttons */
.slot-btn {
  width: 100%;
  min-height: 46px;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1.5px solid transparent;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.25;
  transition: transform 0.08s ease;
  font-family: inherit;
}
.slot-btn:hover:not(:disabled) { transform: translateY(-1px); }
.slot-btn:disabled { cursor: default; opacity: 0.9; }
.slot-sub { font-size: 10.5px; font-weight: 500; margin-top: 2px; max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.st-green { background: var(--st-green-bg); color: var(--st-green-fg); border-color: var(--st-green-bd); }
.st-red { background: var(--st-red-bg); color: var(--st-red-fg); border-color: var(--st-red-bd); }
.st-blue { background: var(--st-blue-bg); color: var(--st-blue-fg); border-color: var(--st-blue-bd); }
.st-orange { background: var(--st-orange-bg); color: var(--st-orange-fg); border-color: var(--st-orange-bd); }
.st-gray { background: var(--st-gray-bg); color: var(--st-gray-fg); border-color: var(--st-gray-bd); }
.st-conflict { background: var(--st-conflict-bg); color: var(--st-conflict-fg); border: 2px solid var(--st-conflict-bd); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}

/* ==================== MEMBER MONTHLY GRID & MOBILE ==================== */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.month-head { text-align: center; font-size: 11.5px; font-weight: 800; color: var(--muted); padding: 4px 0; }
.month-cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px;
  background: #fff;
  min-height: 74px;
  transition: border-color 0.12s, background 0.12s;
}
.month-cell.clickable { cursor: pointer; }
.month-cell.clickable:hover { border-color: var(--navy); background: #f8fbff; }
.month-cell.is-selected { border: 2px solid var(--navy); background: var(--surface-tint); }
.month-day-num { font-size: 11.5px; font-weight: 800; margin-bottom: 4px; color: var(--navy); }
.mini-slots { display: flex; flex-direction: column; gap: 2.5px; }
.mini-pill {
  font-size: 10px; font-weight: 700; padding: 2px 3px; border-radius: 4px;
  text-align: center; border: 1px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.member-status-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px;
}
.status-toggle {
  padding: 10px 6px; border-radius: 10px; border: 1.5px solid var(--border-strong);
  background: #fff; font-weight: 800; font-size: 13px; cursor: pointer; text-align: center;
  word-break: keep-all; line-height: 1.3; font-family: inherit;
}
.status-toggle.active-ok { background: var(--st-green-bg); border-color: var(--st-green-fg); color: var(--st-green-fg); }
.status-toggle.active-warn { background: var(--st-orange-bg); border-color: var(--st-orange-fg); color: var(--st-orange-fg); }
.status-toggle.active-off { background: var(--st-red-bg); border-color: var(--st-red-fg); color: var(--st-red-fg); }

.today-slots-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }

/* ==================== LOGIN PORTAL ==================== */
.login-shell {
  max-width: 760px;
  margin: 28px auto;
  padding: 0 16px;
}
.login-hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 65%, #164634 100%);
  color: #ffffff;
  border-radius: 16px 16px 0 0;
  padding: 24px 26px;
  border-bottom: 3px solid var(--gold);
}
.login-body {
  background: #ffffff;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 16px 16px;
  padding: 22px 26px;
  box-shadow: var(--shadow);
}
.account-group-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  margin: 14px 0 7px;
  letter-spacing: 0.02em;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 8px;
}
.account-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: all 0.12s;
  font-family: inherit;
}
.account-btn:hover { background: #f0f6ff; border-color: var(--navy); transform: translateY(-1px); }

/* ==================== MODALS & FORMS ==================== */
.overlay {
  position: fixed; inset: 0; background: rgba(7, 30, 61, 0.52);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 14px;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  padding: 22px;
}
.modal-lg { max-width: 860px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; color: var(--navy); }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-sub); margin-bottom: 5px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .form-grid-2 { grid-template-columns: 1fr; } }

.lock-banner {
  padding: 10px 13px; border-radius: 9px;
  background: var(--st-orange-bg); border: 1px solid var(--st-orange-bd); color: var(--st-orange-fg);
  font-size: 12.5px; font-weight: 800; margin-bottom: 14px;
  display: flex; justify-content: space-between; align-items: center;
}

.admin-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.subtab {
  padding: 8px 14px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: #fff; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer;
  font-family: inherit;
}
.subtab.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.check-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px;
  max-height: 180px; overflow-y: auto; padding: 8px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft);
}
.check-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }

.quick-team-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 240px;
  overflow-y: auto;
  padding: 2px;
}
.quick-team-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  transition: all 0.12s;
}
.quick-team-option:hover { border-color: var(--navy); background: #f8fbff; }
.quick-team-option.selected { border-color: var(--emerald-bright); background: var(--st-green-bg); }

/* ==================== MOBILE RESPONSIVE POLISH ==================== */
@media (max-width: 720px) {
  .container { padding: 10px 10px 24px; }
  .topbar-inner { padding: 9px 12px; }
  .view-switcher { width: 100%; justify-content: space-between; margin-left: 0; }
  .view-btn { flex: 1; padding: 6px 6px; font-size: 11.5px; }
  .cal-day, .cal-day-blank { min-height: 82px; padding: 4px 3px; }
  .cal-slot-strip { grid-template-columns: 1fr; gap: 2px; }
  .cal-slot-chip { font-size: 9.5px; padding: 1.5px 2px; }
  .cal-event-pill { display: none; }
  .cal-month-title { font-size: 17px; }
  .tdc-slots { gap: 4px; }
  .tdc-slot-btn { padding: 6px 3px; min-height: 48px; }
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--navy-dark); color: #fff; padding: 11px 20px; border-radius: 11px;
  font-size: 13px; font-weight: 700; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  z-index: 400; max-width: calc(100vw - 24px); text-align: center;
}
