:root {
  --ink: #17201d;
  --muted: #66716d;
  --line: #dfe4df;
  --paper: #f3f2ec;
  --panel: #fff;
  --forest: #122520;
  --forest-2: #1c352e;
  --mint: #a9e37d;
  --coral: #fa765f;
  --blue: #6b9df0;
  --shadow: 0 22px 60px rgba(21, 36, 31, .12);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
html.modal-open, body.modal-open { overflow: hidden; overscroll-behavior: none; }
html.modal-open { scrollbar-gutter: stable; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 28px; overflow: hidden; position: relative; background: var(--forest); }
.login-shell::before { content: ""; position: absolute; inset: 0; opacity: .08; background-image: linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px); background-size: 48px 48px; }
.login-ambient { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .75; }
.login-ambient-one { width: 460px; height: 460px; left: -120px; bottom: -180px; background: #375f50; }
.login-ambient-two { width: 280px; height: 280px; right: -40px; top: -80px; background: #9bcc73; opacity: .18; }
.login-card { width: min(440px, 100%); position: relative; z-index: 1; border: 1px solid rgba(255,255,255,.18); border-radius: 28px; padding: 46px; color: white; background: rgba(25, 49, 42, .84); box-shadow: 0 34px 100px rgba(0,0,0,.28); backdrop-filter: blur(16px); }
.brand-mark { width: 60px; height: 60px; display: grid; place-items: center; position: relative; border-radius: 18px; color: var(--forest); background: var(--mint); font-size: 21px; font-weight: 900; letter-spacing: -1px; }
.brand-mark i { width: 10px; height: 10px; position: absolute; right: -3px; bottom: 10px; border: 3px solid var(--forest); border-radius: 50%; background: var(--coral); }
.eyebrow { margin: 24px 0 10px; color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.eyebrow.dark { margin: 0 0 10px; color: #497267; }
.login-card h1 { margin: 0; font-size: clamp(32px, 8vw, 44px); letter-spacing: -.04em; }
.login-copy { margin: 12px 0 30px; color: #b8c8c2; }
.login-form { display: grid; gap: 18px; }
.login-form label { display: grid; gap: 8px; color: #d7e0dc; font-size: 13px; font-weight: 650; }
.login-form input { width: 100%; height: 52px; border: 1px solid rgba(255,255,255,.17); border-radius: 12px; padding: 0 16px; outline: none; color: white; background: rgba(8, 23, 18, .45); transition: .2s; }
.login-form input:focus { border-color: var(--mint); box-shadow: 0 0 0 3px rgba(169, 227, 125, .13); }
.login-code-row { display: grid; grid-template-columns: minmax(0, 1fr) 116px; align-items: end; gap: 10px; }
.code-button { height: 52px; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; color: #dce8e3; background: rgba(255,255,255,.07); font-size: 12px; font-weight: 750; white-space: nowrap; }
.code-button:hover { border-color: rgba(169,227,125,.58); color: var(--mint); background: rgba(169,227,125,.08); }
.code-button:disabled { cursor: default; opacity: .55; }
.form-status { min-height: 18px; margin: -4px 0; color: #a9c0b7; font-size: 13px; }
.form-status.error { color: #ff9f8f; }
.primary-button { height: 54px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 13px; padding: 0 20px; color: var(--forest); background: var(--mint); font-weight: 800; transition: .2s; }
.primary-button:hover { transform: translateY(-1px); background: #b8eb92; }
.primary-button:disabled { cursor: wait; opacity: .65; }
.login-meta { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 26px; color: #91a69e; font-size: 12px; }
.status-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #76d69c; box-shadow: 0 0 0 4px rgba(118,214,156,.12); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.sidebar { height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; color: white; background: var(--forest); overflow: auto; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar::-webkit-scrollbar { width: 0; height: 0; }
.sidebar-brand { min-height: 92px; display: flex; align-items: center; gap: 13px; padding: 22px 24px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark-small { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 13px; font-size: 17px; }
.brand-mark-small i { width: 8px; height: 8px; border-width: 2px; }
.sidebar-brand strong { display: block; font-size: 15px; }
.sidebar-brand small { display: block; margin-top: 4px; color: #789088; font-size: 9px; letter-spacing: .14em; }
.site-nav { flex: 1; padding: 14px 12px; }
.site-group { padding: 15px 8px 19px; border-bottom: 1px solid rgba(255,255,255,.07); }
.site-heading { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; padding: 0 6px 12px; color: white; background: transparent; text-align: left; }
.site-heading-text { min-width: 0; flex: 1; }
.site-heading strong, .site-heading small { display: block; }
.site-heading strong { font-size: 12px; }
.site-heading small { margin-top: 3px; color: #758a83; font-size: 10px; }
.site-toggle-icon { color: #7f948d; font-size: 13px; transform: rotate(0deg); transition: transform .18s, color .18s; }
.site-heading:hover .site-toggle-icon { color: #d4dfdb; }
.site-group.collapsed .site-toggle-icon { transform: rotate(-90deg); }
.site-group.collapsed .nav-item { display: none; }
.site-icon { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; color: var(--forest); background: var(--mint); font-size: 11px; font-weight: 900; }
.site-icon.coral { background: var(--coral); }
.site-icon.blue { background: var(--blue); }
.nav-item { width: 100%; height: 38px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 9px; padding: 0 10px 0 44px; color: #91a39d; background: transparent; font-size: 12px; text-align: left; transition: .18s; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: white; background: var(--forest-2); }
.nav-item b { min-width: 25px; padding: 3px 6px; border-radius: 10px; color: #779087; background: rgba(255,255,255,.06); font-size: 9px; text-align: center; }
.nav-item.active b { color: var(--forest); background: var(--mint); }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; border-top: 1px solid rgba(255,255,255,.08); }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account > div { min-width: 0; }
.account .avatar { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; background: #28443b; font-size: 12px; }
.account strong, .account small { display: block; }
.account strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account small { margin-top: 3px; color: #71877f; font-size: 9px; }
.icon-button { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: #3d4d48; background: white; font-size: 18px; }
.icon-button:hover { border-color: #aab8b2; }
.icon-button.light { border-color: rgba(255,255,255,.1); color: #8fa39b; background: rgba(255,255,255,.04); }
.logout-button { height: 36px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.12); border-radius: 9px; padding: 0 11px; color: #c7d4cf; background: rgba(255,255,255,.05); font-size: 10px; font-weight: 750; white-space: nowrap; }
.logout-button:hover { border-color: rgba(255,255,255,.24); color: white; background: rgba(255,255,255,.09); }

.workspace { min-width: 0; }
.topbar { height: 72px; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 0 36px; border-bottom: 1px solid #e0e1db; background: rgba(243,242,236,.94); backdrop-filter: blur(12px); box-shadow: 0 10px 26px rgba(37, 47, 43, .06); }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: #8a928f; font-size: 12px; }
.breadcrumb i { color: #bdc2bf; font-style: normal; }
.breadcrumb strong { color: #2f3b37; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.live-pill { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid #d9ded9; border-radius: 18px; color: #52615c; background: rgba(255,255,255,.58); font-size: 11px; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: #54b77d; }
.menu-button { display: none; border: 0; background: transparent; font-size: 22px; }
.content { max-width: 1600px; margin: 0 auto; padding: 42px 42px 28px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-intro h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1; letter-spacing: -.05em; }
.page-intro p:last-child { margin: 15px 0 0; color: var(--muted); font-size: 13px; }
.intro-stamp { display: flex; align-items: baseline; gap: 8px; }
.intro-stamp span { font-size: 40px; font-weight: 800; letter-spacing: -.04em; }
.intro-stamp small { color: var(--muted); }
.data-panel { margin-top: 26px; border: 1px solid #dfe2dc; border-radius: 18px; background: var(--panel); box-shadow: 0 14px 40px rgba(37, 47, 43, .05); overflow: hidden; }
.panel-toolbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid #e7e9e4; }
.search-box { width: min(430px, 100%); height: 44px; display: flex; align-items: center; gap: 10px; border: 1px solid #e1e4df; border-radius: 11px; padding: 0 12px; background: #f8f9f6; }
.search-box span { color: #66736e; font-size: 20px; }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; font-size: 12px; }
.search-box kbd { padding: 4px 7px; border: 1px solid #e0e3de; border-radius: 5px; color: #9aa19e; background: white; font-family: inherit; font-size: 9px; }
.secondary-button { height: 42px; display: flex; align-items: center; gap: 8px; border: 1px solid #dce1dc; border-radius: 10px; padding: 0 14px; color: #33443e; background: white; font-size: 11px; font-weight: 700; }
.secondary-button:hover { border-color: #aab7b1; background: #f9faf8; }
.table-wrap { min-height: 380px; position: relative; overflow: auto; }
table { width: 100%; min-width: max-content; table-layout: auto; border-collapse: collapse; font-size: 11px; }
th { height: 42px; position: sticky; top: 0; z-index: 1; padding: 0 12px; color: #87918d; background: #fafbf8; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-align: left; white-space: nowrap; }
td { max-width: 300px; padding: 15px 12px; border-top: 1px solid #eef0ec; color: #3c4844; vertical-align: middle; }
th[data-column="createdAt"], td[data-column="createdAt"],
th[data-column="created_at"], td[data-column="created_at"],
th[data-column="updated_at"], td[data-column="updated_at"] { white-space: nowrap; }
th[data-column="sourceLabel"], td[data-column="sourceLabel"],
th[data-column="kind"], td[data-column="kind"] { white-space: nowrap; }
th[data-column="company"], td[data-column="company"] { width: clamp(80px, 12vw, 170px); min-width: 80px; max-width: 170px; }
th[data-column="name"], td[data-column="name"],
th[data-column="contactName"], td[data-column="contactName"],
th[data-column="salesOwner"], td[data-column="salesOwner"] { white-space: nowrap; }
th[data-column="contact"], td[data-column="contact"],
th[data-column="email"], td[data-column="email"],
th[data-column="salesOwnerEmail"], td[data-column="salesOwnerEmail"] { white-space: nowrap; }
th[data-column="requirement"], td[data-column="requirement"] { width: clamp(160px, 20vw, 230px); min-width: 160px; max-width: 230px; }
th[data-column="location"], td[data-column="location"] { width: clamp(120px, 15vw, 200px); min-width: 120px; max-width: 200px; }
th[data-column="address"], td[data-column="address"] { width: clamp(150px, 18vw, 240px); min-width: 150px; max-width: 240px; }
th[data-column="outputName"], td[data-column="outputName"] { width: clamp(180px, 22vw, 260px); min-width: 180px; max-width: 260px; }
th[data-column="rowCount"], td[data-column="rowCount"],
th[data-column="shareUrl"], td[data-column="shareUrl"],
th[data-column="phone"], td[data-column="phone"] { white-space: nowrap; }
th[data-column="actions"], td[data-column="actions"] { width: 56px; min-width: 56px; position: sticky; right: 0; z-index: 2; text-align: center; background: white; box-shadow: -8px 0 14px -14px rgba(25, 42, 36, .65); }
th[data-column="actions"] { z-index: 3; background: #fafbf8; }
tbody tr { transition: .15s; }
tbody tr:hover { background: #fafbf8; }
tbody tr:hover td[data-column="actions"] { background: #fafbf8; }
.primary-cell { color: #1f2c27; font-weight: 750; line-height: 1.55; }
td[data-column="company"] .primary-cell { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted-cell { color: #83908b; }
.truncate { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 7px; color: #37574c; background: #e8f3e4; font-size: 9px; font-weight: 800; white-space: nowrap; }
.tag.coral { color: #874032; background: #ffebe7; }
.tag.blue { color: #31588e; background: #eaf1ff; }
.record-link { color: #2f6a58; font-weight: 700; text-decoration: none; }
.record-link:hover { text-decoration: underline; }
.detail-button { width: 28px; height: 28px; border: 1px solid #e0e5df; border-radius: 8px; color: #52605b; background: white; }
.panel-footer { min-height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-top: 1px solid #e7e9e4; color: #7d8884; font-size: 10px; }
.pagination { display: flex; align-items: center; gap: 10px; }
.pagination button { width: 32px; height: 30px; border: 1px solid #dee2dd; border-radius: 8px; color: #596661; background: white; }
.pagination button:disabled { cursor: default; opacity: .35; }
.loading-state, .empty-state { position: absolute; inset: 43px 0 0; display: grid; place-content: center; place-items: center; color: #7e8985; background: rgba(255,255,255,.92); text-align: center; }
.spinner { width: 30px; height: 30px; border: 3px solid #e1e8e3; border-top-color: #3a6d5c; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state div { font-size: 34px; }
.empty-state strong { margin-top: 8px; color: #44534e; }
.empty-state p { margin: 7px 0 0; font-size: 11px; }
.sync-note { display: flex; align-items: center; gap: 9px; margin: 16px 3px 0; color: #8a918e; font-size: 10px; }

.detail-dialog { width: min(680px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 32px)); border: 0; border-radius: 20px; padding: 0; overflow: hidden; color: var(--ink); background: white; box-shadow: var(--shadow); }
.detail-dialog[open] { display: flex; flex-direction: column; }
.detail-dialog::backdrop { background: rgba(12, 26, 21, .6); backdrop-filter: blur(4px); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; flex: 0 0 auto; padding: 24px 26px 18px; border-bottom: 1px solid #e9ebe7; }
.dialog-head h2 { margin: 0; font-size: 24px; }
.dialog-actions { display: flex; align-items: center; gap: 8px; margin-left: 16px; }
.dialog-action { height: 34px; border: 1px solid #dce2dc; border-radius: 9px; padding: 0 12px; color: #43534d; background: white; font-size: 11px; font-weight: 800; }
.dialog-action:hover { border-color: #aebbb4; background: #f8faf7; }
.dialog-action.primary { border-color: #2f6a58; color: white; background: #2f6a58; }
.dialog-action.danger { border-color: #ffd5d0; color: #bb3d2e; background: #fff6f4; }
.dialog-close { width: 36px; height: 36px; border: 1px solid #e0e4df; border-radius: 10px; color: #4f5c57; background: white; font-size: 22px; }
.detail-content { min-height: 0; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 6px 26px 28px; }
.detail-row { display: grid; grid-template-columns: 130px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid #eef0ec; }
.detail-row dt { color: #89928e; font-size: 11px; }
.detail-row dd { min-width: 0; margin: 0; color: #303d38; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.detail-input { width: 100%; min-height: 38px; border: 1px solid #dfe6df; border-radius: 8px; padding: 9px 10px; outline: none; color: #25312d; background: #fbfcfa; font: inherit; resize: vertical; }
.detail-input:focus { border-color: #6c927f; box-shadow: 0 0 0 3px rgba(108,146,127,.12); }
.detail-text { white-space: pre-wrap; }
.detail-empty { color: #a0aaa5; }
.detail-link { overflow-wrap: anywhere; }
.detail-object { display: grid; gap: 2px; width: 100%; }
.detail-object.nested { padding-top: 2px; }
.detail-field { display: grid; grid-template-columns: minmax(92px, 34%) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid #f0f2ee; }
.detail-field:last-child { border-bottom: 0; }
.detail-field-label { color: #73807b; font-size: 11px; font-weight: 700; }
.detail-field-value { min-width: 0; color: #25312d; }
.detail-list { display: grid; gap: 10px; }
.detail-card { min-width: 0; border: 1px solid #e5ebe5; border-radius: 8px; padding: 10px 12px; background: #fbfcfa; }
.detail-card-title { margin-bottom: 6px; color: #6b7b75; font-size: 10px; font-weight: 800; }
.detail-pill-list { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-pill-list > span { min-width: 0; max-width: 100%; border: 1px solid #e2e8e2; border-radius: 999px; padding: 3px 8px; background: #fbfcfa; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; padding: 13px 16px; border-radius: 11px; color: white; background: #243c34; box-shadow: 0 14px 38px rgba(15,34,28,.2); font-size: 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 232px minmax(0,1fr); }
  .content { padding: 34px 26px 24px; }
  .topbar { padding: 0 26px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { width: 280px; position: fixed; left: 0; z-index: 10; transform: translateX(-105%); transition: .25s; box-shadow: 18px 0 50px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: block; }
  .breadcrumb span, .breadcrumb i { display: none; }
  .topbar { height: 62px; padding: 0 16px; }
  .live-pill { display: none; }
  .content { padding: 28px 16px 20px; }
  .page-intro { align-items: start; }
  .intro-stamp { display: none; }
  .panel-toolbar { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .toolbar-actions, .secondary-button { width: 100%; }
  .secondary-button { justify-content: center; }
  .login-card { padding: 34px 26px; }
  .dialog-head { flex-direction: column; }
  .dialog-actions { flex-wrap: wrap; margin-left: 0; }
  .detail-row { grid-template-columns: 1fr; gap: 5px; }
  .detail-field { grid-template-columns: 1fr; gap: 2px; }
}
