:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #eef7f4;
    --surface-blue: #eef5ff;
    --text: #172033;
    --muted: #64748b;
    --line: #dbe4ef;
    --blue: #2563eb;
    --blue-strong: #1d4ed8;
    --teal: #0f766e;
    --green: #15803d;
    --amber: #b45309;
    --violet: #6d28d9;
    --danger: #dc2626;
    --shadow: 0 16px 40px rgba(15, 23, 42, 0.10);
    --radius: 8px;
    --shell: 1180px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Sarabun", Tahoma, Arial, sans-serif;
    color: var(--text);
    background:
        linear-gradient(180deg, #f4f8ff 0%, var(--bg) 28%, #f7faf8 100%);
    letter-spacing: 0;
}

a {
    color: inherit;
}

button,
input,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

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

.site-header {
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
}

.header-grid,
.nav-grid,
.admin-bar-inner,
.section-heading,
.modal-header,
.modal-actions,
.status-row {
    display: flex;
    align-items: center;
}

.header-grid {
    justify-content: space-between;
    gap: 18px;
    padding: 14px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    min-width: 0;
}

.brand-logo {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.brand strong {
    display: block;
    font-size: clamp(18px, 2vw, 25px);
    line-height: 1.2;
}

.brand small {
    color: var(--blue);
    font-size: 16px;
    font-weight: 600;
}

.btn,
.icon-btn,
.slide-btn {
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    border-radius: var(--radius);
    font-weight: 700;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.btn:hover,
.icon-btn:hover,
.slide-btn:hover {
    transform: translateY(-1px);
}

.btn {
    padding: 0 14px;
    border: 1px solid transparent;
}

.btn svg,
.icon-btn svg,
.slide-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.2;
}

.btn-primary {
    color: #fff;
    background: var(--blue);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

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

.btn-soft {
    color: #12315f;
    background: #eaf2ff;
    border-color: #cfe0ff;
}

.btn-light,
.btn-ghost {
    color: #334155;
    background: #fff;
    border-color: var(--line);
}

.btn-ghost:hover,
.btn-light:hover {
    background: #f8fafc;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: #fff;
    color: #334155;
    border: 1px solid var(--line);
}

.main-nav {
    background: #17386f;
    color: #fff;
    position: sticky;
    top: 87px;
    z-index: 18;
    box-shadow: 0 10px 24px rgba(23, 56, 111, 0.16);
}

.nav-grid {
    justify-content: space-between;
    gap: 10px;
    min-height: 54px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 0 12px;
    border-radius: var(--radius);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    font-weight: 700;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.14);
}

.admin-bar {
    position: sticky;
    top: 141px;
    z-index: 17;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid #f1d38f;
    backdrop-filter: blur(12px);
}

.admin-bar-inner {
    gap: 12px;
    justify-content: space-between;
    padding: 10px 0;
}

.admin-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #7c2d12;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 800;
}

.admin-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.section-block {
    margin-top: 34px;
}

.best-practice {
    height: 520px;
    max-height: 520px;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 440px);
    align-items: center;
    gap: 28px;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    color: #14213d;
    padding: clamp(24px, 5vw, 52px);
    border-radius: 18px;
    border: 1px solid rgba(191, 219, 254, 0.88);
    background-image: url("https://images.unsplash.com/photo-1497633762265-9d179a990aa6?auto=format&fit=crop&w=1600&q=80");
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    box-shadow: 0 22px 54px rgba(15, 23, 42, 0.12);
}

.section-edit-float {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #1d4ed8;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(147, 197, 253, 0.82);
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(30, 64, 175, 0.14);
    backdrop-filter: blur(10px);
}

.section-edit-float:hover {
    background: #fff;
    color: var(--blue-strong);
}

.best-copy {
    max-width: 640px;
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: start;
    gap: 12px;
}

.best-copy h1 {
    width: auto;
    max-width: 640px;
    margin: 0;
    font-size: clamp(30px, 5vw, 54px);
    line-height: 1.08;
    letter-spacing: 0;
    color: #0f172a;
    text-shadow:
        0 2px 0 rgba(255, 255, 255, 0.98),
        2px 0 0 rgba(255, 255, 255, 0.92),
        -2px 0 0 rgba(255, 255, 255, 0.92),
        0 -2px 0 rgba(255, 255, 255, 0.86),
        0 12px 26px rgba(15, 23, 42, 0.22);
}

.best-copy h1::after {
    content: "";
    display: block;
    width: min(220px, 48%);
    height: 5px;
    margin-top: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--teal), var(--blue));
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.best-copy p:not(.section-label) {
    width: auto;
    margin: 0;
    font-size: 18px;
    line-height: 1.8;
    color: #334155;
    max-width: 620px;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.98),
        1px 0 0 rgba(255, 255, 255, 0.86),
        -1px 0 0 rgba(255, 255, 255, 0.86),
        0 8px 20px rgba(255, 255, 255, 0.52);
}

