:root {
    color-scheme: light;
    --ink: #242a35;
    --muted: #737b89;
    --line: #e8eaf0;
    --surface: #fff;
    --page: #f6f7fa;
    --yellow: #ffe600;
    --blue: #3483fa;
    --green: #168a58;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: inherit; }
.topbar { min-height: 64px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--yellow); }
.brand { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 750; text-decoration: none; }
.brand-mark { width: 31px; height: 22px; border: 2px solid #25304a; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 800; }
.account { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.account-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.container { width: min(1240px, calc(100% - 40px)); margin: 0 auto; min-height: calc(100vh - 122px); }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 38px 0 25px; }
.page-heading h1 { margin: 3px 0 4px; font-size: clamp(23px, 3vw, 30px); letter-spacing: -.035em; line-height: 1.2; }
.eyebrow { margin: 0; color: #697287; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.intro, .panel-heading p { margin: 0; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 17px; border: 0; border-radius: 7px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: filter .15s, transform .15s; }
.button:hover { filter: brightness(.96); }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--blue); color: white; box-shadow: 0 2px 5px #3483fa30; }
.button-quiet { background: transparent; color: #4c5260; }
.button-small { min-height: 34px; padding: 0 12px; font-size: 12px; }
.inline-form { margin: 0; }
.connect-card, .panel, .stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 3px 14px #1a31510a; }
.connect-card { display: flex; align-items: center; gap: 23px; max-width: 700px; margin: 28px auto 0; padding: 32px; }
.connect-icon { flex: 0 0 53px; width: 53px; height: 53px; display: grid; place-items: center; border-radius: 14px; background: #fff5a8; font-size: 26px; font-weight: 700; }
.connect-card h2 { margin: 0 0 5px; font-size: 21px; }
.connect-card p { margin: 0 0 18px; color: var(--muted); }
.setup-hint { max-width: 700px; margin: 16px auto; font-size: 12px; text-align: center; }
.setup-hint a { color: #1d67c1; }
.notice { margin: 0 0 18px; padding: 12px 15px; border: 1px solid transparent; border-radius: 8px; }
.notice-success { color: #146b43; background: #eaf8f0; border-color: #c8ead7; }
.notice-error { color: #9c3035; background: #fff0f0; border-color: #f3cecf; }
.notice-warning { color: #73520a; background: #fff9df; border-color: #f2e1a6; }
.compact { margin: 12px; font-size: 12px; }
.stats-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { display: flex; flex-direction: column; gap: 3px; padding: 15px 18px; }
.stat-card > span { color: var(--muted); font-size: 12px; }
.stat-card strong { font-size: 23px; letter-spacing: -.03em; }
.stat-card strong.stat-date { font-size: 17px; }
.stat-card small { color: #9096a0; font-size: 11px; }
.stat-card small.sync-error { color: #9c3035; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .95fr); gap: 17px; align-items: start; }
.panel { min-width: 0; overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; min-height: 75px; padding: 15px 19px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0 0 2px; font-size: 17px; }
.panel-heading p { font-size: 11px; }
.count-badge { min-width: 28px; height: 26px; padding: 0 8px; display: grid; place-items: center; border-radius: 14px; background: #f1f3f7; color: #596171; font-size: 11px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
thead { background: #fafbfc; color: #808797; font-size: 10px; text-transform: uppercase; letter-spacing: .045em; }
th { height: 38px; padding: 0 12px; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 19px; }
td { padding: 12px; border-top: 1px solid #f0f1f4; vertical-align: middle; }
td strong, td small { display: block; }
td strong { font-size: 12px; }
td small { margin-top: 3px; color: #9399a3; font-size: 10px; }
tbody tr:hover, tbody tr.selected { background: #f8faff; }
.status-pill { display: inline-block; padding: 4px 7px; border-radius: 10px; background: #edf3ff; color: #356ab8; white-space: nowrap; font-size: 10px; font-weight: 700; }
.table-link { color: #246ec7; white-space: nowrap; font-size: 11px; font-weight: 700; text-decoration: none; }
.table-link:hover { text-decoration: underline; }
.shipping-error { max-width: 150px; margin-top: 4px; color: #9c5c13; font-size: 9px; }
.shipping-error summary { cursor: pointer; }
.shipping-error small { display: block; margin-top: 4px; overflow-wrap: anywhere; color: #737b89; }
.label-link { display: block; margin-top: 4px; }
.order-items { margin-top: 4px; color: #555e6c; font-size: 10px; }
.order-items summary { cursor: pointer; color: #2869b5; }
.order-items ul { margin: 4px 0 0; padding-left: 15px; }
.order-items li { margin-top: 3px; }
.muted { color: var(--muted); }
.empty-state { min-height: 210px; padding: 28px 20px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state > span { margin-bottom: 10px; color: #bbc2ce; font-size: 29px; }
.empty-state strong { font-size: 13px; }
.empty-state p { max-width: 290px; margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.table-footnote { margin: 0; padding: 10px 18px 13px; color: #858c98; font-size: 10px; }
.pagination { min-height: 48px; padding: 8px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination a { padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; color: #246ec7; font-weight: 650; text-decoration: none; }
.pagination a:hover { background: #f5f8fd; }
.pagination .disabled { padding: 6px 9px; color: #adb2bb; }
.message-list { max-height: 430px; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 11px; }
.message { max-width: 92%; padding: 10px 12px; border-radius: 10px; }
.message-buyer { align-self: flex-start; background: #f1f3f7; }
.message-seller { align-self: flex-end; background: #e9f2ff; }
.message-meta { display: flex; justify-content: space-between; gap: 16px; color: #606978; font-size: 10px; }
.message-meta time { white-space: nowrap; }
.message > p { margin: 6px 0 0; overflow-wrap: anywhere; font-size: 12px; }
.message > small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; }
.no-messages { padding: 18px 5px; text-align: center; font-size: 11px; }
.message-form { padding: 14px 15px 15px; border-top: 1px solid var(--line); }
.message-form label { display: block; margin: 0 0 7px; font-size: 11px; font-weight: 700; }
.message-form textarea { display: block; width: 100%; min-height: 76px; padding: 10px; border: 1px solid #dce0e8; border-radius: 7px; resize: vertical; color: var(--ink); font: inherit; font-size: 12px; }
.message-form textarea:focus { outline: 2px solid #b8d4ff; border-color: var(--blue); }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.form-footer small { max-width: 210px; color: #888f9a; font-size: 9px; }
.api-limit { margin: 16px 2px 28px; color: #737b89; font-size: 11px; }
.api-limit strong { color: #515967; }
footer { padding: 18px 20px; border-top: 1px solid var(--line); color: #9298a2; font-size: 10px; text-align: center; }
.main-nav { min-height: 46px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; gap: 24px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); }
.main-nav a { display: inline-flex; align-items: center; flex: 0 0 auto; border-bottom: 2px solid transparent; color: #626a78; font-size: 12px; font-weight: 650; text-decoration: none; }
.main-nav a:hover, .main-nav a.active { border-color: var(--blue); color: #1f64b5; }
.overview-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.overview-links a { min-height: 85px; padding: 15px; display: flex; flex-direction: column; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; background: white; text-decoration: none; box-shadow: 0 3px 14px #1a31510a; }
.overview-links a:hover { border-color: #b9d1f4; }
.overview-links strong { font-size: 13px; }
.overview-links span { color: var(--muted); font-size: 10px; }
.order-picker { padding: 15px; display: grid; grid-template-columns: 1fr auto; gap: 8px; border-bottom: 1px solid var(--line); }
.order-picker label { grid-column: 1 / -1; font-size: 11px; font-weight: 700; }
.order-picker select, .install-form input { min-width: 0; min-height: 39px; padding: 8px 10px; border: 1px solid #dce0e8; border-radius: 7px; color: var(--ink); background: #fff; font: inherit; font-size: 12px; }
.inbox-grid { display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.inbox-sidebar, .chat-panel { height: min(680px, calc(100vh - 230px)); min-height: 440px; }
.inbox-sidebar { display: flex; flex-direction: column; }
.chat-list { min-height: 0; flex: 1; overflow-y: auto; }
.chat-list-item { min-height: 75px; padding: 12px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #f0f1f4; text-decoration: none; }
.chat-list-item:hover, .chat-list-item.active { background: #f2f7ff; }
.chat-list-item.active { box-shadow: inset 3px 0 var(--blue); }
.chat-avatar { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #e8effb; color: #356ab8; font-size: 14px; font-weight: 750; }
.chat-summary { min-width: 0; display: flex; flex-direction: column; }
.chat-summary strong, .chat-summary small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-summary strong { font-size: 11px; }
.chat-summary small { color: var(--muted); font-size: 9px; }
.chat-pagination { margin-top: auto; padding: 8px 11px; }
.chat-panel { display: flex; flex-direction: column; }
.chat-panel > .message-list { max-height: none; min-height: 0; flex: 1; }
.message-attachment { display: block; width: fit-content; max-width: 100%; margin-top: 8px; padding: 6px 9px; border: 1px solid #dce5f2; border-radius: 6px; background: #fff; color: #246ec7; overflow-wrap: anywhere; font-size: 11px; font-weight: 650; text-decoration: none; }
.message-attachment:hover { background: #f6f9fe; }
.message-attachment-unavailable { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.attachment-input { display: block; max-width: 100%; margin-top: 3px; color: var(--muted); font: inherit; font-size: 11px; }
.message-form .attachment-input { margin-bottom: 8px; }
.product-thumb { float: left; width: 48px; height: 48px; margin: 0 10px 5px 0; object-fit: contain; border-radius: 5px; background: #f5f6f8; }
.product-edit-form { display: flex; flex-wrap: wrap; align-items: end; gap: 6px; min-width: 220px; }
.product-edit-form label { display: grid; gap: 3px; color: var(--muted); font-size: 9px; }
.product-edit-form input { width: 87px; padding: 6px; border: 1px solid #dce0e8; border-radius: 5px; font: inherit; font-size: 11px; }
.metrics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.metric-list { padding: 7px 18px 16px; }
.metric-list > div { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid #f0f1f4; font-size: 12px; }
.metric-list > div:last-child { border-bottom: 0; }
.metric-list strong { text-align: right; }
.metric-list .product-metric { align-items: flex-start; padding: 9px 0; }
.product-metric small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }
.installer { max-width: 900px; padding-bottom: 40px; }
.install-form { display: grid; gap: 16px; }
.install-form > .button { justify-self: start; }
.install-section { padding: 21px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.install-section h2 { margin: 0 0 4px; font-size: 17px; }
.install-section > p { margin: 0 0 16px; color: var(--muted); font-size: 11px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field-grid label { display: grid; gap: 5px; font-size: 11px; font-weight: 650; }
.field-grid .full-field { grid-column: 1 / -1; }
.install-form input { width: 100%; font-size: 13px; }
.install-note { margin: 13px 0 0 !important; padding: 10px; border-radius: 7px; background: #f5f7fb; }
.login-form { max-width: 360px; margin-top: 18px; display: grid; gap: 8px; }
.login-form label { font-size: 11px; font-weight: 700; }
.login-form input { min-height: 41px; padding: 8px 10px; border: 1px solid #dce0e8; border-radius: 7px; font: inherit; }
.login-form input:focus { outline: 2px solid #b8d4ff; border-color: var(--blue); }
.login-form .button { justify-self: start; margin-top: 5px; }
.button:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 900px) {
    .content-grid { grid-template-columns: 1fr; }
    .messages-panel { min-height: 270px; }
    .inbox-grid { grid-template-columns: minmax(220px, .8fr) minmax(0, 1.6fr); gap: 9px; }
    .inbox-sidebar, .chat-panel { height: min(680px, calc(100vh - 210px)); min-height: 440px; }
    .overview-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .topbar { min-height: 58px; padding: 0 15px; }
    .account { gap: 5px; font-size: 11px; }
    .account .button { padding: 0 6px; font-size: 10px; }
    .main-nav { padding: 0 13px; gap: 19px; }
    .container { width: calc(100% - 24px); }
    .page-heading { align-items: start; flex-direction: column; padding: 25px 0 18px; }
    .page-heading form, .page-heading form .button { width: 100%; }
    .stats-row { gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-card strong { font-size: 20px; }
    .stat-card strong.stat-date { font-size: 14px; }
    .connect-card { align-items: flex-start; gap: 13px; margin-top: 12px; padding: 22px 17px; }
    .connect-icon { flex-basis: 42px; width: 42px; height: 42px; }
    .connect-card h2 { font-size: 18px; }
    .metrics-grid { grid-template-columns: 1fr; }
    .inbox-grid { grid-template-columns: 1fr; }
    .inbox-sidebar { height: auto; min-height: 0; max-height: 245px; }
    .chat-panel { height: min(680px, calc(100vh - 330px)); min-height: 410px; }
    .chat-panel > .message-list { min-height: 0; }
    .field-grid { grid-template-columns: 1fr; }
    .field-grid .full-field { grid-column: auto; }
    .install-section { padding: 16px; }
    table, tbody, tr, td { display: block; width: 100%; }
    thead { display: none; }
    tbody { padding: 4px 12px; }
    tbody tr { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 9px 12px; padding: 12px 7px; border-bottom: 1px solid var(--line); }
    td { padding: 0 !important; border: 0; font-size: 11px; }
    td:before { content: attr(data-label); display: block; margin-bottom: 2px; color: #9096a0; font-size: 9px; text-transform: uppercase; }
    td:last-child { grid-column: 1 / -1; }
}
