body.admin-body .admin-header {
    display: flex !important;
}

body.admin-body {
    display: flex !important;
    flex-direction: row !important;
    min-height: 100vh;
    background: #f5f0e8;
    font-family: 'Noto Sans', sans-serif;
    color: #2c1a0a;
}

body.admin-body main {
    display: none;
}

body.admin-body header,
body.admin-body footer {
    display: none;
}
/* ── CSS VARIABLES (copy từ style.css) ── */
.admin-body {
    --brown-dark:  #4a2c0a;
    --brown-mid:   #7a4a1e;
    --brown-light: #c8965a;
    --gold:        #d4a017;
    --gold-light:  #f5e6c0;
    --cream:       #fdf6e3;
    --cream-dark:  #f0e0b0;
    --text-dark:   #2c1a0a;
    --text-mid:    #5a3e28;
    --text-light:  #8a6a50;
    --red-warn:    #8b2500;
}
/* ── LAYOUT ── */
.admin-body {
    display: flex;
    min-height: 100vh;
    background: #f5f0e8;
}

/* ── SIDEBAR ── */
.admin-sidebar {
    width: 240px;
    min-height: 100vh;
    background: linear-gradient(180deg, var(--brown-dark), #2a1a08);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: 1.5rem;
}

.sidebar-logo strong {
    display: block;
    color: var(--gold-light);
    font-size: 0.95rem;
    font-family: 'Noto Serif', serif;
}

.sidebar-logo small {
    color: var(--brown-light);
    font-size: 0.72rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    gap: 0.25rem;
}

.sidebar-nav a {
    color: var(--brown-light);
    text-decoration: none;
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: var(--gold-light);
}

.sidebar-nav a.active {
    background: rgba(212,160,23,0.15);
    color: var(--gold-light);
    border-left-color: var(--gold);
}

.sidebar-nav hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 0.5rem 1rem;
}

/* ── MAIN ── */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-header {
    background: #fff;
    border-bottom: 2px solid var(--cream-dark);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-header h1 {
    font-family: 'Noto Serif', serif;
    font-size: 1.3rem;
    color: var(--brown-dark);
}

.admin-content {
    padding: 2rem;
    flex: 1;
}

/* ── BUTTONS ── */
.btn {
    display: inline-block;
    padding: 0.45rem 1.1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
    background: var(--gold);
    color: var(--brown-dark);
}

.btn-edit {
    background: var(--gold-light);
    color: var(--brown-mid);
    border: 1px solid var(--cream-dark);
}

.btn-delete {
    background: #fdecea;
    color: var(--red-warn);
    border: 1px solid #f5c6c0;
}

.btn-cancel {
    background: var(--cream-dark);
    color: var(--text-mid);
}

/* ── TABLE ── */
.admin-table-wrap {
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--cream-dark);
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.admin-table thead th {
    background: var(--gold-light);
    color: var(--brown-dark);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--cream-dark);
    color: var(--text-mid);
    vertical-align: top;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--cream); }

.text-warn { color: var(--red-warn); font-size: 0.82rem; }
.empty-row { text-align: center; color: var(--text-light); padding: 2rem; font-style: italic; }

.action-btns {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ── FORM ── */
.admin-form-wrap {
    max-width: 680px;
}

.admin-form {
    background: #fff;
    border: 1px solid var(--cream-dark);
    border-radius: 10px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brown-mid);
}

.required { color: var(--red-warn); }

.form-group input,
.form-group textarea {
    border: 1px solid var(--cream-dark);
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    font-family: 'Noto Sans', sans-serif;
    color: var(--text-dark);
    background: var(--cream);
    transition: border-color 0.2s;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: #fff;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px solid var(--cream-dark);
}

/* ── FORM SECTION TITLE ── */
.form-section-title {
    font-family: 'Noto Serif', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--brown-dark);
    padding: 0.5rem 0;
    border-bottom: 2px solid var(--gold-light);
    margin-top: 0.5rem;
}

/* ── INGREDIENT ROWS ── */
.ingredient-row {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr auto;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.ingredient-row input {
    margin: 0 !important;
}

.btn-remove-ing {
    background: #fdecea;
    color: var(--red-warn);
    border: 1px solid #f5c6c0;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.btn-add-ing {
    background: var(--gold-light);
    color: var(--brown-mid);
    border: 1px solid var(--cream-dark);
    margin-top: 0.25rem;
}

/* ── MULTI SELECT ── */
.multi-select {
    border: 1px solid var(--cream-dark);
    border-radius: 6px;
    padding: 0.4rem;
    font-size: 0.9rem;
    font-family: 'Noto Sans', sans-serif;
    background: var(--cream);
    min-height: 90px;
    color: var(--text-dark);
}

.multi-select option:checked {
    background: var(--gold-light);
    color: var(--brown-dark);
}

.form-group small {
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
}

/* ── TAGS SMALL ── */
.tag-small {
    display: inline-block;
    background: var(--gold-light);
    color: var(--brown-mid);
    border-radius: 10px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    margin: 0.1rem;
}

.tag-purpose {
    display: inline-block;
    background: #e8f4e8;
    color: #2d6a2d;
    border-radius: 10px;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    margin: 0.1rem;
}

/* ── TOGGLE ── */
.toggle-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--cream-dark);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--gold);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-label {
    font-size: 0.88rem;
    color: var(--text-mid);
}

