:root {
  --bg: #0a1428;
  --bg-deep: #060d1c;
  --gold: #c8aa6e;
  --gold-bright: #f0e6d2;
  --gold-dim: #785a28;
  --teal: #0ac8b9;
  --blue: #1e90ff;
  --danger: #e74c3c;
  --card: rgba(9, 20, 40, 0.82);
  --line: rgba(200, 170, 110, 0.28);
  --text: #e8e3d3;
  --text-dim: #8b94a7;
  --name-col: 76px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 120px;
}

.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(30, 144, 255, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 110%, rgba(10, 200, 185, 0.1), transparent 60%),
    radial-gradient(ellipse 50% 35% at 5% 100%, rgba(200, 170, 110, 0.08), transparent 60%),
    linear-gradient(180deg, #0a1428 0%, #060d1c 100%);
}

.bg-fx::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(200, 170, 110, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(200, 170, 110, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black, transparent 75%);
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 16px 8px;
  max-width: 980px;
  margin: 0 auto;
}

.logo { display: flex; align-items: center; gap: 12px; }

.logo-icon {
  width: 40px;
  height: 40px;
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(200, 170, 110, 0.5));
  flex: none;
}

.logo h1 {
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(200, 170, 110, 0.35);
}

.tagline { font-size: 12px; color: var(--text-dim); letter-spacing: 1px; }

.date-nav { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(200, 170, 110, 0.08);
  color: var(--gold);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.icon-btn:hover { background: rgba(200, 170, 110, 0.18); border-color: var(--gold); }
.icon-btn svg { width: 18px; height: 18px; }

.date-label {
  min-width: 118px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 20, 40, 0.7);
  color: var(--gold-bright);
  font-size: 14px;
  letter-spacing: 1px;
  cursor: pointer;
}

.date-label.is-today { border-color: var(--teal); color: var(--teal); }

/* ---------- Main ---------- */

main { max-width: 980px; margin: 0 auto; padding: 8px 16px 0; }

.banner {
  margin: 10px 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(200, 170, 110, 0.14), rgba(9, 20, 40, 0.85) 55%);
  position: relative;
  overflow: hidden;
}

.banner::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--teal));
}

.banner-title { font-size: 13px; color: var(--gold); letter-spacing: 2px; margin-bottom: 4px; }

.banner-main { font-size: 19px; font-weight: 600; color: var(--gold-bright); }

.banner-main strong { color: var(--teal); font-size: 22px; }

.banner-sub { margin-top: 6px; font-size: 13px; color: var(--text-dim); }

.banner-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(200, 170, 110, 0.1);
  color: var(--text);
}

.banner.is-empty { background: var(--card); }
.banner.is-empty .banner-main { font-size: 16px; font-weight: 400; color: var(--text-dim); }

