:root {
  --red-900: #67000d;
  --red-800: #8d0011;
  --red-700: #a90015;
  --red: #c40018;
  --red-soft: #fff1f3;
  --gold: #f2b600;
  --gold-soft: #fff7d6;
  --ink: #1e2028;
  --muted: #6b7280;
  --line: #e7e9ee;
  --paper: #ffffff;
  --bg: #f6f7fb;
  --success: #0f8f55;
  --danger: #b42318;
  --shadow: 0 18px 60px rgba(36, 16, 20, 0.13);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

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

.brand__logo {
  width: 158px;
  height: auto;
}

.login-card .brand__logo,
.expired-card .brand__logo {
  width: 218px;
}

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 20%, rgba(242, 182, 0, 0.28), transparent 25%),
    linear-gradient(135deg, var(--red-900), var(--red) 58%, #e53b22);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 440px);
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  padding: 34px;
  box-shadow: var(--shadow);
  animation: cardIn 420ms ease-out;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-card .brand {
  margin-bottom: 26px;
}

.login-card h1,
.hero-band h1,
.panel h2,
.expired-card h1,
.contract-intro h1 {
  margin: 0;
  letter-spacing: 0;
}

.login-card h1 {
  font-size: 2rem;
  line-height: 1.08;
}

.login-card__text {
  color: var(--muted);
  line-height: 1.6;
  margin: 12px 0 24px;
}

.eyebrow {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-stack label {
  display: grid;
  gap: 8px;
}

.form-stack label span {
  color: #343741;
  font-size: 0.92rem;
  font-weight: 700;
}

.form-stack input,
.form-stack select {
  width: 100%;
  border: 1px solid #d8dce5;
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-stack input:focus,
.form-stack select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(196, 0, 24, 0.1);
}

.button,
.icon-button {
  align-items: center;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  min-height: 44px;
  padding: 0 18px;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
  white-space: nowrap;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 10px 22px rgba(196, 0, 24, 0.22);
}

.button--primary:hover {
  background: var(--red-800);
}

.button--full {
  width: 100%;
}

.button--ghost,
.button--ghost-light {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.button--ghost-light {
  background: rgba(255, 255, 255, 0.92);
}

.button--danger {
  background: #fff2f1;
  color: var(--danger);
}

.button--small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
}

.alert {
  border-radius: 8px;
  font-weight: 700;
  margin: 0 0 20px;
  padding: 13px 14px;
}

.alert--error {
  background: #fff0ee;
  color: var(--danger);
}

.alert--success {
  background: #eefbf4;
  color: #067647;
}

.app-page {
  min-height: 100vh;
}

.topbar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.topbar__inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 0 auto;
  max-width: 1180px;
  min-height: 76px;
  padding: 0 24px;
}

.topbar__actions {
  align-items: center;
  display: flex;
  gap: 12px;
}

.operator {
  color: var(--muted);
  font-weight: 700;
}

.admin-layout {
  display: grid;
  gap: 22px;
  margin: 0 auto;
  max-width: 1180px;
  padding: 28px 24px 56px;
}

.admin-layout--narrow {
  max-width: 850px;
}

.hero-band {
  background:
    linear-gradient(135deg, rgba(196, 0, 24, 0.96), rgba(103, 0, 13, 0.96)),
    #c40018;
  border-radius: 8px;
  color: #fff;
  overflow: hidden;
  padding: 34px;
  position: relative;
}

.hero-band::after {
  background: var(--gold);
  content: "";
  height: 6px;
  left: 34px;
  position: absolute;
  right: 34px;
  top: 0;
}

.hero-band .eyebrow {
  color: var(--gold);
}

.hero-band h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

.hero-band p {
  color: rgba(255, 255, 255, 0.86);
  line-height: 1.6;
  margin: 14px 0 0;
  max-width: 760px;
}

.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(26, 31, 44, 0.06);
}

.stat-card {
  min-height: 118px;
  padding: 22px;
}

.stat-card span {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-bottom: 14px;
}

.stat-card strong {
  color: var(--red);
  display: block;
  font-size: 2.25rem;
  line-height: 1;
}

.stat-card--gold strong {
  color: #a57700;
}

.stat-card__small {
  color: var(--ink) !important;
  font-size: 1.25rem !important;
  line-height: 1.2 !important;
  overflow-wrap: anywhere;
}

.panel-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
}

.users-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
}

.user-form {
  background: #fafbfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.users-table {
  min-width: 560px;
}

.username-pill {
  background: var(--red-soft);
  border-radius: 999px;
  color: var(--red) !important;
  display: inline-flex !important;
  font-weight: 800;
  margin-top: 0 !important;
  padding: 7px 10px;
}

