:root {
    --adm-bg: #f4eee7;
    --adm-surface: #ffffff;
    --adm-surface-soft: #fffaf2;
    --adm-sidebar: #2f2419;
    --adm-text: #2f241b;
    --adm-muted: #78624f;
    --adm-border: #eadbc9;
    --adm-primary: #e78735;
    --adm-primary-dark: #c96f23;
    --adm-danger: #cf5146;
    --adm-shadow: 0 16px 30px rgba(67, 42, 21, 0.12);
    --adm-shadow-soft: 0 10px 20px rgba(67, 42, 21, 0.08);
    --adm-sidebar-w: 272px;
    --adm-topbar-h: 68px;
}

* {
    box-sizing: border-box;
}

body.admin-layout {
    margin: 0;
    min-height: 100vh;
    color: var(--adm-text);
    background:
        radial-gradient(circle at 8% 4%, #fff5e8 0, transparent 34%),
        radial-gradient(circle at 100% 0%, #f8e8d7 0, transparent 25%),
        var(--adm-bg);
    font-family: "Noto Sans TC", "M PLUS Rounded 1c", "Segoe UI", sans-serif;
}

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

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--adm-sidebar-w);
    height: 100vh;
    padding: 0.9rem 0.85rem 1rem;
    overflow-y: auto;
    background: linear-gradient(180deg, #2f2419 0%, #241b13 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1060;
    transition: transform 0.26s ease;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.56rem 0.62rem 0.9rem;
    margin-bottom: 0.62rem;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.admin-brand img {
    width: 36px;
    height: 36px;
    border-radius: 0.65rem;
    object-fit: cover;
}

.admin-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.admin-brand-title {
    color: #fff6ec;
    font-weight: 800;
    font-size: 1rem;
}

.admin-brand-subtitle {
    color: #d8baa1;
    font-weight: 600;
    font-size: 0.78rem;
}

.admin-nav-mode-card {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.85rem;
    background: rgba(255, 255, 255, 0.06);
    color: #f6e7d6;
    display: grid;
    gap: 0.55rem;
    margin: 0 0.1rem 0.72rem;
    padding: 0.68rem 0.72rem;
}

.admin-nav-mode-title {
    color: #fff6ec;
    font-size: 0.88rem;
    font-weight: 900;
    line-height: 1.25;
}

.admin-nav-mode-text {
    color: #d4b79b;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.45;
    margin-top: 0.18rem;
}

.admin-nav-mode-toggle {
    border: 1px solid rgba(255, 230, 202, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffe3c2;
    font-size: 0.78rem;
    font-weight: 800;
    justify-self: start;
    padding: 0.34rem 0.7rem;
}

.admin-nav-mode-toggle:hover {
    background: rgba(231, 135, 53, 0.2);
    color: #fff6ec;
}

.admin-sidebar:not(.admin-sidebar-show-advanced) .admin-nav-advanced-field {
    display: none !important;
}

.admin-nav-list {
    display: grid;
    gap: 0.34rem;
}

.admin-nav-section-title {
    margin: 0.82rem 0 0.18rem;
    padding: 0 0.72rem;
    color: #b99578;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.admin-nav-section-title:first-child {
    margin-top: 0;
}

.admin-nav-link,
.admin-nav-toggle {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 0.82rem;
    background: transparent;
    color: #ebd6c2;
    text-decoration: none;
    text-align: left;
    font-size: 0.93rem;
    font-weight: 700;
    padding: 0.62rem 0.72rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.admin-nav-link:hover,
.admin-nav-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.08);
}

.admin-nav-link.is-active,
.admin-nav-toggle.is-active {
    color: #fff;
    background: linear-gradient(135deg, rgba(231, 135, 53, 0.94), rgba(205, 107, 30, 0.93));
    border-color: rgba(255, 232, 203, 0.22);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
}

.admin-nav-main {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.admin-nav-main i {
    width: 16px;
    text-align: center;
    font-size: 0.95rem;
}

.admin-nav-arrow {
    opacity: 0.86;
    transition: transform 0.22s ease;
}

.admin-nav-toggle.is-open .admin-nav-arrow {
    transform: rotate(90deg);
}

.admin-subnav {
    display: none;
    margin: 0.22rem 0 0.32rem 0.56rem;
    padding-left: 0.62rem;
    border-left: 1px dashed rgba(255, 255, 255, 0.22);
    gap: 0.24rem;
}

.admin-subnav.is-open {
    display: grid;
}

.admin-subnav-link {
    color: #dbc2a9;
    text-decoration: none;
    border-radius: 0.66rem;
    padding: 0.47rem 0.58rem;
    font-size: 0.86rem;
    font-weight: 600;
}

.admin-subnav-link:hover {
    color: #fff7ec;
    background: rgba(255, 255, 255, 0.1);
}

.admin-subnav-link.is-active {
    color: #fff;
    background: rgba(231, 135, 53, 0.26);
}

.admin-sidebar-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(14, 10, 7, 0.46);
    z-index: 1055;
}

.admin-main {
    min-height: 100vh;
    margin-left: var(--adm-sidebar-w);
    transition: margin-left 0.26s ease;
}

.admin-topbar {
    position: sticky;
    top: 0;
    height: var(--adm-topbar-h);
    z-index: 1045;
    padding: 0.66rem 1.1rem;
    border-bottom: 1px solid var(--adm-border);
    background: rgba(255, 251, 246, 0.92);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.admin-topbar-left {
    display: inline-flex;
    align-items: center;
    gap: 0.62rem;
}

.admin-sidebar-toggle {
    width: 38px;
    height: 38px;
    border: 1px solid #dfccb9;
    border-radius: 0.72rem;
    background: #fff;
    color: #624a36;
}

.admin-sidebar-toggle:hover {
    border-color: #d6b99d;
    background: #fff4e7;
}

.admin-topbar-title {
    color: #3a2a1f;
    font-size: 1.04rem;
    font-weight: 800;
}

.admin-quick-jump {
    flex: 1 1 360px;
    max-width: 520px;
    min-width: 220px;
    position: relative;
}

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

.admin-quick-jump-control {
    align-items: center;
    background: #fff;
    border: 1px solid #dfccb9;
    border-radius: 0.85rem;
    display: flex;
    gap: 0.5rem;
    padding: 0.46rem 0.72rem;
}

.admin-quick-jump-control i {
    color: #9b7a5d;
    font-size: 0.95rem;
}

.admin-quick-jump-input {
    border: 0;
    color: var(--adm-text);
    flex: 1;
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 0;
    outline: 0;
}

.admin-quick-jump-input::placeholder {
    color: #a68b72;
    font-weight: 600;
}

.admin-quick-jump-results {
    background: #fff;
    border: 1px solid #dfccb9;
    border-radius: 0.9rem;
    box-shadow: var(--adm-shadow-soft);
    display: none;
    left: 0;
    max-height: min(430px, calc(100vh - 5rem));
    overflow-y: auto;
    padding: 0.4rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.36rem);
    z-index: 1065;
}

.admin-quick-jump.is-open .admin-quick-jump-results {
    display: grid;
    gap: 0.22rem;
}

.admin-quick-jump-option {
    align-items: center;
    border: 0;
    border-radius: 0.72rem;
    background: transparent;
    color: var(--adm-text);
    display: flex;
    gap: 0.7rem;
    justify-content: space-between;
    padding: 0.56rem 0.62rem;
    text-align: left;
    text-decoration: none;
}

.admin-quick-jump-option:hover,
.admin-quick-jump-option.is-active {
    background: #fff4e7;
    color: #2e2014;
}

.admin-quick-jump-option-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1.25;
}

.admin-quick-jump-option-group {
    color: #8b6a50;
    display: block;
    font-size: 0.76rem;
    font-weight: 700;
    margin-top: 0.08rem;
}

.admin-quick-jump-option i {
    color: #c78243;
    flex: 0 0 auto;
}

.admin-quick-jump-empty {
    color: #8b6a50;
    font-size: 0.86rem;
    font-weight: 700;
    padding: 0.68rem 0.7rem;
}

.admin-user-menu {
    display: inline-flex;
    align-items: center;
    gap: 0.56rem;
}

.admin-user-badge {
    border: 1px solid #e4d1bd;
    border-radius: 999px;
    padding: 0.34rem 0.72rem;
    background: #fff;
    color: #5b4632;
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
}

.admin-content {
    padding: 1rem;
}

.admin-page {
    display: grid;
    gap: 1rem;
}

.admin-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.admin-page-title {
    margin: 0;
    color: #2f2116;
    font-size: clamp(1.24rem, 2.3vw, 1.74rem);
    font-weight: 900;
}

.admin-page-subtitle {
    margin: 0.38rem 0 0;
    color: var(--adm-muted);
    font-size: 0.92rem;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.52rem;
}

.admin-card {
    border: 1px solid var(--adm-border);
    border-radius: 1rem;
    background: var(--adm-surface);
    box-shadow: var(--adm-shadow);
}

.admin-card-header {
    border-bottom: 1px solid var(--adm-border);
    background: linear-gradient(180deg, #fffdf9, #fff8f1);
    padding: 0.84rem 1rem;
    color: #3d2c20;
    font-weight: 800;
}

.admin-card-body {
    padding: 1rem;
}

.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.75rem;
}

.admin-col-12 {
    grid-column: span 12;
}

.admin-col-6 {
    grid-column: span 6;
}

.admin-col-4 {
    grid-column: span 4;
}

.admin-col-3 {
    grid-column: span 3;
}

.admin-helper {
    color: var(--adm-muted);
    font-size: 0.84rem;
}

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.8rem;
}

