:root {
  color-scheme: light;
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-2: #eef7f4;
  --ink: #17211f;
  --muted: #64706d;
  --line: #dce3df;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #2563eb;
  --green: #15803d;
  --amber: #b7791f;
  --red: #b42318;
  --coral: #c2410c;
  --shadow: 0 18px 55px rgba(20, 29, 27, 0.12);
  --radius: 8px;
  --tap: 44px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #dfe7e3;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.12), transparent 260px),
    var(--bg);
}

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

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

.app-shell {
  position: relative;
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(23, 33, 31, 0.05), var(--shadow);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(16px + env(safe-area-inset-top)) 18px 12px;
  background: rgba(246, 245, 240, 0.94);
  border-bottom: 1px solid rgba(220, 227, 223, 0.72);
  backdrop-filter: blur(18px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-button {
  max-width: 116px;
  min-height: 38px;
  padding: 0 10px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.25;
}

.screen {
  min-height: calc(100vh - 148px);
  padding: 16px 14px 96px;
}

.screen.is-entering {
  animation: screenEnter 280ms ease both;
}

.page-transition-active::after {
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at 50% 18%, rgba(15, 118, 110, 0.2), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  animation: pageFlash 420ms ease both;
}

@keyframes screenEnter {
  from {
    opacity: 0.72;
    transform: translateY(8px);
  }

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

@keyframes pageFlash {
  0% {
    opacity: 0;
  }

  28% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen.is-entering,
  .page-transition-active::after {
    animation: none;
  }
}

.section {
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h2,
.section-heading h3 {
  margin-bottom: 0;
}

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

.fine {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.card {
  padding: 14px;
  background: var(--surface);
  border: 1px solid rgba(220, 227, 223, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 8px 26px rgba(23, 33, 31, 0.07);
}

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

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

.metric-card {
  min-height: 96px;
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric-value {
  display: block;
  margin-bottom: 4px;
  font-size: 28px;
  font-weight: 830;
  line-height: 1;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.hero-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.95), rgba(37, 99, 235, 0.92)),
    #0f766e;
  border: 0;
}

.hero-card h2 {
  margin-bottom: 4px;
  font-size: 25px;
}

.hero-card p {
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.84);
  line-height: 1.5;
}

.hero-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  min-height: var(--tap);
  padding: 0 13px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 760;
}

.button.primary {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.button.secondary {
  color: var(--teal-dark);
  background: var(--surface-2);
  border-color: rgba(15, 118, 110, 0.18);
}

.button.danger {
  color: var(--red);
  background: #fff7f5;
  border-color: #fed7d2;
}

.danger-zone {
  display: grid;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid #fde2dd;
}

.review-action {
  display: grid;
  gap: 9px;
  padding-top: 12px;
  border-top: 1px solid #f5e0b8;
}

.notification-row,
.admin-row,
.log-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.notification-row p,
.log-row p {
  margin-bottom: 0;
}

.notification-row.is-read {
  opacity: 0.72;
}

.admin-panel h3 {
  margin: 8px 0 0;
}

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

.profile-logout-section {
  padding-bottom: 18px;
}

.compact-button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 11px;
  font-size: 12px;
}

.button:focus-visible,
.icon-button:focus-visible,
.nav-item:focus-visible,
.chip-button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.icon-button {
  display: grid;
  width: var(--tap);
  height: var(--tap);
  place-items: center;
  color: #ffffff;
  background: var(--teal);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 25px;
  font-weight: 520;
  line-height: 1;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-item {
  min-height: 56px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 11px;
  font-weight: 780;
}

.nav-icon {
  display: block;
  margin-bottom: 3px;
  font-size: 20px;
  line-height: 1;
}

.nav-item.is-active {
  color: var(--teal-dark);
  background: var(--surface-2);
}

.profile-row,
.deal-top,
.review-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  color: #ffffff;
  background: var(--teal);
  border-radius: 50%;
  font-size: 16px;
  font-weight: 850;
}

.avatar.blue {
  background: var(--blue);
}

.avatar.coral {
  background: var(--coral);
}

.avatar.amber {
  background: var(--amber);
}

.avatar.green {
  background: var(--green);
}

.profile-main {
  min-width: 0;
  flex: 1;
}

.name-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.name-line h3 {
  overflow: hidden;
  flex: 1 1 150px;
  margin-bottom: 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  color: var(--teal-dark);
  background: var(--surface-2);
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 820;
  white-space: nowrap;
}

.badge.warn {
  color: var(--amber);
  background: #fff8e5;
  border-color: #f4d48b;
}

.badge.bad {
  color: var(--red);
  background: #fff1ef;
  border-color: #ffc9c3;
}

.badge.good {
  color: var(--green);
  background: #ecfdf3;
  border-color: #b7ebc8;
}

.badge.newbie {
  color: #7c3aed;
  background: #f3efff;
  border-color: #ddd0ff;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.mini-stat {
  min-height: 58px;
  padding: 8px 6px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.mini-stat strong {
  display: block;
  margin-bottom: 2px;
  font-size: 17px;
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
}

.progress-list {
  display: grid;
  gap: 9px;
}

.progress-row {
  display: grid;
  gap: 5px;
}

.progress-row header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  overflow: hidden;
  height: 8px;
  background: #e8eee9;
  border-radius: 999px;
}

.progress-fill {
  width: var(--value);
  height: 100%;
  background: var(--bar, var(--teal));
  border-radius: inherit;
}

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

.detail-item {
  min-height: 62px;
  padding: 10px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.detail-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.detail-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.3;
}

.bio-text {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.deal-card {
  display: grid;
  gap: 12px;
}

.deal-title {
  margin-bottom: 4px;
  font-size: 16px;
}

.deal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.deal-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 820;
}

.deal-status.active {
  color: var(--blue);
  background: #eff6ff;
}

.deal-status.draft {
  color: var(--amber);
  background: #fff8e5;
}

.deal-status.signed {
  color: var(--blue);
  background: #eff6ff;
}

.deal-status.success {
  color: var(--green);
  background: #ecfdf3;
}

.deal-status.overdue {
  color: var(--amber);
  background: #fff8e5;
}

.deal-status.failed {
  color: var(--red);
  background: #fff1ef;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip,
.chip-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  color: var(--muted);
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 740;
}

.chip-button {
  cursor: pointer;
}

.chip-button.is-active {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.searchbar {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.empty-state {
  padding: 24px 16px;
  color: var(--muted);
  background: #ffffff;
  border: 1px dashed #cbd5d1;
  border-radius: var(--radius);
  text-align: center;
}

.notice {
  padding: 12px;
  color: var(--teal-dark);
  background: var(--surface-2);
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.45;
}

.loading-state {
  padding: 30px 16px;
  color: var(--muted);
  text-align: center;
}

.rating-number {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  color: #b45309;
  font-size: 13px;
  font-weight: 780;
}

.rating-number strong {
  font-size: 18px;
}

.contract-document {
  display: grid;
  gap: 14px;
}

.contract-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.contract-terms {
  padding: 13px;
  background: #f8faf9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.contract-terms p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-wrap;
}

.signature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.signature-box {
  display: grid;
  gap: 6px;
  min-height: 150px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.signature-box.signed {
  border-color: #b7ebc8;
  background: #f2fff6;
}

.signature-box.missing {
  border-color: #f4d48b;
  background: #fffaf0;
}

.signature-line {
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 760;
}

.copy-box {
  display: grid;
  gap: 8px;
}

.copy-box label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.share-hint {
  margin-bottom: 0;
  padding: 10px 12px;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #dbe3ea;
  border-radius: var(--radius);
  font-size: 12px;
  line-height: 1.45;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.check-row input {
  margin-top: 3px;
  accent-color: var(--teal);
}

.modal-root:empty {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  padding: 18px 12px;
  background: rgba(17, 24, 39, 0.52);
}

.modal {
  width: min(100%, 520px);
  max-height: min(88vh, 760px);
  margin: 0 auto;
  overflow: auto;
  padding: 16px;
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal header h2 {
  margin-bottom: 0;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.field textarea {
  min-height: 88px;
  resize: vertical;
}

.range-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.range-field input {
  accent-color: var(--teal);
}

.rating-stars {
  color: #d97706;
  font-size: 16px;
  letter-spacing: 0;
}

.split-line {
  height: 1px;
  margin: 4px 0;
  background: var(--line);
}

@media (min-width: 700px) {
  body {
    padding: 24px 0;
  }

  .app-shell {
    min-height: calc(100vh - 48px);
    border-radius: 24px;
    overflow: hidden;
  }

  .bottom-nav {
    border-radius: 0 0 24px 24px;
  }

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