.panel {
  padding: 24px;
}

.panel--upload {
  border-top: 4px solid var(--red);
}

.panel--notice {
  background: linear-gradient(180deg, #fff, var(--gold-soft));
}

.panel--notice p {
  color: #4d4f58;
  line-height: 1.6;
}

.panel__header {
  margin-bottom: 18px;
}

.panel__header--row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.panel h2 {
  font-size: 1.35rem;
}

.file-drop {
  background: #fafbfe;
  border: 1px dashed #c9ceda;
  border-radius: 8px;
  padding: 16px;
}

.file-drop input {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.file-drop small {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.contracts-table {
  border-collapse: collapse;
  min-width: 920px;
  width: 100%;
}

.contracts-table th,
.contracts-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 10px;
  text-align: left;
  vertical-align: middle;
}

.contracts-table th {
  color: #4c515d;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.contracts-table td small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.copy-line {
  display: flex;
  gap: 8px;
  min-width: 300px;
}

.copy-line--wide {
  min-width: 0;
}

.copy-line input {
  background: #f8f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #4c515d;
  min-width: 0;
  padding: 10px;
  width: 100%;
}

.icon-button {
  background: var(--ink);
  color: #fff;
  min-height: 40px;
  padding: 0 12px;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 800;
  padding: 6px 10px;
}

.status--active {
  background: #e8f8ef;
  color: var(--success);
}

.status--expired {
  background: #fff0ee;
  color: var(--danger);
}

.status--admin {
  background: var(--gold-soft);
  color: #8a6100;
}

.actions-cell {
  display: flex;
  gap: 8px;
}

.empty-state {
  color: var(--muted);
  padding: 28px !important;
  text-align: center !important;
}

.detail-list {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.detail-list div {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-bottom: 14px;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.contract-page {
  background: #f3f4f8;
}

.contract-header {
  align-items: center;
  background: #fff;
  border-bottom: 4px solid var(--gold);
  display: flex;
  justify-content: center;
  padding: 14px 18px;
}

.contract-shell {
  margin: 0 auto;
  max-width: 980px;
  padding: 20px 14px 44px;
}

.contract-intro {
  background:
    linear-gradient(135deg, rgba(196, 0, 24, 0.98), rgba(122, 0, 15, 0.98)),
    var(--red);
  border-radius: 8px;
  color: #fff;
  margin-bottom: 18px;
  padding: 24px;
}

.contract-intro .eyebrow {
  color: var(--gold);
}

.contract-intro h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.contract-intro p {
  line-height: 1.55;
  margin: 10px 0 0;
  max-width: 720px;
}

.client-name {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
}

.contract-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.pages-stack {
  display: grid;
  gap: 14px;
}

.contract-page-image {
  background: #fff;
  border: 1px solid #d9dde7;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(26, 31, 44, 0.11);
  overflow: hidden;
}

.contract-page-image img {
  height: auto;
  width: 100%;
}

.contract-footer {
  background: #20222b;
  color: #fff;
  font-weight: 700;
  padding: 22px;
  text-align: center;
}

.expired-page {
  align-items: center;
  background:
    radial-gradient(circle at 80% 12%, rgba(242, 182, 0, 0.22), transparent 26%),
    #f8f9fc;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.expired-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 520px;
  padding: 34px;
  text-align: center;
}

.expired-card .brand {
  justify-content: center;
  margin-bottom: 24px;
}

.expired-card p {
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 820px) {
  .topbar__inner,
  .topbar__actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar__inner {
    gap: 14px;
    padding: 16px 18px;
  }

  .topbar__actions {
    width: 100%;
  }

  .stats-grid,
  .panel-grid,
  .users-grid {
    grid-template-columns: 1fr;
  }

  .operator {
    display: none;
  }

  .admin-layout {
    padding: 20px 14px 42px;
  }
}

@media (max-width: 560px) {
  .brand__logo {
    width: 148px;
  }

  .login-card,
  .hero-band,
  .panel,
  .contract-intro,
  .expired-card {
    padding: 22px;
  }

  .login-card h1,
  .hero-band h1,
  .contract-intro h1 {
    font-size: 1.85rem;
  }

  .contract-actions,
  .detail-actions,
  .actions-cell {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .icon-button {
    width: 100%;
  }

  .copy-line {
    flex-direction: column;
    min-width: 230px;
  }

  .contract-shell {
    padding: 14px 8px 34px;
  }

  .contract-page-image {
    border-radius: 4px;
  }
}
