:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #17202a;
    --muted: #647080;
    --line: #d9dee6;
    --primary: #146c63;
    --primary-strong: #0f514a;
    --danger: #b42318;
    --danger-bg: #fee4e2;
    --warning: #9a6700;
    --warning-bg: #fff1b8;
    --safe: #1f7a3f;
    --safe-bg: #dff5e7;
}

* {
    box-sizing: border-box;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html {
    max-width: 100%;
    overflow-x: clip;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px clamp(16px, 4vw, 40px);
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--line);
    max-width: 100%;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 800;
    letter-spacing: 0;
    min-width: 0;
}

.brand img {
    display: block;
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.topbar nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
}

.organization-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 180px;
}

.organization-switcher label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0;
}

.organization-switcher label > svg {
    width: 18px;
    min-width: 18px;
}

.organization-switcher select {
    width: min(220px, 24vw);
    min-width: 140px;
    min-height: 40px;
}

.organization-switcher button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 8px;
}

.organization-context-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid #b8c7d9;
    border-radius: 6px;
    background: #eef4fa;
    color: #29445f;
    font-weight: 700;
}

.organization-context-notice svg {
    width: 18px;
    min-width: 18px;
}

.organization-badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 26px;
    padding: 3px 8px;
    border: 1px solid #b8c7d9;
    border-radius: 999px;
    background: #eef4fa;
    color: #29445f;
    font-size: 0.78rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.custom-header-content {
    flex: 1 1 260px;
    min-width: 180px;
}

.rich-content {
    overflow-wrap: anywhere;
}

.rich-content > *:first-child {
    margin-top: 0;
}

.rich-content > *:last-child {
    margin-bottom: 0;
}

.rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.topbar nav a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 6px;
    color: var(--muted);
}

.topbar nav a:hover {
    background: #eef2f6;
    color: var(--text);
}

.topbar nav a.active {
    background: var(--primary);
    color: #fff;
}

.nav-menu-group {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: stretch;
}

.nav-menu-group > a {
    border-radius: 6px 0 0 6px;
}

.nav-submenu-toggle {
    width: 34px;
    min-width: 34px;
    min-height: 36px;
    padding: 7px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0 6px 6px 0;
    background: #eef2f6;
    color: var(--muted);
}

.nav-submenu-toggle svg {
    width: 17px;
    height: 17px;
    transition: transform 160ms ease;
}

.nav-menu-group.open .nav-submenu-toggle svg {
    transform: rotate(180deg);
}

.nav-submenu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 45;
    display: grid;
    min-width: 220px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(23, 32, 42, 0.16);
}

.nav-submenu[hidden] {
    display: none;
}

.topbar nav .nav-submenu a {
    width: 100%;
    min-height: 40px;
}

.notification-center {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.notification-toggle {
    position: relative;
    width: 38px;
    min-height: 36px;
    padding: 7px;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
}

.notification-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 30;
    width: min(360px, calc(100vw - 32px));
    max-height: min(520px, calc(100vh - 110px));
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 16px 40px rgba(23, 32, 42, 0.16);
}

.notification-menu-head,
.notification-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.notification-menu-head {
    align-items: center;
    padding: 2px 2px 8px;
    border-bottom: 1px solid var(--line);
}

.notification-list {
    display: grid;
    gap: 8px;
    padding-top: 8px;
}

.notification-item {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.notification-item.unread {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, white);
}

.notification-item-body {
    display: grid;
    gap: 4px;
    min-width: 0;
    text-align: left;
}

.notification-item-body strong,
.notification-item-body small {
    overflow-wrap: anywhere;
}

.notification-item-body small,
.notification-empty {
    color: var(--muted);
}

.notification-item-actions {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 6px;
}

.notification-action,
.notification-load-more {
    flex: 0 0 auto;
}

.notification-load-more {
    width: 100%;
    justify-content: center;
}

