:root {
  --bg-0: #060607;
  --bg-1: #0b0c0f;
  --bg-2: #121319;
  --surface-0: rgba(16, 17, 22, 0.78);
  --surface-1: rgba(20, 22, 28, 0.92);
  --surface-2: #171921;
  --text-1: #f5f5f0;
  --text-2: #d1d1ca;
  --text-3: #a8a9a2;
  --line-1: rgba(255, 255, 255, 0.12);
  --line-2: rgba(255, 255, 255, 0.08);
  --gold: #c9a84c;
  --gold-soft: #dec07b;
  --gold-shadow: rgba(201, 168, 76, 0.32);
  --danger: #da6d66;
  --success: #5bbf7e;
  --info: #7ba6d6;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 20px;
  --ease-standard: cubic-bezier(0.33, 0, 0.67, 1);
  --ease-enter: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--text-1);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at 12% -8%, rgba(201, 168, 76, 0.2), transparent 42%),
    radial-gradient(circle at 85% -12%, rgba(201, 168, 76, 0.14), transparent 45%),
    linear-gradient(160deg, #08090c 0%, #0d0f14 48%, #08090c 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 100% 4px;
  opacity: 0.18;
  z-index: -1;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: #fff;
  color: #000;
  padding: 0.5rem 0.75rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 70;
  background: transparent;
}

.scroll-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #b8923d 0%, #dec07b 100%);
  box-shadow: 0 0 18px var(--gold-shadow);
  transition: width 150ms linear;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-1);
  background: linear-gradient(135deg, rgba(14, 15, 19, 0.9), rgba(11, 12, 16, 0.68));
}

.topbar-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.95rem 1.4rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.15rem;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  width: 170px;
  max-width: 44vw;
  height: auto;
  display: block;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.55rem;
  flex-wrap: wrap;
}

.topnav a {
  position: relative;
  color: var(--text-2);
  text-decoration: none;
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 1.07rem;
  transition: color 260ms var(--ease-standard), letter-spacing 260ms var(--ease-standard);
}

.topnav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.28rem;
  width: 100%;
  height: 2px;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  transition: transform 340ms var(--ease-enter);
}

.topnav a:hover,
.topnav a.active {
  color: var(--text-1);
  letter-spacing: 0.12em;
}

.topnav a:hover::after,
.topnav a.active::after {
  transform: scaleX(1);
}

.logout-form {
  margin: 0;
}

.admin-chip {
  border: 1px solid rgba(222, 192, 123, 0.38);
  border-radius: 999px;
  padding: 0.35rem 0.82rem;
  color: var(--text-2);
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(12, 13, 17, 0.68);
}

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 1.4rem;
  display: grid;
  gap: 1rem;
}

.page-intro {
  border: 1px solid var(--line-1);
  border-radius: var(--radius-l);
  background: linear-gradient(145deg, rgba(18, 20, 27, 0.88), rgba(12, 13, 18, 0.96));
  padding: 1.15rem 1.15rem 1rem;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
}

.page-kicker {
  margin: 0 0 0.38rem;
  color: var(--gold-soft);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  font-family: "Barlow Condensed", sans-serif;
}

.page-title {
  margin: 0;
  color: var(--text-1);
  line-height: 1;
  font-size: clamp(2.05rem, 3.8vw, 2.85rem);
  letter-spacing: 0.03em;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
}

.page-subtitle {
  margin: 0.45rem 0 0;
  color: var(--text-3);
  max-width: 74ch;
  font-size: 0.95rem;
}

.card {
  border: 1px solid var(--line-1);
  border-radius: var(--radius-m);
  background: linear-gradient(145deg, rgba(24, 26, 35, 0.88), rgba(16, 17, 23, 0.95));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.26);
  padding: 1.05rem;
}

.grid {
  display: grid;
  gap: 0.95rem;
}

.flash-list {
  display: grid;
  gap: 0.62rem;
}

.flash {
  border: 1px solid var(--line-1);
  border-left: 4px solid var(--gold);
  border-radius: 10px;
  background: rgba(22, 24, 32, 0.82);
  color: var(--text-2);
  padding: 0.72rem 0.82rem;
}

.flash.error {
  border-left-color: var(--danger);
}

.flash.success {
  border-left-color: var(--success);
}

.flash.info {
  border-left-color: var(--info);
}

.auth-box {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}

.section-title,
h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0.04em;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  color: var(--text-1);
}

.section-title,
h2 {
  font-size: clamp(1.65rem, 2.6vw, 2.2rem);
}

h1 {
  font-size: clamp(1.9rem, 3vw, 2.6rem);
}

.muted {
  color: var(--text-3);
}

label {
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 0.84rem;
}

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-s);
  border: 1px solid var(--line-1);
  background: rgba(10, 11, 15, 0.76);
  color: var(--text-1);
  padding: 0.62rem 0.7rem;
  font-family: "Manrope", sans-serif;
}

input::placeholder,
textarea::placeholder {
  color: #7f8179;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(201, 168, 76, 0.34);
  outline-offset: 1px;
  border-color: rgba(201, 168, 76, 0.8);
}

input[type="file"] {
  padding: 0.45rem;
}

input[type="date"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(84%) sepia(20%) saturate(620%) hue-rotate(356deg) brightness(92%) contrast(93%);
  cursor: pointer;
}