.section-label {
    margin: 0 0 6px;
    color: var(--teal);
    text-transform: uppercase;
    font-size: 13px;
    font-weight: 800;
}

.best-practice .section-label {
    width: fit-content;
    color: #047857;
    background: rgba(236, 253, 245, 0.94);
    border: 1px solid rgba(20, 184, 166, 0.24);
    border-radius: 999px;
    padding: 5px 12px;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.10);
}

.best-panel {
    min-height: 210px;
    max-height: 100%;
    overflow: auto;
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(147, 197, 253, 0.62);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 18px 38px rgba(30, 64, 175, 0.16);
    backdrop-filter: blur(12px);
}

.best-item h3 {
    margin: 0 0 10px;
    font-size: 25px;
    color: #12315f;
}

.best-item p {
    margin: 0 0 16px;
    line-height: 1.75;
    color: #475569;
    max-height: 172px;
    overflow: auto;
    padding-right: 4px;
}

.best-item img {
    width: 100%;
    height: clamp(150px, 20vw, 220px);
    object-fit: cover;
    object-position: center;
    border-radius: var(--radius);
    margin-bottom: 14px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.slider-dots {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    display: flex;
    gap: 7px;
}

.slider-dots button {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.24);
}

.slider-dots button.active {
    width: 24px;
    background: var(--blue);
}

.slide-btn {
    position: absolute;
    top: 50%;
    width: 40px;
    height: 40px;
    color: #1d4ed8;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(147, 197, 253, 0.72);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(8px);
}

.slide-prev {
    left: 14px;
}

.slide-next {
    right: 14px;
}

.section-heading {
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.section-heading h2,
.section-heading h4 {
    margin: 0;
}

.section-heading h2 {
    font-size: 28px;
}

.compact {
    margin-bottom: 12px;
}

.structure-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    overflow-x: visible;
    padding: 4px 2px 14px;
    margin-bottom: 4px;
}

