:root {
    --green-900: #075b2d;
    --green-800: #08703a;
    --green-700: #0b7f43;
    --green-100: #eaf5ee;
    --green-50: #f4faf6;
    --ink: #151a17;
    --muted: #6d756f;
    --line: #dde3df;
    --line-strong: #cbd4ce;
    --surface: #ffffff;
    --sidebar: #f6f8f7;
    --danger: #b33a32;
    --danger-bg: #fff1ef;
    --warning: #b45c00;
    --warning-bg: #fff4e7;
    --shadow: 0 18px 42px rgba(17, 35, 24, 0.12);
    --radius: 8px;
    --topbar-height: 64px;
    --sidebar-width: 236px;
    --drawer-width: 390px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--surface);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(11, 127, 67, 0.2);
    outline-offset: 1px;
}

svg {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.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;
}

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: fixed;
    z-index: 30;
    inset: 0 0 auto 0;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-mark {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: var(--green-800);
}

.brand-mark svg {
    width: 28px;
    height: 28px;
    stroke-width: 2.2;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar-actions form {
    margin: 0;
}

.user-menu,
.button {
    border: 0;
    background: transparent;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 40px;
    padding: 3px 7px 3px 3px;
    color: var(--ink);
    border-radius: 7px;
}

.user-menu:hover {
    background: var(--sidebar);
}

.user-menu svg {
    width: 17px;
    height: 17px;
}

.user-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    color: var(--green-900);
    background: var(--green-100);
    font-weight: 700;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 650;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, opacity 140ms ease;
}

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

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.button-primary {
    color: #fff;
    background: var(--green-800);
    border: 1px solid var(--green-800);
}

.button-primary:hover:not(:disabled) {
    background: var(--green-900);
}

.button-secondary {
    color: var(--green-900);
    background: #fff;
    border: 1px solid var(--green-700);
}

.button-secondary:hover {
    background: var(--green-50);
}

.button-quiet {
    color: var(--green-800);
    min-height: 38px;
}

.button-quiet:hover {
    background: var(--green-50);
}

.button-wide {
    width: 100%;
}

.sidebar {
    position: fixed;
    z-index: 20;
    inset: var(--topbar-height) auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
}

.site-section {
    padding: 22px 18px 18px;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.site-switcher {
    padding: 4px;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
}

.site-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 39px;
    padding: 0 10px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 6px;
    text-align: left;
    font-size: 13px;
}

.site-option:hover {
    background: var(--sidebar);
}

.site-option.is-active {
    color: var(--green-900);
    background: var(--green-100);
    font-weight: 650;
}

.site-dot {
    width: 15px;
    height: 15px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    position: relative;
}

.site-dot::before,
.site-dot::after {
    content: "";
    position: absolute;
    background: currentColor;
    opacity: 0.6;
}

.site-dot::before {
    inset: 2px 6px;
    width: 1px;
}

.site-dot::after {
    inset: 6px 2px;
    height: 1px;
}

.main-nav {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
}

.nav-item {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 45px;
    padding: 0 12px;
    color: #4c544f;
    background: transparent;
    border: 0;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 570;
    text-align: left;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: #edf1ee;
}

.nav-item.is-active {
    color: var(--green-900);
    background: var(--green-100);
}

.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: -12px;
    width: 3px;
    height: 30px;
    background: var(--green-800);
}

.save-indicator {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: auto 18px 20px;
    color: var(--muted);
    font-size: 11px;
}

.save-indicator svg {
    width: 20px;
    height: 20px;
    padding: 3px;
    color: var(--green-800);
    border: 1px solid var(--green-800);
    border-radius: 50%;
}

.workspace {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding: calc(var(--topbar-height) + 28px) 32px 34px;
    transition: padding-right 180ms ease;
}

.workspace.has-drawer {
    padding-right: calc(var(--drawer-width) + 26px);
}

