:root {
  --bg0: #071018;
  --bg1: #0c1a24;
  --panel: rgba(10, 26, 36, 0.88);
  --line: #1d3a48;
  --text: #e8f3f6;
  --mute: #8eacb8;
  --ok: #06d6a0;
  --warn: #f4a261;
  --stop: #ef476f;
  --gold: #d4a373;
  --teal: #2ec4b6;
  --font: "Be Vietnam Pro", sans-serif;
  --mono: "JetBrains Mono", monospace;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 480px at 90% -5%, rgba(212, 163, 115, 0.14), transparent 55%),
    radial-gradient(700px 420px at -5% 15%, rgba(46, 196, 182, 0.12), transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.hero {
  position: relative;
  min-height: min(72vh, 640px);
  display: grid;
  align-items: end;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 16, 24, 0.25), rgba(7, 16, 24, 0.92)),
    url("/calendar/assets/hero.jpg") center / cover no-repeat;
  transform: scale(1.02);
  animation: drift 18s ease-in-out infinite alternate;
}
.hero-inner {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 36px;
  display: grid;
  gap: 16px;
}
.brand-block {
  animation: rise 0.8s ease both;
  max-width: 920px;
}
.brand {
  margin: 0;
  font-family: "Cormorant Garamond", "Be Vietnam Pro", serif;
  font-size: clamp(42px, 7.2vw, 78px);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 0.95;
  color: #f6e7c8;
  background: linear-gradient(115deg, #fff8ea 0%, #e8c48a 38%, #f7efd8 58%, #c9964a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.45));
  position: relative;
}
.brand::after {
  content: "";
  display: block;
  width: min(220px, 46%);
  height: 2px;
  margin-top: 14px;
  background: linear-gradient(90deg, #d4a373, rgba(212, 163, 115, 0));
}
.brand-sub {
  margin: 14px 0 0;
  color: #b9ced6;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}
.live-status {
  display: flex;
  gap: 18px;
  align-items: center;
  max-width: 760px;
  padding: 20px 22px;
  border-radius: 20px;
  border: 1px solid color-mix(in srgb, var(--tone, var(--ok)) 42%, rgba(255,255,255,0.08));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--tone, var(--ok)) 16%, transparent), transparent 55%),
    rgba(7, 16, 24, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  animation: rise 0.9s ease 0.08s both;
}
.live-status.tone-ok { --tone: var(--ok); }
.live-status.tone-warn { --tone: var(--warn); }
.live-status.tone-danger { --tone: var(--stop); }
.status-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 14px;
  position: relative;
  background: color-mix(in srgb, var(--tone, var(--ok)) 18%, #071018);
  border: 1px solid color-mix(in srgb, var(--tone, var(--ok)) 55%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 8px 20px rgba(0,0,0,0.28);
}
.status-mark::before,
.status-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
}
/* OK check */
.live-status.tone-ok .status-mark::before {
  width: 16px;
  height: 9px;
  border-left: 2.5px solid var(--ok);
  border-bottom: 2.5px solid var(--ok);
  transform: translate(1px, -1px) rotate(-45deg);
}
/* WARN dash */
.live-status.tone-warn .status-mark::before {
  width: 16px;
  height: 2.5px;
  background: var(--warn);
  border-radius: 2px;
}
.live-status.tone-warn .status-mark::after {
  width: 2.5px;
  height: 10px;
  top: 11px;
  bottom: auto;
  background: var(--warn);
  border-radius: 2px;
}
/* STOP cross */
.live-status.tone-danger .status-mark::before,
.live-status.tone-danger .status-mark::after {
  width: 18px;
  height: 2.5px;
  background: var(--stop);
  border-radius: 2px;
}
.live-status.tone-danger .status-mark::before { transform: rotate(45deg); }
.live-status.tone-danger .status-mark::after { transform: rotate(-45deg); }
.status-copy { min-width: 0; }
.status-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tone, var(--ok)) 75%, #fff);
  font-weight: 600;
}
.live-status h1 {
  margin: 0;
  font-family: "Cormorant Garamond", "Be Vietnam Pro", serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #f4f7f8;
}
.live-status #stShort {
  margin: 6px 0 0;
  color: #9eb4bd;
  font-size: 14px;
  line-height: 1.45;
}
.hero-meta { margin: 0; color: #c7d9e0; font-size: 14px; animation: rise 1s ease 0.12s both; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  color: var(--mute);
  font-size: 13px;
  animation: rise 1.05s ease 0.16s both;
}
.ff-legend img {
  width: 18px;
  height: 18px;
  vertical-align: -4px;
  margin-right: 4px;
  border-radius: 4px;
}
.legend .dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
  vertical-align: middle;
}
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.warn { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.dot.stop { background: var(--stop); box-shadow: 0 0 10px var(--stop); }

.wrap {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
  display: grid;
  gap: 18px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.tab.on {
  background: linear-gradient(135deg, #2ec4b6, #1b9aaa);
  color: #042025;
  border-color: transparent;
}
.hint { margin: 0; color: var(--mute); font-size: 13px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-head h2 { margin: 0; font-size: 18px; }
.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(46, 196, 182, 0.16);
  color: var(--teal);
}
.badge.soft { background: rgba(212, 163, 115, 0.14); color: var(--gold); }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.day {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 10px;
  min-height: 168px;
  width: 100%;
  background: rgba(7, 16, 24, 0.55);
  display: grid;
  gap: 6px;
  align-content: start;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.day:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.28);
  border-color: color-mix(in srgb, var(--teal) 45%, var(--line));
}
.day:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.day .d-time {
  color: var(--gold);
  font-family: var(--mono);
  font-weight: 600;
  margin-right: 2px;
}
.day.today { border-color: var(--teal); box-shadow: inset 0 0 0 1px rgba(46,196,182,0.35); }
.day.past { opacity: 0.62; }
.day.ok { border-top: 3px solid var(--ok); }
.day.warn { border-top: 3px solid var(--warn); }
.day.stop { border-top: 3px solid var(--stop); }
.day .d-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.day .d-sym { font-size: 20px; }
.day .d-date { font-family: var(--mono); font-size: 11px; color: var(--mute); }
.day .d-label { font-weight: 700; font-size: 14px; }
.day .d-short { font-size: 12px; color: var(--mute); line-height: 1.35; }
.day .d-list { display: grid; gap: 4px; margin-top: 2px; }
.day .d-ev {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 6px;
  align-items: start;
  font-size: 11px;
  line-height: 1.3;
  color: #d5e6ec;
}
.day .d-ev img { width: 14px; height: 14px; border-radius: 3px; margin-top: 1px; }
.day .d-empty { font-size: 12px; color: #5f7882; }
.day .d-more { font-size: 11px; color: var(--gold); }
.day .d-count {
  margin-top: 2px;
  font-size: 11px;
  color: var(--gold);
  font-family: var(--mono);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th { color: var(--mute); font-weight: 600; font-size: 12px; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pill.ok { background: rgba(6,214,160,0.12); color: var(--ok); }
.pill.warn { background: rgba(244,162,97,0.14); color: var(--warn); }
.pill.stop { background: rgba(239,71,111,0.14); color: var(--stop); }
.impact-cell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ff-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}

.foot {
  color: var(--mute);
  font-size: 13px;
  display: grid;
  gap: 4px;
  padding: 8px 2px 0;
}

.modal.hidden { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: end center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 8, 12, 0.72);
  backdrop-filter: blur(4px);
}
.modal-sheet {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100% - 16px));
  max-height: min(82vh, 760px);
  overflow: auto;
  margin-bottom: 12px;
  background: rgba(10, 26, 36, 0.97);
  border: 1px solid var(--line);
  border-radius: 22px 22px 16px 16px;
  box-shadow: var(--shadow);
  padding: 16px 16px 20px;
  animation: rise 0.28s ease both;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}
.modal-head h3 { margin: 4px 0; font-size: 22px; }
.hint-mini { font-size: 11px; color: var(--mute); margin-top: 2px; }
body.modal-open { overflow: hidden; }

@media (min-width: 820px) {
  .modal { place-items: center; }
  .modal-sheet {
    margin: 0;
    border-radius: 22px;
    max-height: min(78vh, 720px);
  }
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  min-height: 36px;
}
.pager:empty { display: none; }
.pager .pager-info {
  color: var(--mute);
  font-size: 12px;
  margin-right: 4px;
}
.pager button {
  border: 1px solid var(--line);
  background: rgba(7, 20, 28, 0.75);
  color: var(--text);
  border-radius: 10px;
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pager button:hover { border-color: var(--acc); color: var(--acc); }
.pager button.on {
  background: linear-gradient(135deg, rgba(46, 196, 182, 0.28), rgba(27, 154, 170, 0.22));
  border-color: rgba(46, 196, 182, 0.55);
  color: #9ff3e8;
}
.pager button:disabled {
  opacity: 0.35;
  cursor: default;
}

@keyframes drift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.06) translate3d(-1.2%, -1%, 0); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 900px) {
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .hero { min-height: 58vh; }
}
@media (max-width: 520px) {
  .week-grid { grid-template-columns: 1fr; }
}