.structure-tab {
    position: relative;
    min-width: 142px;
    max-width: none;
    min-height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 150px;
    padding: 13px 16px;
    text-align: center;
    background:
        linear-gradient(135deg, #fff 0%, color-mix(in srgb, var(--structure-soft, #f8fbff) 78%, #fff) 100%);
    border: 1px solid var(--structure-line, var(--line));
    border-radius: 8px;
    color: var(--structure-deep, #17324d);
    box-shadow: 0 8px 18px color-mix(in srgb, var(--structure-accent, #2563eb) 10%, transparent);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease, color 160ms ease;
}

.structure-tab strong {
    display: block;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 950;
    white-space: nowrap;
}

.structure-tab:hover,
.structure-tab.active {
    border-color: var(--structure-accent, #8eb8ff);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--structure-accent, #2563eb) 18%, transparent);
}

.structure-tab:hover {
    transform: translateY(-1px);
}

.structure-tab.active {
    color: #fff;
    border-color: var(--structure-accent, #2563eb);
    background:
        linear-gradient(135deg, var(--structure-accent, #2563eb), color-mix(in srgb, var(--structure-accent, #2563eb) 66%, #0f172a));
    box-shadow:
        inset 0 0 0 1px color-mix(in srgb, #fff 28%, transparent),
        0 12px 26px color-mix(in srgb, var(--structure-accent, #2563eb) 18%, transparent);
}

.structure-tab.active::after {
    content: "";
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 7px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.82);
}

.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
}

.link-card,
.standard-card,
.attachment-row,
.year-row,
.manage-item,
.structure-standard {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.link-card {
    min-height: 104px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    text-decoration: none;
    overflow: hidden;
}

.link-card:hover,
.standard-card:hover {
    border-color: #9cc1ff;
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.10);
}

.link-card .link-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--item-soft, #eaf2ff);
    color: var(--item-accent, var(--blue));
    flex: 0 0 auto;
}

.link-card-body {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.link-card strong {
    display: block;
    color: #18304f;
    font-size: 16px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.link-card .link-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.link-card .link-meta > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-card .link-chip {
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--item-accent, var(--blue-strong));
    background: var(--item-soft, #eff6ff);
    border: 1px solid var(--item-line, #cfe0ff);
    font-size: 12px;
    font-weight: 800;
}

.link-card.is-disabled {
    opacity: 0.68;
    cursor: not-allowed;
}

.report-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 12px;
}

.report-menu-grid .link-card {
    min-height: 78px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.report-menu-grid .link-card::after {
    content: "›";
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    color: var(--item-accent, var(--blue));
    background: var(--item-soft, #eff6ff);
    border: 1px solid var(--item-line, #cfe0ff);
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.report-menu-grid .link-card.is-disabled::after {
    display: none;
}

.report-menu-grid .link-card .link-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
}

.report-menu-grid .link-card-body {
    gap: 4px;
}

.report-menu-grid .link-card strong {
    font-size: 15px;
    line-height: 1.32;
}

.report-menu-grid .link-card .link-meta {
    gap: 6px;
    font-size: 12.5px;
}

.report-menu-grid .link-card .link-chip {
    padding: 2px 7px;
    font-size: 11.5px;
}

.document-section {
    margin-bottom: 40px;
}

.document-heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.document-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.document-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
    gap: 12px;
    padding: 16px;
    background:
        linear-gradient(135deg, rgba(239, 246, 255, 0.86), rgba(240, 253, 250, 0.78)),
        #fff;
    border-bottom: 1px solid var(--line);
}

.document-search-field input {
    min-width: 0;
}

.document-quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 252, 0.94)),
        #fff;
    border-bottom: 1px solid #edf2f7;
}

.quick-filter {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    color: var(--item-accent, #2563eb);
    background: var(--item-soft, #eff6ff);
    border: 1px solid var(--item-line, #bfdbfe);
    border-radius: 999px;
    font-weight: 900;
}

.quick-filter svg {
    width: 17px;
    height: 17px;
}

.quick-filter:hover,
.quick-filter.active {
    color: #fff;
    background: var(--item-accent, #2563eb);
    border-color: var(--item-accent, #2563eb);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--item-accent, #2563eb) 18%, transparent);
}

.quick-filter:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    box-shadow: none;
}

.document-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    color: #334155;
    border-bottom: 1px solid #edf2f7;
}

.document-table-head span {
    color: var(--muted);
    font-size: 13px;
}

.document-table-wrap {
    overflow-x: auto;
}

.document-table {
    width: 100%;
    min-width: 920px;
    border-collapse: collapse;
}

.document-table th,
.document-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #edf2f7;
    text-align: left;
    vertical-align: middle;
}

.document-table th {
    color: #0f2a44;
    background:
        linear-gradient(135deg, rgba(219, 234, 254, 0.92), rgba(204, 251, 241, 0.72)),
        #f8fafc;
    font-size: 13px;
    font-weight: 900;
}

.document-table tbody tr:hover {
    background: #fbfdff;
}

.document-file-cell {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.document-file-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue), #0f766e);
    border: 1px solid rgba(37, 99, 235, 0.16);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.15);
}

.document-album-preview {
    position: relative;
    width: 44px;
    height: 44px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
    padding: 3px;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff, #f0fdfa);
    border: 1px solid #bfdbfe;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.14);
}

.document-album-preview button {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 7px;
    background: #fff;
    cursor: zoom-in;
}

.document-album-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.document-album-count {
    position: absolute;
    right: -7px;
    bottom: -7px;
    min-width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border-radius: 999px;
    color: #fff;
    background: #0f766e;
    border: 2px solid #fff;
    font-size: 11px;
    font-weight: 900;
    box-shadow: 0 6px 12px rgba(15, 118, 110, 0.22);
}

.document-file-cell strong,
.document-owner strong,
.document-year strong {
    display: block;
    color: #172033;
    line-height: 1.35;
}

.document-file-cell strong,
.document-owner strong {
    max-width: 310px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-file-cell small,
.document-year small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.35;
}

.document-category {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    max-width: 180px;
    padding: 0 10px;
    border-radius: 999px;
    color: var(--item-accent, var(--blue));
    background: var(--item-soft, #eff6ff);
    border: 1px solid var(--item-line, #cfe0ff);
    font-size: 12.5px;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.document-actions .icon-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
    color: #31506f;
    text-decoration: none;
}

.document-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 16px;
}

.page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.page-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: #334155;
    font-weight: 900;
}

.page-btn.active {
    color: #fff;
    border-color: var(--blue);
    background: var(--blue);
}

.page-gap {
    color: var(--muted);
    padding: 0 4px;
}

.table-loading {
    padding: 20px;
    color: var(--muted);
    text-align: center;
}

.document-form,
.category-list {
    padding: 16px 20px;
    overflow: auto;
}

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

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

.year-field {
    min-width: 0;
}

.inline-year-tools {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto auto;
    gap: 8px;
    margin-top: 8px;
}

.inline-year-tools .btn {
    min-height: 38px;
    white-space: nowrap;
}

.danger-text {
    color: #b91c1c;
}

.danger-text:hover {
    color: #991b1b;
    border-color: #fecaca;
    background: #fff1f2;
}

.category-list {
    display: grid;
    gap: 10px;
    max-height: 62vh;
}

.category-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1.2fr) minmax(180px, 240px) minmax(170px, 210px) auto;
    align-items: end;
    gap: 10px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.quick-toggle {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 12px;
    color: #0f3f6f;
    background: #f0f7ff;
    border: 1px solid #cfe0ff;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 800;
    white-space: nowrap;
}

.quick-toggle input {
    width: 17px;
    height: 17px;
    accent-color: var(--blue);
}

.quick-filter-manage {
    color: #334155;
    background: #fff;
    border-style: dashed;
}

button:disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.empty-state {
    padding: 22px;
    color: var(--muted);
    background: #fff;
    border: 1px dashed #bfd0e5;
    border-radius: var(--radius);
    text-align: center;
}

.control-band {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
    padding: 14px;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 248, 246, 0.92) 56%, rgba(239, 246, 255, 0.96)),
        radial-gradient(circle at 95% 0%, rgba(37, 99, 235, 0.16), transparent 34%);
    border: 1px solid #cfe1dc;
    box-shadow: 0 12px 28px rgba(23, 56, 111, 0.07);
}

.control-band::before {
    display: none;
}

.control-groups {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(207, 224, 255, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
}

.control-groups > div {
    display: grid;
    justify-items: center;
    gap: 7px;
    padding: 10px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #e3ebf5;
}

.control-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    color: #22324a;
}

.control-title::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.10);
}

.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    padding: 4px;
    border-radius: 12px;
    background: #f3f7fb;
    border: 1px solid #e1eaf4;
}

.segmented button {
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #334155;
    background: transparent;
    padding: 0 12px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: none;
}

.segmented button:hover {
    color: var(--blue-strong);
    background: #fff;
    border-color: #d6e4f7;
}

.segmented button.active {
    color: #fff;
    border-color: var(--blue);
    background: linear-gradient(135deg, var(--blue), #1e40af);
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
}

.year-select {
    min-width: 132px;
    min-height: 38px;
    appearance: none;
    color: #fff;
    border: 1px solid var(--blue);
    border-radius: 10px;
    background:
        linear-gradient(45deg, transparent 50%, currentColor 50%),
        linear-gradient(135deg, currentColor 50%, transparent 50%),
        linear-gradient(135deg, var(--blue), #1e40af);
    background-position:
        calc(100% - 18px) 16px,
        calc(100% - 12px) 16px,
        0 0;
    background-size:
        6px 6px,
        6px 6px,
        100% 100%;
    background-repeat: no-repeat;
    padding: 0 34px 0 14px;
    font-weight: 800;
    text-align: center;
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.22);
    outline: none;
}

.year-select:hover,
.year-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12), 0 10px 18px rgba(37, 99, 235, 0.22);
}

.year-select option {
    color: var(--text);
    background: #fff;
    font-weight: 700;
}

.status-row {
    position: relative;
    overflow: hidden;
    margin-top: 16px;
    padding: 12px;
    gap: 12px;
    display: grid;
    grid-template-columns: minmax(280px, 1.35fr) repeat(2, minmax(170px, 0.82fr));
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(239, 246, 255, 0.92) 58%, rgba(240, 253, 250, 0.9) 100%);
    border: 1px solid rgba(37, 99, 235, 0.22);
    border-left: 4px solid var(--blue);
    border-radius: var(--radius);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

.status-row > div {
    --status-accent: var(--blue);
    --status-soft: #eff6ff;
    position: relative;
    min-height: 72px;
    display: grid;
    align-content: center;
    background: linear-gradient(135deg, var(--status-soft) 0%, #fff 62%);
    border: 1px solid color-mix(in srgb, var(--status-accent) 24%, #dbe4ef);
    border-radius: var(--radius);
    padding: 14px 16px 14px 18px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86), 0 8px 20px rgba(15, 23, 42, 0.055);
}

.status-row > div::before {
    content: "";
    position: absolute;
    inset: 12px auto 12px 0;
    width: 4px;
    border-radius: 999px;
    background: var(--status-accent);
}

.status-row > div:nth-child(2) {
    --status-accent: var(--teal);
    --status-soft: #f0fdfa;
}

.status-row > div:nth-child(3) {
    --status-accent: var(--violet);
    --status-soft: #f5f3ff;
}

.status-row span {
    display: block;
    color: var(--status-accent);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 5px;
}

.status-row strong {
    display: block;
    color: #0f172a;
    font-size: 22px;
    line-height: 1.22;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.standard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.standard-grid.iqa-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.standard-grid.iqa-single-grid {
    grid-template-columns: 1fr;
}

.standard-card {
    overflow: hidden;
    position: relative;
    border-color: var(--structure-line, var(--line));
    background:
        linear-gradient(180deg, #fff 0%, color-mix(in srgb, var(--structure-soft, #eff6ff) 34%, #fff) 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.055);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.standard-card.is-focused {
    border-color: #74a8ff;
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.13);
}

.standard-header {
    position: relative;
    overflow: hidden;
    padding: 18px;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--structure-soft, #eff6ff) 82%, #fff) 0%, #fff 68%),
        #fff;
    border-bottom: 1px solid var(--structure-line, var(--line));
}

.standard-header::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--structure-accent, var(--blue)), color-mix(in srgb, var(--structure-accent, var(--blue)) 42%, #fff));
}

.iqa-grid .standard-card {
    border-color: var(--structure-line, var(--line));
    background:
        linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

.iqa-single-grid .standard-card {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    min-height: 0;
}

.iqa-grid .standard-header {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--structure-soft, #eff6ff) 82%, #fff), #fff 62%),
        #fff;
    border-bottom-color: var(--structure-line, var(--line));
}

.iqa-single-grid .standard-header {
    display: grid;
    justify-items: center;
    text-align: center;
    border-right: 0;
    border-bottom: 1px solid var(--structure-line, var(--line));
    padding: 24px 28px 22px;
}

.iqa-grid .standard-header::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    width: auto;
    height: 5px;
    background: linear-gradient(90deg, var(--structure-accent, var(--blue)), color-mix(in srgb, var(--structure-accent, var(--blue)) 36%, #fff));
}

.standard-header small {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 10px;
    border-radius: 999px;
    color: var(--structure-deep, var(--teal));
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--structure-line, var(--line));
    box-shadow: 0 8px 18px color-mix(in srgb, var(--structure-accent, var(--blue)) 10%, transparent);
    font-weight: 900;
}

.iqa-grid .standard-header small {
    position: relative;
    z-index: 1;
    width: fit-content;
    padding: 4px 10px;
    border-radius: 999px;
    color: var(--structure-deep, var(--teal));
    background: #fff;
    border: 1px solid var(--structure-line, var(--line));
}

.standard-header h3 {
    position: relative;
    z-index: 1;
    margin: 8px 0 6px;
    line-height: 1.35;
    color: #10243f;
}

.iqa-single-grid .standard-header h3 {
    font-size: clamp(22px, 2.4vw, 30px);
    line-height: 1.28;
    max-width: 880px;
}

.standard-header p {
    position: relative;
    z-index: 1;
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.indicator-list {
    display: grid;
    gap: 9px;
    padding: 12px;
    background:
        linear-gradient(135deg, rgba(248, 250, 252, 0.62), color-mix(in srgb, var(--structure-soft, #eff6ff) 34%, #fff)),
        #fff;
}

.iqa-grid .indicator-list {
    gap: 12px;
    padding: 16px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    align-content: start;
    background:
        linear-gradient(135deg, rgba(248, 250, 252, 0.72), rgba(255, 255, 255, 0.96)),
        #fff;
}

.iqa-single-grid .indicator-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    padding: 18px 20px 20px;
}

.indicator-btn {
    width: 100%;
    min-height: 58px;
    display: grid;
    grid-template-columns: 52px 1fr 30px;
    align-items: center;
    gap: 10px;
    border: 1px solid color-mix(in srgb, var(--structure-line, #bfdbfe) 66%, #e2e8f0);
    border-radius: 10px;
    background:
        linear-gradient(135deg, #fff 0%, color-mix(in srgb, var(--structure-soft, #eff6ff) 52%, #fff) 100%);
    color: var(--text);
    text-align: left;
    padding: 10px 14px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.035);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.indicator-btn:hover {
    border-color: var(--structure-accent, var(--blue));
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--structure-soft, #eff6ff) 72%, #fff), #fff);
    transform: translateY(-1px);
    box-shadow: 0 12px 24px color-mix(in srgb, var(--structure-accent, var(--blue)) 14%, transparent);
}

.iqa-grid .indicator-btn {
    min-height: 104px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    border: 1px solid color-mix(in srgb, var(--structure-line, #bfdbfe) 72%, #e2e8f0);
    border-radius: 12px;
    background:
        linear-gradient(135deg, #fff 0%, color-mix(in srgb, var(--structure-soft, #eff6ff) 58%, #fff) 100%);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.045);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.iqa-single-grid .indicator-btn {
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: 86px;
    grid-template-columns: 64px minmax(0, 1fr) 34px;
    padding: 16px 18px;
}

.iqa-grid .indicator-btn:hover {
    border-color: var(--structure-accent, #2563eb);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--structure-soft, #eff6ff) 72%, #fff), #fff);
    transform: translateY(-1px);
    box-shadow: 0 12px 26px color-mix(in srgb, var(--structure-accent, #2563eb) 14%, transparent);
}

.iqa-grid .indicator-btn.issue-tone-2 {
    background: linear-gradient(135deg, #fff 0%, #f0fdfa 100%);
    border-color: #99f6e4;
}

.iqa-grid .indicator-btn.issue-tone-3 {
    background: linear-gradient(135deg, #fff 0%, #f5f3ff 100%);
    border-color: #ddd6fe;
}

.iqa-grid .indicator-btn.issue-tone-4 {
    background: linear-gradient(135deg, #fff 0%, #fff7ed 100%);
    border-color: #fed7aa;
}

.indicator-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 32px;
    border-radius: var(--radius);
    background: #fff;
    color: var(--structure-deep, var(--teal));
    border: 1px solid var(--structure-line, var(--line));
    box-shadow: inset 0 -7px 14px color-mix(in srgb, var(--structure-soft, #eff6ff) 70%, transparent);
    font-weight: 900;
}

.iqa-grid .indicator-code {
    min-width: 48px;
    height: 38px;
    color: var(--structure-deep, var(--teal));
    background: #fff;
    border: 1px solid var(--structure-line, #dbeafe);
    box-shadow: inset 0 -8px 16px color-mix(in srgb, var(--structure-soft, #eff6ff) 70%, transparent);
}

.indicator-title {
    line-height: 1.55;
    color: #172033;
}

.chevron {
    color: var(--structure-accent, var(--blue));
}

.iqa-grid .indicator-title {
    font-weight: 800;
    color: #17324d;
}

.iqa-single-grid .indicator-title {
    font-size: 15px;
    line-height: 1.55;
}

.iqa-grid .chevron {
    color: var(--structure-accent, #2563eb);
}

.field-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.indicator-link-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.indicator-link-picker .btn {
    min-height: 42px;
    white-space: nowrap;
}

.indicator-link-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.indicator-link-item,
.indicator-link-empty {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
}

.indicator-link-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.indicator-link-item strong,
.indicator-link-item small {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.indicator-link-item strong {
    color: #172033;
    font-size: 13.5px;
    line-height: 1.35;
}

.indicator-link-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.indicator-link-empty {
    padding: 12px;
    color: var(--muted);
    border-style: dashed;
    font-size: 13px;
    text-align: center;
}

.site-settings-preview {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
}

.site-settings-preview img {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
}

.site-settings-preview strong,
.site-settings-preview small {
    display: block;
    overflow-wrap: anywhere;
}

.site-settings-preview strong {
    color: #172033;
    line-height: 1.35;
}

.site-settings-preview small {
    margin-top: 3px;
    color: var(--blue);
    font-weight: 700;
}

.site-footer {
    margin-top: 44px;
    color: #dbeafe;
    background: #172033;
}

.site-footer .shell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 22px 0;
    text-align: center;
}

.global-loader {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: grid;
    place-items: center;
    background: rgba(15, 23, 42, 0.38);
}

.loader-panel {
    min-width: 240px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.spinner {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 3px solid #dbeafe;
    border-top-color: var(--blue);
    animation: spin 900ms linear infinite;
}

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

.toast-root {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 100;
    display: grid;
    gap: 8px;
    max-width: min(360px, calc(100% - 36px));
}

.toast {
    padding: 12px 14px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    font-weight: 700;
}

.toast.ok {
    border-color: #bbf7d0;
    color: #166534;
}

.toast.fail {
    border-color: #fecaca;
    color: #991b1b;
}

.modal,
.image-viewer {
    width: 100%;
    max-width: none;
    max-height: none;
    padding: 0;
    border: 0;
    background: transparent;
}

.modal:not([open]),
.image-viewer:not([open]) {
    display: none;
}

.modal::backdrop,
.image-viewer::backdrop {
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(5px);
}

.modal-panel {
    width: min(100% - 28px, 720px);
    max-height: min(90vh, 880px);
    margin: 5vh auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.modal-panel.narrow {
    width: min(100% - 28px, 480px);
    padding: 22px;
}

.modal-panel.wide {
    width: min(100% - 28px, 980px);
}

.modal-panel.full {
    width: min(100% - 20px, 1220px);
    height: min(94vh, 960px);
    max-height: none;
    margin: 3vh auto;
}

.modal-header {
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.modal-header.sticky {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}

.modal-header h3 {
    margin: 0;
    font-size: 22px;
}

.modal-subtitle {
    color: var(--muted);
    margin: 4px 0 0;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.export-menu {
    position: relative;
}

.export-menu > .btn {
    min-width: 108px;
}

.export-menu-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 5;
    min-width: 164px;
    display: none;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
}

.export-menu:hover .export-menu-list,
.export-menu:focus-within .export-menu-list {
    display: grid;
    gap: 4px;
}

.export-menu-list a {
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 10px;
    color: #12315f;
    text-decoration: none;
    border-radius: 7px;
    font-weight: 800;
}

.export-menu-list a:hover {
    background: #eaf2ff;
}

.export-menu-list svg {
    width: 17px;
    height: 17px;
    color: var(--blue);
}

.modal-actions {
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
}

.modal-actions.split {
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--line);
}

.modal-actions.split > div {
    display: flex;
    gap: 10px;
}

.field {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 800;
}

.field input,
.field select,
.field textarea,
.content-view input,
.manage-item input,
.manage-item select,
.manage-item textarea,
.structure-editor input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 9px 11px;
    color: var(--text);
    background: #fff;
    outline: none;
}

.field textarea,
.manage-item textarea {
    min-height: 86px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.content-view input:focus,
.manage-item input:focus,
.manage-item select:focus,
.manage-item textarea:focus,
.structure-editor input:focus,
.editor-surface:focus {
    border-color: #8db7ff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 10px;
}

.manage-list {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    overflow: auto;
}

.manage-list.tall,
.structure-editor {
    padding: 16px 20px;
    margin-top: 0;
    max-height: 62vh;
    overflow: auto;
}

.year-row,
.attachment-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px;
}

.row-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
}

.manage-item {
    padding: 0;
    overflow: hidden;
}

.manage-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    min-height: 68px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}

.manage-summary::-webkit-details-marker {
    display: none;
}

.manage-summary-main {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
}

.manage-index {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border-radius: 10px;
    color: var(--blue-strong);
    background: #eff6ff;
    border: 1px solid #d8e6ff;
    font-weight: 900;
}

.manage-summary-text {
    min-width: 0;
}

.manage-summary-text strong,
.manage-summary-text small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manage-summary-text strong {
    color: #172033;
}

.manage-summary-text small {
    color: var(--muted);
    margin-top: 2px;
    font-size: 13px;
}

.manage-summary-tools {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.manage-swatch {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: var(--swatch, var(--blue));
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.78), 0 0 0 1px rgba(15, 23, 42, 0.14);
}

.manage-toggle {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
}

.manage-toggle svg {
    transition: transform 0.18s ease;
}

.manage-item[open] .manage-toggle svg {
    transform: rotate(180deg);
}

.manage-item-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 14px 14px;
    border-top: 1px solid var(--line);
}

.manage-item-grid .wide-field {
    grid-column: 1 / -1;
}

.manage-item textarea.content-source {
    min-height: 190px;
    font-family: Consolas, "Liberation Mono", monospace;
    line-height: 1.55;
}

.manage-preview-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border: 1px solid #dbe7f3;
    border-radius: var(--radius);
    background: #f8fafc;
}

.manage-preview-actions small {
    flex: 1 1 260px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.manage-content-preview {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.manage-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.manage-preview-head strong,
.manage-preview-head span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manage-preview-head strong {
    color: #172033;
    font-size: 13.5px;
}

.manage-preview-head span {
    color: var(--muted);
    font-size: 12px;
}

.manage-preview-body {
    padding: 12px;
}

.manage-preview-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
    padding: 0 12px 12px;
}

.manage-preview-gallery img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.dynamic-html-frame {
    display: block;
    width: 100%;
    min-height: 520px;
    height: min(72vh, 720px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.manage-content-preview .dynamic-html-frame {
    min-height: 360px;
    height: 360px;
}

.manage-gallery-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius);
    background: #f8fafc;
}

.manage-gallery-preview img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.select-with-swatch {
    position: relative;
    display: block;
}

.select-with-swatch select {
    padding-left: 42px;
}

.color-preview {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 18px;
    height: 18px;
    z-index: 1;
    pointer-events: none;
    border-radius: 999px;
    background: var(--swatch, var(--blue));
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.78), 0 0 0 1px rgba(15, 23, 42, 0.14);
    transform: translateY(-50%);
}

.structure-standard {
    padding: 14px;
    margin-bottom: 12px;
}

.structure-standard-head,
.indicator-editor-row {
    display: grid;
    gap: 10px;
}

.structure-standard-head {
    grid-template-columns: 90px 1fr 1fr auto;
    align-items: end;
}

.indicator-editor-row {
    grid-template-columns: 120px 1fr auto;
    align-items: center;
    padding: 10px;
    margin-top: 8px;
    background: #f8fafc;
    border-radius: var(--radius);
}

.content-layout {
    height: 100%;
    overflow: auto;
    padding: 22px;
}

.content-view,
.content-editor {
    max-width: 980px;
    margin: 0 auto;
}

.meta-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.meta-pills span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef6f4;
    color: #315f5b;
    font-size: 14px;
}

.content-render {
    min-height: 140px;
    line-height: 1.85;
    color: #334155;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-wrap: anywhere;
}

.content-render:empty::before {
    content: "ยังไม่มีข้อมูลสำหรับตัวชี้วัดนี้";
    color: var(--muted);
}

.single-content-layout {
    grid-template-columns: minmax(0, 1fr);
}

.dynamic-content-render:empty::before {
    content: "ยังไม่มีเนื้อหาในหน้านี้";
}

.dynamic-content-render pre {
    padding: 14px;
    overflow: auto;
    border-radius: var(--radius);
    background: #0f172a;
    color: #e5eefb;
    line-height: 1.6;
}

.content-render h1,
.content-render h2,
.content-render h3 {
    color: #111827;
    line-height: 1.35;
}

.content-render img,
.content-render iframe,
.content-render table,
.content-render pre {
    max-width: 100%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.gallery-grid button {
    padding: 0;
    border: 0;
    background: transparent;
}

.gallery-grid img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--line);
}

.video-section {
    margin-top: 18px;
}

.video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: var(--radius);
}

.attachments-section {
    margin-top: 28px;
}

.attachment-list {
    display: grid;
    gap: 8px;
}

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

.attachment-kind {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: #eef6f4;
    color: var(--teal);
}

.attachment-row strong {
    display: block;
}

.attachment-row small {
    color: var(--muted);
}

.content-editor {
    display: grid;
    gap: 16px;
}

.editor-toolbar {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
}

.editor-toolbar input[type="color"] {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px;
    background: #fff;
}

.editor-surface {
    min-height: 240px;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius) var(--radius);
    line-height: 1.85;
    overflow-wrap: anywhere;
    outline: none;
}

.editor-surface:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
}

.upload-grid,
.link-adder {
    display: grid;
    gap: 12px;
}

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

.link-adder {
    grid-template-columns: 1fr 1.3fr auto;
    align-items: end;
    padding-top: 8px;
}

.image-viewer {
    height: 100%;
    display: grid;
    place-items: center;
}

.image-viewer img {
    max-width: min(96vw, 1200px);
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
}

.image-viewer img:not([src]),
.image-viewer img[src=""] {
    display: none;
}

.viewer-close {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 2;
}

.danger {
    color: var(--danger);
}

@media (max-width: 860px) {
    .header-grid,
    .admin-bar-inner,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .main-nav {
        top: 87px;
    }

    .admin-bar {
        top: 141px;
    }

    .best-practice,
    .control-band,
    .status-row,
    .upload-grid,
    .link-adder,
    .indicator-link-picker,
    .document-toolbar,
    .document-form-grid,
    .inline-year-tools,
    .manage-item-grid,
    .structure-standard-head,
    .indicator-editor-row {
        grid-template-columns: 1fr;
    }

    .best-practice {
        height: 620px;
        max-height: 620px;
        align-content: start;
        padding-bottom: 56px;
    }

    .best-panel {
        max-height: 360px;
    }

    .best-item img {
        max-height: 190px;
    }

    .status-row {
        display: grid;
    }

    .report-menu-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .control-band {
        width: 100%;
        padding: 10px;
    }

    .control-groups {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .control-groups > div {
        width: 100%;
        gap: 6px;
        padding: 8px;
    }

    .segmented {
        width: 100%;
    }

    .segmented button {
        min-height: 34px;
        padding: 0 10px;
    }

    .structure-tab {
        min-width: min(78vw, 260px);
        max-width: 260px;
        flex: 0 0 auto;
    }

    .structure-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x proximity;
    }

    .structure-tab {
        scroll-snap-align: start;
    }

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

    .iqa-single-grid .standard-card {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .iqa-single-grid .standard-header {
        border-right: 0;
        border-bottom: 1px solid var(--structure-line, var(--line));
        padding: 18px;
    }

    .iqa-grid .indicator-list {
        grid-template-columns: 1fr;
    }

    .modal-actions.split,
    .modal-actions.split > div,
    .modal-header-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .modal-header {
        align-items: flex-start;
    }

    .manage-summary {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }

    .manage-summary-tools {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .document-heading-actions,
    .document-table-head,
    .document-pagination {
        align-items: stretch;
        flex-direction: column;
        justify-content: flex-start;
    }

    .document-table {
        min-width: 820px;
    }

    .category-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
    }

    .category-row .color-field,
    .category-row .quick-toggle {
        grid-column: 1 / -1;
    }

    .category-row .quick-toggle {
        justify-content: flex-start;
    }
}

@media (max-width: 560px) {
    .shell {
        width: min(var(--shell), calc(100% - 20px));
    }

    .brand-logo {
        width: 48px;
        height: 48px;
    }

    .brand strong {
        font-size: 17px;
    }

    .brand small {
        font-size: 14px;
    }

    .header-grid {
        gap: 12px;
    }

    .best-copy h1 {
        font-size: 30px;
    }

    .content-layout {
        padding: 14px;
    }

    .indicator-btn {
        grid-template-columns: 46px 1fr;
    }

    .indicator-btn .chevron {
        display: none;
    }

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

    .report-menu-grid .link-card {
        min-height: 74px;
    }

    .document-toolbar,
    .document-table-head,
    .document-form,
    .category-list {
        padding: 12px;
    }

    .document-table {
        min-width: 760px;
    }

    .page-numbers {
        flex-wrap: wrap;
    }
}
