@layer base, layout, components, responsive;

@layer base {
    :root {
        color-scheme: dark;
        --body: #101622;
        --nav: #0e1420;
        --surface: #151e2c;
        --input: #101926;
        --line: #2b3749;
        --line-soft: #232f40;
        --text: #edf2f8;
        --muted: #9eabc0;
        --quiet: #8392a9;
        --accent: #54d4c5;
        --accent-bright: #63e3d3;
        --accent-ink: #0b2828;
        --green: #80dbac;
        --danger: #ff959c;
        --warn: #f1c386;
        --radius: 9px;
        font: 15px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
        background: var(--body);
        color: var(--text);
    }
    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; min-width: 280px; }
    button, input, textarea, select { font: inherit; }
    button { color: inherit; }
    a { color: inherit; text-decoration: none; }
    p, h1, h2, h3 { margin: 0; }
    h1, h2, h3 { line-height: 1.24; }
    h1:focus { outline: none; }
    button:not(:disabled), [type=file], summary { cursor: pointer; }
    button:disabled { opacity: .46; }
    :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
    label { display: grid; gap: 4px; color: #d5ddea; font-size: .82rem; font-weight: 600; min-width: 0; }
    input:not([type=checkbox]):not([type=file]):not([type=color]), textarea, select {
        width: 100%; min-width: 0; color: var(--text); background: var(--input); border: 1px solid #344155;
        border-radius: 6px; min-height: 35px; padding: 6px 9px; outline: none; font-size: .9rem; font-weight: 400;
    }
    input::placeholder, textarea::placeholder { color: #8292a8; opacity: 1; }
    input:focus, textarea:focus, select:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 2px #54d4c520; }
    select { appearance: none; padding-right: 25px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23a9b6c9' stroke-width='1.4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 10px; }
    textarea { resize: vertical; }
    [hidden] { display: none !important; }
    ::selection { color: var(--accent-ink); background: var(--accent); }
    .icon { flex: 0 0 auto; width: 1.1rem; height: 1.1rem; }
    .muted { color: var(--muted); }
    .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

@layer layout {
    .app-shell { min-height: 100dvh; display: grid; grid-template-columns: 209px minmax(0, 1fr); }
    .sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: linear-gradient(150deg, #121b29 0%, var(--nav) 48%); border-right: 1px solid var(--line-soft); padding: 23px 13px 13px; }
    .sidebar-brand { margin: 0 4px 29px; }
    .sidebar nav { display: grid; gap: 4px; }
    .sidebar nav a { display: flex; align-items: center; gap: 11px; min-height: 39px; padding: 8px 9px; border: 1px solid transparent; border-radius: 7px; color: #bcc8d8; font-size: .92rem; font-weight: 550; }
    .sidebar nav a:hover { background: #192434; color: white; }
    .sidebar nav a.active { background: #20303e; color: #80e6dc; border-color: #2b414d; }
    .sidebar-account { margin-top: auto; border-top: 1px solid var(--line-soft); padding: 13px 0 2px; display: flex; align-items: center; gap: 8px; min-width: 0; }
    .sidebar-account form { margin-left: auto; }
    .workspace { min-width: 0; }
    .mobile-top, .mobile-tabs, .menu-scrim { display: none; }
    .plain-layout { display: grid; place-items: center; min-height: 100dvh; padding: 20px; background: radial-gradient(ellipse at 50% 10%, #192b38, #101622 65%); }
    .page-content { max-width: 1240px; margin-inline: auto; padding: 34px clamp(17px, 3.4vw, 48px) 40px; }
    .page-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 23px; }
    .page-heading h1 { font-size: 1.88rem; letter-spacing: -.035em; }
    .page-heading p { color: var(--muted); margin-top: 6px; }
    .page-block { margin-top: 22px; }
    .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 11px; }
    .section-heading h2 { font-size: 1.1rem; }
    .editor-page { display: flex; flex-direction: column; height: 100dvh; }
    .editor-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(15px, 1.65vw, 25px); min-height: 70px; background: #111925; border-bottom: 1px solid var(--line); }
    .editor-title { min-width: 0; }
    .back-link { display: inline-flex; align-items: center; gap: 3px; color: #91a4ba; font-weight: 600; font-size: .73rem; line-height: 1; }
    .back-link .icon { width: .74rem; height: .74rem; }
    .back-link:hover { color: var(--accent-bright); }
    .title-line { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
    .title-line h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(1.1rem, 1.7vw, 1.49rem); letter-spacing: -.02em; }
    .editor-header-actions { flex: none; display: flex; align-items: center; gap: 13px; }
    .editor-grid { min-height: 0; flex: 1 1 auto; display: grid; grid-template-columns: minmax(365px, .86fr) minmax(0, 1.14fr); }
    .edit-pane, .preview-pane { min-width: 0; padding: 15px clamp(13px, 1.5vw, 25px) 17px; }
    .edit-pane { overflow: auto; scrollbar-width: thin; scrollbar-color: #3b4a60 transparent; border-right: 1px solid var(--line); }
    .preview-pane { background: #111925; display: flex; flex-direction: column; min-height: 0; }
    .pane-heading { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 11px; min-width: 0; }
    .pane-heading h2 { display: flex; align-items: center; gap: 8px; font-size: 1.09rem; letter-spacing: -.015em; }
    .pane-heading p { margin-top: 3px; color: var(--quiet); font-size: .79rem; }
    .pane-heading > button { flex: none; }
    .preview-controls { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
    .preview-controls > span { color: var(--muted); font-size: .77rem; }
    .preview-stage { min-height: 145px; flex: 1 1 auto; overflow: auto; padding: 12px clamp(7px, 1.2vw, 19px); background: radial-gradient(ellipse at 50% 0, #f3f6f8, #dbe4ea 88%); border: 1px solid #cbd7df; border-radius: 10px; color-scheme: light; scrollbar-width: thin; scrollbar-color: #99a9b6 transparent; }
    .frame-host { display: block; position: relative; width: 100%; max-width: 632px; height: 220px; overflow: hidden; margin: 0 auto; }
    .frame-host[data-device=mobile] { max-width: 390px; }
    .frame-host iframe { position: absolute; inset: 0 auto auto 0; display: block; width: 100%; height: 100%; border: 0; transform-origin: top left; }
    .editor-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex: none; min-height: 58px; padding: 8px clamp(13px, 1.6vw, 24px); background: #151e2d; border-top: 1px solid var(--line); }
    .email-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
    .delivery-fields { margin-top: 12px; display: grid; gap: 7px; }
    .mail-results { display: grid; gap: 8px; margin: 0; padding-left: 20px; overflow-wrap: anywhere; }
    .mail-results li > :not(:first-child) { display: block; color: var(--muted); font-size: .82rem; }
    .mail-results .address-invalid strong { color: #ffc3ca; }
    .mail-results .address-incomplete strong { color: #f2cb98; }
    .send-summary { display: grid; gap: 3px; margin: 0; overflow-wrap: anywhere; }
    .send-summary dt { font-weight: 650; font-size: .82rem; color: var(--muted); }
    .send-summary dd { margin: 0 0 7px; }
    .send-summary ul { margin: 0; padding-left: 18px; }
    .email-meta { display: grid; justify-items: end; color: var(--muted); white-space: nowrap; font-size: .75rem; line-height: 1.25; }
    .email-meta strong { color: #98e2d2; font-size: .88rem; }
}
@layer components {
    .brand { display: inline-flex; align-items: center; line-height: 1.03; gap: 8px; white-space: nowrap; }
    .brand img { flex: none; display: block; }
    .brand > span { display: grid; gap: 2px; }
    .brand strong { font-size: 1.05rem; font-weight: 750; letter-spacing: .025em; color: #f2f6ff; }
    .brand span span { font-size: .84rem; color: #b7c5d7; }
    .avatar { display: inline-grid; flex: 0 0 auto; place-items: center; width: 31px; height: 31px; border-radius: 50%; color: #adebdf; background: #223941; border: 1px solid #385861; font-size: .72rem; font-weight: 750; }
    .account-text { display: grid; min-width: 0; line-height: 1.25; }
    .account-text strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .83rem; }
    .account-text span { color: #94a5b8; font-size: .7rem; }
    .button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 35px; border: 1px solid #38465a; border-radius: 7px; padding: 6px 10px; background: #202b3b; color: #e2ebf6; font-weight: 650; font-size: .84rem; line-height: 1.2; white-space: nowrap; }
    .button:not(:disabled):hover, .icon-button:not(:disabled):hover { background: #2a394d; border-color: #56677b; color: #fff; }
    .button.primary { background: var(--accent); color: var(--accent-ink); border-color: #66ddd0; font-weight: 750; }
    .button.primary:not(:disabled):hover { background: var(--accent-bright); color: #071e1f; border-color: var(--accent-bright); }
    .button.small { font-size: .78rem; min-height: 31px; padding: 5px 8px; }
    .button.tiny { font-size: .74rem; min-height: 27px; padding: 4px 6px; gap: 4px; }
    .button.tiny .icon { width: .88rem; height: .88rem; }
    .icon-button { padding: 0; width: 30px; min-height: 30px; background: transparent; color: #bbc8d8; }
    .icon-button.danger { color: var(--danger); }
    .icon-button.danger:hover { background: #482d39; border-color: #794756; color: #ffdce0; }
    .logout { border-color: transparent; }
    .danger-button { color: #ffe4e5; background: #743743; border-color: #a84e60; }
    .danger-button:not(:disabled):hover { background: #914050; border-color: #c56272; }
    .segments { display: flex; gap: 5px; }
    .segments button, .mobile-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 33px; padding: 5px 9px; background: #151f2d; border: 1px solid #354257; color: #c2cee0; border-radius: 6px; font-weight: 600; font-size: .83rem; white-space: nowrap; }
    .segments button:hover, .mobile-tabs button:hover { background: #233043; }
    .segments button.selected, .mobile-tabs button.selected { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 750; }
    .segments .icon { width: .95rem; height: .95rem; }
    .arrangement button { flex: 1 1 0; min-width: 0; }
    .badge { flex: none; display: inline-flex; white-space: nowrap; padding: 2px 8px; border-radius: 999px; border: 1px solid #465367; color: #cbd7e7; background: #222e40; font-size: .73rem; font-weight: 650; }
    .badge.ready { color: #9be3bb; border-color: #356450; background: #20392f; }
    .save-state { display: inline-flex; gap: 5px; align-items: center; color: var(--warn); font-size: .78rem; white-space: nowrap; }
    .save-state.saved { color: #92ddbd; }
    .save-state .icon { width: 1rem; height: 1rem; }
    .live-dot { width: 7px; height: 7px; border-radius: 50%; background: #66e1bd; box-shadow: 0 0 0 3px #66e1bd24; }
    .campaign-fields { display: grid; gap: 7px; }
    .mobile-campaign-toggle.button { display: none; }
    .field-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, .64fr); gap: 8px; }
    .advanced-fields { padding: 2px 0 1px; color: #aabbd1; font-size: .82rem; }
    .advanced-fields[open] { display: grid; padding: 7px; background: #172231; border: 1px solid var(--line); border-radius: 7px; }
    .advanced-fields[open] > :not(summary) { margin-top: 8px; }
    .check-field, .color-field { display: flex; align-items: center; gap: 7px; }
    .check-field input { accent-color: var(--accent); }
    .color-field input { width: 38px; padding: 2px 3px; background: var(--input); border: 1px solid var(--line); border-radius: 5px; }
    .editor-section { margin-top: 12px; }
    .editor-section h3, .section-title h3 { margin-bottom: 6px; color: #c8d5e5; font-size: .72rem; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; }
    .editor-section h3 label { color: inherit; font-size: inherit; font-weight: inherit; }
    .import-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
    .field-with-icon { position: relative; min-width: 0; }
    .field-with-icon > .icon { position: absolute; color: #8ca4bc; top: 50%; left: 9px; transform: translateY(-50%); pointer-events: none; }
    .field-with-icon > input:not([type=checkbox]):not([type=file]):not([type=color]) { padding-left: 33px; }
    .product-section { display: grid; gap: 7px; margin-top: 13px; padding-top: 10px; border-top: 1px solid var(--line); }
    .section-title { display: flex; gap: 7px; align-items: center; }
    .section-title h3 { margin: 0; }
    .section-title > span { display: inline-grid; place-items: center; min-width: 20px; padding: 0 5px; border: 1px solid #37485d; color: #acbdcf; background: #1c2839; border-radius: 10px; font-size: .72rem; line-height: 1.35; }
    .empty-products, .empty-state { display: grid; justify-items: center; gap: 6px; padding: 16px 8px; border: 1px dashed #35465b; border-radius: var(--radius); color: var(--muted); text-align: center; background: #151f2d; }
    .empty-products strong, .empty-state h3 { color: #dce6f2; font-size: .93rem; }
    .empty-products > span { font-size: .79rem; }
    .empty-products > .icon, .empty-state > .icon { color: var(--accent); width: 1.35rem; height: 1.35rem; }
    .empty-state { padding: 28px 10px; }
    .add-product { width: 100%; border-style: dashed; color: #d2e1ed; background: #151f2d; }
    .product-card { border: 1px solid #334154; overflow: hidden; border-radius: 8px; background: #182333; min-width: 0; }
    .product-card.expanded { border-color: #405267; }
    .product-header { display: flex; align-items: center; gap: 4px; justify-content: space-between; background: #243142; padding: 4px 6px; min-height: 34px; }
    .product-toggle { display: flex; align-items: center; gap: 5px; min-width: 0; flex: 1 1 auto; border: 0; padding: 3px 0; background: transparent; text-align: left; }
    .product-toggle .icon { width: .87rem; height: .87rem; color: #adc1d6; }
    .product-card.expanded .product-toggle .icon { transform: rotate(90deg); color: var(--accent); }
    .product-index { flex: 0 0 auto; color: #a8bacf; font-weight: 700; font-size: .71rem; }
    .product-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; font-weight: 650; }
    .product-actions { display: flex; flex: none; gap: 3px; }
    .product-actions .icon-button, .photo-tools .icon-button { width: 24px; min-height: 24px; border-color: #43546a; border-radius: 5px; }
    .product-actions .icon, .photo-tools .icon-button .icon { width: .91rem; height: .91rem; }
    .product-actions .danger { border-color: transparent; }
    .product-body { display: grid; gap: 7px; padding: 8px; }
    .photo-row { display: flex; align-items: center; gap: 8px; }
    .product-thumb { display: grid; place-items: center; flex: 0 0 auto; width: 51px; height: 43px; border-radius: 6px; background: #f5f7f9; color: #53677e; overflow: hidden; border: 1px solid #bac6d4; }
    .product-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
    .photo-row > .product-thumb { width: 63px; height: 51px; }
    .product-summary { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; text-align: left; padding: 6px 8px; border: 0; background: transparent; color: var(--muted); font-size: .81rem; }
    .product-summary:hover { background: #202d3e; }
    .product-summary strong { color: #e7eff8; font-weight: 700; white-space: nowrap; margin-left: auto; font-size: .84rem; }
    .summary-detail { min-width: 0; display: grid; gap: 2px; }
    .summary-detail > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .link-state { display: inline-flex; align-items: center; gap: 4px; color: #a9b9cd; font-size: .73rem; }
    .link-state .icon { width: .85rem; height: .85rem; }
    .link-state.verified { color: var(--green); }
    .link-state.invalid { color: var(--warn); }
    .photo-tools { min-width: 0; }
    .inline-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
    .inline-controls.compact { gap: 4px; }
    .upload-button { position: relative; align-self: flex-start; overflow: hidden; }
    .upload-button:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
    .upload-button input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
    .product-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(62px, .62fr) minmax(0, 1.1fr); gap: 6px; }
    .product-url-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: end; }
    .product-url-row .button { min-height: 35px; }
    .photo-address { color: var(--muted); font-size: .8rem; }
    .photo-address[open] label { margin-top: 5px; }
}
@layer components {
    .notice { margin-block: 7px; padding: 8px 10px; border: 1px solid #405771; border-radius: 7px; background: #1b2a3c; color: #ccdaeb; font-size: .82rem; }
    .notice .icon { vertical-align: -.16em; }
    .notice.error { border-color: #76434f; background: #3b2835; color: #ffc3ca; }
    .notice.success { border-color: #396555; background: #21382f; color: #a9e9c5; }
    .notice.warning { border-color: #6a543d; background: #362d28; color: #f3cea0; }
    .preview-issues { flex: 0 1 auto; margin-bottom: 0; max-height: 25%; overflow: auto; }
    .preview-issues ul { margin: 3px 0 0; padding-inline-start: 20px; }
    .clipboard-toast { position: fixed; z-index: 8; bottom: 67px; right: 18px; width: max-content; max-width: calc(100vw - 36px); border: 1px solid #4d8371; border-radius: 8px; color: #ccf6de; background: #1e3a32; padding: 10px 14px; box-shadow: 0 12px 34px #0006; font-size: .84rem; }
    .clipboard-toast.fallback { border-color: #826348; color: #ffe1b4; background: #403327; max-width: min(410px, calc(100vw - 36px)); }
    .modal-scrim { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; background: #080d16ba; padding: 16px; }
    .modal-card, .login-card { width: min(100%, 438px); max-height: 90dvh; overflow: auto; display: grid; gap: 11px; align-content: start; padding: 20px; border: 1px solid #3c4f65; background: #182434; border-radius: 13px; box-shadow: 0 14px 60px #060b12a0; }
    .modal-card h2 { font-size: 1.11rem; }
    .modal-card p, .login-card p { color: var(--muted); }
    .modal-card .notice.error { color: #ffc3ca; }
    .modal-card .notice.success { color: #a9e9c5; }
    .modal-card > .button { justify-self: start; }
    .modal-heading { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
    .media-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .media-choice { display: grid; gap: 5px; overflow: hidden; border: 1px solid var(--line); background: #202e41; border-radius: 7px; padding: 5px; text-align: left; }
    .media-choice:hover { border-color: var(--accent); }
    .media-choice img { width: 100%; height: 58px; object-fit: contain; background: #f3f6f8; border-radius: 5px; }
    .media-choice span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .75rem; }
    .login-card { padding: 25px; border-top: 3px solid var(--accent); }
    .login-card h1 { margin-top: 11px; font-size: 1.6rem; }
    .login-card form { display: grid; gap: 11px; margin-top: 3px; }
    .login-card input:not([type=checkbox]):not([type=file]):not([type=color]) { min-height: 42px; }
    .login-card .button { margin-top: 3px; min-height: 41px; }
    .dashboard-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
    .summary-card { min-width: 0; display: flex; gap: 11px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
    .summary-card:hover { border-color: #4d7a80; }
    .summary-card div { display: grid; color: var(--muted); font-size: .83rem; }
    .summary-card strong { color: var(--text); font-size: 1.54rem; line-height: 1.3; }
    .summary-icon { display: inline-grid; place-items: center; width: 35px; height: 35px; flex: none; border-radius: 7px; background: #24444b; color: #92eadb; }
    .text-link { color: #87e3d7; font-size: .83rem; font-weight: 650; }
    .text-link:hover { text-decoration: underline; }
    .list-tools { margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
    .email-table-state { display: grid; gap: 3px; justify-items: start; }
    .email-table-state small { font-size: .75rem; color: var(--muted); }
    .search-field { width: min(100%, 355px); }
    .data-table, .recent-products, .saved-templates { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
    .table-head, .table-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(80px, .24fr) minmax(90px, .26fr) 68px; align-items: center; gap: 8px; padding: 9px 12px; }
    .table-head { background: #1f2a3b; color: #bdcadd; font-weight: 650; font-size: .77rem; }
    .table-row, .recent-row { border-top: 1px solid var(--line-soft); }
    .table-row time { color: var(--muted); font-size: .82rem; }
    .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
    .cell-title { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
    .cell-title:hover:is(a) { color: var(--accent-bright); }
    .cell-title small, .cell-title a { color: var(--muted); font-size: .78rem; }
    .cell-title a:hover { color: var(--accent-bright); }
    .recent-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 9px; padding: 8px 11px; }
    .recent-row:first-child { border-top: 0; }
    .recent-price { font-size: .86rem; }
    .template-gallery, .media-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 10px; }
    .template-card, .media-card, .settings-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
    .template-card { display: grid; gap: 6px; grid-template-rows: auto auto 1fr auto; padding: 10px; }
    .template-card h2 { font-size: 1rem; margin-top: 3px; }
    .template-card p { font-size: .79rem; color: var(--muted); }
    .template-card .button { justify-self: start; margin-top: 4px; }
    .layout-sample { display: grid; min-height: 91px; grid-template-columns: 1fr; grid-auto-rows: 1fr; align-content: start; gap: 4px; padding: 8px 24%; background: #233342; border-radius: 6px; }
    .layout-sample.grid { grid-template-columns: 1fr 1fr; }
    .sample-heading { grid-column: 1 / -1; border-radius: 3px; min-height: 11px; background: #61beaf; }
    .sample-block { display: flex; gap: 4px; align-items: center; padding: 3px; background: #3c5365; border-radius: 3px; min-height: 14px; }
    .sample-block i { width: 25%; min-height: 9px; background: #698799; border-radius: 2px; }
    .sample-block i + i { width: 55%; min-height: 4px; background: #9bb4c1; }
    .media-gallery { grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
    .media-preview { display: grid; place-items: center; background: #e5ebef; height: 118px; padding: 5px; }
    .media-preview img { max-width: 100%; max-height: 106px; object-fit: contain; }
    .media-card-body { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 8px; }
    .settings-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; }
    .settings-card { margin: 0; padding: 13px; display: grid; align-content: start; gap: 10px; }
    .settings-card h2 { font-size: 1.08rem; }
    .settings-card .button, .settings-card .badge { justify-self: start; }
    .settings-card p { color: var(--muted); font-size: .88rem; }
    .smtp-card h2 .icon { vertical-align: -.16em; }
    .smtp-fields { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; }
    .catalog-thumb { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
    .smtp-account-row { display: grid; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 10px; overflow-wrap: anywhere; }
    .smtp-help { padding-top: 7px; }
    .smtp-help p { margin-top: 7px; }
    .standalone { margin: 14px; }
    #blazor-error-ui { display: none; position: fixed; z-index: 30; inset: auto 0 0; padding: 9px 15px; background: #643941; color: #fff; }
    #blazor-error-ui a { text-decoration: underline; }
}

@layer responsive {
    @media (min-width: 901px) and (max-height: 850px) {
        .editor-header { min-height: 61px; padding-block: 8px; }
        .edit-pane, .preview-pane { padding-block: 10px; }
        .edit-pane .pane-heading { margin-bottom: 8px; }
        .campaign-fields { gap: 5px; }
        .campaign-fields input:not([type=checkbox]):not([type=file]):not([type=color]), .campaign-fields select { min-height: 31px; padding-block: 4px; }
        .campaign-fields textarea { height: 43px; }
        .editor-section { margin-top: 9px; }
        .product-section { margin-top: 9px; padding-top: 8px; gap: 5px; }
        .product-summary { padding-block: 3px; }
        .product-summary .product-thumb { width: 41px; height: 34px; }
    }
    @media (min-width: 1580px) {
        .app-shell { grid-template-columns: 227px minmax(0, 1fr); }
        .editor-grid { grid-template-columns: minmax(450px, .87fr) minmax(0, 1.13fr); }
    }
    @media (max-width: 1150px) and (min-width: 901px) {
        .app-shell { grid-template-columns: 176px minmax(0, 1fr); }
        .sidebar { padding-inline: 9px; }
        .sidebar nav a { gap: 8px; }
        .pane-heading p, .external-button span { display: none; }
        .editor-grid { grid-template-columns: minmax(350px, 1fr) minmax(0, 1fr); }
    }
    @media (max-width: 900px) {
        .app-shell { display: block; }
        .sidebar { position: fixed; inset: 0 auto 0 0; width: min(260px, 80vw); z-index: 7; transform: translateX(-102%); transition: transform .18s ease; visibility: hidden; }
        .sidebar.open { transform: translateX(0); visibility: visible; }
        .menu-scrim { display: block; position: fixed; z-index: 6; inset: 0; width: 100%; border: 0; background: #080d16a8; }
        .mobile-top { display: flex; align-items: center; gap: 9px; min-height: 54px; padding: 7px 12px; border-bottom: 1px solid var(--line); background: #111925; }
        .mobile-menu { width: 33px; min-height: 33px; border-color: transparent; }
        .mobile-user { margin-left: auto; display: flex; gap: 6px; align-items: center; color: #d4deeb; font-size: .79rem; min-width: 0; }
        .mobile-user > span:last-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
        .mobile-user .avatar { width: 25px; height: 25px; font-size: .65rem; }
        .mobile-top .brand img { width: 29px; height: 29px; }
        .mobile-top .brand strong { font-size: .91rem; }
        .mobile-top .brand span span { font-size: .73rem; }
        .editor-page { height: auto; min-height: calc(100dvh - 54px); }
        .editor-header { min-height: 57px; padding: 7px 12px; }
        .editor-header-actions { gap: 7px; }
        .save-state { font-size: .72rem; }
        .editor-header-actions .button { min-height: 31px; }
        .mobile-tabs { display: flex; gap: 6px; padding: 9px 12px; background: var(--body); border-bottom: 1px solid var(--line-soft); }
        .mobile-tabs button { flex: 1; min-height: 37px; }
        .editor-grid { display: block; }
        .edit-pane, .preview-pane { padding: 11px 12px 15px; border: 0; overflow: visible; }
        .preview-pane { display: none; }
        .preview-active .edit-pane { display: none; }
        .preview-active .preview-pane { display: flex; }
        .preview-stage { min-height: 330px; max-height: 73dvh; padding: 5px; }
        .preview-issues { max-height: none; }
        .editor-bar { position: sticky; bottom: 0; z-index: 4; padding: 7px 12px calc(7px + env(safe-area-inset-bottom)); min-height: 57px; }
        .editor-bar .button { min-height: 38px; }
        .page-content { padding-top: 20px; }
    }
    @media (max-width: 500px) {
        .editor-header .back-link { display: none; }
        .editor-header { min-height: 49px; }
        .title-line h1 { font-size: 1.05rem; }
        .editor-header .save-state { max-width: 88px; white-space: normal; line-height: 1.12; }
        .save-button { font-size: 0; gap: 0; width: 31px; padding: 0; }
        .save-button .icon { width: 1rem; height: 1rem; }
        .pane-heading { margin-bottom: 8px; }
        .pane-heading p, .external-button span { display: none; }
        .pane-heading h2 { font-size: 1.02rem; }
        .edit-pane .pane-heading h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
        .mobile-campaign-toggle.button { display: flex; }
        .mobile-campaign-toggle[aria-expanded=true] .icon:last-child { transform: rotate(90deg); }
        .campaign-fields:not(.show-mobile) { display: none; }
        .campaign-fields.show-mobile { margin-top: 8px; }
        .editor-bar .email-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
        .email-meta { display: none; }
        .email-actions .button { padding-inline: 5px; gap: 4px; }
        .dashboard-stats { grid-template-columns: 1fr; }
        .summary-card { padding: 8px; }
        .summary-card div { display: flex; align-items: center; gap: 7px; }
        .summary-card strong { font-size: 1.2rem; }
        .page-heading { align-items: flex-start; flex-wrap: wrap; margin-bottom: 13px; }
        .page-heading h1 { font-size: 1.5rem; }
        .page-heading p { font-size: .86rem; }
        .table-head, .table-row { grid-template-columns: minmax(0, 1fr) auto auto; padding: 7px; gap: 5px; }
        .table-head > span:nth-child(3), .table-row time { display: none; }
        .settings-grid { grid-template-columns: 1fr; }
        .product-title { font-size: .82rem; }
        .product-index { font-size: .66rem; }
        .product-summary { display: none; }
    }
    @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
}

@layer components {
    .nav-section-title { margin: 0 9px 8px; color: var(--quiet); font-size: .73rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
    .company-workspace { --company-bar-height: 48px; }
    .company-workspace .editor-page { height: calc(100dvh - var(--company-bar-height)); }
    .company-bar {
        display: flex; gap: 10px; justify-content: space-between; align-items: center; min-height: var(--company-bar-height);
        padding: 7px clamp(12px, 1.65vw, 25px); background: #182432; border-bottom: 1px solid #35465a;
    }
    .company-bar > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
    .company-bar > div:first-child > span:first-child { color: #aebed0; font-size: .77rem; white-space: nowrap; }
    .company-bar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .93rem; }
    .company-bar-actions { flex: none; }
    .company-option { justify-content: flex-start; text-align: left; white-space: normal; }
    .company-option .icon:last-child { margin-left: auto; }
    .publication-action { margin-top: 7px; display: flex; align-items: center; justify-content: space-between; gap: 7px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; }
    .preview-issues:has(+ .publication-action) { max-height: 95px; }
    .platform-page { max-width: 1390px; }
    .platform-heading { margin-bottom: 23px; }
    .platform-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
    .platform-stats .summary-card { min-height: 82px; }
    .platform-stats .summary-card strong { font-variant-numeric: tabular-nums; }
    .summary-icon.blue { background: #283d5c; color: #a9ceff; }
    .summary-icon.amber { background: #453a34; color: #f4cb91; }
    .platform-block { margin-top: 23px; }
    .platform-block .section-heading time, .platform-table time { color: var(--muted); font-size: .79rem; }
    .platform-block > .muted { margin-block: 7px; }
    .service-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
    .service-grid > div { display: grid; gap: 3px 8px; grid-template-columns: auto minmax(0, 1fr); align-items: center; padding: 12px; }
    .service-grid > div + div { border-left: 1px solid var(--line); }
    .service-grid .icon { color: var(--muted); }
    .service-grid span { font-weight: 650; font-size: .82rem; }
    .service-grid strong { grid-column: 2; font-size: .83rem; }
    .service-grid .operational { color: var(--green); }
    .platform-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
    .platform-table-head, .platform-table-row { display: grid; align-items: center; gap: 10px; padding: 10px 12px; }
    .platform-table-head { color: #bdcadd; background: #223043; font-size: .77rem; font-weight: 650; }
    .platform-table-row { min-height: 55px; border-top: 1px solid var(--line-soft); font-size: .86rem; }
    .platform-table-row small { display: block; color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
    .platform-table-row strong { overflow-wrap: anywhere; }
    .firms-table > div { grid-template-columns: minmax(0, 1.8fr) minmax(85px, .65fr) minmax(70px, .55fr) minmax(65px, .55fr) minmax(77px, .63fr) minmax(125px, 1fr); }
    .members-table > div { grid-template-columns: minmax(0, 1fr) minmax(95px, .5fr) minmax(70px, .4fr) minmax(138px, .8fr); }
    .users-table > div { grid-template-columns: minmax(0, 1.2fr) minmax(75px, .45fr) minmax(90px, .8fr) minmax(136px, .8fr); }
    .audit-table > div { grid-template-columns: minmax(107px, .58fr) minmax(0, .65fr) minmax(0, .9fr) minmax(0, 1.25fr); }
    .platform-firm { display: flex; align-items: center; min-width: 0; gap: 9px; }
    .firm-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
    .firm-actions .icon-button { width: 26px; min-height: 26px; }
    .badge.suspended { color: #f2cb98; background: #3b322d; border-color: #685443; }
    .admin-form { max-width: 670px; }
    .member-block .admin-form { margin-block: 9px; }
}

@layer responsive {
    @media (max-width: 1100px) {
        .platform-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    @media (max-width: 900px) {
        .company-workspace .editor-page { height: auto; min-height: calc(100dvh - 54px - var(--company-bar-height)); }
    }
    @media (max-width: 640px) {
        .company-bar > div:first-child { display: grid; gap: 0; }
        .company-bar > div:first-child > .badge { justify-self: start; }
        .company-bar-actions a:last-child span { display: none; }
        .platform-stats, .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .service-grid > div:nth-child(n+3) { border-top: 1px solid var(--line); }
        .service-grid > div:nth-child(odd) { border-left: 0; }
        .firms-table > div { grid-template-columns: minmax(0, 1fr) auto minmax(95px, auto); }
        .firms-table .platform-table-row > :nth-child(3), .firms-table .platform-table-row > :nth-child(4),
        .firms-table .platform-table-row > :nth-child(5), .firms-table .platform-table-head > :nth-child(3),
        .firms-table .platform-table-head > :nth-child(4), .firms-table .platform-table-head > :nth-child(5) { display: none; }
        .platform-firm .summary-icon { display: none; }
        .members-table > div, .users-table > div, .audit-table > div { grid-template-columns: minmax(0, 1fr) minmax(90px, .7fr); }
        .members-table .platform-table-head, .users-table .platform-table-head, .audit-table .platform-table-head { display: none; }
    }
}
