:root {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #273642;
    background: #f3f5f8;
    font-size: 14px;
    line-height: 1.6;
    --accent: #168f7a;
    --line: #e7ecf0;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
}
a {
    color: inherit;
    text-decoration: none;
}
button,
input,
select {
    font: inherit;
}
button,
.button {
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: white;
    padding: 10px 18px;
    cursor: pointer;
    display: inline-block;
}
button:hover {
    background: #107a68;
}
button:disabled {
    opacity: 0.6;
    cursor: wait;
}
button.secondary {
    background: #edf3f2;
    color: #236554;
}
button.danger {
    background: #fff0ee;
    color: #ad4234;
}
input,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d8e0e5;
    border-radius: 6px;
    background: white;
    color: #273642;
}
input:focus,
select:focus {
    outline: 2px solid #c2e8df;
    outline-offset: 1px;
}
label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
}
.field {
    margin: 16px 0;
}
.hint,
.muted {
    color: #788793;
    font-size: 13px;
}
.notice {
    padding: 10px 14px;
    border-radius: 6px;
    margin: 14px 0;
    min-height: 0;
}
.notice:empty {
    display: none;
}
.notice.error {
    background: #fff0ee;
    color: #b23a30;
}
.notice.success {
    background: #e8f6ef;
    color: #27754e;
}
h1,
h2,
h3,
p {
    margin-top: 0;
}
h1 {
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 650;
}
h2 {
    font-size: 17px;
    margin-bottom: 18px;
}
h3 {
    font-size: 15px;
}
small {
    font-size: 12px;
}
.brand-mark {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-size: 23px;
    font-weight: 700;
    flex-shrink: 0;
}
.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 18px;
    font-weight: 600;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 220px;
    background: #19343c;
    color: #c4d4d7;
    padding: 28px 18px;
}
.sidebar .brand {
    color: white;
    padding: 0 8px 30px;
}
.sidebar .brand-mark {
    background: #2e625e;
}
.nav-label {
    font-size: 11px;
    letter-spacing: 2px;
    color: #7e9da4;
    padding: 12px;
}
.nav-link {
    display: block;
    padding: 12px 14px;
    margin: 5px 0;
    border-radius: 7px;
}
.nav-link:hover,
.nav-link.active {
    background: #28504f;
    color: white;
}
.sidebar-foot {
    position: absolute;
    bottom: 24px;
    left: 30px;
    color: #819fa6;
    font-size: 12px;
}
.workspace {
    margin-left: 220px;
}
.topbar {
    height: 72px;
    background: white;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}