.admin-stat-card {
    border: 1px solid var(--adm-border);
    border-radius: 0.95rem;
    background: linear-gradient(145deg, #fff9ef, #fff);
    padding: 0.84rem 0.9rem;
    box-shadow: var(--adm-shadow-soft);
}

.admin-stat-label {
    color: #7f6650;
    font-size: 0.83rem;
    font-weight: 700;
}

.admin-stat-value {
    margin-top: 0.3rem;
    color: #2e2117;
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.1;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    margin-bottom: 0;
    min-width: 760px;
}

.admin-table thead th {
    border-bottom-width: 1px;
    border-color: #ecdccc;
    background: #fff6ec;
    color: #5b432f;
    font-weight: 800;
    vertical-align: middle;
}

.admin-table th,
.admin-table td {
    border-color: #f2e4d4;
    vertical-align: middle;
}

.admin-table .form-control,
.admin-table .form-select,
.admin-table textarea {
    min-width: 120px;
}

.admin-empty {
    text-align: center;
    color: var(--adm-muted);
    padding: 1rem;
}

.admin-thumb {
    width: 90px;
    height: 58px;
    border-radius: 0.48rem;
    border: 1px solid #ecdccc;
    object-fit: cover;
}

.admin-photo-thumb {
    width: 96px;
    height: 74px;
    border-radius: 0.52rem;
    border: 1px solid #ecdccc;
    object-fit: cover;
}

.admin-recent-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.62rem;
}

