:root {
  --surface: #e9ecfa;
  --surface-container-low: #dfe4f5;
  --surface-container: #d3d9ef;
  --surface-container-high: #c7cfea;
  --on-surface: #191830;
  --on-surface-variant: #4c4d72;
  --outline: #6d6f9c;
  --outline-variant: #c3c9e8;
  --primary: #2b2f6e;
  --primary-deep: #1a1c45;
  --on-primary: #eef1fb;
  --gold: #1f95a8;
  --gold-container: #6fd8e0;
  --on-gold-container: #063740;
  --oak: #191833;
  --error: #93000a;
  --success: #2c5223;
  --shadow: rgba(10, 10, 30, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--oak);
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.03), transparent 60%),
    radial-gradient(ellipse at 80% 90%, rgba(255, 255, 255, 0.025), transparent 60%);
  color: var(--on-surface);
  font-family: "Work Sans", system-ui, sans-serif;
  min-height: 100vh;
  padding: 48px 20px 80px;
}

h1,
h2,
h3 {
  font-family: "EB Garamond", Georgia, serif;
  text-wrap: balance;
  margin: 0;
}

.shell {
  max-width: 920px;
  margin: 0 auto;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
}

.brand-seal {
  display: none;
  /* Pre-`cap`-unit fallback for older browsers: ~6 x the estimated
     cap-height of 26px EB Garamond (~0.7em). Browsers that support `cap`
     use the exact value below instead. */
  height: 108px;
  height: 6cap;
  font-family: "EB Garamond", serif;
  font-size: 26px;
}

.brand-seal img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  color: var(--gold-container);
  font-family: "EB Garamond", serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-sub {
  text-align: center;
  color: #a8b0e0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: -4px 0 36px;
  opacity: 0.8;
}

.folio {
  background: var(--surface);
  border: 1px solid var(--outline-variant);
  border-radius: 4px;
  box-shadow: 0 8px 24px var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  position: relative;
  padding: 40px 44px;
}

.folio::before,
.folio::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
  border-color: var(--gold);
  opacity: 0.55;
}

.folio::before {
  top: 14px;
  left: 14px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.folio::after {
  bottom: 14px;
  right: 14px;
  border-bottom: 2px solid;
  border-right: 2px solid;
}

.folio--narrow {
  max-width: 460px;
  margin: 0 auto;
}

.folio--wide {
  max-width: 880px;
  margin: 0 auto;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  row-gap: 8px;
  gap: 24px;
  padding-bottom: 16px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--outline-variant);
  font-size: 14px;
  font-weight: 600;
  /* Reserves real space for .header-actions (position:absolute, so it takes
     none itself) instead of relying on font size/label length happening to
     leave enough of a gap -- the prior fixed-width assumption broke with a
     9th nav item or a slightly larger font. Measured: the button itself is
     ~111px wide, and the 8-item admin nav already wraps to 2 rows at ANY
     reservation above 0 within this folio's 880px cap (there's essentially
     no slack in that nav's own width) -- so this can't avoid the wrap AND
     keep real margin at the same time. Chooses margin: 150px clears the
     button with room to spare even if it grows slightly (a longer/larger
     label), rather than trimming to the ~111-119px range where a single
     extra pixel of button width would reopen the exact click-interception
     bug this reservation exists to close. Reset to 0 below, where
     .header-actions switches to position:static and no longer overlaps. */
  padding-right: 150px;
}

.app-nav a {
  color: var(--on-surface-variant);
  text-decoration: none;
  padding-bottom: 14px;
  margin-bottom: -1px;
}

.app-nav a.current {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.app-nav a:not(.current):hover {
  color: var(--primary-deep);
}

#admin-nav-links {
  display: contents;
}

.eyebrow {
  font-family: "Work Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--outline);
  margin: 0 0 6px;
}

h1 {
  font-size: 34px;
  font-weight: 600;
  color: var(--primary-deep);
  margin: 0 0 6px;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--primary-deep);
  margin: 36px 0 16px;
}

h2:first-child {
  margin-top: 0;
}

.lede {
  color: var(--on-surface-variant);
  font-style: italic;
  margin: 0 0 28px;
}

.rule {
  border: none;
  height: 1px;
  margin: 24px 0;
  background: linear-gradient(90deg, transparent, var(--outline-variant) 20%, var(--outline-variant) 80%, transparent);
}

.text-center {
  text-align: center;
}

form {
  display: block;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--on-surface-variant);
  margin: 22px 0 8px;
}

#dynamic-fields label,
#nsc-dynamic-fields label {
  margin: 4px 0 18px;
}

label:first-child {
  margin-top: 0;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  border: none;
  border-bottom: 1.5px solid var(--outline-variant);
  background: transparent;
  padding: 8px 2px;
  font: 16px "Work Sans", sans-serif;
  color: var(--on-surface);
}

input,
textarea {
  font-style: italic;
}

input[type="checkbox"] {
  display: inline-block;
  width: auto;
}

input::placeholder,
textarea::placeholder {
  color: #8688b0;
  font-style: italic;
}

