:root {
  --bg-1: #fff8ea;
  --bg-2: #eef7ff;
  --ink: #18203a;
  --muted: #5a617b;
  --panel: rgba(255, 255, 255, 0.86);
  --line: #dfe5f4;
  --accent: #0b6e99;
  --accent-2: #f26419;
  --danger: #bf2f3a;
  --ok: #0d8f57;
  --radius: 18px;
  --shadow: 0 14px 44px rgba(24, 32, 58, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 0%, var(--bg-1), transparent 38%),
    radial-gradient(circle at 85% 15%, var(--bg-2), transparent 42%),
    linear-gradient(135deg, #f9fbff, #fffdf7 58%);
}

.orb {
  position: fixed;
  z-index: 0;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(46px);
  opacity: 0.42;
  pointer-events: none;
}

.orb-left {
  background: #9ce6ff;
  top: -120px;
  left: -80px;
}

.orb-right {
  background: #ffc193;
  top: 18%;
  right: -110px;
}

.layout {
  position: relative;
  z-index: 1;
  width: min(1280px, 94vw);
  margin: 28px auto 42px;
  display: grid;
  gap: 20px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  animation: rise-in 360ms ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 72px;
  height: 72px;
}

.brand h1 {
  margin: 0 0 4px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.65rem, 2.6vw, 2.2rem);
  letter-spacing: 0.2px;
}

.brand p {
  margin: 0;
  color: var(--muted);
}

.hero-link-row {
  margin-top: 10px;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  font-weight: 600;
  color: #0b6e99;
}

.hero-link:hover {
  text-decoration: underline;
}

.gear-btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  background: #fff;
  color: #28476a;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.gear-btn:hover {
  box-shadow: 0 8px 18px rgba(24, 32, 58, 0.12);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 120px));
  gap: 10px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  text-align: center;
}

.stat-card span {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
}

.stat-card strong {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.5rem;
}

.stat-card.warning strong {
  color: var(--accent-2);
}

.workflow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: rise-in 440ms ease;
}

.panel h2 {
  margin: 0 0 8px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 1.25rem;
}

.panel p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.stack-form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.93rem;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 110, 153, 0.14);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  background: #ebf4fb;
  color: #0a4f70;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(11, 110, 153, 0.16);
}

.btn.primary {
  background: linear-gradient(135deg, #0b6e99, #1591c7);
  color: #ffffff;
}

.btn.danger {
  background: #feecef;
  color: var(--danger);
}

.panel.wide {
  padding: 16px;
}

.seminar-toolbar {
  display: grid;
  gap: 12px;
}

.seminar-toolbar-head p {
  margin: 4px 0 0;
}

.seminar-toolbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.seminar-toolbar-actions select {
  min-width: 260px;
  max-width: 460px;
}

.seminar-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.seminar-lists h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: #3e4c70;
}

.week-snapshot {
  display: grid;
  gap: 10px;
}

.week-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.week-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.week-controls {
  display: flex;
  gap: 8px;
}

.week-filter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.week-filter label {
  color: #3e4c70;
  font-weight: 600;
  min-width: 44px;
}

.week-filter select {
  width: auto;
  min-width: 280px;
}

.filter-count {
  color: #3e4c70;
  font-size: 0.88rem;
  font-weight: 600;
}

.week-legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
}

.week-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.week-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.week-card:hover {
  transform: translateY(-1px);
  border-color: #b8d6ea;
  box-shadow: 0 8px 20px rgba(24, 32, 58, 0.12);
}

.week-card h4 {
  margin: 0;
  font-size: 1rem;
  color: #21375a;
}

.week-card .date {
  color: var(--muted);
  font-size: 0.88rem;
}

.week-card .hint {
  color: #496287;
  font-size: 0.8rem;
}

.badge {
  display: inline-block;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-today {
  background: #dff8e8;
  color: #0d8f57;
}

.badge-running {
  background: #e8f4ff;
  color: #0b6e99;
}

.badge-soon {
  background: #fff3d9;
  color: #b06b00;
}

.badge-expired {
  background: #ffe7ea;
  color: #bf2f3a;
}

.chip-list {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: #fff;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dbe7f2;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f4f9ff;
  color: #264a6f;
  font-size: 0.84rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.chip:hover {
  transform: translateY(-1px);
  border-color: #bcd3e6;
  box-shadow: 0 7px 16px rgba(24, 32, 58, 0.1);
}

.chip.is-active {
  background: #e8f4ff;
  border-color: #77b6dc;
  color: #0a4f70;
  box-shadow: 0 0 0 2px rgba(11, 110, 153, 0.12);
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.table-head h2 {
  margin: 0;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.inline-form {
  display: flex;
  gap: 8px;
}

.inline-form input {
  min-width: 160px;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  border-bottom: 1px solid #edf1fa;
  text-align: left;
  padding: 10px;
  white-space: nowrap;
}

th {
  background: #eff6fb;
  color: #28476a;
  font-size: 0.92rem;
}

td:nth-child(2) {
  width: 42%;
}

#participantsBody tr[data-index] {
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

#participantsBody tr[data-index]:nth-child(odd) {
  background: #f8fbff;
}

#participantsBody tr[data-index]:nth-child(even) {
  background: #ffffff;
}

#participantsBody tr[data-index]:hover {
  background: #e9f4ff;
  cursor: pointer;
}

.name-input {
  min-width: 210px;
}

.seminar-input {
  min-width: 180px;
}

.key-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1f7fb;
  border: 1px solid #dceaf4;
  font-family: Consolas, "Courier New", monospace;
  letter-spacing: 0.35px;
}

