:root {
  --brand-color: #0369a1;
  --brand-dark: #0f172a;
  --error-color: #dc2626;
  --error-bg: #fef2f2;
  --success-color: #15803d;
}

body {
  line-height: 1.5;
  text-align: start;
  accent-color: var(--brand-color);
  background-color: #f8fafc;
  color: #0f172a;
}

h1, h2 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

.hero-title {
  font-size: clamp(1.65rem, 1.1rem + 2vw, 2.35rem);
  line-height: 1.2;
}

.prose-cap {
  max-inline-size: 62ch;
}

/* Hides content visually while keeping it accessible to screen readers */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Clean Slate & Sky-Teal Hero */
.hero-banner {
  background:
    radial-gradient(circle at 90% 20%, rgba(56, 189, 248, 0.18), transparent 40%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #0c4a6e 100%);
}

/* Form hints & post-interaction validation (:user-invalid + fallback) */
.field {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.field .hint {
  display: block;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.4;
}

.field input:not([type="radio"]):not([type="checkbox"]):not([type="file"]),
.field select {
  font: inherit;
  font-size: max(1rem, 1em);
  min-block-size: 48px;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.75rem;
  padding: 0.625rem 0.9rem;
  background-color: #ffffff;
  color: #0f172a;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input[type="file"] {
  font: inherit;
  font-size: max(1rem, 1em);
  min-block-size: 48px;
}

.field :is(input, select):focus-visible,
a:focus-visible,
button:focus-visible,
.table-wrapper:focus-visible {
  outline: 3px solid #0284c7;
  outline-offset: 2px;
}

.error-msg {
  display: none;
  color: var(--error-color);
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

:is(input, select, textarea):is(:user-invalid, .user-invalid-fallback) {
  border-color: var(--error-color) !important;
  background-color: var(--error-bg);
}

:is(input, select, textarea):is(:user-invalid, .user-invalid-fallback) + .error-msg,
fieldset:has(input[type="radio"]:is(:user-invalid, .user-invalid-fallback)) .error-msg {
  display: block;
}

:is(input, select, textarea):is(:user-valid, .user-valid-fallback) {
  border-color: var(--success-color);
}

/* Session Cards (+ @supports not accent-color fallback & reduced-motion guard) */
.session-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.15rem;
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .session-card {
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
  }

  .session-card.is-selectable:hover {
    transform: translateY(-2px);
  }
}

.session-card.is-selectable {
  cursor: pointer;
}

.session-card.is-selectable:hover {
  border-color: #38bdf8;
  box-shadow: 0 10px 24px -10px rgba(3, 105, 161, 0.2);
}

.session-card:has(input[type="radio"]:checked) {
  border-color: #0369a1;
  background-color: #f0f9ff;
  box-shadow: 0 10px 24px -10px rgba(3, 105, 161, 0.22);
}

.session-card:has(input[type="radio"]:focus-visible) {
  outline: 3px solid #0284c7;
  outline-offset: 2px;
}

.session-card.is-full {
  background-color: #f8fafc;
  border-color: #e2e8f0;
  opacity: 0.78;
  cursor: not-allowed;
}

.session-card.is-preview {
  cursor: default;
}

.session-card input[type="radio"] {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--brand-color);
  flex-shrink: 0;
  margin-top: 0.15rem;
}

.session-card .radio-indicator {
  display: none;
}

@supports not (accent-color: #0369a1) {
  .session-card input[type="radio"] {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
  }

  .session-card .radio-indicator {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 9999px;
    border: 2px solid #64748b;
    background: #ffffff;
    flex-shrink: 0;
  }

  .session-card input[type="radio"]:checked ~ .radio-indicator,
  .session-card:has(input[type="radio"]:checked) .radio-indicator {
    border-color: #0369a1;
    border-width: 6px;
  }
}

/* Native <progress> quota bar */
progress.quota-progress {
  appearance: none;
  border: 0 solid;
  overflow: clip;
  width: 100%;
  height: 0.5rem;
  border-radius: 9999px;
  background: #e2e8f0;
  --progress-bar-fill: #0284c7;
}

progress.quota-progress.is-warn {
  --progress-bar-fill: #d97706;
}

progress.quota-progress.is-full {
  --progress-bar-fill: #dc2626;
}

progress.quota-progress::-webkit-progress-bar {
  background: transparent;
}

progress.quota-progress::-webkit-progress-value {
  background: var(--progress-bar-fill);
  border-radius: 9999px;
  transition: inline-size 0.3s ease;
}

progress.quota-progress::-moz-progress-bar {
  background: var(--progress-bar-fill);
  border-radius: 9999px;
  transition: inline-size 0.3s ease;
}

/* Responsive site navbar (admin pages) */
.header-inner > * {
  flex-shrink: 0;
  white-space: nowrap;
}

.site-header.is-measuring * {
  transition: none !important;
}

.site-header .menu-button {
  anchor-name: --menu-button;
  min-block-size: 44px;
}

.site-menu {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  background-color: #ffffff;
  box-shadow: 0 10px 25px -8px rgba(15, 23, 42, 0.14);
}

.site-menu[popover] {
  position: fixed;
  inset: auto;
  inset-block-start: 4.25rem;
  inset-block-start: anchor(--menu-button bottom);
  inset-inline-end: 1rem;
  inline-size: min(82dvw, 20rem);
  max-inline-size: calc(100dvw - 2rem);
  block-size: fit-content;
  max-block-size: calc(100dvh - 5.5rem);
  margin-block-start: 0.5rem;
  overflow: auto;
}

@supports not selector(:popover-open) {
  [popover]:not(.\:popover-open) {
    display: none;
  }
}

.site-menu li a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: #334155;
  text-decoration: none;
  min-block-size: 44px;
}