input,
select,
textarea,
button,
a {
  min-height: 44px;
}

.field {
  display: grid;
  gap: 0.34rem;
}

.field-grid {
  display: grid;
  gap: 0.68rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field.full {
  grid-column: 1 / -1;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.72rem;
}

.toolbar-actions,
.filter-actions,
.inline-form,
.pager-actions,
.action-row {
  display: flex;
  align-items: center;
  gap: 0.58rem;
  flex-wrap: wrap;
}

.inline-form {
  gap: 0.45rem;
}

.btn {
  position: relative;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.58rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: "Manrope", sans-serif;
  cursor: pointer;
  transition:
    transform 260ms var(--ease-standard),
    border-color 260ms var(--ease-standard),
    color 260ms var(--ease-standard),
    background 260ms var(--ease-standard),
    box-shadow 260ms var(--ease-standard);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible,
a:focus-visible {
  outline: 2px solid rgba(201, 168, 76, 0.7);
  outline-offset: 2px;
}

.btn-primary {
  color: #1a160c;
  background: linear-gradient(130deg, #b8923d, #dec07b);
  border-color: rgba(222, 192, 123, 0.8);
  box-shadow: 0 8px 22px rgba(172, 133, 47, 0.34);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(172, 133, 47, 0.4);
}

.btn-secondary,
.btn-logout {
  color: var(--text-1);
  background: rgba(16, 18, 24, 0.74);
  border-color: rgba(255, 255, 255, 0.16);
}

.btn-secondary:hover,
.btn-logout:hover {
  transform: translateY(-1px);
  border-color: rgba(222, 192, 123, 0.6);
  color: var(--gold-soft);
}

.btn-link-disabled,
.btn-disabled {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #7f8079;
  background: rgba(13, 14, 18, 0.74);
  padding: 0.58rem 0.9rem;
  font-size: 0.82rem;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 930px;
  background: rgba(11, 12, 16, 0.45);
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line-2);
  padding: 0.72rem 0.58rem;
  color: var(--text-2);
  vertical-align: middle;
}

th {
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.78rem;
  font-family: "Barlow Condensed", sans-serif;
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(16, 17, 23, 0.95);
}

tbody tr:hover td {
  background: rgba(201, 168, 76, 0.08);
}

.sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.sort-link:hover {
  color: var(--gold-soft);
}

.sort-arrow {
  color: var(--gold-soft);
  font-size: 0.8rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  border-radius: 999px;
  font-size: 0.73rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border: 1px solid transparent;
}

.status-badge.pending,
.status-badge.viewed {
  color: #241e10;
  background: linear-gradient(160deg, #c3913d, #e0bc73);
  border-color: rgba(224, 188, 115, 0.68);
}

.status-badge.signed {
  color: #f2fff5;
  background: rgba(54, 136, 87, 0.42);
  border-color: rgba(91, 191, 126, 0.6);
}

.status-badge.expired {
  color: #ffe9e7;
  background: rgba(120, 42, 42, 0.44);
  border-color: rgba(218, 109, 102, 0.62);
}

.filters-form {
  display: grid;
  gap: 0.74rem;
  margin-bottom: 0.95rem;
}

.filters-grid {
  display: grid;
  gap: 0.68rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.field.actions {
  align-content: end;
}

.pager {
  margin-top: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.api-grid {
  display: grid;
  gap: 0.72rem;
}

.api-endpoint {
  border: 1px solid var(--line-1);
  border-radius: 12px;
  padding: 0.86rem;
  background: rgba(15, 16, 22, 0.9);
}

.api-endpoint h2 {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
  font-size: clamp(1.2rem, 2.1vw, 1.45rem);
}

.api-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 0.13rem 0.48rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  font-family: "Barlow Condensed", sans-serif;
}

.api-method.post {
  color: #f2fff5;
  background: rgba(54, 136, 87, 0.36);
  border: 1px solid rgba(91, 191, 126, 0.5);
}

.api-method.get {
  color: #edf5ff;
  background: rgba(58, 100, 154, 0.4);
  border: 1px solid rgba(108, 153, 218, 0.45);
}

.api-path,
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.api-path {
  color: var(--text-1);
  font-size: 0.9rem;
}

code {
  border-radius: 6px;
  padding: 0.08rem 0.26rem;
  background: rgba(8, 9, 12, 0.9);
  border: 1px solid var(--line-2);
  color: #efe6cd;
}

pre {
  margin: 0.6rem 0 0;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(8, 9, 12, 0.96);
  color: #ecebe6;
  padding: 0.72rem;
  font-size: 0.81rem;
  overflow-x: auto;
}

pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

.section-reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: transform 520ms var(--ease-enter), opacity 520ms var(--ease-enter);
}

.section-reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 1120px) {
  .topbar-inner {
    padding: 0.84rem 1rem;
  }

  .topnav {
    gap: 1.05rem;
  }

  .topnav a {
    font-size: 0.96rem;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar-inner {
    grid-template-columns: 1fr auto;
    gap: 0.68rem;
  }

  .topnav {
    order: 3;
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
    padding-bottom: 0.2rem;
  }

  .brand-logo {
    width: 148px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0.95rem;
  }

  .card {
    border-radius: 12px;
    padding: 0.86rem;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 2rem;
  }

  .toolbar {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .section-reveal {
    opacity: 1;
    transform: none;
  }
}
