:root {
  color-scheme: dark;
  --bg: #08111f;
  --surface: #101d2d;
  --surface-2: #152438;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f7fb;
  --muted: #8d9aab;
  --green: #32e39a;
  --green-dark: #061b15;
  --amber: #f5bd58;
  --red: #ff6b72;
  --blue: #679cff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 70% -10%, rgba(50, 227, 154, 0.12), transparent 34%),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

#app {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 18px 112px;
}

.topbar, .row, .deal-head, .split, .person, .summary-line {
  display: flex;
  align-items: center;
}

.topbar { justify-content: space-between; margin-bottom: 24px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.language-select {
  width: 112px; min-height: 38px; padding: 0 30px 0 11px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--text); font-size: 12px; font-weight: 700; outline: none; cursor: pointer;
}
[dir="rtl"] .language-select { padding: 0 11px 0 30px; }
[dir="rtl"] .deal-head, [dir="rtl"] .summary-line, [dir="rtl"] .section-head { flex-direction: row-reverse; }
[dir="rtl"] .role, [dir="rtl"] label { text-align: right; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 800; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  color: #04100c; background: var(--green); border-radius: 11px;
  box-shadow: 0 8px 30px rgba(50, 227, 154, 0.24);
}
.avatar {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; background: linear-gradient(145deg, #f4bd7b, #8e5cd8);
  color: #fff; font-weight: 800; border: 2px solid rgba(255,255,255,.12);
}

h1 { max-width: 360px; margin: 0 0 8px; font-size: 32px; line-height: 1.08; letter-spacing: -1.1px; }
h2 { margin: 0; font-size: 19px; letter-spacing: -.25px; }
h3 { margin: 0 0 5px; font-size: 16px; }
p { margin: 0; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.hero-card {
  position: relative; overflow: hidden; margin: 26px 0;
  padding: 22px; border: 1px solid rgba(50, 227, 154, 0.2); border-radius: 24px;
  background: linear-gradient(145deg, rgba(50,227,154,.14), rgba(16,29,45,.9) 58%);
}
.hero-card::after {
  position: absolute; content: ""; width: 170px; height: 170px; right: -80px; top: -100px;
  border: 30px solid rgba(50,227,154,.08); border-radius: 50%;
}
.hero-card strong { display: block; margin: 12px 0 18px; font-size: 28px; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; padding: 0 18px; border: 0; border-radius: 15px;
  background: var(--green); color: #04110c; font-weight: 800; cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.button:active { transform: scale(.98); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.button.danger { background: rgba(255,107,114,.13); color: var(--red); }
.button.small { width: auto; min-height: 36px; padding: 0 13px; border-radius: 11px; font-size: 13px; }

.section-head { justify-content: space-between; margin: 28px 0 13px; }
.text-button { border: 0; background: none; color: var(--green); cursor: pointer; }
.stack { display: grid; gap: 12px; }

.card {
  padding: 17px; border: 1px solid var(--line); border-radius: 19px;
  background: rgba(16, 29, 45, .82); box-shadow: 0 16px 45px rgba(0,0,0,.12);
}
.deal-card { cursor: pointer; }
.deal-card:hover { border-color: rgba(50,227,154,.23); }
.deal-head { justify-content: space-between; gap: 12px; }
.deal-title { overflow: hidden; font-weight: 750; white-space: nowrap; text-overflow: ellipsis; }
.amount { font-size: 17px; font-weight: 800; white-space: nowrap; }
.deal-meta { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); justify-content: space-between; }

.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px;
  border-radius: 999px; background: rgba(245,189,88,.1); color: var(--amber);
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.funded { color: var(--green); background: rgba(50,227,154,.1); }
.status.released { color: var(--blue); background: rgba(103,156,255,.1); }
.status.disputed { color: var(--red); background: rgba(255,107,114,.1); }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric strong { display: block; margin-top: 7px; font-size: 22px; }

.back {
  display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 22px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer;
}

.form { display: grid; gap: 18px; margin-top: 26px; }
label { display: grid; gap: 8px; color: #c7d0dc; font-size: 13px; font-weight: 700; }
input, textarea {
  width: 100%; padding: 15px; color: var(--text); outline: none;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
input:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(50,227,154,.08); }
textarea { min-height: 92px; resize: vertical; }
.form-error {
  padding: 12px 14px; border: 1px solid rgba(255,107,114,.35); border-radius: 12px;
  background: rgba(255,107,114,.1); color: var(--red); font-size: 13px; font-weight: 700;
}
.field-invalid { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(255,107,114,.08) !important; }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 70px; font-size: 22px; font-weight: 800; }
.suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--green); font-weight: 800; }

