:root {
    --bg: #f7f9fd;
    --panel: rgba(255, 255, 255, 0.88);
    --text: #172033;
    --muted: #728097;
    --line: #e7edf5;
    --primary: #2a9d8f;
    --primary-dark: #1f7f74;
    --blue: #547cff;
    --danger: #f05268;
    --shadow: 0 18px 45px rgba(31, 49, 80, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    letter-spacing: 0;
}

body.home-dashboard {
    background:
        radial-gradient(circle at 16% 12%, rgba(42, 157, 143, 0.12), transparent 28%),
        radial-gradient(circle at 86% 8%, rgba(72, 115, 255, 0.11), transparent 30%),
        linear-gradient(135deg, #f8fbff 0%, #eef5fb 52%, #f9fbff 100%);
}

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

img {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    display: grid;
    grid-template-columns: 254px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    border-right: 1px solid rgba(226, 234, 244, 0.95);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 12px 0 36px rgba(31, 49, 80, 0.06);
    backdrop-filter: blur(18px);
    padding: 24px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    color: var(--text);
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #2a9d8f, #547cff);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 14px 30px rgba(42, 157, 143, 0.24);
}

.brand strong,
.brand span {
    display: block;
}

.brand span:last-child {
    margin-top: 4px;
    color: #8491a5;
    font-size: 12px;
}

.sidebar nav {
    display: grid;
    gap: 10px;
}

.sidebar nav a {
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4h10l3 4v12H4V8l3-4Z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M9 12h6M9 16h4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 11px 12px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #506078;
    font-weight: 700;
}

.sidebar nav a::before {
    content: "";
    display: block;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    background: #8494aa;
    mask: var(--menu-icon) center / contain no-repeat;
    -webkit-mask: var(--menu-icon) center / contain no-repeat;
}

.sidebar nav a:nth-child(2) {
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 5v14M5 12h14' fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round'/%3E%3C/svg%3E");
}

.sidebar nav a:nth-child(3) {
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m5 13 4 4L19 7' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sidebar nav a:nth-child(4) {
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 6h7l2 3h7v9H4V6Z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.sidebar nav a:nth-child(5) {
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='3' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M3 12h4M17 12h4M12 3v4M12 17v4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.sidebar nav a:nth-child(6) {
    --menu-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 7h16M6 12h12M8 17h8' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.sidebar nav a.active,
.sidebar nav a:hover {
    border-color: #e1eaf4;
    background: #fff;
    color: #162035;
    box-shadow: 0 10px 24px rgba(31, 49, 80, 0.08);
}

.sidebar nav a.active {
    border-color: transparent;
    background: linear-gradient(135deg, #2a9d8f, #547cff);
    color: #fff;
    box-shadow: 0 14px 28px rgba(42, 157, 143, 0.22);
}

.sidebar nav a.active::before {
    background: #fff;
}

.sidebar nav a:hover::before {
    background: currentColor;
}

.sidebar-account {
    display: grid;
    gap: 12px;
    margin-top: auto;
    border-top: 1px solid #e7edf5;
    padding-top: 18px;
}

.sidebar-account-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px;
    border: 1px solid #e4ecf6;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 12px 28px rgba(31, 49, 80, 0.07);
}

.account-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, #2a9d8f, #547cff);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.account-meta {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.account-meta span {
    color: #8491a5;
    font-size: 12px;
}

.account-meta strong {
    overflow: hidden;
    color: var(--text);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-link-button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border: 1px solid #e1eaf4;
    border-radius: 7px;
    background: #f7fafd;
    color: #506078;
    font-weight: 700;
}

.main {
    min-width: 0;
    padding: 24px 28px 28px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.stat {
    position: relative;
    display: grid;
    min-height: 116px;
    overflow: hidden;
    border: 1px solid rgba(226, 234, 244, 0.92);
    border-radius: 18px;
    padding: 17px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow);
}

.stat::before {
    content: "";
    position: absolute;
    right: 16px;
    top: 16px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: rgba(42, 157, 143, 0.12);
}

.stat:nth-child(2)::before {
    background: rgba(84, 124, 255, 0.12);
}

.stat:nth-child(3)::before {
    background: rgba(242, 166, 90, 0.16);
}

.stat:nth-child(4)::before {
    background: rgba(141, 108, 223, 0.14);
}

.stat span {
    position: relative;
    color: #7a889d;
    font-weight: 700;
}

.stat strong {
    position: relative;
    align-self: end;
    margin-top: 18px;
    color: #121b2f;
    font-size: 34px;
    line-height: 1;
}

.topbar,
.section-head,
.detail-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 132px;
    margin-bottom: 14px;
    overflow: hidden;
    border: 1px solid rgba(226, 234, 244, 0.9);
    border-radius: 22px;
    padding: 24px 26px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 247, 255, 0.78)),
        linear-gradient(90deg, rgba(42, 157, 143, 0.12), rgba(84, 124, 255, 0.08));
    box-shadow: var(--shadow);
}

.topbar::after,
.section-head::after,
.detail-hero::after {
    content: "";
    position: absolute;
    right: -82px;
    top: -94px;
    width: 260px;
    height: 260px;
    border-radius: 42px;
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.18), rgba(84, 124, 255, 0.16));
    transform: rotate(18deg);
}

