:root {
  --black: #070706;
  --charcoal: #151513;
  --ivory: #f3eee5;
  --paper: #fbf7ef;
  --stone: #81786c;
  --taupe: #b5a695;
  --bronze: #8b7058;
  --line: #d8cec0;
  --line-soft: rgba(216, 206, 192, 0.68);
  --white: #fffdf8;
  --danger: #8b3027;
  --success: #4d6d50;
  --shadow: 0 20px 60px rgba(7, 7, 6, 0.10);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--charcoal);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.boot-screen,
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(7, 7, 6, 0.88), rgba(7, 7, 6, 0.97)),
    radial-gradient(circle at 50% 20%, rgba(181, 166, 149, 0.12), transparent 34%),
    var(--black);
  color: var(--paper);
  padding: 28px;
}

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

.boot-screen h1,
.auth-card h1,
.page-title h1,
.panel-title,
.crm-name {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: 0;
}

.boot-screen h1 {
  font-size: clamp(2.4rem, 8vw, 5rem);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--taupe);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.auth-card {
  width: min(100%, 520px);
  border: 1px solid rgba(216, 206, 192, 0.24);
  background: rgba(21, 21, 19, 0.82);
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.32);
  padding: clamp(28px, 6vw, 54px);
}

.auth-card.wide {
  width: min(100%, 900px);
}

.auth-card h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 0.98;
}

.auth-card p {
  color: rgba(251, 247, 239, 0.74);
}

.auth-card label {
  color: rgba(251, 247, 239, 0.86);
}

.auth-card input,
.auth-card textarea,
.auth-card select {
  background: rgba(251, 247, 239, 0.08);
  border-color: rgba(216, 206, 192, 0.32);
  color: var(--paper);
}

.auth-card input::placeholder {
  color: rgba(251, 247, 239, 0.42);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--paper);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--black);
  color: var(--paper);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand-lockup {
  display: grid;
  gap: 4px;
}

.brand-lockup strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  font-weight: 400;
}

.brand-lockup span {
  color: var(--taupe);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  color: rgba(251, 247, 239, 0.68);
  font-size: 0.92rem;
}

.nav a:hover,
.nav a:focus-visible,
.nav a[aria-current="page"] {
  border-color: rgba(181, 166, 149, 0.32);
  background: rgba(251, 247, 239, 0.08);
  color: var(--paper);
  outline: none;
}

.sidebar-note {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(216, 206, 192, 0.18);
  color: rgba(251, 247, 239, 0.58);
  font-size: 0.82rem;
}

.main {
  min-width: 0;
  padding: 28px clamp(18px, 4vw, 54px) 54px;
}

.topbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
  padding-bottom: 18px;
}

.mobile-brand {
  display: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.3rem;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 1px solid var(--line);
  padding: 0 12px;
  color: var(--stone);
  background: rgba(255, 253, 248, 0.62);
}

.page-title {
  display: grid;
  gap: 10px;
  margin-bottom: 26px;
}

.page-title h1 {
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.98;
  max-width: 980px;
}

.page-title p {
  max-width: 720px;
  margin: 0;
  color: var(--stone);
  font-size: 1rem;
}

.toolbar,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
  align-items: start;
}

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

.stack-offset {
  margin-top: 18px;
}

.metric-strip {
  margin: 20px 0;
}

.spacer-sm {
  height: 14px;
}

.spacer-md {
  height: 16px;
}

.spacer-lg {
  height: 18px;
}

.panel,
.stat,
.timeline-item,
.request-row,
.profile-section {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
}

.panel {
  padding: clamp(18px, 3vw, 28px);
}

.panel.dark {
  background: var(--charcoal);
  color: var(--paper);
  border-color: var(--charcoal);
}

.panel-title {
  margin-bottom: 18px;
  font-size: 1.55rem;
}

.stat {
  min-height: 118px;
  padding: 18px;
  display: grid;
  align-content: space-between;
}

.stat span {
  color: var(--stone);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.stat strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.8rem;
  line-height: 1;
  font-weight: 400;
}