.small-btn {
  padding: 7px 9px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #264a6f;
  cursor: pointer;
  margin-right: 6px;
}

.small-btn.delete {
  color: var(--danger);
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  min-width: 240px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 12px;
  color: #ffffff;
  background: rgba(24, 32, 58, 0.94);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 32, 58, 0.36);
}

.modal-card {
  position: relative;
  width: min(560px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
  z-index: 1;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-head h2 {
  margin: 0;
}

.portal-shell {
  position: relative;
  z-index: 1;
  width: min(1100px, 95vw);
  margin: 20px auto 30px;
}

.portal-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(24, 32, 58, 0.08);
  padding: 16px;
  animation: rise-in 420ms ease;
}

.portal-card h2 {
  margin: 0 0 6px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

.portal-card p {
  margin: 0 0 14px;
  color: var(--muted);
}

.result-meta {
  margin: -4px 0 10px;
  color: #5d6d8a;
  font-size: 0.82rem;
}

.portal-week {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfdff;
}

.portal-week h3 {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 0.96rem;
}

.portal-week #weekLabel {
  margin: 4px 0 8px;
  color: #3e4c70;
  font-size: 0.78rem;
}

.portal-week .week-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.portal-week .week-card.is-active {
  background: #edf6ff;
  border-color: #6aa8cd;
  box-shadow: 0 0 0 1px rgba(11, 110, 153, 0.18);
}

.portal-week .week-card {
  padding: 9px;
  gap: 4px;
  border-radius: 10px;
}

.portal-week .week-card h4 {
  font-size: 0.88rem;
}

.portal-week .week-card .date {
  font-size: 0.74rem;
}

.portal-pin {
  margin-top: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-pin-meta {
  display: grid;
  gap: 2px;
}

.portal-pin-meta span {
  font-size: 0.75rem;
  color: #647694;
}

.portal-pin-meta strong {
  font-size: 0.92rem;
  color: #1f3658;
}

.portal-pin-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.portal-pin-controls input {
  width: 140px;
}

.portal-pin-controls .btn,
.week-controls .small-btn,
.table-actions .btn,
.table-actions .small-btn,
.gear-btn {
  min-height: 42px;
}

.key-badge {
  overflow-wrap: anywhere;
}

.result-box .copy-key {
  cursor: pointer;
  border: 1px solid #dceaf4;
  background: #f1f7fb;
}

.result-box .copy-key:hover,
.result-box .copy-key:focus {
  border-color: #6aa8cd;
  background: #e8f3fb;
  outline: none;
}

.result-box {
  margin-top: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
}

.result-box h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
}

.result-box tbody tr {
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.result-box tbody tr:nth-child(odd) {
  background: #f8fbff;
}

.result-box tbody tr:nth-child(even) {
  background: #ffffff;
}

.result-box tbody tr:hover {
  background: #e9f4ff;
  cursor: pointer;
}

.result-box tbody td {
  user-select: text;
}

.portal-branding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfe;
}

.portal-logo {
  display: block;
  max-height: 40px;
  width: auto;
  object-fit: contain;
}

.portal-logo.header {
  max-width: 52%;
}

.portal-logo.watermark {
  max-width: 32%;
  opacity: 0.82;
}

.result-key {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #dceaf4;
  background: #f1f7fb;
  font-family: Consolas, "Courier New", monospace;
  letter-spacing: 0.4px;
  font-size: 1.08rem;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .layout {
    width: min(1280px, 96vw);
  }

  .workflow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    flex-direction: column;
  }

  .table-head {
    flex-direction: column;
    align-items: stretch;
  }

  .table-actions {
    justify-content: flex-start;
  }

  .seminar-lists {
    grid-template-columns: 1fr;
  }

  .week-cards {
    grid-template-columns: 1fr;
  }

  .week-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .week-filter {
    flex-direction: column;
    align-items: flex-start;
  }

  .week-filter select {
    width: 100%;
    min-width: 0;
  }

  .portal-card {
    padding: 14px;
  }

  .portal-week .week-cards {
    grid-template-columns: 1fr;
  }

  .filter-count {
    font-size: 0.84rem;
  }
}

@media (max-width: 760px) {
  .layout {
    width: min(1280px, 96vw);
    margin-top: 12px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
  }

  .grid-two {
    grid-template-columns: 1fr;
  }

  .workflow {
    grid-template-columns: 1fr;
  }

  .inline-form {
    width: 100%;
    flex-direction: column;
  }

  .inline-form input {
    min-width: 0;
  }

  .portal-branding {
    gap: 10px;
  }

  .portal-pin {
    flex-direction: column;
    align-items: flex-start;
  }

  .portal-pin-controls {
    width: 100%;
  }

  .portal-pin-controls input {
    width: 100%;
  }

  .portal-pin-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-pin-controls .btn {
    width: 100%;
  }

  .week-controls {
    flex-wrap: wrap;
  }

  .table-wrap table {
    min-width: 680px;
  }

  .portal-logo.header,
  .portal-logo.watermark {
    max-width: 48%;
  }
}