.topbar > *,
.section-head > *,
.detail-hero > * {
    position: relative;
    z-index: 1;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 800;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    color: #121b2f;
    font-size: 34px;
    line-height: 1.15;
}

h2 {
    margin-bottom: 14px;
    color: #121b2f;
    font-size: 20px;
}

h3 {
    margin-bottom: 10px;
    color: #1a2438;
    font-size: 15px;
}

.button,
.primary-link,
.ghost-button,
.secondary-button,
.text-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid #dfe8f3;
    border-radius: 12px;
    padding: 0 18px;
    background: #fff;
    color: #40516b;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

.button.primary,
.primary-link,
.primary-button {
    border-color: transparent;
    background: linear-gradient(135deg, #2a9d8f, #547cff);
    color: #fff;
    box-shadow: 0 12px 24px rgba(42, 157, 143, 0.2);
}

.button.ghost,
.ghost-button {
    background: rgba(255, 255, 255, 0.82);
}

.button.danger {
    border-color: #ffd5dc;
    background: #fff5f7;
    color: var(--danger);
}

.button.small {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.notice {
    margin-bottom: 14px;
    border: 1px solid #cdeee6;
    border-radius: 14px;
    padding: 12px 14px;
    background: #ecfbf7;
    color: #1f7f74;
    font-weight: 700;
}

.list-panel,
.panel {
    border: 1px solid rgba(226, 234, 244, 0.92);
    border-radius: 22px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow);
}

.panel {
    margin-bottom: 16px;
}

.list-panel {
    display: grid;
    gap: 12px;
}

.panel-heading,
.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
    border-bottom: 1px solid #edf2f7;
    padding-bottom: 12px;
}

.panel-heading {
    display: grid;
    grid-template-columns: auto auto minmax(220px, 1fr);
}

.panel-heading h2,
.panel-title-row h2 {
    margin: 0;
}

.panel-heading > span {
    border-radius: 999px;
    padding: 7px 12px;
    background: #f0f6ff;
    color: #547cff;
    font-weight: 700;
}

.panel-heading-actions,
.action-row,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.filters {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 180px 180px auto auto;
    gap: 10px;
    border: 1px solid #e7edf5;
    border-radius: 16px;
    padding: 10px;
    background: #f8fbff;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid #dfe8f3;
    border-radius: 12px;
    background: #fff;
    color: var(--text);
}

input,
select {
    padding: 0 12px;
}

textarea {
    min-height: 96px;
    resize: vertical;
    padding: 11px 12px;
    line-height: 1.6;
}

.secondary-button,
.filters .secondary-button {
    border-color: #172033;
    background: #172033;
    color: #fff;
}

.text-button,
.filters .text-button {
    border-color: transparent;
    background: transparent;
    color: #65748a;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid #edf2f7;
    border-radius: 18px;
    background: #fff;
}

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

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

th {
    padding: 11px 12px;
    background: #f8fafc;
    color: #7b889b;
    font-size: 13px;
    font-weight: 800;
}

tbody td {
    padding: 12px;
    background: #fff;
    color: #23304a;
}