.language-switch {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.language-switch a {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: 2px solid transparent;
    border-radius: 6px;
    opacity: 0.58;
    transition: border-color 0.16s ease, opacity 0.16s ease, background-color 0.16s ease;
}

.language-switch a.active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 9%, white);
    opacity: 1;
}

.language-switch a:hover,
.language-switch a:focus-visible {
    opacity: 1;
    background: #eef2f6;
}

.flag-icon {
    display: block;
    font-size: 1.25rem;
    line-height: 1;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 24px auto 48px;
    min-width: 0;
}

.grid {
    display: grid;
    grid-template-columns: minmax(300px, 390px) 1fr;
    gap: 20px;
    align-items: start;
}

.stack {
    display: grid;
    gap: 20px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: clamp(18px, 3vw, 26px);
    min-width: 0;
}

.narrow {
    max-width: 440px;
    margin: 48px auto;
}

h1,
h2 {
    margin: 0 0 18px;
    line-height: 1.2;
}

h1 {
    font-size: 1.45rem;
}

h2 {
    font-size: 1.15rem;
}

.form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.94rem;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(20, 108, 99, 0.22);
    border-color: var(--primary);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    max-width: 100%;
}

button:hover {
    background: #eef2f6;
}

form.is-saving {
    opacity: 0.72;
    pointer-events: none;
}