.admin-recent-item {
    border: 1px solid #efdfcf;
    border-radius: 0.74rem;
    background: #fffaf4;
    padding: 0.62rem;
}

.admin-badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    border: 1px solid #f0d7bd;
    border-radius: 999px;
    background: #fff8ee;
    color: #895d37;
    font-size: 0.79rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
}

.admin-modal .modal-content {
    border: 1px solid var(--adm-border);
    border-radius: 1rem;
}

.admin-modal .modal-header,
.admin-modal .modal-footer {
    border-color: #f1e3d3;
}

.admin-loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(20, 14, 10, 0.58);
    z-index: 1200;
}

.admin-loading-overlay.show {
    display: flex;
}

.admin-loading-box {
    min-width: 230px;
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.26);
    background: rgba(44, 28, 16, 0.86);
    color: #fff9ee;
    text-align: center;
    padding: 1rem;
}

.admin-loading-box .spinner-border {
    width: 2.4rem;
    height: 2.4rem;
}

.admin-loading-text {
    margin: 0.62rem 0 0;
}

/* Keep SweetAlert confirm dialog above backend loading overlays. */
.swal2-container {
    z-index: 4000 !important;
}

.admin-ig-preview {
    width: 100%;
    max-width: 360px;
    aspect-ratio: 4 / 5;
    border-radius: 1rem;
    border: 1px solid #ecdccc;
    background: #fff8ef;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.admin-ig-preview img,
.admin-ig-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-layout .nav-tabs {
    flex-wrap: wrap;
    gap: 0.35rem;
    border-bottom: 1px solid var(--adm-border);
}

.admin-layout .nav-tabs .nav-link {
    border: 1px solid transparent;
    border-radius: 0.82rem 0.82rem 0 0;
    color: #6f563e;
    font-weight: 800;
    padding: 0.58rem 0.82rem;
}

.admin-layout .nav-tabs .nav-link:hover {
    border-color: #eadbc9;
    background: #fff8ef;
}

.admin-layout .nav-tabs .nav-link.active {
    border-color: var(--adm-border) var(--adm-border) #fff;
    background: #fff;
    color: var(--adm-primary-dark);
}

.admin-layout .nav-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.45rem;
    border: 1px solid var(--adm-border);
    border-radius: 0.82rem;
    background: #fff6ec;
}

.admin-layout .nav-pills .nav-link {
    border: 1px solid transparent;
    border-radius: 0.72rem;
    color: #6f563e;
    font-weight: 800;
    padding: 0.5rem 0.78rem;
}

.admin-layout .nav-pills .nav-link:hover {
    border-color: #eadbc9;
    background: #fff;
}

.admin-layout .nav-pills .nav-link.active {
    border-color: var(--adm-primary);
    background: var(--adm-primary);
    color: #fff;
    box-shadow: 0 6px 14px rgba(231, 135, 53, 0.18);
}

.admin-layout .tab-content {
    min-width: 0;
}

.admin-layout .tab-pane {
    min-width: 0;
}

.admin-layout .alert {
    border-radius: 0.5rem;
}

.admin-layout .btn {
    border-radius: 0.5rem;
    font-weight: 700;
    white-space: nowrap;
}

.admin-layout .form-control,
.admin-layout .form-select {
    min-width: 0;
    border-color: #dfccb9;
    border-radius: 0.72rem;
}

.admin-layout .form-control:focus,
.admin-layout .form-select:focus {
    border-color: #e8ad73;
    box-shadow: 0 0 0 0.2rem rgba(231, 135, 53, 0.14);
}

.admin-layout textarea.form-control {
    min-height: 96px;
}

.admin-layout .table {
    --bs-table-hover-bg: #fff4e7;
}

.admin-layout .badge {
    font-weight: 800;
}