select {
  font-style: normal;
}

textarea {
  min-height: 76px;
  resize: vertical;
  font-style: normal;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-bottom-color: var(--gold);
  border-bottom-width: 2px;
}

input.invalid,
select.invalid,
textarea.invalid {
  border-bottom-color: var(--error);
  border-bottom-width: 2px;
}

.field-error {
  color: var(--error);
  font-size: 12px;
  margin: 2px 0 0;
  min-height: 14px;
}

button[type="submit"],
.btn-seal {
  font-family: "EB Garamond", serif;
  font-size: 17px;
  font-weight: 600;
  background: radial-gradient(circle at 35% 30%, #3a3d8a, var(--primary-deep) 75%);
  color: var(--on-primary);
  border: none;
  padding: 13px 30px;
  border-radius: 6px;
  box-shadow: 0 3px 0 var(--primary-deep), 0 6px 14px var(--shadow);
  cursor: pointer;
  letter-spacing: 0.02em;
  margin-top: 28px;
}

button[type="submit"]:active,
.btn-seal:active {
  box-shadow: 0 1px 0 var(--primary-deep);
  transform: translateY(2px);
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--on-surface-variant);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 20px;
  vertical-align: middle;
  line-height: 1;
  user-select: none;
}

.btn-danger {
  font-family: "Work Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--error);
  border: 1.5px solid var(--error);
  padding: 9px 18px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-danger:hover {
  background: var(--error);
  color: var(--surface);
}

.header-actions {
  position: absolute;
  top: 40px;
  right: 44px;
}

/* ponytail: 1024px (not 600px) because .header-actions is position:absolute
   and .app-nav only reserves space for it above this breakpoint (see
   .app-nav's own padding-right) -- below it there isn't room for both a
   multi-row nav and a reserved gutter, so .header-actions drops to static
   and stacks below the nav instead, and the reservation resets to 0. */
@media (max-width: 1024px) {
  .header-actions {
    position: static;
    text-align: right;
    margin-bottom: 16px;
  }

  .btn-danger {
    padding: 7px 14px;
    font-size: 13px;
  }

  .app-nav {
    padding-right: 0;
  }
}

.divider-word {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--outline);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 28px 0;
}

.divider-word::before,
.divider-word::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--outline-variant);
}

.oauth-row {
  display: flex;
  gap: 12px;
}

.oauth-row a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--outline-variant);
  background: var(--surface-container-low);
  padding: 11px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
  text-decoration: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline);
  padding: 0 10px 10px;
  border-bottom: 1.5px solid var(--outline-variant);
}

td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--outline-variant);
  font-size: 15px;
}

tr:last-child td {
  border-bottom: none;
}

.ribbon {
  display: inline-flex;
  align-items: center;
  font-family: "Work Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  color: var(--on-gold-container);
  background: var(--gold-container);
  clip-path: polygon(6% 0, 100% 0, 100% 100%, 6% 100%, 0 50%);
  padding-left: 16px;
}

.ribbon.status-checked_in {
  background: #c9dfc2;
  color: #2c5223;
}

.ribbon.status-checked_out {
  background: #d8dae8;
  color: #4c4d72;
}

.ribbon.status-notified {
  background: #d8dae8;
  color: #4c4d72;
}

.ribbon.status-pending {
  background: #fde8b6;
  color: #7a5b00;
}

.ribbon.status-confirmed {
  background: #cfe9ec;
  color: #063740;
}

.ribbon.status-cancelled {
  background: #f3c6c6;
  color: #7a1f1f;
}

.char-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 8px;
}

@media (max-width: 560px) {
  .char-grid {
    grid-template-columns: 1fr;
  }
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

@media (max-width: 560px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}

/* ponytail: wrapping each field in its own div (for the grid) makes every
   label a first-child of that div, so the global label:first-child rule
   above now matches ALL of them instead of just the form's true first
   field -- it silently zeroed the row spacing this grid relies on. Restore
   it here with higher specificity. */
.field-grid > div > label {
  margin-top: 22px;
}

.char-card {
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: 4px;
  padding: 20px;
  position: relative;
}

.char-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 18px;
  width: 16px;
  height: 24px;
  background: var(--gold-container);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
}

.char-card h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.char-meta {
  font-size: 13px;
  color: var(--on-surface-variant);
  margin-bottom: 14px;
}

.char-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-container-high);
  border: 1px solid var(--outline-variant);
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--on-surface-variant);
}

.sealed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-transform: none;
  letter-spacing: 0;
}

.error {
  color: var(--error);
  font-size: 13px;
  font-weight: 600;
}

.success {
  color: var(--success);
  font-size: 13px;
  font-weight: 600;
}

.sub {
  color: var(--on-surface-variant);
  font-size: 13px;
  font-style: normal;
  margin: 8px 0 0;
}

.char-files {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--outline-variant);
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.file-upload-form {
  margin-top: 10px;
}

.file-upload-form button[type="submit"] {
  padding: 9px 20px;
  font-size: 14px;
  margin-top: 8px;
}
