:root {
  --blue: #2B7FFF;
  --blue-dark: #176CE8;
  --blue-soft: #EAF2FF;
  --bg: #F4F6F9;
  --card: #FFFFFF;
  --text: #171B24;
  --muted: #687385;
  --light: #97A1B0;
  --border: #E5E9F0;
  --danger: #D92D20;
  --danger-soft: #FEE4E2;
  --amber: #B54708;
  --amber-soft: #FFF4E5;
  --star: #F5B301;
  --success: #067647;
  --success-soft: #ECFDF3;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --nav-height: 78px;
  --max-vh: 100dvh;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #0D1424; }
body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: 100%;
  max-width: 430px;
  min-height: var(--max-vh);
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 70px rgba(0, 0, 0, .28);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: calc(12px + var(--safe-top)) 16px 14px;
  background: linear-gradient(180deg, #4697FF, var(--blue));
  color: #fff;
  border-radius: 0 0 24px 24px;
  box-shadow: 0 6px 24px rgba(43, 127, 255, .16);
}
.header-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-size: 22px; line-height: 1; font-weight: 800; letter-spacing: -.04em; }
.header-sub { margin-top: 5px; font-size: 12px; opacity: .86; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.13); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(.96); }

.role-toggle {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-top: 14px; padding: 3px;
  background: rgba(255,255,255,.16); border-radius: 999px;
}
.role-toggle button {
  border: 0; background: transparent; color: rgba(255,255,255,.78); min-height: 38px;
  border-radius: 999px; font-size: 13px; font-weight: 650; cursor: pointer;
}
.role-toggle button.active { background: #fff; color: var(--blue-dark); box-shadow: 0 2px 8px rgba(0,0,0,.10); }
.search-box {
  margin-top: 10px; height: 46px; background: #fff; color: var(--text); border-radius: 14px;
  display: flex; align-items: center; gap: 9px; padding: 0 13px; box-shadow: 0 4px 16px rgba(0,0,0,.07);
}
.search-box svg { width: 18px; height: 18px; fill: none; stroke: #98A2B3; stroke-width: 2; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--text); }
.search-box input::placeholder { color: #98A2B3; }

.main { min-height: calc(var(--max-vh) - var(--nav-height)); padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px); }
.page { padding: 16px; animation: pageIn .18s ease; }
@keyframes pageIn { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.boot-screen, .gate-screen {
  min-height: var(--max-vh); padding: 34px 24px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; background: #fff;
}
.brand-mark {
  width: 74px; height: 74px; border-radius: 24px; display: grid; place-items: center; background: var(--blue);
  color: #fff; font-size: 34px; font-weight: 800; box-shadow: 0 15px 34px rgba(43,127,255,.28);
}
.boot-screen h1, .gate-screen h1 { margin: 18px 0 7px; font-size: 26px; letter-spacing: -.04em; }
.boot-screen p, .gate-screen p { margin: 0; max-width: 330px; color: var(--muted); font-size: 14px; line-height: 1.55; }
.spinner { width: 28px; height: 28px; margin-top: 24px; border-radius: 50%; border: 3px solid #DFE7F2; border-top-color: var(--blue); animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.max-badge { margin-bottom: 8px; padding: 7px 11px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: 12px; font-weight: 700; }

.bottom-nav {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-bottom));
  width: min(calc(100% - 24px), 406px); height: 64px; padding: 5px 8px;
  border: 1px solid rgba(220,226,235,.88); border-radius: 22px; background: rgba(255,255,255,.91);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 10px 30px rgba(26,35,50,.14); display: grid; grid-template-columns: 1fr 1fr 62px 1fr 1fr;
}
.bottom-nav button {
  position: relative;
  min-width: 0; border: 0; background: transparent; color: #9AA6B7; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; cursor: pointer; border-radius: 15px;
}
.nav-unread { position: absolute; top: 3px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; border: 2px solid #fff; display: grid; place-items: center; font-size: 8.5px !important; font-weight: 800 !important; line-height: 1; }
.bottom-nav button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav button span { font-size: 9.5px; font-weight: 600; white-space: nowrap; }
.bottom-nav button.active { color: var(--blue); }
.bottom-nav .nav-create { align-self: center; justify-self: center; width: 50px; height: 50px; background: var(--blue); color: #fff; border-radius: 18px; box-shadow: 0 8px 18px rgba(43,127,255,.30); }
.bottom-nav .nav-create .plus { font-size: 30px; line-height: 1; font-weight: 400; }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.section-head h1, .section-head h2 { margin: 0; letter-spacing: -.025em; }
.section-head h1 { font-size: 21px; }
.section-head h2 { font-size: 17px; }
.section-head p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.link-btn { border: 0; background: transparent; color: var(--blue); font-size: 13px; font-weight: 650; cursor: pointer; padding: 4px 0; }

.stack { display: grid; gap: 10px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 14px;
  box-shadow: 0 2px 6px rgba(16,24,40,.02);
}
.job-card { cursor: pointer; }
.job-card:active { transform: scale(.995); }
.card-top { display: flex; gap: 12px; align-items: flex-start; }
.thumb {
  width: 68px; height: 68px; flex: 0 0 68px; border-radius: 14px; background: #F0F3F7 center/cover no-repeat;
  border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; color: #8D99AA;
}
.thumb svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.card-main { min-width: 0; flex: 1; }
.card-main h3 { margin: 0 0 4px; font-size: 14.5px; line-height: 1.28; font-weight: 700; }
.meta { color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.meta + .meta { margin-top: 2px; }
.price { margin-top: 8px; font-size: 18px; font-weight: 800; letter-spacing: -.025em; color: #1D2939; }
.card-foot { margin-top: 12px; padding-top: 11px; border-top: 1px solid #EEF1F5; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-foot .meta { flex: 1; }
.card-foot { flex-wrap: wrap; }

.stars { display: inline-flex; align-items: center; gap: 1px; color: var(--star); letter-spacing: -.08em; }
.rating-value { margin-left: 4px; color: var(--text); font-weight: 650; letter-spacing: normal; }
.badge {
  display: inline-flex; align-items: center; min-height: 25px; padding: 4px 9px; border-radius: 999px;
  background: #F2F4F7; color: #475467; font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.badge.blue { background: var(--blue-soft); color: var(--blue-dark); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { padding: 6px 8px; border-radius: 9px; background: #F6F7F9; border: 1px solid var(--border); color: #475467; font-size: 10.5px; font-weight: 600; }

.btn {
  border: 0; border-radius: 13px; min-height: 46px; padding: 0 18px; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; background: var(--blue); color: #fff; font-weight: 700; font-size: 14px; cursor: pointer;
}
.btn:active { transform: scale(.985); background: var(--blue-dark); }
.btn:disabled { opacity: .48; cursor: default; transform: none; }
.btn.block { width: 100%; }
.btn.small { min-height: 34px; padding: 0 13px; border-radius: 999px; font-size: 11.5px; }
.btn.secondary { background: #fff; color: var(--blue); border: 1px solid #CFE0FF; }
.btn.secondary:active { background: var(--blue-soft); }
.btn.ghost { background: #F5F7FA; color: #344054; }
.btn.danger { background: var(--danger); }

.empty-state { padding: 42px 22px; text-align: center; color: var(--muted); }
.empty-icon { width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 18px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-size: 24px; }
.empty-state h3 { margin: 0 0 7px; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0 auto; max-width: 300px; font-size: 13px; line-height: 1.55; }
.empty-state .btn { margin-top: 16px; }

.notice { padding: 12px 13px; border-radius: 13px; background: var(--blue-soft); color: #245B9C; font-size: 12px; line-height: 1.5; }
.notice.warn { background: var(--amber-soft); color: #93410B; }

.form-card { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 15px; }
.form-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 12.5px; font-weight: 700; color: #344054; }
.field .hint { margin-top: -2px; color: var(--muted); font-size: 10.5px; line-height: 1.4; }
.field input, .field textarea, .field select {
  width: 100%; min-height: 46px; border: 1px solid #DDE3EB; background: #fff; border-radius: 12px; padding: 11px 13px;
  color: var(--text); outline: none; font-size: 14px; transition: border .15s, box-shadow .15s;
}
.field textarea { min-height: 94px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(43,127,255,.10); }
.field input::placeholder, .field textarea::placeholder { color: #98A2B3; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.condition-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.condition-pill input { position: absolute; opacity: 0; pointer-events: none; }
.condition-pill span { display: inline-flex; align-items: center; min-height: 34px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: #F8FAFC; color: #475467; font-size: 11px; font-weight: 600; cursor: pointer; }
.condition-pill input:checked + span { border-color: #9FC4FF; background: var(--blue-soft); color: var(--blue-dark); }
.form-actions { display: grid; gap: 8px; margin-top: 16px; }
.photo-preview { width: 100%; aspect-ratio: 16/8; border: 1px dashed #C9D2DF; border-radius: 14px; background: #F8FAFC center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 12px; overflow: hidden; }

.detail-hero { margin: -16px -16px 14px; background: #fff; border-bottom: 1px solid var(--border); overflow: hidden; }
.detail-photo { width: 100%; aspect-ratio: 16/8.4; background: #EEF2F7 center/cover no-repeat; display: grid; place-items: center; color: #8C98A8; }
.detail-photo svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.detail-summary { padding: 16px; }
.detail-summary h1 { margin: 0 0 8px; font-size: 21px; line-height: 1.2; letter-spacing: -.035em; }
.detail-price { margin: 10px 0 4px; font-size: 23px; font-weight: 800; letter-spacing: -.035em; }
.detail-section { margin-top: 10px; background: #fff; border: 1px solid var(--border); border-radius: 17px; padding: 15px; }
.detail-section h3 { margin: 0 0 10px; font-size: 14px; }
.detail-section p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.58; white-space: pre-wrap; }
.detail-actions { position: sticky; bottom: calc(var(--nav-height) + var(--safe-bottom) + 2px); z-index: 20; margin-top: 12px; padding: 9px; border-radius: 17px; background: rgba(244,246,249,.94); backdrop-filter: blur(12px); display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.share-btn { width: 46px; height: 46px; border-radius: 13px; border: 1px solid #CFE0FF; background: #fff; color: var(--blue); display: grid; place-items: center; cursor: pointer; }
.share-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }

.profile-card { background: linear-gradient(180deg, #4697FF, var(--blue)); color: #fff; border-radius: 22px; padding: 22px 18px; text-align: center; }
.avatar { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 11px; background: rgba(255,255,255,.18) center/cover no-repeat; border: 3px solid rgba(255,255,255,.42); display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.profile-card h2 { margin: 0; font-size: 20px; }
.profile-card p { margin: 5px 0 0; font-size: 12px; opacity: .85; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 14px; overflow: hidden; background: var(--border); border: 1px solid var(--border); border-radius: 16px; }
.stat { background: #fff; text-align: center; padding: 13px 4px; }
.stat strong { display: block; font-size: 17px; color: var(--blue-dark); }
.stat span { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); }
.info-list { margin-top: 12px; background: #fff; border: 1px solid var(--border); border-radius: 17px; overflow: hidden; }
.info-row { padding: 13px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12px; }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.info-row strong { text-align: right; font-weight: 650; overflow-wrap: anywhere; }

.chat-card { cursor: pointer; }
.chat-card.unread { border-color: #B8D3FF; box-shadow: 0 4px 14px rgba(43,127,255,.08); }
.chat-card .card-top { align-items: center; }
.chat-avatar { width: 50px; height: 50px; flex: 0 0 50px; border-radius: 50%; background: var(--blue-soft) center/cover no-repeat; color: var(--blue-dark); display: grid; place-items: center; font-weight: 750; }
.chat-preview { margin-top: 4px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; color: var(--muted); font-size: 12px; }
.chat-unread { min-width: 23px; height: 23px; padding: 0 7px; border-radius: 999px; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.chat-time { color: var(--light); font-size: 10px; white-space: nowrap; }
.chat-page { display: flex; flex-direction: column; min-height: calc(var(--max-vh) - var(--nav-height) - 12px); padding: 0; }
.chat-head { position: sticky; top: 0; z-index: 20; padding: calc(10px + var(--safe-top)) 14px 10px; background: #fff; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.back-btn { width: 38px; height: 38px; flex: 0 0 38px; border: 0; border-radius: 12px; background: #F2F4F7; color: #344054; cursor: pointer; display: grid; place-items: center; }
.back-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.chat-head-main { min-width: 0; flex: 1; }
.chat-head-main strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-main span { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messages { flex: 1; padding: 14px 12px 90px; display: flex; flex-direction: column; gap: 7px; }
.system-message { align-self: center; max-width: 88%; padding: 7px 10px; border-radius: 999px; background: #E9EDF3; color: #667085; font-size: 10.5px; line-height: 1.35; text-align: center; }
.system-message span { margin-left: 5px; color: #98A2B3; font-size: 9px; white-space: nowrap; }
.bubble { max-width: 82%; padding: 9px 11px; border-radius: 15px 15px 15px 4px; background: #fff; border: 1px solid var(--border); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--blue); border-color: var(--blue); color: #fff; border-radius: 15px 15px 4px 15px; }
.bubble-time { display: block; margin-top: 4px; font-size: 9px; color: #98A2B3; text-align: right; }
.bubble.mine .bubble-time { color: rgba(255,255,255,.72); }
.chat-compose { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(82px + var(--safe-bottom)); z-index: 30; width: min(calc(100% - 24px), 406px); display: grid; grid-template-columns: 1fr 46px; gap: 7px; padding: 7px; border: 1px solid var(--border); border-radius: 17px; background: rgba(255,255,255,.95); box-shadow: 0 8px 24px rgba(16,24,40,.12); }
.chat-compose textarea { min-height: 42px; max-height: 110px; resize: none; border: 0; outline: 0; background: transparent; padding: 10px 8px; font-size: 13px; }
.chat-compose button { width: 44px; height: 44px; border: 0; border-radius: 13px; background: var(--blue); color: #fff; display: grid; place-items: center; cursor: pointer; }
.chat-compose button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.load-older { align-self: center; border: 0; background: var(--blue-soft); color: var(--blue-dark); border-radius: 999px; padding: 7px 11px; font-size: 10.5px; font-weight: 700; cursor: pointer; }

.toast { position: fixed; left: 50%; transform: translate(-50%, 18px); bottom: calc(88px + var(--safe-bottom)); z-index: 100; width: min(calc(100% - 40px), 390px); padding: 12px 14px; background: #101828; color: #fff; border-radius: 13px; text-align: center; font-size: 12px; line-height: 1.4; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: 0 10px 30px rgba(16,24,40,.24); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #7A271A; }

.skeleton { height: 104px; border-radius: 18px; background: linear-gradient(90deg,#ECEFF4 25%,#F7F8FA 38%,#ECEFF4 55%); background-size: 300% 100%; animation: shimmer 1.15s infinite; }
@keyframes shimmer { to { background-position: -100% 0; } }


.action-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.card-actions { margin-top: 12px; padding-top: 11px; border-top: 1px solid #EEF1F5; }
.presence { margin-top: 5px; color: var(--success); font-size: 11px; font-weight: 650; }
.profile-section { margin-top: 12px; }
.profile-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.profile-section-head h3 { margin: 0; font-size: 15px; }
.profile-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.rating-picker { display: flex; align-items: center; gap: 5px; }
.rating-picker button { width: 42px; height: 42px; padding: 0; border: 0; background: transparent; color: #D0D5DD; font-size: 34px; line-height: 1; cursor: pointer; transition: transform .12s ease, color .12s ease; }
.rating-picker button.active { color: var(--star); }
.rating-picker button:active { transform: scale(.92); }

[hidden] { display: none !important; }

@media (max-width: 360px) {
  .app-header { padding-left: 12px; padding-right: 12px; }
  .page { padding-left: 12px; padding-right: 12px; }
  .two-col { grid-template-columns: 1fr; }
  .bottom-nav { width: calc(100% - 16px); }
  .bottom-nav button span { font-size: 8.8px; }
  .thumb { width: 60px; height: 60px; flex-basis: 60px; }
}