.admin-layout .border.rounded,
.admin-layout section.border.rounded {
    border-color: var(--adm-border) !important;
    border-radius: 0.82rem !important;
    background: #fff;
}

.admin-layout section.border.rounded.bg-light,
.admin-layout .border.rounded.bg-light {
    background: #fffaf2 !important;
}

.admin-subsection {
    border: 1px solid var(--adm-border);
    border-radius: 0.82rem;
    background: #fff;
    padding: 1rem;
    margin-bottom: 1rem;
}

.admin-subsection.is-muted {
    background: #fffaf2;
}

.admin-subsection-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.admin-flow-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.admin-flow-step {
    min-height: 100%;
    border: 1px solid #eadbc9;
    border-radius: 0.82rem;
    background: #fff;
    padding: 0.78rem;
}

.admin-flow-step-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.32rem;
    color: #1e293b;
    font-weight: 900;
}

.admin-flow-step-number {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #ffe7cc;
    color: #c96f23;
    font-size: 0.78rem;
    font-weight: 900;
    flex: 0 0 auto;
}

.admin-chip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.admin-action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
    align-items: stretch;
}

.admin-action-card {
    min-width: 0;
    border: 1px solid #eadbc9;
    border-radius: 0.82rem;
    background: #fff;
    padding: 0.9rem;
    box-shadow: var(--adm-shadow-soft);
}

.admin-action-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.admin-message-settings {
    border-color: #eadbc9;
    overflow: hidden;
}

.admin-message-settings .admin-card-header {
    background: linear-gradient(180deg, #fffdf9 0%, #fff5e8 100%);
}

.admin-message-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #895d37;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.admin-message-title {
    margin-top: 0.15rem;
    color: #3d2c20;
    font-size: 1rem;
    font-weight: 900;
}

.admin-message-description {
    max-width: 820px;
    color: #78624f;
    font-size: 0.86rem;
    line-height: 1.55;
}

.admin-message-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
    min-width: min(100%, 360px);
}

.admin-message-summary-item {
    border: 1px solid #eadbc9;
    border-radius: 0.72rem;
    background: rgba(255, 255, 255, 0.78);
    padding: 0.48rem 0.58rem;
}

.admin-message-summary-label {
    color: #8a6a4d;
    font-size: 0.72rem;
    font-weight: 800;
}

.admin-message-summary-value {
    color: #3d2c20;
    font-size: 0.92rem;
    font-weight: 900;
    line-height: 1.2;
}

.admin-message-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    border-bottom: 1px solid #eadbc9;
    padding-bottom: 0.65rem;
}

.admin-message-tabs .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid #eadbc9;
    border-radius: 0.72rem;
    background: #fff;
    color: #6f563e;
    font-size: 0.82rem;
    font-weight: 900;
    padding: 0.42rem 0.64rem;
}

.admin-message-tabs .nav-link.active {
    border-color: #e8ad73;
    background: #fff1df;
    color: #8a4b16;
}

.admin-message-group-panel {
    border: 1px solid #eadbc9;
    border-radius: 0.82rem;
    background: #fffaf2;
    padding: 0.85rem;
}

.admin-message-group-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.8rem;
}

.admin-message-group-title {
    color: #3d2c20;
    font-size: 0.95rem;
    font-weight: 900;
}

.admin-message-field-card {
    height: 100%;
    border: 1px solid #eadbc9;
    border-radius: 0.82rem;
    background: #fff;
    padding: 0.72rem;
    box-shadow: 0 8px 18px rgba(67, 42, 21, 0.05);
}

.admin-message-field-card .form-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    color: #3d2c20;
    font-size: 0.84rem;
    font-weight: 900;
}

.admin-message-field-card textarea.form-control {
    min-height: 132px;
    resize: vertical;
}

.admin-message-variable-list code {
    display: inline-flex;
    margin: 0.1rem 0.14rem 0.1rem 0;
    border: 1px solid #eadbc9;
    border-radius: 999px;
    background: #fff8ee;
    color: #895d37;
    font-size: 0.72rem;
    padding: 0.08rem 0.34rem;
}

.admin-settings-stack {
    display: grid;
    gap: 0.7rem;
}

.admin-settings-details {
    border: 1px solid #eadbc9;
    border-radius: 0.82rem;
    background: #fff;
    overflow: hidden;
}

.admin-settings-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    cursor: pointer;
    padding: 0.78rem 0.9rem;
    color: #3d2c20;
    font-weight: 900;
    list-style: none;
}

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

.admin-settings-details summary::after {
    content: "+";
    width: 1.45rem;
    height: 1.45rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #fff1df;
    color: var(--adm-primary-dark);
    font-weight: 900;
    flex: 0 0 auto;
}

.admin-settings-details[open] summary {
    border-bottom: 1px solid var(--adm-border);
    background: #fffaf2;
}

.admin-settings-details[open] summary::after {
    content: "-";
}

.admin-settings-details > form,
.admin-settings-details > .row,
.admin-settings-details > .alert {
    margin-left: 0.9rem;
    margin-right: 0.9rem;
}