.upload-status {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.upload-status.error {
    color: var(--danger);
}

button svg {
    width: 18px;
    height: 18px;
}

.primary {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.primary:hover {
    background: var(--primary-strong);
}

.danger-btn {
    color: var(--danger);
    border-color: #f5b5af;
}

.barcode-row,
.inline-form,
.row-form {
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.permissions-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    min-width: 260px;
}

.admin-create-user {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.admin-stack {
    gap: 16px;
}

.admin-overview {
    padding-block: 18px;
}

.admin-overview h1 {
    margin-bottom: 0;
}

.admin-section {
    padding: 0;
    overflow: clip;
}

.admin-section-toggle {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px clamp(16px, 3vw, 22px);
    cursor: pointer;
    font-weight: 850;
    list-style: none;
}

.admin-section-toggle::-webkit-details-marker {
    display: none;
}

.admin-section-toggle span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.admin-section-toggle svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
}

.admin-section-toggle > svg:last-child {
    transition: transform 0.16s ease;
}

.admin-section-toggle:hover,
.admin-section-toggle:focus-visible {
    background: #eef2f6;
}

.admin-section[open] .admin-section-toggle {
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.admin-section[open] .admin-section-toggle > svg:last-child {
    transform: rotate(180deg);
}

.admin-section-body {
    display: grid;
    gap: 16px;
    padding: clamp(16px, 3vw, 22px);
    min-width: 0;
}

.admin-section-body > h2 {
    margin-bottom: 0;
}

.admin-divider {
    height: 1px;
    margin-block: 4px;
    background: var(--line);
}

.admin-nested-section {
    display: grid;
    gap: 12px;
}

.admin-nested-section summary {
    cursor: pointer;
    font-weight: 800;
}

.table-thumb {
    width: 54px;
    height: 54px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.master-product-match {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.master-product-preview {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.appearance-form {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.notification-template-grid {
    display: grid;
    grid-column: 1 / -1;
    gap: 10px;
    min-width: 0;
}

.notification-template-help {
    margin: 0;
}

.notification-template-preview {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--primary) 5%, white);
    color: var(--text);
    overflow-wrap: anywhere;
}

.rich-editor-group {
    display: grid;
    gap: 14px;
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rich-editor-toolbar button {
    width: 40px;
    min-width: 40px;
    padding-inline: 8px;
}

.rich-editor {
    min-height: 150px;
    padding: 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    overflow-wrap: anywhere;
}

.rich-editor:focus {
    outline: 2px solid rgba(20, 108, 99, 0.22);
    border-color: var(--primary);
}

.rich-editor img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: 8px;
}

.site-footer {
    width: min(1180px, calc(100% - 32px));
    margin: -24px auto 32px;
    padding: 16px clamp(18px, 3vw, 26px);
    border-top: 1px solid var(--line);
    color: var(--muted);
}

.asset-fields,
.color-grid,
.profile-layout {
    display: grid;
    gap: 14px;
}

.asset-fields {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.color-grid {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
}

input[type="color"] {
    min-height: 46px;
    padding: 4px;
}

.asset-preview {
    display: block;
    width: min(100%, 240px);
    height: 70px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.favicon-preview {
    display: block;
    width: 48px;
    height: 48px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.profile-layout {
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    align-items: start;
}

.profile-summary dl {
    display: grid;
    gap: 12px;
    margin: 0;
}

.profile-summary dl div {
    display: grid;
    gap: 2px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.profile-summary dt {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.profile-summary dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 750;
}

.profile-tabs {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.profile-tabs a {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-weight: 800;
}

.profile-tabs a.active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, white);
    color: var(--primary-strong);
}

.profile-manual {
    grid-row: span 2;
    min-width: 0;
}

.manual-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.manual-heading h2,
.manual-heading p {
    margin-bottom: 6px;
}

.manual-heading small {
    flex: 0 0 auto;
    color: var(--muted);
}

.manual-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-block: 16px;
}

.manual-search > svg {
    position: absolute;
    left: 12px;
    width: 18px;
    pointer-events: none;
    color: var(--muted);
}

.manual-search input {
    width: 100%;
    min-height: 46px;
    padding-left: 40px;
    padding-right: 48px;
}

.manual-search button {
    position: absolute;
    right: 4px;
    min-width: 38px;
    min-height: 38px;
    padding: 7px;
}

.manual-toc {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    background: #f8fafc;
}

.manual-toc > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 16px;
}

.manual-toc a {
    overflow-wrap: anywhere;
    color: var(--primary-strong);
    font-weight: 700;
}

.manual-guide {
    display: grid;
    gap: 14px;
}

.manual-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    scroll-margin-top: 90px;
}

.manual-section > summary {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
    font-weight: 850;
}

.manual-section > summary::-webkit-details-marker {
    display: none;
}

.manual-section > summary span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.manual-section > summary svg {
    width: 19px;
    flex: 0 0 auto;
}

.manual-section > summary > svg:last-child {
    transition: transform 0.16s ease;
}

.manual-section[open] > summary {
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.manual-section[open] > summary > svg:last-child {
    transform: rotate(180deg);
}

.manual-section-content {
    padding: 14px;
}

.manual-section-content ol {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 20px;
}

.manual-section li {
    overflow-wrap: anywhere;
}

.manual-faq {
    display: grid;
    gap: 8px;
}

.manual-faq details {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.manual-faq summary {
    cursor: pointer;
    font-weight: 800;
}

.manual-faq p {
    margin: 10px 0 0;
}

.user-guide-languages {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.user-guide-language {
    min-width: 0;
    display: grid;
    gap: 12px;
}

.user-guide-language .admin-nested-section {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.user-guide-language textarea {
    width: 100%;
    resize: vertical;
}

.admin-create-user .permissions-form {
    grid-column: 1 / -1;
}

.admin-users-table td,
.admin-category-table td,
.admin-sessions-table td {
    min-width: 130px;
}

.admin-sessions-table td:nth-child(5) {
    min-width: 260px;
}

.session-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-users-table td:nth-child(1) {
    min-width: 150px;
}

.admin-users-table td:nth-child(2) {
    min-width: 150px;
}

.admin-users-table td:nth-child(4) {
    min-width: 260px;
}

.admin-users-table td:nth-child(5),
.admin-users-table td:nth-child(6) {
    min-width: 240px;
}

.user-name-with-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    min-height: 28px;
    min-width: 0;
}

.user-name-with-status > span:not(.activity-dot):not(.badge) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #cbd5e1;
    box-shadow: 0 0 0 2px var(--surface);
}

.activity-dot.online {
    background: var(--safe);
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 5px var(--safe-bg);
}

.activity-label {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    max-width: 100%;
    padding: 4px 9px;
    border-radius: 999px;
    background: #eef2f6;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.activity-label.online {
    background: var(--safe-bg);
    color: var(--safe);
}

.password-tools {
    display: flex;
    gap: 8px;
}

.password-tools input {
    min-width: 0;
}

.revealed-password {
    display: inline-block;
    max-width: 220px;
    overflow-wrap: anywhere;
    padding: 7px 9px;
    border-radius: 6px;
    background: #eef2f6;
}

.barcode-row input,
.row-form input,
.row-form select {
    min-width: 0;
}

.filters .scanner {
    grid-column: 1 / -1;
}

.category-edit-list {
    margin-top: 16px;
}

.category-edit-forms {
    display: grid;
    gap: 8px;
}

.scanner {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #111827;
}

.scanner-dialog {
    width: min(680px, calc(100% - 20px));
    max-height: min(92vh, 760px);
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
}

.scanner-dialog::backdrop {
    background: rgba(15, 23, 42, 0.58);
}

.scanner-dialog .dialog-head {
    margin-bottom: 12px;
}

.scanner video {
    display: block;
    width: 100%;
    height: min(58vh, 430px);
    min-height: 260px;
    object-fit: cover;
}

.qr-reader {
    width: 100%;
    min-height: min(58vh, 360px);
    background: #111827;
}

.qr-reader video {
    width: 100% !important;
    max-height: min(58vh, 430px);
    object-fit: cover;
}

.qr-reader img,
.qr-reader select,
.qr-reader input[type="file"] {
    max-width: 100%;
}

.qr-reader button {
    margin: 8px auto;
}

.scanner-controls {
    display: flex;
    gap: 8px;
    padding: 10px;
}

.scanner-controls button {
    flex: 1;
    justify-content: center;
    min-height: 38px;
    border-color: rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.scanner-controls button.is-active {
    background: #fff;
    color: #111827;
}

.scanner p {
    margin: 0;
    padding: 10px;
    color: #fff;
    font-size: 0.9rem;
}

.products {
    display: grid;
    gap: 12px;
}

.products.is-loading {
    opacity: 0.62;
}

.catalog-head {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.catalog-head h1 {
    margin-bottom: 0;
}

.catalog-title-row {
    align-items: center;
}

.panel-head,
.dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.panel-head h2,
.panel-head p,
.dialog-head h2 {
    margin: 0;
}

.panel-head p {
    color: var(--muted);
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(130px, 0.7fr) auto auto;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: center;
    padding-top: 6px;
}

.pagination span {
    color: var(--muted);
    font-weight: 800;
}

.infinite-scroll-status,
.catalog-notice {
    grid-column: 1 / -1;
}

.infinite-scroll-status {
    padding: 12px;
    text-align: center;
    color: var(--muted);
    font-weight: 800;
}

.admin-dialog {
    width: min(760px, calc(100% - 24px));
    max-height: min(760px, calc(100vh - 24px));
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    color: var(--text);
    background: var(--surface);
}

.admin-dialog::backdrop {
    background: rgba(15, 23, 42, 0.52);
}

.admin-dialog form {
    display: grid;
    gap: 14px;
}

.product-add-dialog {
    width: min(620px, calc(100% - 24px));
    overflow: auto;
}

.product-add-dialog .form-actions {
    margin-top: 0;
}

.bulk-list {
    display: grid;
    gap: 8px;
    max-height: min(52vh, 440px);
    overflow: auto;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.bulk-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

.bulk-item input {
    width: auto;
    min-height: 0;
    margin-top: 4px;
}

.bulk-item span,
.bulk-item small {
    display: grid;
    min-width: 0;
}

.bulk-item strong,
.bulk-item small {
    overflow-wrap: anywhere;
}

.bulk-item small {
    color: var(--muted);
}

.category-create {
    margin-bottom: 14px;
}

.category-table {
    margin-top: 8px;
}

.category-list-toggle {
    display: grid;
    gap: 10px;
}

.category-list-toggle summary {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-weight: 800;
    cursor: pointer;
}

.category-list-toggle summary:hover {
    background: #eef2f6;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
}

.category-card {
    display: grid;
    gap: 5px;
    min-height: 112px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.category-card:hover {
    border-color: var(--primary);
    background: #f4fbf9;
}

.category-card span {
    font-weight: 800;
    overflow-wrap: anywhere;
}

.category-card strong,
.category-card small {
    color: var(--muted);
}

.compact-link {
    justify-self: start;
}

.text-link {
    color: var(--primary);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.button-link {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}

.button-link:hover {
    background: #eef2f6;
}

.button-link svg {
    width: 18px;
    height: 18px;
}

.product {
    display: grid;
    grid-template-columns: clamp(96px, 18vw, 144px) minmax(0, 1fr);
    min-height: 118px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.product img {
    display: block;
    width: 100%;
    height: 100%;
    min-height: clamp(118px, 18vw, 160px);
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #eef2f6;
}

.product-body {
    padding: 13px;
    min-width: 0;
}

.product-title {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 8px;
    min-width: 0;
}

.product-title .status {
    max-width: 100%;
    white-space: normal;
}

.product-title strong {
    min-width: 0;
    overflow-wrap: anywhere;
}

.product p {
    margin: 4px 0;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.product-actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.current-photo {
    display: grid;
    gap: 10px;
    width: 100%;
}

.current-photo img {
    display: block;
    width: min(100%, 520px);
    height: auto;
    max-height: min(58vh, 460px);
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #eef2f6;
}

.status,
.badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.status.safe {
    color: var(--safe);
    background: var(--safe-bg);
}

.status.warning {
    color: var(--warning);
    background: var(--warning-bg);
}

.status.danger {
    color: var(--danger);
    background: var(--danger-bg);
}

.status.neutral,
.badge {
    color: var(--muted);
    background: #eef2f6;
}

.error-box,
.notice {
    margin: 0 0 14px;
    padding: 12px;
    border-radius: 8px;
}

.error-box {
    border: 1px solid #f5b5af;
    background: var(--danger-bg);
    color: var(--danger);
}

.error-box p {
    margin: 0;
}

.error-box p + p {
    margin-top: 6px;
}

.notice {
    border: 1px solid #9fd8b4;
    background: var(--safe-bg);
    color: var(--safe);
}

.muted-text,
.notification-status {
    color: var(--muted);
}

.notification-status {
    margin-bottom: 0;
}

.notification-push-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 0.86rem;
}

.checkbox {
    display: inline-flex;
    grid-template-columns: none;
    flex-direction: row;
    align-items: center;
}

.checkbox input {
    width: auto;
    min-height: 0;
}

.error-list {
    display: grid;
    gap: 10px;
}

.error-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 13px;
    border: 1px solid #f5b5af;
    border-radius: 8px;
    background: #fffafa;
}

.error-item.resolved {
    border-color: var(--line);
    background: #f8fafc;
    opacity: 0.72;
}

.error-item p {
    margin: 5px 0;
    color: var(--muted);
}

pre {
    max-width: 100%;
    overflow-x: auto;
    margin: 8px 0 0;
    padding: 10px;
    border-radius: 6px;
    background: #111827;
    color: #f9fafb;
    font-size: 0.84rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 1040px) {
    .grid {
        grid-template-columns: minmax(280px, 340px) 1fr;
    }

    .filters {
        grid-template-columns: minmax(0, 1fr) minmax(160px, 200px);
    }
}

@media (max-width: 820px) {
    .user-guide-languages {
        grid-template-columns: 1fr;
    }

    .manual-toc > div {
        grid-template-columns: 1fr;
    }
    .topbar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px 12px;
        padding: 12px 14px 10px;
    }

    .brand {
        order: 1;
        max-width: 100%;
        min-width: 0;
        padding-right: 48px;
    }

    .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar nav {
        order: 3;
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        width: 100%;
        max-width: 100%;
        gap: 6px;
        overflow-x: auto;
        overflow-y: visible;
        padding: 2px 2px 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .organization-switcher {
        order: 2;
        grid-column: 1 / -1;
        width: calc(100% - 54px);
        min-width: 0;
    }

    .organization-switcher label {
        flex: 1;
    }

    .organization-switcher select {
        width: 100%;
        min-width: 0;
        min-height: 44px;
    }

    .organization-switcher button {
        min-height: 44px;
    }

    .topbar nav a,
    .language-switch {
        flex: 0 0 auto;
    }

    .nav-menu-group.open {
        flex-wrap: wrap;
        width: min(250px, calc(100vw - 28px));
    }

    .nav-menu-group.open > a {
        flex: 1 1 auto;
    }

    .nav-submenu {
        position: static;
        flex: 1 0 100%;
        min-width: 0;
        margin-top: 4px;
        box-shadow: none;
    }

    .notification-center {
        order: 2;
        position: absolute;
        top: 12px;
        right: 14px;
        z-index: 35;
    }

    .notification-toggle {
        width: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 9px;
        background: #fff;
        box-shadow: 0 6px 18px rgba(23, 32, 42, 0.12);
    }

    .notification-badge {
        top: -3px;
        right: -3px;
        min-width: 20px;
        height: 20px;
        line-height: 20px;
    }

    .notification-menu {
        position: fixed;
        top: 62px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: calc(100vh - 74px);
    }

    .custom-header-content {
        order: 2;
        grid-column: 1 / -1;
        flex: 0 1 auto;
        width: 100%;
        min-width: 0;
    }

    .custom-header-content.rich-content {
        font-size: clamp(0.9rem, 3.6vw, 1rem);
    }

    .custom-header-content.rich-content img {
        max-height: min(28vh, 180px);
        object-fit: contain;
    }

    .topbar nav a {
        min-height: 44px;
        padding: 9px 12px;
        font-size: 0.94rem;
        white-space: nowrap;
    }

    .shell {
        width: min(100% - 20px, 760px);
        margin-top: 12px;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 16px;
    }

    .admin-section {
        padding: 0;
    }

    .admin-section-toggle {
        min-height: 56px;
        padding: 14px 16px;
    }

    .admin-section-body {
        padding: 16px;
    }

    .product {
        grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
    }

    .product img {
        min-height: clamp(132px, 34vw, 220px);
    }

    .current-photo img {
        width: 100%;
        max-height: min(56vh, 420px);
    }

    .inline-form,
    .row-form,
    .permissions-form,
    .panel-head,
    .dialog-head,
    .admin-create-user,
    .asset-fields,
    .color-grid,
    .profile-layout,
    .filters,
    .error-item {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-form > *,
    .row-form > *,
    .filters > *,
    .panel-head > *,
    .dialog-head > *,
    .error-item > * {
        max-width: 100%;
        min-width: 0;
    }

    .admin-stack {
        gap: 12px;
        min-width: 0;
        overflow-x: hidden;
    }

    .admin-stack .panel,
    .admin-stack form,
    .admin-stack label,
    .admin-stack input,
    .admin-stack select,
    .admin-stack textarea,
    .admin-stack button,
    .admin-stack .button-link,
    .admin-stack .password-tools,
    .admin-stack .permissions-form,
    .admin-stack .table-wrap,
    .admin-stack .bulk-list,
    .admin-stack .error-item > div {
        max-width: 100%;
        min-width: 0;
    }

    .admin-stack .permissions-form {
        width: 100%;
    }

    .admin-create-user,
    .asset-fields,
    .color-grid,
    .profile-layout {
        display: flex;
    }

    .filters {
        display: flex;
    }

    .product-actions,
    .form-actions {
        align-items: stretch;
    }

    .notification-push-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .button-link,
    button {
        min-height: 44px;
    }

    .admin-dialog {
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        padding: 14px;
    }

    .bulk-list {
        max-height: 48vh;
    }

    .product-actions .button-link,
    .product-actions button,
    .form-actions .button-link,
    .form-actions button {
        flex: 1 1 140px;
    }

    .product-add-dialog .dialog-head {
        align-items: center;
        flex-direction: row;
    }

    .scanner-dialog {
        width: calc(100% - 12px);
        max-height: calc(100dvh - 12px);
        padding: 10px;
    }

    .scanner-dialog .dialog-head {
        align-items: center;
        flex-direction: row;
    }

    .scanner video,
    .qr-reader video {
        height: min(62dvh, 420px);
        min-height: 240px;
    }

    .qr-reader {
        min-height: min(62dvh, 360px);
    }
}

@media (max-width: 480px) {
    .manual-heading {
        display: grid;
    }

    .manual-search,
    .manual-toc {
        margin-inline: -2px;
    }

    .manual-section > summary,
    .manual-section-content {
        padding-inline: 12px;
    }
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
    }

    .shell {
        width: 100%;
        margin: 0 auto 32px;
        overflow-x: hidden;
    }

    .site-footer {
        width: 100%;
        margin: -16px auto 24px;
    }

    .panel {
        border-left: 0;
        border-right: 0;
        border-radius: 0;
    }

    .admin-section {
        padding: 0;
    }

    .admin-section-toggle {
        min-height: 54px;
        padding: 13px 14px;
    }

    .admin-section-body {
        padding: 14px;
    }

    .narrow {
        margin: 0 auto 32px;
        max-width: none;
    }

    h1 {
        font-size: 1.25rem;
    }

    .product {
        grid-template-columns: 1fr;
    }

    .product img {
        width: 100%;
        height: auto;
        min-height: 0;
        max-height: min(58vh, 340px);
        aspect-ratio: 4 / 3;
        object-fit: contain;
        background: #f1f4f7;
    }

    .current-photo img {
        width: 100%;
        max-height: min(52vh, 320px);
        aspect-ratio: 4 / 3;
        object-fit: contain;
    }

    .product-title {
        flex-direction: column;
        gap: 6px;
    }

    .catalog-title-row,
    .panel-head,
    .dialog-head {
        gap: 10px;
    }

    .barcode-row {
        align-items: stretch;
    }

    .barcode-row button {
        flex: 0 0 48px;
        padding-inline: 8px;
    }

    .product-actions,
    .form-actions {
        flex-direction: column;
    }

    .product-actions .button-link,
    .product-actions button,
    .form-actions .button-link,
    .form-actions button {
        width: 100%;
        flex-basis: auto;
    }

    th,
    td {
        padding: 9px 8px;
    }

    .admin-stack button,
    .admin-stack .button-link,
    .filters button,
    .filters .button-link {
        width: 100%;
        white-space: normal;
    }

    .admin-stack .password-tools {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        gap: 8px;
        width: 100%;
    }

    .admin-stack .password-tools button,
    .admin-users-table .generate-password,
    .admin-users-table .row-form button[title] {
        width: 44px;
        min-width: 44px;
        padding-inline: 8px;
    }

    .admin-stack .checkbox {
        width: 100%;
        min-width: 0;
        align-items: flex-start;
        white-space: normal;
    }

    .admin-stack .checkbox input {
        flex: 0 0 auto;
        margin-top: 4px;
    }

    .topbar {
        position: sticky;
        gap: 8px;
        padding: 10px;
    }

    .brand {
        max-width: 100%;
        min-height: 44px;
    }

    .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topbar nav {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .topbar nav a {
        min-height: 44px;
        padding: 9px 12px;
        font-size: 0.9rem;
    }

    .topbar nav a,
    .language-switch {
        justify-content: center;
        width: auto;
    }

    .language-switch {
        min-height: 44px;
    }

    .notification-center {
        top: 10px;
        right: 10px;
    }

    .admin-users-table,
    .admin-category-table,
    .admin-sessions-table {
        overflow: visible;
    }

    .admin-users-table table,
    .admin-users-table thead,
    .admin-users-table tbody,
    .admin-users-table tr,
    .admin-users-table th,
    .admin-users-table td,
    .admin-category-table table,
    .admin-category-table thead,
    .admin-category-table tbody,
    .admin-category-table tr,
    .admin-category-table th,
    .admin-category-table td,
    .admin-sessions-table table,
    .admin-sessions-table thead,
    .admin-sessions-table tbody,
    .admin-sessions-table tr,
    .admin-sessions-table th,
    .admin-sessions-table td {
        display: block;
    }

    .admin-users-table thead,
    .admin-category-table thead,
    .admin-sessions-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .admin-users-table tr,
    .admin-category-table tr,
    .admin-sessions-table tr {
        display: grid;
        gap: 10px;
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
    }

    .admin-users-table td,
    .admin-category-table td,
    .admin-sessions-table td {
        min-width: 0;
        padding: 0;
        border-bottom: 0;
        overflow-wrap: anywhere;
    }

    .admin-users-table td::before,
    .admin-category-table td::before,
    .admin-sessions-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 5px;
        color: var(--muted);
        font-size: 0.78rem;
        font-weight: 800;
        text-transform: uppercase;
    }

    .admin-users-table .row-form,
    .admin-category-table .row-form,
    .admin-users-table .permissions-form {
        gap: 8px;
    }

    .admin-users-table .permissions-form button {
        margin-top: 2px;
    }

    .admin-users-table form:not(.permissions-form),
    .admin-category-table form:not(.permissions-form),
    .admin-sessions-table form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .admin-users-table .badge {
        margin-left: 6px;
    }

    .revealed-password {
        max-width: 100%;
    }
}

.custom-page-content { display: grid; gap: 16px; min-width: 0; }
.custom-page-content > * { min-width: 0; max-width: 100%; }
.custom-page-image { display: block; width: auto; max-width: 100%; height: auto; max-height: 70vh; object-fit: contain; }
.custom-page-card { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.custom-page-section { min-width: 0; border-radius: 8px; }
.craft-rendered-page { width: 100%; }
.custom-page-columns { display: grid; grid-template-columns: repeat(var(--custom-columns), minmax(0, 1fr)); gap: 14px; }
.custom-page-columns > div { min-width: 0; overflow-wrap: anywhere; }
.custom-page-embed { width: 100%; aspect-ratio: 16 / 9; }
.custom-page-embed iframe { width: 100%; height: 100%; border: 0; }

@media (max-width: 700px) {
    .custom-page-columns { grid-template-columns: 1fr; }
}
.nav-logout-form {
    display: contents;
}

.nav-logout-form button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 7px 10px;
    border-radius: 6px;
}

.nav-logout-form button:hover {
    background: #eef2f6;
    color: var(--text);
}

@media (max-width: 768px) {
    .nav-logout-form button {
        min-height: 44px;
        padding: 9px 12px;
        font-size: 0.9rem;
    }
}
.two-factor-panel {
    width: min(100%, 32rem);
}

.two-factor-code {
    min-height: 3.25rem;
    text-align: center;
    font-size: 1.5rem;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.two-factor-panel form + form {
    margin-top: 0.75rem;
}
