:root {
  --green: #07c160;
  --green-dark: #049c4d;
  --ink: #27313a;
  --muted: #8b949c;
  --soft: #f5f7f8;
  --line: #e9edf0;
  --blue: #5b83f1;
  --orange: #f39a38;
  --red: #ed6a5a;
  --shadow: 0 18px 45px rgba(31, 45, 56, .10);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #edf1f3;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 960px; background: radial-gradient(circle at 20% 10%, #f8fbfc 0, #edf1f3 54%, #e5eaed 100%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; }
.app-shell { width: min(1500px, calc(100vw - 56px)); height: min(900px, calc(100vh - 48px)); min-height: 680px; margin: 24px auto; overflow: hidden; border: 1px solid rgba(255,255,255,.9); border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.topbar { height: 76px; display: flex; align-items: center; gap: 34px; padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.logout-button { color: #be5b5b; background: #fff7f7; border-color: #f4dada; }
.logout-button[hidden] { display: none !important; }
.logout-button:hover { color: #a63e3e; background: #fff0f0; border-color: #ecc4c4; }
.brand-lockup { width: 220px; display: flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: var(--green); color: #fff; font-size: 20px; font-weight: 800; box-shadow: 0 5px 13px rgba(7,193,96,.23); }
.brand-lockup strong { display: block; font-size: 15px; letter-spacing: .3px; }
.brand-lockup span:not(.brand-mark) { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.global-search { width: min(460px, 42vw); height: 39px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #edf0f2; border-radius: 10px; color: #9ba5ad; background: #f7f9fa; }
.global-search:focus-within { border-color: #b5e9c9; background: #fff; box-shadow: 0 0 0 3px rgba(7,193,96,.08); }
.global-search span { font-size: 22px; line-height: 1; transform: rotate(-15deg); }
.global-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
kbd { padding: 2px 6px; border: 1px solid #dfe5e8; border-radius: 5px; color: #a2abb1; background: #fff; font-size: 10px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.icon-button { width: 32px; height: 32px; border-radius: 50%; color: #7c868c; background: #f5f7f8; font-weight: 700; }
.icon-button:hover, .small-action:hover { color: var(--green); background: #e9f9ef; }
.profile-chip { display: flex; align-items: center; gap: 9px; padding: 4px 2px 4px 4px; color: var(--ink); background: transparent; font-size: 13px; }
.profile-chip .chevron { color: #a3abb0; font-size: 15px; }
.avatar { display: inline-grid; place-items: center; width: 39px; height: 39px; flex: 0 0 auto; border-radius: 10px; color: #fff; font-weight: 700; font-size: 14px; }
.avatar-self { background: linear-gradient(135deg, #70b8ff, #3971dc); }
.avatar-blue { background: linear-gradient(135deg, #93c4ff, #5a8bf0); }
.avatar-green { background: linear-gradient(135deg, #67dca0, #17aa67); }
.avatar-orange { background: linear-gradient(135deg, #ffbf74, #ef8c2f); }
.avatar-purple { background: linear-gradient(135deg, #c9a7ff, #8956d7); }

.app-layout { height: calc(100% - 76px); display: grid; grid-template-columns: 72px 294px minmax(0, 1fr); }
.rail { display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 19px 0 17px; background: #f8fafb; border-right: 1px solid var(--line); }
.rail-top, .rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 25px; }
.rail-avatar { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #6ab6ff, #356ed5); font-weight: 800; }
.online-dot { position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border: 2px solid #f8fafb; border-radius: 50%; background: var(--green); }
.rail nav { display: flex; flex-direction: column; gap: 18px; }
.rail-button { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; color: #a2abb1; background: transparent; }
.rail-button:hover, .rail-button.active { color: var(--green); background: #e9f9ef; }
.rail-icon { font-size: 23px; line-height: 1; }
.rail-button i { position: absolute; top: -3px; right: -4px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 10px; color: #fff; background: #f05d4c; font-size: 10px; font-style: normal; }
.conversation-panel { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); background: #fbfcfc; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 28px 21px 20px; }
.eyebrow { color: #a1abb1; font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; }
.panel-heading h1 { margin: 5px 0 0; font-size: 20px; letter-spacing: -.3px; }
.small-action { width: 31px; height: 31px; border-radius: 9px; color: #879196; background: #f1f4f5; font-size: 21px; line-height: 1; }
.conversation-list { flex: 1; overflow: auto; padding: 0 9px; }
.conversation-item { position: relative; display: flex; align-items: center; gap: 11px; min-height: 69px; padding: 10px 12px; border-radius: 11px; }
.conversation-item:hover { background: #f1f5f6; }
.conversation-item.active { background: #e8f8ed; }
.conversation-item.unread::after { content: ""; position: absolute; top: 12px; right: 11px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.conversation-copy { min-width: 0; flex: 1; }
.conversation-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.conversation-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.conversation-title time { color: #a9b1b6; font-size: 10px; }
.conversation-copy p { overflow: hidden; margin: 6px 0 0; color: #929ca3; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.panel-footer { padding: 15px 20px 17px; border-top: 1px solid var(--line); }
.storage-line { color: #667279; font-size: 11px; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px #dff7e8; }
.muted { display: block; margin-top: 7px; color: #b0b8bd; font-size: 10px; }
.content-panel { min-width: 0; overflow: auto; background: #fff; }
#contentView { min-height: 100%; }

.content-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 25px; padding: 31px 38px 25px; border-bottom: 1px solid var(--line); }
.content-header h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.7px; }
.content-header p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; gap: 8px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; padding: 0 14px; border-radius: 9px; color: #5e696f; background: #f3f6f7; font-size: 12px; }
.button:hover { background: #e9eff1; }
.button.primary { color: #fff; background: var(--green); box-shadow: 0 6px 13px rgba(7,193,96,.18); }
.button.primary:hover { background: var(--green-dark); }
.button.text { padding: 0 5px; color: var(--green-dark); background: transparent; }
.workspace-body { padding: 27px 38px 42px; }
.workspace-tabs { display: flex; gap: 21px; margin-bottom: 25px; border-bottom: 1px solid var(--line); }
.workspace-tab { position: relative; padding: 0 1px 13px; color: #939da3; background: transparent; font-size: 12px; }
.workspace-tab.active { color: var(--ink); font-weight: 700; }
.workspace-tab.active::after { content: ""; position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; border-radius: 2px; background: var(--green); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); gap: 12px; }
.stat-card { padding: 17px 18px; border: 1px solid #eef1f3; border-radius: 13px; background: linear-gradient(145deg, #fff, #f8fafb); }
.stat-top { display: flex; justify-content: space-between; align-items: center; color: #9ba5ab; font-size: 11px; }
.stat-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: #fff; background: var(--green); font-size: 15px; }
.stat-icon.blue { background: var(--blue); }.stat-icon.orange { background: var(--orange); }.stat-icon.purple { background: #8a67d5; }
.stat-card strong { display: block; margin-top: 13px; color: var(--ink); font-size: 24px; letter-spacing: -.8px; }
.stat-card small { display: block; margin-top: 6px; color: #a0a9ae; font-size: 10px; }
.section-row { display: flex; align-items: center; justify-content: space-between; margin: 27px 0 12px; }
.section-row h3 { margin: 0; font-size: 14px; }
.section-row span { color: #a1abb1; font-size: 11px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-card { display: flex; align-items: center; gap: 10px; padding: 13px 12px; border: 1px solid #eef1f3; border-radius: 11px; color: #5c686e; background: #fff; text-align: left; }
.quick-card:hover { border-color: #bdeccf; background: #f7fcf8; }.quick-card b { display: block; color: var(--ink); font-size: 12px; }.quick-card small { display: block; margin-top: 4px; color: #a0a9ae; font-size: 10px; }
.quick-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: var(--green-dark); background: #e7f8ed; font-size: 16px; }
.surface { border: 1px solid #eef1f3; border-radius: 13px; background: #fff; overflow: hidden; }.surface-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px; border-bottom: 1px solid #f0f2f3; }.surface-head h3 { margin: 0; font-size: 13px; }.surface-head span { color: #a1abb1; font-size: 11px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; }.data-table th { padding: 11px 15px; color: #a0a9ae; background: #fafbfb; font-size: 10px; font-weight: 500; text-align: left; }.data-table td { padding: 12px 15px; border-top: 1px solid #f1f3f4; color: #637078; }.data-table tr:hover td { background: #fbfdfc; }.data-table strong { color: var(--ink); font-weight: 600; }.data-table .empty { padding: 30px; color: #a8b0b5; text-align: center; }
.agent-adjust { display: flex; align-items: center; gap: 5px; margin-top: 7px; min-width: 150px; }.agent-adjust .form-input { min-height: 30px; width: 105px; padding: 0 7px; font-size: 11px; }
.danger-text { color: #b45f56 !important; }
.countdown { display: inline-flex; min-width: 82px; color: #1b9a5d; font-variant-numeric: tabular-nums; }.countdown-done { color: #a2abb1; }
.profile-lines { padding: 0 17px; }.amount-positive { color: #15945a !important; }.amount-negative { color: #c65c5c !important; }
.balance-panel { padding: 24px 21px 6px; color: var(--green-dark); font-size: 25px; font-weight: 700; }
.card-info-panel { margin-top: 15px; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 20px; color: #63806e; background: #e8f7ed; font-size: 10px; }.badge.warn { color: #a9793e; background: #fff3df; }.badge.danger { color: #b45f56; background: #fff0ed; }.badge.blue { color: #5a76b0; background: #edf2ff; }
.message-view { display: flex; flex-direction: column; height: 100%; }.message-head { display: flex; align-items: center; gap: 12px; padding: 24px 34px 18px; border-bottom: 1px solid var(--line); }.message-head h2 { margin: 0; font-size: 16px; }.message-head p { margin: 4px 0 0; color: #a0a9ae; font-size: 11px; }.message-body { flex: 1; padding: 24px 34px; overflow: auto; background: linear-gradient(180deg, #fbfcfc, #f7f9fa); }.bubble-row { display: flex; gap: 10px; margin: 17px 0; }.bubble-row.mine { flex-direction: row-reverse; }.bubble { max-width: min(560px, 70%); padding: 11px 13px; border-radius: 4px 12px 12px 12px; color: #58656d; background: #fff; box-shadow: 0 2px 9px rgba(39,49,58,.04); font-size: 12px; line-height: 1.65; }.mine .bubble { border-radius: 12px 4px 12px 12px; color: #fff; background: var(--green); }.bubble time { display: block; margin-top: 6px; color: #b2bbc0; font-size: 9px; }.mine .bubble time { color: rgba(255,255,255,.65); }
.contact-grid, .discover-grid, .profile-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 13px; }.contact-card, .discover-card, .profile-card { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid #eef1f3; border-radius: 13px; }.contact-card:hover, .discover-card:hover { border-color: #bdeccf; background: #fbfffc; }.contact-copy { min-width: 0; flex: 1; }.contact-copy strong { display: block; font-size: 13px; }.contact-copy span { display: block; margin-top: 5px; color: #9da7ad; font-size: 11px; }.discover-card { display: block; min-height: 138px; }.discover-card .discover-icon { font-size: 25px; }.discover-card h3 { margin: 12px 0 5px; font-size: 13px; }.discover-card p { margin: 0; color: #9da7ad; font-size: 11px; line-height: 1.6; }.profile-card { align-items: flex-start; grid-column: span 2; padding: 22px; }.profile-card .avatar { width: 62px; height: 62px; font-size: 21px; }.profile-info h2 { margin: 2px 0 6px; font-size: 20px; }.profile-info p { margin: 0; color: #9da7ad; font-size: 12px; }.profile-line { display: flex; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid #f0f2f3; font-size: 12px; }.profile-line span { color: #9da7ad; }
.empty-state { display: grid; place-items: center; height: 100%; min-height: 500px; color: #a2abb1; text-align: center; }.empty-state .empty-icon { margin-bottom: 13px; font-size: 45px; opacity: .55; }.empty-state h2 { margin: 0; color: #69757c; font-size: 18px; }.empty-state p { margin: 8px 0 0; font-size: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 17px; }.toolbar .filter { display: flex; gap: 8px; }.filter-input, .form-input, .form-select, .form-textarea { width: 100%; min-height: 36px; padding: 0 11px; border: 1px solid #e8edef; border-radius: 8px; outline: none; color: var(--ink); background: #fafcfc; font-size: 12px; }.filter-input { width: 190px; }.filter-input:focus, .form-input:focus, .form-select:focus, .form-textarea:focus { border-color: #b5e9c9; background: #fff; box-shadow: 0 0 0 3px rgba(7,193,96,.06); }.form-textarea { padding-top: 10px; resize: vertical; }.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }.form-field { display: flex; flex-direction: column; gap: 7px; }.form-field.full { grid-column: span 2; }.form-field label { color: #748087; font-size: 11px; }.modal { width: min(510px, calc(100vw - 40px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 22px 70px rgba(35,50,59,.22); }.modal::backdrop { background: rgba(26,35,40,.32); backdrop-filter: blur(3px); }.modal-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }.modal-head h2 { margin: 5px 0 0; font-size: 18px; }.modal-close { width: 28px; height: 28px; border-radius: 7px; color: #9ca5aa; background: #f4f6f7; font-size: 20px; }.modal form { padding: 20px 24px 24px; }.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }.switch { position: relative; display: inline-block; width: 35px; height: 20px; }.switch input { opacity: 0; width: 0; height: 0; }.slider { position: absolute; inset: 0; border-radius: 20px; background: #d9e0e3; transition: .2s; }.slider::before { position: absolute; content: ""; width: 16px; height: 16px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.14); }.switch input:checked + .slider { background: var(--green); }.switch input:checked + .slider::before { transform: translateX(15px); }.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid #f0f2f3; }.toggle-row strong { display: block; font-size: 12px; }.toggle-row small { display: block; margin-top: 5px; color: #a3acb1; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 30px; z-index: 20; padding: 10px 15px; border-radius: 9px; color: #fff; background: rgba(39,49,58,.9); box-shadow: 0 8px 22px rgba(39,49,58,.2); font-size: 12px; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .25s; }.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1120px) { .app-shell { width: calc(100vw - 24px); margin: 12px auto; height: calc(100vh - 24px); }.app-layout { grid-template-columns: 66px 260px minmax(0, 1fr); }.workspace-body, .content-header { padding-left: 25px; padding-right: 25px; }.quick-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) { body { min-width: 0; }.app-shell { width: 100vw; height: 100vh; min-height: 0; margin: 0; border: 0; border-radius: 0; }.topbar { padding: 0 14px; gap: 12px; }.brand-lockup { width: auto; }.brand-lockup > div { display: none; }.global-search { width: 45vw; }.profile-chip > span:not(.avatar) { display: none; }.app-layout { grid-template-columns: 60px 230px minmax(0, 1fr); }.content-header { padding: 23px 20px 20px; }.workspace-body { padding: 21px 20px 30px; }.stat-grid { grid-template-columns: repeat(2, 1fr); }.contact-grid, .discover-grid { grid-template-columns: 1fr; }.profile-card { grid-column: span 1; }.form-grid { grid-template-columns: 1fr; }.form-field.full { grid-column: span 1; } }

/* Layout spacing polish */
.app-shell { width: min(1600px, calc(100vw - 80px)); }
.topbar { gap: 44px; padding-left: 30px; padding-right: 30px; }
.app-layout { grid-template-columns: 78px 320px minmax(0, 1fr); }
.panel-heading { padding: 30px 26px 22px; }
.conversation-list { padding-left: 14px; padding-right: 14px; }
.conversation-item { min-height: 76px; padding: 12px 14px; gap: 14px; }
.content-header { gap: 36px; padding: 38px 48px 30px; }
.workspace-body { padding: 32px 48px 50px; }
.workspace-tabs { flex-wrap: wrap; gap: 0 27px; margin-bottom: 32px; padding-bottom: 0; }
.workspace-tab { min-height: 31px; padding-bottom: 14px; }
.stat-grid { gap: 18px; }
.quick-grid { gap: 16px; }
.surface-head { padding: 18px 21px; }
.data-table { min-width: 760px; }

@media (max-width: 1120px) {
  body { min-width: 0; }
  .app-shell { width: calc(100vw - 32px); margin: 16px auto; }
  .topbar { gap: 20px; padding-left: 22px; padding-right: 22px; }
  .app-layout { grid-template-columns: 68px 280px minmax(0, 1fr); }
  .content-header { padding: 30px 30px 25px; }
  .workspace-body { padding: 27px 30px 40px; }
  .workspace-tabs { gap: 0 20px; }
}

@media (max-width: 860px) {
  .app-shell { width: 100vw; }
  .topbar { gap: 12px; padding-left: 14px; padding-right: 14px; }
  .app-layout { grid-template-columns: 60px 230px minmax(0, 1fr); }
  .content-header { gap: 18px; padding: 23px 20px 20px; }
  .workspace-body { padding: 21px 20px 30px; }
  .workspace-tabs { gap: 0 16px; margin-bottom: 24px; }
}

/* Full-width business workspace */
.topbar { justify-content: space-between; }
.app-shell { width: min(1800px, calc(100vw - 32px)); height: min(960px, calc(100vh - 32px)); margin: 16px auto; }
.app-layout { grid-template-columns: minmax(0, 1fr); }
.content-panel { width: 100%; }

@media (max-width: 860px) {
  .app-shell { width: 100vw; height: 100vh; margin: 0; }
  .app-layout { grid-template-columns: minmax(0, 1fr); }
}

.login-screen { min-height: 100%; display: grid; place-items: center; padding: 60px 24px; background: radial-gradient(circle at 50% 0%, #f7fffa 0, #fff 52%, #f4f8f6 100%); }
.login-card { width: min(430px, 100%); padding: 38px 40px 34px; border: 1px solid #edf2ef; border-radius: 20px; background: rgba(255,255,255,.96); box-shadow: 0 22px 70px rgba(31,75,48,.12); }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong { display: block; font-size: 17px; }
.login-brand span:not(.brand-mark) { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.login-copy { margin-top: 42px; }
.login-copy h1 { margin: 9px 0 0; font-size: 28px; letter-spacing: -.8px; }
.login-copy p { margin: 11px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-form { display: grid; gap: 9px; margin-top: 28px; }
.login-form label { color: #667279; font-size: 12px; font-weight: 600; }
.login-form .form-input { min-height: 44px; font-size: 13px; }
.login-submit { width: 100%; min-height: 44px; margin-top: 8px; }
.login-hint { margin-top: 18px; padding: 10px 12px; border-radius: 9px; color: #63806e; background: #f0fbf3; font-size: 11px; }
.login-hint strong { color: var(--green-dark); letter-spacing: .4px; }
.login-note { margin-top: 17px; color: #a3adb2; font-size: 10px; line-height: 1.6; text-align: center; }
.login-switch { display: block; width: 100%; margin-top: 17px; padding: 0; color: var(--green-dark); background: transparent; font-size: 11px; }
.login-switch:hover { color: var(--green); text-decoration: underline; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.inline-form { display: flex; gap: 10px; padding: 20px; }
.inline-form .form-input { min-width: 0; flex: 1; }

@media (max-width: 560px) {
  .login-screen { padding: 24px 16px; }
  .login-card { padding: 30px 24px 26px; }
}

@media (max-width: 760px) {
  .two-column { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; }
}

/* Mobile scrolling */
html, body { min-height: 100%; }
body { overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 860px) {
  .app-shell { height: auto; min-height: 100vh; overflow: visible; }
  .app-layout { height: auto; min-height: calc(100vh - 76px); }
  .content-panel { min-height: calc(100vh - 76px); overflow: visible; }
  #contentView { min-height: 0; }
}