.role-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role {
  padding: 14px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); text-align: left; cursor: pointer;
}
.role.active { border-color: var(--green); background: rgba(50,227,154,.08); }
.role strong, .role span { display: block; }
.role span { margin-top: 3px; color: var(--muted); font-size: 12px; }

.progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 24px 0; }
.progress span { height: 4px; border-radius: 3px; background: var(--surface-2); }
.progress span.on { background: var(--green); }

.detail-amount { margin: 20px 0 6px; font-size: 38px; font-weight: 850; letter-spacing: -1.5px; }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.person { gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.mini-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); }
.person small, .person strong { display: block; }
.person small { color: var(--muted); }
.summary { margin: 20px 0; padding: 6px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.summary-line { justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary-line:last-child { border: 0; }
.address { overflow: hidden; max-width: 150px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.actions .button:first-child { grid-column: 1 / -1; }

.chat-thread {
  display: grid; gap: 10px; min-height: 230px; max-height: 390px; overflow-y: auto;
  margin: 22px 0 12px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(16,29,45,.7);
}
.message { justify-self: start; max-width: 84%; padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: var(--surface-2); }
.message.mine { justify-self: end; border-radius: 14px 14px 4px 14px; background: rgba(50,227,154,.13); }
.message small { display: block; margin-bottom: 3px; color: var(--green); font-weight: 800; }
.empty-chat { align-self: center; color: var(--muted); text-align: center; }
.chat-compose { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 16px; }
.chat-compose .button { min-height: 48px; }
.confirmation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0; }
.confirmation-card { display: grid; gap: 5px; }
.confirmed { color: var(--green); }
.locked-note { margin: 12px 0; padding: 13px; border-radius: 13px; background: rgba(50,227,154,.1); color: var(--green); }

.empty { padding: 48px 24px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 20px; background: var(--surface-2); color: var(--green); font-size: 28px; }

.tabbar {
  position: fixed; z-index: 10; left: 50%; bottom: 0; transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  width: min(100%, 520px); padding: 10px 10px max(11px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: rgba(8,17,31,.92); backdrop-filter: blur(18px);
}
.tab {
  display: grid; justify-items: center; gap: 3px; padding: 5px;
  border: 0; background: transparent; color: #718095; font-size: 10px; cursor: pointer;
}
.tab.active { color: var(--green); }
.tab-icon { font-size: 20px; line-height: 1; }
.new-deal {
  justify-self: center; display: grid; place-items: center; width: 52px; height: 52px;
  margin-top: -29px; border: 5px solid var(--bg); border-radius: 18px;
  background: var(--green); color: #06110d; font-size: 30px; cursor: pointer;
}

.toast {
  position: fixed; z-index: 20; left: 50%; bottom: 92px; transform: translate(-50%, 16px);
  width: min(calc(100% - 36px), 470px); padding: 13px 16px;
  border: 1px solid var(--line); border-radius: 13px; background: #1a2a3d;
  opacity: 0; pointer-events: none; transition: .2s ease;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (min-width: 700px) {
  body { padding: 28px 0; }
  #app { min-height: calc(100vh - 56px); border: 1px solid var(--line); border-radius: 28px; background: rgba(8,17,31,.55); }
  .tabbar { bottom: 28px; border: 1px solid var(--line); border-radius: 0 0 28px 28px; }
}