.site-menu[popover] li a {
  display: flex;
  width: 100%;
}

.site-menu li a:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.site-menu li a[aria-current="page"] {
  background-color: #f0f9ff;
  color: #0369a1;
  font-weight: 600;
  border-inline-start: 3px solid #0369a1;
}

.site-header.is-wide .menu-button {
  display: none;
}

.site-header.is-wide .site-menu {
  position: static;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  inline-size: auto;
  max-inline-size: none;
  block-size: auto;
  max-block-size: none;
  overflow: visible;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.site-header.is-wide .site-menu::backdrop {
  display: none;
}

.site-header.is-wide .site-menu li a[aria-current="page"] {
  border-inline-start: 0;
  border-block-end: 2px solid #0369a1;
}

@media (forced-colors: active) {
  .site-menu li a[aria-current="page"] {
    outline: 2px solid Highlight;
  }
}

/* Responsive data table with sticky headers & container-query card stacking */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(560px, 75dvh);
  container-type: inline-size;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  background-color: #ffffff;
}

.responsive-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 0.9375rem;
}

.responsive-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background-color: #f8fafc;
}

.responsive-table thead th {
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: #1e293b;
  border-bottom: 1px solid #cbd5e1;
  text-wrap: balance;
}

.responsive-table tbody th,
.responsive-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.responsive-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background-color: #ffffff;
  font-weight: 600;
  color: #0f172a;
}

.responsive-table tbody tr:hover td,
.responsive-table tbody tr:hover th {
  background-color: #f8fafc;
}

@container (width < 600px) {
  .table-wrapper {
    max-block-size: none;
    border: 0;
    background: transparent;
  }

  .responsive-table,
  .responsive-table thead,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table th,
  .responsive-table td {
    display: block;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table tbody tr {
    margin-block-end: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.875rem;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  }

  .responsive-table tbody th {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background-color: #f0f9ff;
    border-bottom: 1px solid #bae6fd;
  }

  .responsive-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid #f1f5f9;
  }

  .responsive-table tbody td:last-child {
    border-bottom: 0;
  }

  .responsive-table td::before {
    font-weight: 600;
    color: #475569;
    flex-shrink: 0;
  }

  .responsive-table td:nth-child(2)::before { content: var(--label-2, "Kolom 2") ": "; }
  .responsive-table td:nth-child(3)::before { content: var(--label-3, "Kolom 3") ": "; }
  .responsive-table td:nth-child(4)::before { content: var(--label-4, "Kolom 4") ": "; }
  .responsive-table td:nth-child(5)::before { content: var(--label-5, "Kolom 5") ": "; }
  .responsive-table td:nth-child(6)::before { content: var(--label-6, "Kolom 6") ": "; }
}

@media print {
  .no-print {
    display: none !important;
  }
  body {
    background: #ffffff !important;
  }
}

dialog:modal {
  overscroll-behavior: contain;
  margin: auto;
  max-inline-size: min(92dvw, 28rem);
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  padding: 1.5rem;
  background-color: #ffffff;
  color: #0f172a;
  box-shadow: 0 20px 35px -10px rgba(15, 23, 42, 0.3);
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(15, 23, 42, 0.55);
}