.topbar .user {
    display: flex;
    gap: 16px;
    align-items: center;
}
.topbar button {
    padding: 6px 14px;
    background: #f0f4f5;
    color: #536875;
}
.main {
    max-width: 1320px;
    padding: 32px;
    margin: auto;
}
.page-title {
    margin-bottom: 26px;
}
.card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 22px;
    box-shadow: 0 2px 3px #18314203;
}
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}
.grid .card {
    margin-bottom: 0;
}
.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #21a77c;
    border-radius: 50%;
    margin-right: 7px;
}
.tag {
    padding: 3px 9px;
    border-radius: 4px;
    background: #e9f5f0;
    color: #298267;
    white-space: nowrap;
    font-size: 12px;
}
.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 16px;
}
.table-wrap {
    overflow-x: auto;
}
table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    font-size: 13px;
}
th {
    font-weight: 500;
    background: #f6f8fa;
    color: #667682;
}
th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
td button {
    padding: 5px 9px;
    font-size: 12px;
    margin: 2px;
}
.empty {
    text-align: center;
    color: #8b98a3;
    padding: 36px;
}
.number {
    font-size: 32px;
    color: #203d46;
    line-height: 1.2;
    margin: 18px 0;
}
.split-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.split-title h2 {
    margin: 0;
}
.secret {
    word-break: break-all;
    padding: 14px;
    background: #f5f7f9;
    border: 1px dashed #ccd8df;
    border-radius: 6px;
}
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: white;
}
.login-brand {
    background: linear-gradient(145deg, #173b42, #24675f);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 64px;
    min-height: 100vh;
}
.login-brand .brand-mark {
    background: #ffffff24;
}
.login-brand h1 {
    font-size: 38px;
    line-height: 1.4;
    letter-spacing: 2px;
    max-width: 440px;
}
.login-brand p {
    color: #bdcfcd;
    max-width: 350px;
}
.login-brand footer {
    font-size: 12px;
    color: #b1c8c5;
}
.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.login-form {
    width: 360px;
    max-width: 100%;
}
.login-form h1 {
    font-size: 26px;
}
.login-form .button-full {
    width: 100%;
    margin-top: 12px;
}
.login-switch {
    margin-top: 28px;
    text-align: center;
    font-size: 12px;
    color: #7d8f98;
}
.login-switch a {
    color: var(--accent);
}
.security-info {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
    margin: 18px 0;
}
.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 14px;
    margin-top: 20px;
}
@media (max-width: 800px) {
    .sidebar {
        width: 164px;
        padding: 22px 10px;
    }
    .sidebar .brand {
        font-size: 14px;
        padding-left: 4px;
    }
    .sidebar .brand-mark {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    .workspace {
        margin-left: 164px;
    }
    .main {
        padding: 20px;
    }
    .topbar {
        padding: 0 20px;
    }
    .grid {
        grid-template-columns: 1fr;
    }
    .login-brand {
        padding: 36px;
    }
    .login-brand h1 {
        font-size: 28px;
    }
    .login-panel {
        padding: 28px;
    }
}
@media (max-width: 540px) {
    .sidebar {
        position: static;
        width: auto;
        padding: 16px;
        display: flex;
        gap: 8px;
        align-items: center;
        flex-wrap: wrap;
    }
    .sidebar .brand {
        width: 100%;
        padding: 0 0 8px;
    }
    .nav-label,
    .sidebar-foot {
        display: none;
    }
    .nav-link {
        display: inline-block;
        padding: 6px 10px;
        margin: 0;
        font-size: 12px;
    }
    .workspace {
        margin-left: 0;
    }
    .topbar {
        height: 58px;
        font-size: 12px;
    }
    .main {
        padding: 18px 14px;
    }
    .card {
        padding: 18px;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .login-page {
        grid-template-columns: 1fr;
    }
    .login-brand {
        min-height: 0;
        padding: 26px;
    }
    .login-brand .login-intro,
    .login-brand footer {
        display: none;
    }
    .login-panel {
        padding: 48px 26px;
    }
    .security-info {
        grid-template-columns: 100px 1fr;
    }
    .topbar .user {
        gap: 8px;
    }
    h1 {
        font-size: 21px;
    }
}
.field label {
    display: block;
}
.field textarea {
    display: block;
    width: 100%;
    min-height: 100px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid #d4dfe5;
    border-radius: 5px;
    font: inherit;
    resize: vertical;
}
.field input,
.field select {
    margin-top: 6px;
}
/* Catalogue forms follow the shared portal visual system. */
fieldset {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}
fieldset:disabled {
    opacity: 0.78;
}
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.filter-bar label {
    display: grid;
    gap: 6px;
    min-width: 140px;
    max-width: 100%;
}
.filter-bar input,
.filter-bar select {
    max-width: 100%;
}
.block {
    display: block;
    margin-top: 5px;
}
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 18px;
}
.media-tile {
    border: 1px solid #dde6e8;
    border-radius: 8px;
    padding: 12px;
}
.media-tile img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    background: #f5f8f7;
}
.media-tile p {
    margin: 8px 0;
}
.media-tile .actions {
    flex-wrap: wrap;
    gap: 5px;
}
.media-tile button {
    font-size: 12px;
    padding: 6px 8px;
}
.rich-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.rich-editor {
    border: 1px solid #cddbdc;
    border-radius: 6px;
    padding: 16px;
    min-height: 220px;
    max-height: 650px;
    overflow: auto;
    line-height: 1.7;
}
.rich-editor img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}
.rich-editor:focus {
    outline: 2px solid #299883;
}
.parameter-row {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    align-items: center;
}
.parameter-row input:not([type="checkbox"]) {
    min-width: 0;
    flex: 1;
}
.spec-group {
    padding: 18px;
    background: #f5f8f7;
    border-radius: 8px;
    margin-bottom: 14px;
}
.sku-table {
    margin-top: 18px;
}
.sku-table input {
    width: 125px;
}
.sku-table input[type="checkbox"] {
    width: auto;
}
.sku-table select {
    min-width: 140px;
}
.preview-image {
    max-width: 250px;
    max-height: 140px;
    display: block;
    margin: 10px 0;
}
.pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
}
#content-body {
    min-height: 220px;
}
@media (max-width: 650px) {
    .filter-bar {
        align-items: stretch;
    }
    .filter-bar label {
        width: 100%;
    }
    .parameter-row {
        flex-wrap: wrap;
    }
    .spec-group {
        padding: 12px;
    }
    .sku-table {
        max-width: 100%;
    }
    .page-title {
        flex-wrap: wrap;
        gap: 12px;
    }
}
[hidden] {
    display: none !important;
}
/* Keep tables readable on compact screens; scrolling stays inside the card. */
body[data-page="products"] .table-wrap table,
body[data-page="inventory"] .table-wrap table {
    min-width: 760px;
}
.sku-table table {
    min-width: 1420px;
}
.filter-bar > .field {
    flex: 1 1 160px;
    margin-bottom: 0;
    min-width: 0;
}
.filter-bar > button,
.filter-bar > .button {
    align-self: flex-end;
    white-space: nowrap;
}
@media (max-width: 650px) {
    .filter-bar > .field {
        flex-basis: 100%;
    }
    .filter-bar > button,
    .filter-bar > .button {
        align-self: auto;
    }
    .filter-bar select,
    .filter-bar input {
        width: 100%;
    }
}

body[data-page="order"] #items input {
    min-width: 64px;
    padding: 10px;
}
.subsection {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #e6eeee;
}
.subsection label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.subsection input[type="checkbox"] {
    width: 22px;
    height: 22px;
    min-width: 22px;
}
.evidence-thumb {
    display: block;
    max-width: 240px;
    max-height: 240px;
    object-fit: contain;
    margin: 12px 0;
}
#detail-body > a {
    display: inline-block;
    margin: 8px 20px 8px 0;
}
#tools {
    margin: 12px 0;
}
#print-area h2 {
    margin-top: 28px;
}
.sidebar nav {
    max-height: calc(100vh - 190px);
    overflow-y: auto;
}
@media print {
    body {
        background: white;
    }
    .sidebar,
    .topbar,
    .page-title,
    #notice,
    #list-card,
    #close-detail,
    #detail-title,
    #detail-body > button {
        display: none !important;
    }
    .workspace,
    .main {
        margin: 0;
        padding: 0;
        max-width: none;
    }
    .card {
        box-shadow: none;
        border: 0;
        padding: 0;
    }
    #print-area {
        display: block;
    }
    #print-area h2 {
        break-after: avoid;
    }
    table {
        break-inside: avoid;
    }
    a {
        color: inherit;
    }
}

#detail-title {
    min-width: 0;
    overflow-wrap: anywhere;
}
#close-detail {
    flex-shrink: 0;
    white-space: nowrap;
}
