/* ShopAssist user pages: lists, a list, sign in. The admin pages keep style.css and DevExtreme. */

:root {
    --bg: #F5F6F8;
    --card: #FFFFFF;
    --line: #E4E7EC;
    --line-strong: #D5DAE2;
    --text: #14171F;
    --muted: #5B6270;
    --soft: #F0F2F5;
    --accent: #2F55D4;
    --accent-hover: #2446B8;
    --accent-soft: #EEF2FD;
    --accent-ink: #1D3FB8;
    --good: #0B6B35;
    --good-soft: #E3F4EA;
    --bad: #A34500;
    --bad-soft: #FFEFE3;
    --warn-ink: #5A3B00;
    --warn-soft: #FFF8EB;
    --warn-line: #F3D9A4;
    --radius: 18px;
    --display: Manrope, Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.sa {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.sa a { color: #2348C9; text-decoration: none; }
.sa a:hover { color: #16328F; }
.sa h1, .sa h2, .sa h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; }
.sa button, .sa input, .sa textarea, .sa select { font: inherit; color: inherit; }
.sa :focus-visible { outline: 3px solid rgba(47, 85, 212, .45); outline-offset: 2px; }
.sa-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.sa-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.sa-header-in { max-width: 1120px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.sa-brand { display: flex; align-items: center; gap: 10px; color: var(--text) !important; }
.sa-brand-name { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.sa-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: 16px; }
.sa-nav a { padding: 10px 14px; border-radius: 10px; color: #3F4654; font-weight: 500; }
.sa-nav a:hover { background: var(--soft); color: var(--text); }
.sa-nav a.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.sa-user { margin-left: auto; position: relative; }
.sa-user > summary { list-style: none; cursor: pointer; height: 44px; padding: 0 12px 0 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: flex; align-items: center; gap: 8px; font-size: 14px; }
.sa-user > summary::-webkit-details-marker { display: none; }
.sa-avatar { width: 32px; height: 32px; border-radius: 50%; background: #FFE7D6; color: #9A3D0A; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.sa-user-name { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(20, 23, 31, .12); padding: 6px; display: flex; flex-direction: column; z-index: 30; }
.sa-menu a, .sa-menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; border: 0; background: none; color: var(--text) !important; cursor: pointer; font-size: 14px; }
.sa-menu a:hover, .sa-menu button:hover { background: var(--soft); }
.sa-menu-label { padding: 8px 12px 4px; color: var(--muted); font-size: 12px; }
.sa-menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.sa-menu .danger { color: var(--bad) !important; }

/* layout */
.sa-main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; display: flex; flex-direction: column; gap: 24px; }
.sa-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.sa-head h1 { font-size: 34px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.sa-lead { margin: 6px 0 0; color: var(--muted); font-size: 16px; max-width: 640px; }
.sa-back { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; }
.sa-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.sa-muted { color: var(--muted); }

/* buttons */
.sa-btn { height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); color: var(--text) !important; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.sa-btn:hover { background: var(--soft); }
.sa-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff !important; }
.sa-btn-primary:hover { background: var(--accent-hover); }
.sa-btn-sm { height: 40px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.sa-btn-link { height: auto; padding: 0; border: 0; background: none; color: #2348C9 !important; font-weight: 600; }
.sa-btn-link:hover { background: none; color: #16328F !important; }
.sa-btn-danger { color: var(--bad) !important; }
.sa-icon-btn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #3F4654; }
.sa-icon-btn:hover { background: var(--soft); }

/* forms */
.sa-field { display: flex; flex-direction: column; gap: 6px; }
.sa-field label { font-size: 14px; font-weight: 600; }
.sa-input { height: 48px; padding: 0 14px; border: 1px solid #C9CFD8; border-radius: 12px; background: #fff; font-size: 15px; width: 100%; }
textarea.sa-input { height: auto; min-height: 140px; padding: 12px 14px; resize: vertical; }
.sa-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(47, 85, 212, .18); }
.sa-field-error { color: var(--bad); font-size: 13px; }
.sa-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.sa-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.sa-choice { display: flex; gap: 10px; flex-wrap: wrap; }
.sa-choice label { flex: 1 1 140px; border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 500; }
.sa-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sa-choice input { accent-color: var(--accent); }

/* notices */
.sa-flash { border-radius: 14px; padding: 14px 16px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.sa-flash-ok { background: var(--good-soft); color: var(--good); }
.sa-flash-error { background: var(--bad-soft); color: var(--bad); }
.sa-pill { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sa-pill-good { background: var(--good-soft); color: var(--good); }
.sa-pill-bad { background: var(--bad-soft); color: var(--bad); }
.sa-pill-info { background: var(--accent-soft); color: var(--accent-ink); }
.sa-good { color: var(--good); }
.sa-bad { color: var(--bad); }

/* lists home */
.sa-lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.sa-list-card { padding: 22px; display: flex; flex-direction: column; gap: 18px; color: var(--text) !important; transition: border-color .15s, box-shadow .15s; }
.sa-list-card:hover { border-color: #C3CBE0; box-shadow: 0 6px 20px rgba(20, 23, 31, .06); }
.sa-list-top { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sa-mark { width: 48px; height: 48px; flex: none; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.sa-mark-0 { background: #EEF2FD; color: #1D3FB8; }
.sa-mark-1 { background: #FFF1E6; color: #9A3D0A; }
.sa-mark-2 { background: #E8F6F1; color: #0B6150; }
.sa-mark-3 { background: #F3EEFC; color: #5B2DA8; }
.sa-list-name { font-family: var(--display); font-weight: 700; font-size: 19px; overflow-wrap: anywhere; }
.sa-list-sub { color: var(--muted); font-size: 14px; }
.sa-list-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sa-caption { color: var(--muted); font-size: 13px; }
.sa-big { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.01em; }
.sa-new-list { min-height: 168px; border: 2px dashed #CBD1DB; border-radius: var(--radius); background: transparent; color: #3F4654; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; cursor: pointer; }
.sa-new-list:hover { border-color: var(--accent); color: var(--accent-ink); background: rgba(47, 85, 212, .03); }

.sa-section { padding: 24px; display: flex; flex-direction: column; gap: 8px; }
.sa-section h2 { font-size: 21px; font-weight: 800; }
.sa-drop { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 0; border-top: 1px solid #EEF0F3; color: var(--text) !important; }
.sa-drop:first-of-type { border-top: 0; }
.sa-drop-name { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sa-drop-name b { font-weight: 600; }
.sa-drop-prices { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.sa-was { color: var(--muted); font-size: 14px; text-decoration: line-through; }
.sa-now { font-family: var(--display); font-weight: 800; font-size: 18px; }

/* a list */
.sa-add { padding: 18px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.sa-add-input { flex: 999 1 380px; min-width: 0; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border: 2px solid var(--accent); border-radius: 14px; background: #fff; }
.sa-add-input input { flex: 1; min-width: 0; border: 0; outline: none; font-size: 16px; background: transparent; }
.sa-add .sa-btn { flex: 1 0 auto; height: 52px; border-radius: 14px; }
.sa-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.sa-tile { padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.sa-tile .sa-caption { font-size: 13px; }

.sa-items { display: flex; flex-direction: column; gap: 12px; }
.sa-item { display: flex; align-items: flex-start; gap: 4px; padding-left: 14px; overflow: hidden; scroll-margin-top: 140px; }
.sa-item:has(details[open]) { border: 2px solid var(--accent); }
.sa-item-select { padding-top: 44px; flex: none; }
.sa-item-select input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.sa-item details { flex: 1; min-width: 0; }
.sa-item summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 18px 18px 18px 8px; }
.sa-item summary::-webkit-details-marker { display: none; }
.sa-photo { width: 72px; height: 72px; flex: none; border-radius: 14px; background: var(--soft); display: flex; align-items: center; justify-content: center; color: #8A93A3; }
.sa-item-text { flex: 999 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.sa-item-name { font-weight: 600; font-size: 17px; overflow-wrap: anywhere; }
.sa-item-meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; color: var(--muted); }
.sa-item-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 120px; margin-left: auto; }
.sa-item-price .sa-now { font-size: 22px; }
.sa-delta { font-size: 13px; font-weight: 600; }
.sa-chevron { transition: transform .15s; }
.sa-item details[open] .sa-chevron { transform: rotate(180deg); }
.sa-spark { flex: none; }
.sa-item-body { background: #F8F9FB; border-top: 1px solid var(--line); margin-left: -18px; padding: 8px 18px 18px 26px; display: flex; flex-direction: column; gap: 16px; }
.sa-table-wrap { overflow-x: auto; }
.sa-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.sa-table th { padding: 10px 8px; font-weight: 500; color: var(--muted); text-align: left; }
.sa-table td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.sa-table .num { text-align: right; white-space: nowrap; }
.sa-table .shop-title { display: block; color: var(--muted); font-size: 12px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.sa-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.sa-inline .sa-field { flex: 1 1 200px; }
.sa-inline .sa-input { height: 44px; }
.sa-item-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; }
.sa-empty { padding: 40px 24px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.sa-empty h2 { font-size: 20px; }

.sa-groupbar { position: sticky; bottom: 16px; z-index: 10; background: var(--text); color: #fff; border-radius: 16px; padding: 12px 12px 12px 18px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; box-shadow: 0 12px 32px rgba(20, 23, 31, .25); }
.sa-groupbar[hidden] { display: none; }
.sa-groupbar span { flex: 1 1 240px; font-size: 14px; }
.sa-groupbar .sa-btn { border-color: transparent; }

/* dialogs */
.sa-dialog { border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(20, 23, 31, .25); color: var(--text); }
.sa-dialog::backdrop { background: rgba(20, 23, 31, .45); }
.sa-dialog form { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.sa-dialog h2 { font-size: 22px; font-weight: 800; }
.sa-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* sign in */
.sa-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.sa-auth-in { width: 100%; max-width: 1040px; display: flex; flex-wrap: wrap; gap: 48px; align-items: center; }
.sa-auth-pitch { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.sa-auth-pitch h1 { font-size: 44px; line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; }
.sa-feature { display: flex; gap: 14px; align-items: flex-start; }
.sa-feature-icon { width: 40px; height: 40px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.sa-feature b { display: block; font-weight: 600; font-size: 16px; }
.sa-feature span { color: var(--muted); }
.sa-auth-card { flex: 1 1 380px; max-width: 440px; min-width: 0; padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.sa-auth-card h2 { font-size: 24px; font-weight: 800; }
.sa-provider { height: 52px; border-radius: 14px; border: 0; width: 100%; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; color: #fff !important; }
.sa-provider-yandex { background: #14171F; }
.sa-provider-yandex:hover { background: #2A2F3A; }
.sa-provider-vk { background: #0B5ED7; }
.sa-provider-vk:hover { background: #0A52BC; }
.sa-provider-other { background: var(--card); color: var(--text) !important; border: 1px solid var(--line-strong); }
.sa-provider-badge { width: 26px; height: 26px; border-radius: 8px; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.sa-provider-yandex .sa-provider-badge { border-radius: 50%; color: #14171F; font-size: 15px; }
.sa-provider-vk .sa-provider-badge { color: #0B5ED7; font-size: 12px; }
.sa-providers { display: flex; flex-direction: column; gap: 10px; }
.sa-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.sa-or::before, .sa-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sa-auth-form { display: flex; flex-direction: column; gap: 14px; }
.sa-auth-form .sa-btn { height: 52px; border-radius: 14px; }

@media (max-width: 640px) {
    .sa-header-in { padding: 10px 16px; }
    .sa-nav { margin-left: 0; order: 3; width: 100%; }
    .sa-user-name { display: none; }
    .sa-main { padding: 20px 16px 48px; gap: 18px; }
    .sa-head h1 { font-size: 26px; }
    .sa-auth-pitch h1 { font-size: 32px; }
    .sa-auth-card { padding: 22px; }
    .sa-item { padding-left: 10px; }
    .sa-item summary { padding: 14px 14px 14px 6px; gap: 10px 12px; }
    .sa-item-select { padding-top: 34px; }
    .sa-photo { width: 56px; height: 56px; }
    .sa-item-text { flex-basis: calc(100% - 80px); }
    .sa-spark { display: none; }
    .sa-item-price { align-items: flex-start; margin-left: 68px; flex-direction: row; align-items: baseline; gap: 10px; }
    .sa-item-price .sa-now { font-size: 19px; }
    .sa-item summary > .sa-chevron-btn { display: none; }
    .sa-item-body { margin-left: -14px; padding: 8px 14px 14px 18px; }
    .sa-section { padding: 18px; }
    .sa-tiles { gap: 8px; }
    .sa-tile { flex-direction: row; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; padding: 12px 16px; }
    .sa-tile .sa-big { font-size: 18px; }
    .sa-tile-hint { display: none; }
    .sa-add { padding: 12px; }
}