.page-heading {
    min-height: 58px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.page-heading h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.page-heading p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.filterbar {
    display: grid;
    grid-template-columns: minmax(260px, 1.35fr) minmax(170px, 0.8fr) minmax(160px, 0.7fr);
    gap: 16px;
    max-width: 850px;
    margin: 22px 0 20px;
}

.search-control,
.select-control {
    position: relative;
    display: block;
}

.search-control svg {
    position: absolute;
    z-index: 1;
    left: 13px;
    top: 50%;
    width: 19px;
    height: 19px;
    color: #49524c;
    transform: translateY(-50%);
}

input,
select {
    width: 100%;
    min-height: 43px;
    padding: 0 13px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    font-size: 13px;
}

input::placeholder {
    color: #9aa19c;
}

.search-control input {
    padding-left: 42px;
}

.table-shell {
    position: relative;
    min-height: 360px;
    overflow-x: auto;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.product-table th {
    height: 49px;
    padding: 0 14px;
    color: #555e58;
    font-size: 11px;
    font-weight: 650;
    text-align: left;
    white-space: nowrap;
}

.product-table td {
    height: 86px;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}

.product-table th:nth-child(1) { width: 27%; }
.product-table th:nth-child(2) { width: 17%; }
.product-table th:nth-child(3) { width: 13%; }
.product-table th:nth-child(4) { width: 14%; }
.product-table th:nth-child(5) { width: 14%; }
.product-table th:nth-child(6) { width: 11%; }
.product-table th:nth-child(7) { width: 62px; }

.product-table tbody tr {
    cursor: pointer;
    transition: background 120ms ease;
}

.product-table tbody tr:hover {
    background: #fafcfb;
}

.product-table tbody tr.is-selected {
    background: var(--green-50);
    box-shadow: inset 3px 0 0 var(--green-700);
}

.product-cell {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.product-thumbnail,
.drawer-thumbnail {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    color: #8b948e;
    background: #f5f7f6;
    border: 1px solid var(--line);
    border-radius: 7px;
}

.product-thumbnail {
    width: 58px;
    height: 58px;
}

.product-thumbnail img,
.drawer-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-copy {
    min-width: 0;
}

.product-copy strong {
    display: block;
    overflow: hidden;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-copy span,
.drawer-product span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.category-copy {
    display: -webkit-box;
    overflow: hidden;
    color: #4d5550;
    font-size: 12px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.price {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 12px;
}

.sale-price {
    color: var(--green-800);
    font-weight: 650;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 5px;
    font-size: 11px;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-instock {
    color: var(--green-800);
    background: var(--green-100);
}

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

.status-hidden {
    color: #68706b;
    background: #eef0ef;
}

.modified {
    color: #525a55;
    font-size: 11px;
    line-height: 1.5;
}

.actions-column {
    text-align: center !important;
}

.row-action {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 6px;
}

.row-action:hover {
    color: var(--green-800);
    background: var(--green-100);
}

.row-action svg {
    width: 18px;
    height: 18px;
}

.loading-state,
.empty-state {
    position: absolute;
    inset: 50px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.94);
}

.loading-state[hidden],
.empty-state[hidden] {
    display: none;
}

.spinner {
    width: 27px;
    height: 27px;
    border: 2px solid var(--line);
    border-top-color: var(--green-700);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state h2 {
    margin: 0;
    color: var(--ink);
    font-size: 16px;
}

.empty-state p {
    margin: -5px 0 0;
    font-size: 12px;
}

.paginationbar {
    min-height: 64px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    color: var(--muted);
    font-size: 11px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 9px;
}

.icon-button {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    color: #39413c;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
}

.icon-button:hover:not(:disabled) {
    color: var(--green-800);
    background: var(--green-50);
    border-color: var(--green-700);
}

.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.icon-button svg {
    width: 19px;
    height: 19px;
}

.icon-button-borderless {
    border-color: transparent;
}

.current-page {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    color: var(--green-900);
    border: 1px solid var(--green-700);
    border-radius: 7px;
    font-weight: 700;
}

.per-page-control {
    justify-self: end;
}

.per-page-control select {
    width: 145px;
    min-height: 38px;
    font-size: 11px;
}

.edit-drawer {
    position: fixed;
    z-index: 50;
    inset: var(--topbar-height) 0 0 auto;
    width: var(--drawer-width);
    padding: 0 22px 22px;
    overflow-y: auto;
    background: #fff;
    border-left: 1px solid var(--line);
    transform: translateX(100%);
    transition: transform 180ms ease;
}

.edit-drawer.is-open {
    transform: translateX(0);
}

.drawer-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -0.015em;
}

.drawer-product {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 0;
}

.drawer-thumbnail {
    width: 64px;
    height: 64px;
}

.drawer-product strong {
    display: block;
    font-size: 14px;
}

.product-type-note {
    color: var(--warning) !important;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 12px;
}

.form-field {
    grid-column: 1 / -1;
}

.form-field-half {
    grid-column: auto;
}

.form-field > span {
    display: block;
    margin-bottom: 7px;
    color: #4c544f;
    font-size: 11px;
    font-weight: 650;
}

.money-input {
    position: relative;
}

.money-input input {
    padding-right: 38px;
}

.money-input > span {
    position: absolute;
    right: 13px;
    top: 50%;
    color: var(--muted);
    transform: translateY(-50%);
}

.form-message {
    min-height: 48px;
    display: flex;
    align-items: center;
    margin-top: 15px;
    color: var(--muted);
    font-size: 11px;
}

.form-message.is-error {
    color: var(--danger);
}

.form-message.is-dirty {
    color: var(--warning);
}

.form-message.is-dirty::before,
.form-message.is-error::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border-radius: 50%;
    background: currentColor;
}

.drawer-actions {
    display: grid;
    grid-template-columns: 1fr 1.45fr;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.drawer-backdrop {
    display: none;
}

.toast {
    position: fixed;
    z-index: 80;
    right: 22px;
    bottom: 22px;
    max-width: 360px;
    padding: 13px 16px;
    color: #fff;
    background: #1d2c23;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 12px;
}

.toast.is-error {
    background: var(--danger);
}

.history-list {
    max-width: 900px;
    margin-top: 22px;
    border-top: 1px solid var(--line);
}

.history-item {
    display: grid;
    grid-template-columns: 150px minmax(180px, 1fr) 2fr;
    gap: 20px;
    align-items: start;
    padding: 18px 6px;
    border-bottom: 1px solid var(--line);
}

.history-time,
.history-change {
    color: var(--muted);
    font-size: 12px;
}

.history-product strong,
.history-product span {
    display: block;
}

.history-product span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.login-body {
    min-height: 100vh;
    background: #f6f8f7;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 420px);
    padding: 34px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 22px 60px rgba(30, 48, 37, 0.08);
}

.brand-login {
    margin-bottom: 34px;
}

.login-panel h1 {
    margin: 0;
    font-size: 27px;
    letter-spacing: -0.025em;
}

.login-panel > p {
    margin: 8px 0 24px;
    color: var(--muted);
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form label span {
    display: block;
    margin-bottom: 7px;
    color: #4c544f;
    font-size: 12px;
    font-weight: 650;
}

.form-alert {
    margin-bottom: 16px;
    padding: 11px 13px;
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid #f0c9c5;
    border-radius: var(--radius);
    font-size: 12px;
}

@media (max-width: 1180px) {
    :root {
        --sidebar-width: 210px;
        --drawer-width: 360px;
    }

    .workspace {
        padding-left: 24px;
        padding-right: 24px;
    }

    .workspace.has-drawer {
        padding-right: 24px;
    }

    .edit-drawer {
        box-shadow: var(--shadow);
    }

    .drawer-backdrop {
        position: fixed;
        z-index: 45;
        inset: var(--topbar-height) 0 0 var(--sidebar-width);
        display: block;
        background: rgba(18, 28, 22, 0.16);
    }

    .drawer-backdrop[hidden] {
        display: none;
    }
}

@media (max-width: 820px) {
    :root {
        --topbar-height: 58px;
        --sidebar-width: 100%;
        --drawer-width: min(100%, 420px);
    }

    .topbar {
        padding: 0 14px;
    }

    .brand {
        font-size: 14px;
    }

    .button-quiet span,
    .user-menu > span:not(.user-avatar) {
        display: none;
    }

    .sidebar {
        inset: var(--topbar-height) 0 auto 0;
        width: 100%;
        height: auto;
        display: block;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .site-section {
        display: none;
    }

    .main-nav {
        grid-template-columns: 1fr 1fr;
        padding: 7px 12px;
        border-top: 0;
    }

    .nav-item {
        justify-content: center;
        min-height: 40px;
    }

    .nav-item.is-active::before {
        inset: auto 18px -7px;
        width: auto;
        height: 2px;
    }

    .save-indicator {
        display: none;
    }

    .workspace {
        margin-left: 0;
        padding: calc(var(--topbar-height) + 82px) 16px 24px;
    }

    .filterbar {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .table-shell {
        margin-inline: -16px;
    }

    .product-table {
        min-width: 900px;
    }

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

    .pagination-controls {
        grid-column: 2;
        grid-row: 1;
    }

    .per-page-control {
        display: none;
    }

    .edit-drawer {
        top: var(--topbar-height);
    }

    .drawer-backdrop {
        inset: var(--topbar-height) 0 0;
    }

    .history-item {
        grid-template-columns: 1fr;
        gap: 7px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