/* ---------- Chart card ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  backdrop-filter: blur(6px);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px 10px;
}

.card-head h2 { font-size: 15px; letter-spacing: 3px; color: var(--gold); }

.headcount { font-size: 12px; color: var(--text-dim); }

.chart-scroll { overflow-x: auto; padding: 0 12px 4px; scrollbar-width: thin; }

.chart-inner { min-width: 620px; }

.axis-row,
.heat-row,
.person-row {
  display: grid;
  grid-template-columns: var(--name-col) 1fr;
  align-items: center;
}

.name-col {
  font-size: 13px;
  padding-right: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track { position: relative; height: 26px; }

.axis { height: 20px; border-bottom: 1px solid rgba(200, 170, 110, 0.15); }

.axis-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}

.heat { display: flex; gap: 2px; height: 18px; margin: 6px 0 10px; }

.heat-label { font-size: 11px; color: var(--text-dim); }

.heat-cell { flex: 1; border-radius: 3px; background: rgba(30, 60, 110, 0.35); }
.heat-cell.c1 { background: rgba(30, 144, 255, 0.35); }
.heat-cell.c2 { background: rgba(10, 200, 185, 0.45); }
.heat-cell.c3 { background: rgba(10, 200, 185, 0.7); }
.heat-cell.c4 { background: rgba(200, 170, 110, 0.75); }
.heat-cell.c5 {
  background: linear-gradient(180deg, #f0e6d2, #c8aa6e);
  box-shadow: 0 0 10px rgba(240, 230, 210, 0.45);
}

.person-row { height: 40px; border-top: 1px dashed rgba(200, 170, 110, 0.1); }

.person-name { display: flex; align-items: center; gap: 7px; min-width: 0; }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 6px currentColor; }

.person-row .track { height: 22px; }

.bar {
  position: absolute;
  top: 3px;
  height: 16px;
  border-radius: 4px;
  box-shadow: 0 0 8px -1px currentColor;
  opacity: 0.92;
}

.empty { padding: 34px 0 28px; text-align: center; color: var(--text-dim); font-size: 14px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 16px 14px;
  font-size: 12px;
  color: var(--text-dim);
}

.lg { display: inline-flex; align-items: center; gap: 6px; }

.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-idle { background: rgba(30, 60, 110, 0.35); }
.sw-some { background: rgba(10, 200, 185, 0.6); }
.sw-full { background: linear-gradient(180deg, #f0e6d2, #c8aa6e); }

.tip {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border: none;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #0a1428;
  background: linear-gradient(135deg, #f0e6d2, #c8aa6e 60%, #a0803c);
  box-shadow: 0 6px 24px rgba(200, 170, 110, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s;
}

.fab:hover { transform: translateY(-2px); }
.fab:active { transform: translateY(0); }
.fab svg { width: 18px; height: 18px; }

/* ---------- Modal sheet ---------- */

.modal { position: fixed; inset: 0; z-index: 30; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 15, 0.72);
  backdrop-filter: blur(3px);
}

.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  background: #0b1630;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: rise 0.22s ease-out;
}

@keyframes rise {
  from { transform: translate(-50%, 30px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { font-size: 17px; letter-spacing: 2px; color: var(--gold-bright); }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; color: var(--gold); margin-bottom: 6px; letter-spacing: 1px; }

.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 13, 28, 0.8);
  outline: none;
}

.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(200, 170, 110, 0.2); }

.name-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--teal); font-style: normal; }

.slots-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.slots-head > span { font-size: 13px; color: var(--gold); letter-spacing: 1px; }

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: none;
  color: var(--teal);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 4px;
}

.text-btn svg { width: 14px; height: 14px; }

.slot-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

.slot-row select {
  flex: 1;
  min-width: 0;
  padding: 11px 10px;
  font-size: 15px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 13, 28, 0.8);
}

.slot-row .sep { color: var(--text-dim); font-size: 13px; flex: none; }

.slot-remove {
  flex: none;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(231, 76, 60, 0.4);
  border-radius: 8px;
  background: rgba(231, 76, 60, 0.08);
  color: var(--danger);
  cursor: pointer;
}

.slot-remove svg { width: 16px; height: 16px; }

.form-error { color: var(--danger); font-size: 13px; margin: 4px 0 8px; }

.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }

.submit-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #0a1428;
  background: linear-gradient(135deg, #f0e6d2, #c8aa6e 60%, #a0803c);
  cursor: pointer;
}

.submit-btn:disabled { opacity: 0.6; cursor: wait; }

.danger-btn {
  padding: 14px 16px;
  border: 1px solid rgba(231, 76, 60, 0.5);
  border-radius: 8px;
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
}

@media (max-width: 480px) {
  .logo h1 { font-size: 19px; letter-spacing: 3px; }
  .tagline { font-size: 11px; }
  .banner-main { font-size: 17px; }
  .banner-main strong { font-size: 19px; }
  .fab { right: 14px; left: 14px; justify-content: center; }
}
