:root {
  --navy-950: #061942;
  --navy-900: #062761;
  --navy-800: #073783;
  --navy-700: #0b48a2;
  --gold-600: #c99319;
  --gold-500: #e0ad32;
  --gold-100: #fff2cf;
  --green-700: #2f7d45;
  --green-100: #e4f4e7;
  --red-700: #c7384a;
  --red-100: #fde5e9;
  --blue-100: #eaf1ff;
  --ink: #101f44;
  --muted: #607097;
  --line: #dfe6f2;
  --page: #f7f9fd;
  --panel: #ffffff;
  --shadow: 0 16px 45px rgba(18, 35, 76, .10);
  --soft-shadow: 0 10px 28px rgba(18, 35, 76, .08);
  --radius: 8px;
  --font-title: Georgia, "Times New Roman", serif;
  --font-ui: Inter, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 10%, rgba(224, 173, 50, .12), transparent 22rem),
    linear-gradient(135deg, #fff, var(--page));
}

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

button {
  cursor: pointer;
}

.brand {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.brand img {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.brand-name {
  font-family: var(--font-title);
  color: #fff;
  font-size: 25px;
  line-height: 1;
}

.brand-line {
  width: 190px;
  height: 1px;
  margin: 4px auto;
  background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
}

.brand-subtitle {
  color: #fff;
  font-size: 10px;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-align: center;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: .9fr 1.1fr;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  color: #fff;
  background: linear-gradient(180deg, rgba(7, 56, 134, .96), rgba(4, 24, 65, .98));
}

.auth-brand .brand {
  justify-items: start;
}

.auth-brand .brand-line {
  margin-left: 0;
}

.auth-copy h1,
h1 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 500;
  line-height: .98;
}

.auth-copy h1 {
  color: #fff;
  font-size: clamp(46px, 5vw, 72px);
}

.auth-copy p {
  max-width: 560px;
  color: rgba(255,255,255,.82);
  line-height: 1.7;
  font-size: 18px;
}

.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
  padding: 48px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-600);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  color: var(--navy-950);
  font-size: clamp(38px, 5vw, 64px);
}

.subtitle {
  margin: 10px 0 0;
  color: #42537b;
  font-size: 17px;
  line-height: 1.5;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.panel,
.auth-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  margin: 0;
  color: var(--navy-950);
  font-size: 18px;
  font-weight: 900;
}

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

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

.field {
  display: grid;
  gap: 8px;
}

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

label {
  color: var(--navy-950);
  font-size: 13px;
  font-weight: 900;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd5e8;
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  outline: 0;
}

input,
select {
  padding: 0 13px;
}

textarea {
  min-height: 108px;
  padding: 12px 13px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy-700);
  box-shadow: 0 0 0 3px rgba(11, 72, 162, .11);
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid var(--navy-900);
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 12px 22px rgba(8, 43, 118, .14);
}

.button.secondary {
  color: var(--navy-900);
  background: #fff;
  box-shadow: none;
}

.button.gold {
  border-color: var(--gold-600);
  background: linear-gradient(135deg, var(--gold-600), var(--gold-500));
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.button.danger {
  border-color: var(--red-700);
  background: linear-gradient(135deg, #a72131, var(--red-700));
}

.button.danger-outline {
  color: var(--red-700);
  border-color: #f4b9c2;
  background: #fff;
  box-shadow: none;
}

.auth-help {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px 14px 20px;
  overflow-y: auto;
  color: #fff;
  background: linear-gradient(180deg, rgba(7, 56, 134, .95), rgba(4, 24, 65, .98));
}

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

.nav button {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 54px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: rgba(255,255,255,.92);
  background: transparent;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  border-color: var(--gold-500);
  color: var(--gold-500);
  background: rgba(255,255,255,.08);
}

.sidebar-footer {
  margin-top: auto;
}

.content {
  min-width: 0;
  padding: 34px 42px;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  margin-bottom: 22px;
}

.avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  font-weight: 900;
}

.page-head {
  margin-bottom: 24px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric {
  min-height: 126px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.metric-icon,
.item-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: var(--navy-900);
  background: var(--blue-100);
  font-size: 25px;
}

.metric-icon.gold,
.item-icon.gold {
  color: #9b6b00;
  background: var(--gold-100);
}

.metric-icon.green,
.item-icon.green {
  color: var(--green-700);
  background: var(--green-100);
}

.metric-icon.red,
.item-icon.red {
  color: var(--red-700);
  background: var(--red-100);
}

.metric-value {
  margin-top: 4px;
  font-family: var(--font-title);
  font-size: 38px;
  line-height: 1;
  color: var(--navy-950);
}

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

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 20px;
  align-items: start;
}

.list {
  display: grid;
  gap: 12px;
  padding: 18px 22px 22px;
}

.list-item,
.process-card,
.client-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.process-card {
  width: 100%;
}

.card-end {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.client-card.active {
  border-color: var(--gold-500);
  background: #fffaf0;
}

.list-item h3,
.process-card h3,
.client-card h3 {
  margin: 0 0 5px;
  color: var(--navy-950);
}

.list-item p,
.process-card p,
.client-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status.blue {
  color: #0b56c5;
  background: #eaf1ff;
}

.status.gold {
  color: #a66f00;
  background: #fff1cf;
}

.status.green {
  color: var(--green-700);
  background: var(--green-100);
}

.status.red {
  color: var(--red-700);
  background: var(--red-100);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
}

.progress {
  position: relative;
  height: 10px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf6;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold-500), var(--navy-700));
}