/* ── BADGE ── */
.badge {
    display: inline-block;
    border-radius: 20px;
    padding: 0.2rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-on {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-off {
    background: #f5f5f5;
    color: #9e9e9e;
}

/* ── LOGIN ── */
.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(74,44,10,0.15);
    border-top: 4px solid var(--gold);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-logo h1 {
    font-family: 'Noto Serif', serif;
    font-size: 1.4rem;
    color: var(--brown-dark);
    margin-top: 0.5rem;
}

.login-logo p {
    font-size: 0.8rem;
    color: var(--text-light);
    font-style: italic;
}

.login-error {
    background: #fdecea;
    color: var(--red-warn);
    border: 1px solid #f5c6c0;
    border-radius: 6px;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── FORM ROW ── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* ── CHECKBOX GROUP ── */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-mid);
    cursor: pointer;
    background: var(--cream);
    border: 1px solid var(--cream-dark);
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    transition: all 0.2s;
}

.checkbox-item:has(input:checked) {
    background: var(--gold-light);
    border-color: var(--gold);
    color: var(--brown-dark);
    font-weight: 600;
}

.checkbox-item input {
    display: none;
}

/* ── BADGE TỨ KHÍ ── */
.badge-tu-khi {
    display: inline-block;
    border-radius: 20px;
    padding: 0.2rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-tu-khi.hàn  { background: #e3f2fd; color: #1565c0; }
.badge-tu-khi.lương { background: #e8f5e9; color: #2e7d32; }
.badge-tu-khi.bình  { background: #f5f5f5; color: #616161; }
.badge-tu-khi.ôn   { background: #fff3e0; color: #e65100; }
.badge-tu-khi.nhiệt { background: #fbe9e7; color: #b71c1c; }

/* ── REF ROW ── */
.ref-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.ref-search-wrap {
    position: relative;
    margin-top: 0.5rem;
}

.ref-search-wrap input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    border: 1px dashed var(--gold);
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fffdf5;
    font-family: 'Noto Sans', sans-serif;
}

.ref-search-wrap input:focus {
    outline: none;
    border-color: var(--brown-mid);
}
/* ── LOADING SPINNER ── */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--cream-dark);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* ── UPLOAD ── */
.upload-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.upload-preview {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px dashed var(--cream-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--cream);
    flex-shrink: 0;
}

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

.upload-placeholder {
    font-size: 2rem;
    opacity: 0.4;
}

.upload-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── ALBUM UPLOAD ── */
.album-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.75rem;
    background: var(--cream);
    border: 1px solid var(--cream-dark);
    border-radius: 8px;
    min-height: 110px;
    align-items: flex-start;
}

.album-item {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid var(--cream-dark);
    flex-shrink: 0;
}

.album-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.album-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: rgba(180,0,0,0.8);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.album-remove:hover { background: #b71c1c; }

.album-add {
    width: 90px;
    height: 90px;
    border: 2px dashed var(--gold);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--gold);
    transition: background 0.2s;
    flex-shrink: 0;
}

.album-add:hover { background: var(--gold-light); }

.album-add span {
    font-size: 1.8rem;
    line-height: 1;
    font-weight: 300;
}

.album-add small {
    font-size: 0.72rem;
    color: var(--brown-light);
}

/* ── DANH SÁCH: thống kê + phân trang ── */
.list-summary {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem;
}
.list-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.count-chip {
    padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.85rem;
    background: #fff; border: 1px solid var(--cream-dark); color: var(--text-mid);
}
.count-chip strong { color: var(--brown-dark); }
.count-total { background: var(--gold-light); border-color: var(--gold); }
.count-on strong { color: #2e7d32; }
.count-off strong { color: #b26a00; }
.count-found { background: #eef6ff; border-color: #b6d4f5; }
.count-clear { font-size: 0.82rem; color: var(--red-warn); text-decoration: none; }
.count-clear:hover { text-decoration: underline; }
.per-page-form { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-mid); }
.per-page-form select {
    padding: 0.35rem 0.6rem; border: 1px solid var(--cream-dark);
    border-radius: 6px; background: var(--cream); font-size: 0.85rem;
}
.list-footer {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem;
}
.list-range { font-size: 0.85rem; color: var(--text-mid); }
.admin-pagination { padding: 0; flex-wrap: wrap; }
.page-gap { padding: 0 0.3rem; color: var(--text-light); }