.request-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.request-row h3 {
  margin: 0 0 5px;
  font-size: 1rem;
  font-weight: 650;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--stone);
  font-size: 0.84rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  padding: 0 9px;
  background: rgba(243, 238, 229, 0.68);
  color: var(--bronze);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.urgent {
  border-color: rgba(139, 48, 39, 0.32);
  color: var(--danger);
}

.badge.success {
  border-color: rgba(77, 109, 80, 0.28);
  color: var(--success);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--charcoal);
  padding: 0 16px;
  background: transparent;
  color: var(--charcoal);
  cursor: pointer;
  font-weight: 650;
  text-align: center;
}

.button.primary {
  background: var(--charcoal);
  color: var(--paper);
}

.button.light {
  border-color: rgba(216, 206, 192, 0.48);
  color: var(--paper);
}

.button.subtle {
  border-color: var(--line);
  color: var(--stone);
  background: rgba(255, 253, 248, 0.46);
}

.button:hover,
.button:focus-visible {
  background: var(--black);
  border-color: var(--black);
  color: var(--paper);
  outline: none;
}

.button.light:hover,
.button.light:focus-visible {
  background: var(--paper);
  color: var(--black);
}

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

.field,
.field.full {
  display: grid;
  gap: 7px;
}

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

label {
  color: var(--stone);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--white);
  color: var(--charcoal);
  padding: 12px 12px;
  min-height: 45px;
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--bronze);
  box-shadow: 0 0 0 3px rgba(139, 112, 88, 0.12);
}

.help {
  margin: 0;
  color: var(--stone);
  font-size: 0.86rem;
}

.notice {
  border: 1px solid var(--line);
  background: rgba(243, 238, 229, 0.8);
  color: var(--stone);
  padding: 14px 16px;
}

.notice.error {
  border-color: rgba(139, 48, 39, 0.24);
  color: var(--danger);
  background: rgba(139, 48, 39, 0.06);
}

.notice.success {
  border-color: rgba(77, 109, 80, 0.24);
  color: var(--success);
  background: rgba(77, 109, 80, 0.06);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  padding: 14px;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--stone);
}

.message-list {
  display: grid;
  gap: 12px;
}

.message {
  border-left: 2px solid var(--bronze);
  padding: 10px 0 10px 14px;
}

.message.admin {
  border-left-color: var(--charcoal);
}

.message p {
  margin: 4px 0 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--white);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--stone);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

td {
  color: var(--charcoal);
}

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

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  background: var(--white);
  padding: 3px;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--stone);
  min-height: 34px;
  padding: 0 10px;
  cursor: pointer;
}

.segmented button.is-active {
  background: var(--charcoal);
  color: var(--paper);
}

.profile-section {
  padding: 18px;
}

.profile-section h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.empty {
  border: 1px dashed var(--line);
  padding: 28px;
  color: var(--stone);
  background: rgba(255, 253, 248, 0.46);
  text-align: center;
}

.cf-turnstile {
  min-height: 65px;
}

.consent-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: rgba(251, 247, 239, 0.84);
  font-size: 0.96rem;
  letter-spacing: 0;
  text-transform: none;
}

.consent-check input {
  width: auto;
  min-height: auto;
  margin-top: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid rgba(216, 206, 192, 0.18);
  }

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

  .nav a {
    justify-content: center;
    text-align: center;
  }

  .sidebar-note {
    display: none;
  }

  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 14px;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 18px 14px 38px;
  }

  .mobile-brand {
    display: block;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: -18px -14px 24px;
    padding: 12px 14px;
    background: rgba(251, 247, 239, 0.96);
    backdrop-filter: blur(12px);
  }

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

  .mobile-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    border-top: 1px solid var(--line);
    background: var(--paper);
    position: fixed;
    z-index: 5;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 7px;
  }

  .mobile-nav a {
    min-height: 42px;
    display: grid;
    place-items: center;
    color: var(--stone);
    font-size: 0.78rem;
  }

  .mobile-nav a[aria-current="page"] {
    background: var(--charcoal);
    color: var(--paper);
  }

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

  .request-row {
    grid-template-columns: 1fr;
  }

  .actions,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .user-chip,
  .segmented {
    width: 100%;
  }

  .segmented {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 721px) {
  .mobile-nav {
    display: none;
  }
}