.admin-settings-details > form:last-child,
.admin-settings-details > .row:last-child {
    margin-bottom: 0.9rem;
}

.admin-inline-details {
    min-width: 0;
}

.admin-inline-details summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 0.55rem;
    cursor: pointer;
    list-style: none;
    border: 1px solid #eadbc9;
    border-radius: 0.72rem;
    background: #fffaf2;
    padding: 0.45rem 0.55rem;
    color: #3d2c20;
    font-weight: 800;
}

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

.admin-inline-details summary::after {
    content: "+";
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: #fff1df;
    color: var(--adm-primary-dark);
    font-size: 0.82rem;
    font-weight: 900;
    flex: 0 0 auto;
}

.admin-inline-details[open] summary {
    margin-bottom: 0.55rem;
    background: #fff;
}

.admin-inline-details[open] summary::after {
    content: "-";
}

.admin-section-stack {
    display: grid;
    gap: 1rem;
}

.admin-section-title {
    margin: 0;
    color: #3d2c20;
    font-size: 1rem;
    font-weight: 900;
}

.admin-section-desc {
    margin: 0.2rem 0 0;
    color: var(--adm-muted);
    font-size: 0.88rem;
}

@media (max-width: 1200px) {
    .admin-stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 991.98px) {
    .admin-topbar {
        flex-wrap: wrap;
        height: auto;
        min-height: var(--adm-topbar-h);
    }

    .admin-quick-jump {
        flex: 1 1 100%;
        max-width: none;
        order: 3;
    }

    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.is-open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .admin-sidebar-backdrop.is-open {
        display: block;
    }

    .admin-content {
        padding: 0.88rem;
    }

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

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

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

    .admin-message-summary {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .admin-col-4,
    .admin-col-3 {
        grid-column: span 3;
    }

    .admin-col-6 {
        grid-column: span 6;
    }
}

@media (max-width: 767.98px) {
    .admin-topbar {
        padding: 0.62rem 0.72rem;
    }

    .admin-topbar-title {
        font-size: 0.96rem;
    }

    .admin-quick-jump-control {
        padding: 0.42rem 0.62rem;
    }

    .admin-user-badge {
        display: none;
    }

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

    .admin-card-body {
        padding: 0.86rem;
    }

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

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

    .admin-col-12,
    .admin-col-6,
    .admin-col-4,
    .admin-col-3 {
        grid-column: span 2;
    }
}

.admin-pagination .pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0;
}