tbody tr:hover td {
    background: #fbfcfe;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.product-thumb-button,
.product-thumb,
.image-empty {
    display: inline-grid;
    width: 78px;
    height: 78px;
    min-height: 78px;
    place-items: center;
    border: 0;
    border-radius: 14px;
    overflow: hidden;
}

.product-thumb-button {
    background: transparent;
}

.product-thumb {
    object-fit: cover;
    box-shadow: inset 0 0 0 1px rgba(226, 234, 244, 0.8);
}

.image-empty {
    background: #eef3f8;
    color: #64748b;
    font-size: 12px;
}

.record-main {
    width: 280px;
}

.record-main strong {
    display: block;
    color: #1a2438;
    font-size: 14px;
}

.record-main small,
.record-main em,
.muted {
    display: block;
    margin-top: 4px;
    color: #7a889d;
    font-size: 13px;
    font-style: normal;
}

.tag,
.inline-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 800;
}

.tag-blue {
    background: #eef3ff;
    color: #547cff;
}

.tag-yellow {
    background: #fff7d6;
    color: #d99a00;
}

.tag-green {
    background: #e8fbf6;
    color: #168274;
}

.category-color-tag {
    background: color-mix(in srgb, var(--category-color, #547cff) 14%, #fff);
    color: var(--category-color, #547cff);
}

.category-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -3px;
}

.category-icon-chip {
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--category-color, #547cff) 14%, #fff);
    color: var(--category-color, #547cff);
}

.category-icon-chip .category-icon {
    width: 19px;
    height: 19px;
}

.category-select-control {
    position: relative;
}

.category-select-button {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 16px;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    border: 1px solid #dfe8f3;
    border-radius: 12px;
    padding: 0 12px;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.category-select-button::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid #64748b;
    border-bottom: 2px solid #64748b;
    transform: rotate(45deg) translateY(-2px);
}

.category-select-button-icon,
.category-select-option-icon {
    display: grid;
    place-items: center;
    color: var(--category-color, #547cff);
}

.category-select-button span,
.category-select-option span {
    color: inherit;
    font-size: 14px;
    font-weight: 700;
}

.category-select-button .category-select-button-icon,
.category-select-option .category-select-option-icon {
    color: var(--category-color, #547cff);
}

.category-select-button-icon .category-icon,
.category-select-option-icon .category-icon {
    width: 17px;
    height: 17px;
}

.category-select-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 20;
    display: none;
    overflow: hidden;
    border: 1px solid #dfe8f3;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 38px rgba(31, 49, 80, 0.14);
}

.category-select-control.is-open .category-select-menu {
    display: grid;
}

.category-select-option {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 0;
    padding: 0 12px;
    background: #fff;
    color: #172033;
    text-align: left;
    cursor: pointer;
}

.category-select-option:hover,
.category-select-option.is-selected {
    background: color-mix(in srgb, var(--category-color, #547cff) 12%, #f8fbff);
    color: var(--category-color, #547cff);
}

.color-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    border: 1px solid #dfe8f3;
    border-radius: 999px;
    vertical-align: -4px;
}

.inline-pill {
    border: 1px solid #dfe8f3;
    background: #fff;
    color: #f05268;
}

.table-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.action-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-buttons form {
    margin: 0;
}

.action-buttons a,
.action-buttons button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    border: 1px solid #e7edf5;
    border-radius: 999px;
    padding: 0 13px;
    background: #f8fbff;
    color: #172033;
    font-weight: 700;
}

.action-buttons .danger,
.action-buttons button.danger {
    border-color: #ffd5dc;
    background: #fff5f7;
    color: var(--danger);
}

.empty-cell,
.empty {
    padding: 42px 18px;
    color: #7a889d;
    text-align: center;
}

.record-form,
.form-workspace {
    max-width: 1120px;
}

.category-layout {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

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

.tag-picker {
    display: grid;
    gap: 10px;
    border: 1px solid #e7edf5;
    border-radius: 14px;
    padding: 12px;
    background: #f8fbff;
}

.tag-picker-group {
    display: grid;
    gap: 8px;
}

.tag-picker-group strong {
    color: var(--tag-type-color, #547cff);
    font-size: 13px;
}

.tag-picker-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-choice,
.managed-tag {
    border: 1px solid color-mix(in srgb, var(--tag-type-color, #547cff) 24%, #dfe8f3);
    background: color-mix(in srgb, var(--tag-type-color, #547cff) 12%, #fff);
    color: var(--tag-type-color, #547cff);
}

.tag-choice {
    min-height: 30px;
    border-radius: 999px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.tag-choice.is-selected {
    background: var(--tag-type-color, #547cff);
    color: #fff;
    box-shadow: 0 8px 18px color-mix(in srgb, var(--tag-type-color, #547cff) 24%, transparent);
}

.tag-manager-groups {
    display: grid;
    gap: 14px;
    padding: 14px;
}

.tag-manager-group {
    overflow: hidden;
    border: 1px solid #e7edf5;
    border-radius: 14px;
    background: #fff;
}

.tag-manager-group-head,
.tag-manager-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) 80px 180px;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.tag-manager-group-head {
    background: color-mix(in srgb, var(--tag-type-color, #547cff) 8%, #f8fafc);
}

.tag-manager-group-head h3 {
    margin: 0;
    color: var(--tag-type-color, #547cff);
    font-size: 15px;
}

.tag-manager-group-head span {
    color: #7b889b;
    font-size: 13px;
    font-weight: 800;
}

.tag-manager-row {
    border-top: 1px solid #edf2f7;
}

.empty-mini {
    margin: 0;
    border-top: 1px solid #edf2f7;
    padding: 16px 14px;
    color: #7a889d;
    font-size: 13px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    display: grid;
    gap: 7px;
}

.field span {
    color: #66758e;
    font-size: 13px;
    font-weight: 800;
}

.span-2 {
    grid-column: span 2;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.product-image-field {
    display: grid;
    gap: 10px;
}

.field-title {
    display: block;
    color: #334155;
    font-size: 13px;
    font-weight: 800;
}

.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.image-upload-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.image-upload-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 14px;
    min-height: 132px;
    border: 1px solid #e7edf5;
    border-radius: 16px;
    padding: 20px;
    background: #fff;
    color: #1f2937;
    text-align: left;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(31, 49, 80, 0.05);
}

.image-upload-card:hover,
.image-upload-card:focus {
    border-color: #b9d9f2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(84, 124, 255, 0.09), 0 12px 24px rgba(31, 49, 80, 0.07);
}

.image-upload-card.paste {
    border-style: dashed;
    background: #fbfdff;
}

.product-image-field.is-paste-ready .image-upload-card.paste {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.14);
}

.image-upload-card.has-image {
    align-content: start;
}

.image-action-icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.image-upload-card.paste .image-action-icon {
    background: #e9fbf5;
    color: var(--primary);
    font-size: 16px;
}

.image-card-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.image-upload-card strong {
    color: #172033;
    font-size: 16px;
    line-height: 22px;
}

.image-upload-card small {
    color: var(--muted);
    font-size: 13px;
    line-height: 18px;
}

.image-inline-preview {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.image-inline-preview:empty {
    display: none;
}

.image-preview-tile {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.image-preview-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    width: 24px;
    height: 24px;
    min-height: 24px;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.78);
    color: #fff;
    line-height: 1;
}

.image-upload-status {
    min-height: 20px;
    color: var(--muted);
    font-size: 12px;
}

.image-upload-status.is-ready {
    color: var(--primary);
}

.image-upload-status.is-warning {
    color: var(--danger);
}

.existing-photos {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.thumb-grid,
.photo-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.thumb,
.photo-tile {
    position: relative;
    overflow: hidden;
    border: 1px solid #e7edf5;
    border-radius: 16px;
    background: #fff;
}

.thumb img,
.photo-tile img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.thumb.selectable span {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    color: #7a889d;
    font-size: 13px;
}

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

.existing-thumb {
    display: block;
}

.thumb-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border: 1px solid #ffd5dc;
    border-radius: 999px;
    padding: 0 10px;
    background: rgba(255, 245, 247, 0.94);
    color: var(--danger);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(240, 82, 104, 0.12);
}

.thumb-delete:hover {
    background: #fff;
}

.photo-gallery {
    display: grid;
    gap: 16px;
    margin-bottom: 16px;
}

.gallery-group {
    border: 1px solid rgba(226, 234, 244, 0.92);
    border-radius: 22px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--shadow);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.facts,
.mini-facts {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 10px 14px;
    margin: 0;
}

.facts dt,
.mini-facts dt {
    color: #7a889d;
    font-weight: 800;
}

.facts dd,
.mini-facts dd {
    margin: 0;
    min-height: 20px;
}

.note,
.preline {
    white-space: pre-line;
    line-height: 1.7;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .stats-grid,
    .filters,
    .category-layout,
    .form-grid,
    .form-grid.compact,
    .detail-grid,
    .upload-grid,
    .image-upload-actions,
    .panel-heading {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: auto;
    }

    .section-head,
    .detail-hero {
        align-items: flex-start;
        flex-direction: column;
    }
}