.progress-text {
  min-width: 42px;
  color: var(--navy-950);
  font-weight: 900;
  text-align: right;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 22px;
  margin-bottom: 22px;
  padding: 26px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, rgba(5, 30, 82, .96), rgba(8, 62, 149, .94));
  box-shadow: var(--shadow);
}

.detail-hero h2 {
  margin: 10px 0;
  color: #fff;
  font-family: var(--font-title);
  font-size: clamp(30px, 3.8vw, 48px);
  font-weight: 500;
}

.detail-hero .progress {
  height: 14px;
  background: rgba(255,255,255,.22);
}

.detail-hero .progress-fill {
  background: linear-gradient(90deg, var(--gold-500), #fff);
}

.progress-number {
  font-family: var(--font-title);
  font-size: 62px;
  line-height: .9;
  text-align: right;
}

.timeline {
  display: grid;
  padding: 6px 22px 18px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 16px;
  position: relative;
  padding: 16px 0;
}

.timeline-dot {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--navy-900);
  font-size: 12px;
  font-weight: 900;
}

.timeline-dot.done {
  background: var(--green-700);
}

.empty {
  padding: 22px;
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-layout > *,
.admin-main,
.admin-client-list,
.panel {
  min-width: 0;
}

.admin-main {
  display: grid;
  gap: 20px;
}

.admin-main > .panel {
  margin-top: 0 !important;
}

.compact-list {
  padding-top: 0;
}

.compact-list .list-item {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.stage-list {
  display: grid;
  gap: 10px;
  padding: 18px 22px 0;
}

.stage-row {
  display: grid;
  grid-template-columns: 34px minmax(170px, 1.2fr) 110px minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.stage-row.dragging {
  opacity: .55;
}

.drag-handle {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--gold-600);
  background: var(--gold-100);
  font-weight: 900;
  cursor: grab;
}

.document-list,
.document-admin-list {
  gap: 14px;
}

.document-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.document-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.document-card h3 {
  margin: 0 0 5px;
  color: var(--navy-950);
}

.document-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.review-note {
  margin-top: 8px !important;
  color: var(--navy-700) !important;
  font-weight: 700;
}

.review-note.red {
  color: var(--red-700) !important;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.inline-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.inline-review {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.inline-review input {
  width: min(300px, 100%);
  min-height: 34px;
}

.inline-upload input[type="file"] {
  max-width: 280px;
  padding: 10px;
}

.process-switcher {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.process-choice {
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--navy-950);
  background: #fff;
  text-align: left;
  box-shadow: var(--soft-shadow);
}

.process-choice span {
  color: var(--muted);
  font-size: 14px;
}

.process-choice.active {
  border-color: var(--gold-500);
  background: #fffaf0;
}

.account-grid {
  align-items: start;
}

.danger-zone {
  border-color: #f2bec7;
  background: #fffafa;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: none;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--navy-900);
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

@media (max-width: 1100px) {
  .auth-shell,
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .metrics,
  .auth-grid,
  .grid-2,
  .admin-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .auth-brand,
  .auth-panel,
  .content {
    padding: 24px 16px;
  }

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

  .detail-hero,
  .list-item,
  .process-card,
  .client-card,
  .stage-row,
  .document-card {
    grid-template-columns: 1fr;
  }

  .progress-number {
    text-align: left;
  }
}
