:root {
  --bg: #f4f2ea;
  --ink: #1f1b17;
  --panel: rgba(255, 255, 255, 0.76);
  --accent: #c85a1f;
  --accent-2: #1f7a8c;
  --line: rgba(31, 27, 23, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 0%, #fffbe7 0%, #f4f2ea 58%, #ece8df 100%);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  pointer-events: none;
  filter: blur(64px);
  opacity: 0.35;
  z-index: 0;
}

.bg-orb-a {
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: #ffc27a;
  top: -120px;
  left: -80px;
}

.bg-orb-b {
  width: 400px;
  height: 400px;
  border-radius: 999px;
  background: #88d7d2;
  bottom: -180px;
  right: -120px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1200px, 94vw);
  margin: 28px auto 52px;
  display: grid;
  gap: 18px;
}

.hero {
  background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  animation: slideIn 0.45s ease-out;
}

.top-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.nav-link {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--ink);
  background: #ffffff;
  font-size: 0.9rem;
}

.nav-link.active {
  background: linear-gradient(120deg, var(--accent), #d06d2a);
  color: #fff;
  border-color: transparent;
}

.kicker {
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  margin: 0 0 6px;
  font-size: 12px;
}

h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 2.4vw, 2.3rem); }
.subtitle { margin: 0; color: #52473d; }

.password-inline-form {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.password-inline-form input {
  min-width: 0;
}

.password-inline-form button {
  white-space: nowrap;
}

.password-message {
  margin-top: 8px;
  min-height: 1.2em;
}

.password-message-success {
  color: #166534;
}

.password-message-error {
  color: #b91c1c;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  border-radius: 16px;
  padding: 16px;
  animation: rise 0.35s ease-out;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-span-2 {
  grid-column: 1 / -1;
}

h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.stack {
  display: grid;
  gap: 8px;
}

label { display: grid; gap: 4px; font-size: 0.92rem; }

input, select, button {
  font: inherit;
}

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: #ffffff;
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 12px;
  background: linear-gradient(120deg, var(--accent), #d06d2a);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

button:hover { transform: translateY(-1px); filter: brightness(1.03); }
button:active { transform: translateY(0); }

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.list .small {
  font-size: 0.85rem;
  color: #63574d;
}

.list .danger {
  background: #c83535;
  padding: 5px 9px;
  font-size: 0.85rem;
}

button.danger {
  background: #c83535;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.row-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cards {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.card .label {
  font-size: 0.82rem;
  color: #665a4f;
}

.card .value {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  margin-top: 3px;
}

.table-wrap {
  margin-top: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 9px 10px;
  font-size: 0.92rem;
}

tbody tr:nth-child(even) {
  background: #fcfaf6;
}

tbody tr:hover {
  background: #fff3de;
}

thead th {
  background: #f8f4ec;
  position: sticky;
  top: 0;
}

.hint {
  font-size: 0.88rem;
  color: #6c6156;
}

#resultTable th,
#resultTable td,
#inputTable th,
#inputTable td,
#weeklyInputTable th,
#weeklyInputTable td {
  white-space: nowrap;
}

#resultTable th:first-child,
#resultTable td:first-child,
#inputTable th:first-child,
#inputTable td:first-child,
#weeklyInputTable th:first-child,
#weeklyInputTable td:first-child {
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

#scheduleTable th,
#scheduleTable td {
  white-space: nowrap;
  text-align: center;
}

#scheduleTable th:first-child,
#scheduleTable td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

.role-cell {
  min-width: 62px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 6px 8px;
  font-size: 0.82rem;
  font-family: 'IBM Plex Mono', monospace;
}

.role-none {
  background: #f2f0ec;
  color: #64584d;
}

.role-host {
  background: #ffe0a8;
  color: #533d15;
}

.role-shift {
  background: #c9efec;
  color: #124d56;
}

.role-heimai {
  background: #d9d3ce;
  color: #2e2a26;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .grid-two { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

  .password-inline-form {
    grid-template-columns: 1fr;
  }

@media (max-width: 620px) {
  .cards { grid-template-columns: 1fr; }
  .row-between { flex-direction: column; align-items: flex-start; }
}

/* ── Streamer Performance ─────────────────────────────────────────────── */
.perf-panel {
  margin-top: 12px;
}

/* Room bar chart */
.room-chart {
  margin-top: 16px;
  background: #f8f4ec;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

.room-chart:empty {
  display: none;
}

.room-chart-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a6e64;
  margin-bottom: 10px;
}

.room-chart-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}

.room-chart-label {
  width: 120px;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.room-chart-track {
  flex: 1;
  background: #e9e4d8;
  border-radius: 6px;
  height: 22px;
  overflow: hidden;
}

.room-chart-bar {
  height: 22px;
  border-radius: 6px;
  min-width: 40px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  transition: width 0.4s ease;
}

.room-chart-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
  color: #fff;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.room-chart-meta {
  font-size: 0.78rem;
  color: #8a7e74;
  white-space: nowrap;
  flex-shrink: 0;
  width: 80px;
}

/* Performance table */
#perfTable .perf-expand-cell {
  text-align: center;
  padding: 6px 4px;
}

.perf-expand-btn {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.75rem;
  display: inline-block;
  transition: transform 0.15s;
  user-select: none;
}

.perf-placeholder {
  color: #8a7e74;
  font-style: italic;
  text-align: center;
  padding: 24px;
}

.perf-row:hover {
  background: #fff8ec !important;
}

/* Trend badges */
.trend-up   { color: #059669; font-weight: 600; font-size: 0.84rem; }
.trend-down { color: #dc2626; font-weight: 600; font-size: 0.84rem; }
.trend-flat { color: #9ca3af; font-weight: 600; font-size: 0.84rem; }

/* Drill-down rows */
.perf-drilldown-row > td {
  padding: 0;
  background: #fafaf7;
  border-bottom: 2px solid var(--line);
}

.perf-drilldown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px 6px;
  font-size: 0.9rem;
  background: #f2efe5;
  border-bottom: 1px solid var(--line);
}

.perf-drilldown-close {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #6c5e52;
}

.perf-drilldown-close:hover { background: #ffe4cc; }

.perf-drilldown-wrap {
  padding: 10px 14px 14px;
}

.perf-drilldown-sparkwrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.perf-drilldown-spark-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a7e74;
  white-space: nowrap;
}

.perf-drilldown-tbl th,
.perf-drilldown-tbl td {
  white-space: nowrap;
  font-size: 0.86rem;
  padding: 7px 9px;
}

.perf-drilldown-loading,
.perf-drilldown-empty {
  padding: 18px;
  text-align: center;
  font-size: 0.88rem;
  color: #8a7e74;
  font-style: italic;
}