.admin-pagination .page-link {
    border: 1px solid var(--adm-border);
    border-radius: 0.62rem;
    background: #fff;
    color: var(--adm-text);
    font-weight: 700;
    line-height: 1.15;
    padding: 0.44rem 0.7rem;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.admin-pagination .page-link:hover {
    border-color: #deb08a;
    background: #fff2e3;
    color: var(--adm-primary-dark);
}

.admin-pagination .page-item.active .page-link {
    border-color: var(--adm-primary);
    background: var(--adm-primary);
    color: #fff;
}

.admin-pagination .page-item.disabled .page-link {
    border-color: var(--adm-border);
    background: #f8f0e8;
    color: #b69a81;
}
/* Global quiet-luxury system: management surfaces remain calm, legible, and operational. */
:root {
    --adm-bg: #071326;
    --adm-surface: rgba(14, 29, 51, 0.96);
    --adm-surface-soft: rgba(20, 39, 64, 0.9);
    --adm-sidebar: #071222;
    --adm-text: #edf1f7;
    --adm-muted: #aebacc;
    --adm-border: rgba(231, 214, 171, 0.16);
    --adm-primary: #caa45f;
    --adm-primary-dark: #a57e42;
    --adm-shadow: 0 18px 42px rgba(0, 5, 17, 0.22);
    --adm-shadow-soft: 0 10px 26px rgba(0, 5, 17, 0.16);
}

body.admin-layout {
    color: var(--adm-text);
    background:
        radial-gradient(880px 520px at 5% -10%, rgba(66, 91, 132, 0.24), transparent 70%),
        radial-gradient(720px 480px at 100% 12%, rgba(130, 100, 58, 0.12), transparent 70%),
        linear-gradient(145deg, #08162b, #0a1a31 55%, #071326);
}

.admin-sidebar {
    background: linear-gradient(180deg, rgba(5, 16, 31, 0.98), rgba(7, 22, 41, 0.98));
    border-right-color: rgba(231, 214, 171, 0.12);
    box-shadow: 14px 0 32px rgba(0, 5, 17, 0.14);
}

.admin-brand,
.admin-card-header {
    border-color: rgba(231, 214, 171, 0.14);
}

.admin-brand-title,
.admin-nav-mode-title,
.admin-topbar-title,
.admin-page-title,
.admin-card-header {
    color: #f3f1eb;
}

.admin-brand-subtitle,
.admin-nav-mode-text,
.admin-nav-section-title,
.admin-page-subtitle,
.admin-quick-jump-option-group,
.admin-quick-jump-empty {
    color: #b7c2d1;
}

.admin-nav-link,
.admin-nav-toggle {
    color: rgba(232, 239, 248, 0.78);
}

.admin-nav-link:hover,
.admin-nav-toggle:hover {
    color: #fff8e8;
    border-color: rgba(231, 214, 171, 0.14);
    background: rgba(214, 181, 108, 0.10);
}

.admin-nav-link.is-active,
.admin-nav-toggle.is-active {
    color: #fff8e8;
    background: linear-gradient(135deg, rgba(151, 119, 64, 0.78), rgba(48, 65, 85, 0.9));
    border-color: rgba(231, 214, 171, 0.2);
}

.admin-topbar {
    border-bottom-color: rgba(231, 214, 171, 0.14);
    background: rgba(7, 18, 35, 0.88);
    box-shadow: 0 8px 24px rgba(0, 5, 17, 0.12);
    backdrop-filter: blur(18px);
}

.admin-sidebar-toggle,
.admin-quick-jump-control,
.admin-quick-jump-results,
.admin-user-badge {
    color: #e7edf5;
    border-color: rgba(231, 214, 171, 0.18);
    background: rgba(16, 34, 57, 0.9);
}

.admin-sidebar-toggle:hover,
.admin-quick-jump-option:hover,
.admin-quick-jump-option.is-active {
    color: #fff8e8;
    border-color: rgba(220, 190, 124, 0.3);
    background: rgba(214, 181, 108, 0.12);
}

.admin-quick-jump-input,
.admin-quick-jump-option {
    color: #e7edf5;
    background-color: transparent;
}

.admin-card,
.admin-modal-card,
body.admin-layout .modal-content {
    color: var(--adm-text);
    border-color: rgba(231, 214, 171, 0.15);
    background: linear-gradient(145deg, rgba(18, 38, 63, 0.98), rgba(9, 23, 42, 0.98));
    box-shadow: var(--adm-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.admin-card-header {
    background: linear-gradient(180deg, rgba(31, 52, 78, 0.86), rgba(15, 32, 54, 0.86));
}

body.admin-layout .form-control,
body.admin-layout .form-select,
body.admin-layout textarea,
body.admin-layout select {
    color: #edf1f7;
    border-color: rgba(231, 214, 171, 0.18);
    background: rgba(6, 18, 35, 0.62);
}

body.admin-layout .form-control:focus,
body.admin-layout .form-select:focus,
body.admin-layout textarea:focus,
body.admin-layout select:focus {
    color: #fff;
    border-color: rgba(220, 190, 124, 0.55);
    background: rgba(7, 21, 39, 0.94);
    box-shadow: 0 0 0 0.2rem rgba(202, 167, 91, 0.12);
}

body.admin-layout .table {
    --bs-table-color: #e7edf5;
    --bs-table-bg: transparent;
    --bs-table-border-color: rgba(231, 214, 171, 0.13);
    --bs-table-striped-color: #f2f5f9;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.035);
    --bs-table-hover-color: #fff8e8;
    --bs-table-hover-bg: rgba(214, 181, 108, 0.08);
}

/* Dense member lists need their own hierarchy: no warm-white headers or low-contrast guides. */
body.admin-layout .admin-table thead th {
    color: #fff8eb;
    border-color: rgba(231, 214, 171, 0.18);
    background: linear-gradient(180deg, rgba(22, 47, 76, 0.98), rgba(13, 32, 57, 0.98));
    box-shadow: inset 0 -1px 0 rgba(232, 200, 135, 0.22);
}

body.admin-layout .admin-table tbody td {
    color: #edf3fa;
}

body.admin-layout .admin-table tbody tr:hover > * {
    color: #fff9eb;
}

body.admin-layout .btn-primary {
    color: #fff9eb;
    border-color: rgba(255, 239, 198, 0.2);
    background: linear-gradient(135deg, #c7a25c, #92703b);
    box-shadow: inset 0 1px 0 rgba(255, 248, 224, 0.17);
}

body.admin-layout .btn-outline-primary {
    color: #e4c483;
    border-color: rgba(220, 190, 124, 0.44);
}

body.admin-layout .btn-outline-primary:hover {
    color: #fff8e8;
    background: rgba(202, 167, 91, 0.22);
}
/* AI-created site texture: low-contrast depth for operational pages. */
body.admin-layout {
    background:
        linear-gradient(145deg, rgba(5, 15, 29, 0.78), rgba(7, 20, 39, 0.86)),
        url("/images/site-textures/quiet-luxury-site-backdrop-v1.png") center / cover fixed;
}
/* Administration uses the same lighter mist-navy system for long working sessions. */
:root {
    --adm-bg: #36536e;
    --adm-surface: rgba(62, 88, 113, 0.96);
    --adm-surface-soft: rgba(85, 111, 134, 0.9);
    --adm-sidebar: #294560;
    --adm-text: #f7f4ed;
    --adm-muted: #d1dce5;
    --adm-border: rgba(255, 247, 229, 0.2);
    --adm-shadow: 0 16px 38px rgba(25, 46, 67, 0.18);
    --adm-shadow-soft: 0 9px 22px rgba(25, 46, 67, 0.14);
}

body.admin-layout {
    background:
        radial-gradient(880px 520px at 5% -10%, rgba(218, 229, 238, 0.24), transparent 70%),
        radial-gradient(720px 480px at 100% 12%, rgba(223, 191, 132, 0.16), transparent 70%),
        linear-gradient(145deg, rgba(80, 110, 137, 0.9), rgba(47, 77, 104, 0.92)),
        url("/images/site-textures/quiet-luxury-site-backdrop-v1.png") center / cover fixed;
}

.admin-sidebar {
    background: linear-gradient(180deg, rgba(38, 65, 91, 0.97), rgba(32, 57, 82, 0.97));
    box-shadow: 12px 0 28px rgba(25, 46, 67, 0.14);
}

.admin-topbar {
    background: rgba(37, 63, 89, 0.9);
}

.admin-card,
.admin-modal-card,
body.admin-layout .modal-content {
    background: linear-gradient(145deg, rgba(79, 105, 129, 0.98), rgba(48, 76, 102, 0.98));
    box-shadow: var(--adm-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.admin-layout .form-control,
body.admin-layout .form-select,
body.admin-layout textarea,
body.admin-layout select {
    background: rgba(42, 69, 95, 0.76);
}

/* Operational surfaces share the front site's dark-glass contrast contract. */
body.admin-layout .nav-pills {
    gap: 0.38rem;
    padding: 0.5rem;
    border: 1px solid rgba(231, 214, 171, 0.16);
    border-radius: 0.86rem;
    background: linear-gradient(145deg, rgba(22, 45, 72, 0.96), rgba(12, 28, 51, 0.96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.admin-layout .nav-pills .nav-link {
    color: #dbe6f2;
    border-color: transparent;
    background: transparent;
}

body.admin-layout .nav-pills .nav-link:hover {
    color: #fff9eb;
    border-color: rgba(231, 214, 171, 0.22);
    background: rgba(202, 164, 95, 0.14);
}

body.admin-layout .nav-pills .nav-link.active {
    color: #fff9eb;
    border-color: rgba(255, 239, 198, 0.22);
    background: linear-gradient(135deg, #c7a25c, #96743f);
    box-shadow: 0 7px 16px rgba(2, 10, 24, 0.24);
}

/* Bootstrap tab bars otherwise retain the legacy brown-on-blue treatment. */
body.admin-layout .nav-tabs {
    gap: 0.38rem;
    padding: 0.4rem 0.48rem 0;
    border-bottom-color: rgba(231, 214, 171, 0.2);
}

body.admin-layout .nav-tabs .nav-link {
    color: #dbe6f2;
    border-color: transparent;
    background: rgba(9, 25, 47, 0.52);
}

body.admin-layout .nav-tabs .nav-link:hover {
    color: #fff9eb;
    border-color: rgba(231, 214, 171, 0.22);
    background: rgba(202, 164, 95, 0.16);
}

body.admin-layout .nav-tabs .nav-link.active {
    color: #fff9eb;
    border-color: rgba(255, 239, 198, 0.24);
    background: linear-gradient(135deg, #c7a25c, #96743f);
    box-shadow: 0 7px 16px rgba(2, 10, 24, 0.24);
}

body.admin-layout .admin-subsection,
body.admin-layout .admin-subsection.is-muted,
body.admin-layout .admin-action-card,
body.admin-layout .admin-settings-details,
body.admin-layout .admin-inline-details summary,
body.admin-layout .border.rounded,
body.admin-layout section.border.rounded,
body.admin-layout section.border.rounded.bg-light,
body.admin-layout .border.rounded.bg-light {
    color: #edf3fa;
    border-color: rgba(231, 214, 171, 0.16) !important;
    background: linear-gradient(145deg, rgba(24, 48, 77, 0.98), rgba(11, 27, 49, 0.98)) !important;
    box-shadow: 0 14px 30px rgba(2, 10, 24, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body.admin-layout .admin-subsection.is-muted,
body.admin-layout .admin-settings-details[open] summary,
body.admin-layout .admin-inline-details[open] summary {
    background: linear-gradient(145deg, rgba(30, 55, 84, 0.98), rgba(14, 33, 57, 0.98)) !important;
}

body.admin-layout .admin-section-title,
body.admin-layout .admin-message-title,
body.admin-layout .admin-message-group-title,
body.admin-layout .admin-action-card .form-label,
body.admin-layout .admin-settings-details summary,
body.admin-layout .admin-inline-details summary {
    color: #fff8eb;
}

body.admin-layout .admin-section-desc,
body.admin-layout .admin-message-description,
body.admin-layout .text-muted,
body.admin-layout .small.text-muted {
    color: #bdcede !important;
}

body.admin-layout .admin-message-kicker {
    color: #e8c887;
}

body.admin-layout .admin-subsection .form-control,
body.admin-layout .admin-subsection .form-select,
body.admin-layout .admin-subsection textarea,
body.admin-layout .admin-subsection select {
    color: #f5f8fc;
    border-color: rgba(231, 214, 171, 0.2);
    background: rgba(5, 17, 34, 0.72);
}

body.admin-layout .admin-subsection .form-control::placeholder {
    color: #aebfd0;
    opacity: 1;
}

body.admin-layout .admin-subsection .form-control:focus,
body.admin-layout .admin-subsection .form-select:focus,
body.admin-layout .admin-subsection textarea:focus,
body.admin-layout .admin-subsection select:focus {
    color: #fff;
    border-color: rgba(232, 200, 135, 0.7);
    background: rgba(6, 20, 39, 0.96);
}

body.admin-layout .badge.text-bg-light {
    color: #eaf1f8 !important;
    border-color: rgba(231, 214, 171, 0.22) !important;
    background: rgba(47, 75, 105, 0.9) !important;
}

body.admin-layout .admin-pagination .page-link,
body.admin-layout .dropdown-menu,
body.admin-layout .modal-header,
body.admin-layout .modal-footer {
    color: #edf3fa;
    border-color: rgba(231, 214, 171, 0.16);
    background: rgba(14, 32, 56, 0.98);
}

body.admin-layout .admin-pagination .page-link:hover,
body.admin-layout .dropdown-item:hover,
body.admin-layout .dropdown-item:focus {
    color: #fff9eb;
    background: rgba(202, 164, 95, 0.18);
}

/* Member management has an inline guide style that otherwise paints white behind white copy. */
body.admin-layout .member-admin-guide {
    color: #edf3fa;
    border-color: rgba(231, 214, 171, 0.18);
    background: linear-gradient(145deg, rgba(20, 45, 74, 0.98), rgba(10, 27, 50, 0.98));
    box-shadow: 0 12px 26px rgba(2, 10, 24, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body.admin-layout .member-admin-guide-title {
    color: #fff8eb;
}

body.admin-layout .member-admin-guide-text {
    color: #c5d4e2;
}

/* Discord module settings are reused by several admin areas; keep every nested card readable. */
body.admin-layout .admin-message-settings .admin-card-header {
    background: linear-gradient(145deg, rgba(21, 47, 77, 0.98), rgba(10, 27, 50, 0.98));
}

body.admin-layout .admin-message-summary-item,
body.admin-layout .admin-message-group-panel,
body.admin-layout .admin-message-field-card {
    color: #edf3fa;
    border-color: rgba(231, 214, 171, 0.18);
    background: linear-gradient(145deg, rgba(24, 50, 79, 0.98), rgba(12, 30, 54, 0.98));
    box-shadow: 0 10px 22px rgba(2, 10, 24, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body.admin-layout .admin-message-summary-label,
body.admin-layout .admin-message-field-card .form-text,
body.admin-layout .admin-message-variable-list {
    color: #bdcede;
}

body.admin-layout .admin-message-summary-value,
body.admin-layout .admin-message-group-title,
body.admin-layout .admin-message-field-card .form-label {
    color: #fff8eb;
}

body.admin-layout .admin-message-tabs {
    border-color: rgba(231, 214, 171, 0.16);
}

body.admin-layout .admin-message-tabs .nav-link {
    color: #dbe6f2;
    border-color: rgba(231, 214, 171, 0.18);
    background: rgba(9, 25, 47, 0.72);
}

body.admin-layout .admin-message-tabs .nav-link.active {
    color: #fff9eb;
    border-color: rgba(255, 239, 198, 0.24);
    background: linear-gradient(135deg, #c7a25c, #96743f);
}

body.admin-layout .admin-message-variable-list code {
    color: #fff2d4;
    border-color: rgba(232, 200, 135, 0.28);
    background: rgba(7, 20, 39, 0.78);
}

/* Profession settings used a local white row behind the shared light labels. */
body.admin-layout .profession-setting-row {
    color: #edf3fa;
    border-color: rgba(231, 214, 171, 0.18);
    background: linear-gradient(145deg, rgba(25, 51, 80, 0.98), rgba(12, 30, 54, 0.98));
    box-shadow: 0 10px 22px rgba(2, 10, 24, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

body.admin-layout .profession-setting-row .form-label {
    color: #fff8eb;
}

body.admin-layout .profession-setting-row .form-control {
    color: #f5f8fc;
    border-color: rgba(231, 214, 171, 0.22);
    background: rgba(5, 17, 34, 0.72);
}

body.admin-layout .profession-setting-row .form-control::file-selector-button {
    color: #182a40;
    border-color: rgba(255, 247, 229, 0.72);
    background: linear-gradient(135deg, #fff7e5, #e7d1a2);
}

body.admin-layout .profession-image-preview {
    border-color: rgba(234, 209, 149, 0.44);
    background: rgba(7, 20, 39, 0.72);
}
