* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #f5f1ea;
    color: #241b14;
}
a { color: inherit; text-decoration: none; }
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, #2e2118 0%, #1d140f 100%);
    color: #f7efe7;
    padding: 28px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.admin-brand {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 30px;
}
.admin-nav { display: grid; gap: 10px; }
.admin-nav a {
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(255,255,255,.82);
}
.admin-nav a.active, .admin-nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-counter {
    display: inline-flex;
    min-width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #d6a067;
    color: #1d140f;
    font-size: 12px;
    font-weight: 700;
    margin-left: 8px;
}
.admin-main { flex: 1; padding: 32px; }
.admin-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}
.admin-topbar h1 { margin: 0 0 8px; font-size: 34px; }
.admin-topbar p { margin: 0; color: #7a6b5f; }
.admin-user {
    background: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    box-shadow: 0 10px 24px rgba(0,0,0,.08);
}
.flash {
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 20px;
    font-weight: 600;
}
.flash.success { background: #e7f8ee; color: #18653a; }
.flash.error { background: #ffebeb; color: #8b1e1e; }
.grid {
    display: grid;
    gap: 20px;
}
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
    background: #fff;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 16px 38px rgba(36,27,20,.08);
}
.detail-copy {
    background: #faf6f1;
    border: 1px solid #eadfd4;
    border-radius: 16px;
    padding: 18px;
    line-height: 1.75;
}
.metric-value {
    font-size: 38px;
    font-weight: 700;
    margin: 8px 0;
}
.muted { color: #7a6b5f; }
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}
.btn, button, input[type=submit] {
    border: 0;
    background: #6e4a32;
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}
.btn.secondary {
    background: #efe6dc;
    color: #3c2e22;
}
.btn.danger { background: #b73737; }
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 16px 38px rgba(36,27,20,.08);
}
th, td {
    text-align: left;
    padding: 16px;
    border-bottom: 1px solid #f0e8df;
    vertical-align: top;
}
th { color: #6f6053; font-size: 14px; }
tr:last-child td { border-bottom: 0; }
.list-shell {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 16px 38px rgba(36,27,20,.08);
    overflow: hidden;
}
.list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid #f0e8df;
    background: #fcfaf7;
}
.admin-table {
    box-shadow: none;
    border-radius: 0;
}
.row-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
}
.row-sub {
    color: #7a6b5f;
    font-size: 13px;
    line-height: 1.6;
}
.row-meta {
    display: inline-flex;
    margin-top: 8px;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f5efe7;
    color: #6a5543;
    font-size: 12px;
    font-weight: 700;
}
.stack-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}
.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.status-pill.published {
    background: #e8f6ed;
    color: #1f7a45;
}
.status-pill.draft {
    background: #fdf0d6;
    color: #8a5a00;
}
.icon-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.icon-actions form {
    margin: 0;
}
.icon-btn {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid #e5d8ca;
    background: #fff;
    color: #5a4635;
    padding: 0;
    box-shadow: 0 6px 14px rgba(36,27,20,.06);
}
.icon-btn:hover {
    background: #f6efe8;
}
.icon-btn.warn {
    background: #fff6e5;
    color: #9a6500;
    border-color: #f1d59a;
}
.icon-btn.success {
    background: #ecf9f1;
    color: #1f7a45;
    border-color: #bde2cb;
}
.icon-btn.danger {
    background: #ffefef;
    color: #b73737;
    border-color: #f0bcbc;
}
.pagination-bar {
    display: flex;
    gap: 10px;
    padding: 18px 22px 22px;
    flex-wrap: wrap;
    border-top: 1px solid #f0e8df;
    background: #fcfaf7;
}
.page-chip {
    min-width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 12px;
    background: #efe6dc;
    color: #4b392d;
    font-weight: 700;
}
.page-chip.active {
    background: #6e4a32;
    color: #fff;
}
.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #f0e8df;
    color: #5a4635;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.form-group { display: grid; gap: 8px; margin-bottom: 18px; }
.form-group.full { grid-column: 1 / -1; }
label { font-weight: 600; }
input[type=text], input[type=password], input[type=email], input[type=number], textarea, select {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid #dacdbf;
    border-radius: 14px;
    background: #fff;
    font: inherit;
}
textarea { min-height: 160px; resize: vertical; }
.checkbox-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.gallery-item {
    background: #faf6f1;
    border: 1px solid #eadfd4;
    border-radius: 16px;
    padding: 14px;
}
.gallery-item img {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 10px;
}
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top, #8c6848, #2b2018 65%);
}
.login-card {
    width: min(520px, 100%);
    background: #fff;
    border-radius: 28px;
    padding: 32px;
    box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.login-card h1 { margin-top: 0; }
.helper {
    font-size: 13px;
    color: #7a6b5f;
    line-height: 1.6;
}
.translation-panel {
    grid-column: 1 / -1;
    border: 1px solid #e7daca;
    border-radius: 20px;
    background: #fcf8f3;
    padding: 18px;
    margin-bottom: 8px;
}
.translation-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid #eadfd4;
}
.translation-panel-head strong {
    font-size: 16px;
    color: #3c2e22;
}
.translation-panel-head span {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    color: #8b745f;
    text-transform: uppercase;
}
.editor-shell {
    border: 1px solid #dacdbf;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
}
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f8f3ed;
    border-bottom: 1px solid #eadfd4;
}
.editor-toolbar button,
.editor-toolbar select {
    background: #fff;
    color: #3c2e22;
    border: 1px solid #d9ccbf;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px;
}
.editor-toolbar button.active {
    background: #6e4a32;
    color: #fff;
    border-color: #6e4a32;
}
.rich-editor {
    min-height: 240px;
    padding: 16px;
    outline: none;
    line-height: 1.7;
}
.rich-editor p { margin: 0 0 1em; }
.rich-editor ul,
.rich-editor ol { padding-left: 22px; }
.media-preview {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed #dbcfc2;
    border-radius: 14px;
    background: #faf6f1;
}
.media-preview img {
    width: 100%;
    max-width: 260px;
    border-radius: 12px;
    display: block;
}
.media-select {
    display: grid;
    gap: 10px;
}
.media-inline {
    display: grid;
    gap: 8px;
}
.media-browser-trigger {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.media-current {
    font-size: 13px;
    color: #6f6053;
    word-break: break-all;
}
.media-browser-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(17, 12, 9, .62);
    z-index: 9999;
}
.media-browser-modal.open {
    display: flex;
}
.media-browser-dialog {
    width: min(1100px, 100%);
    max-height: 86vh;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,.22);
    display: grid;
    grid-template-rows: auto 1fr;
}
.media-browser-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid #eee2d6;
}
.media-browser-body {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 0;
}
.media-folder-list {
    padding: 16px;
    background: #fcfaf7;
    border-right: 1px solid #eee2d6;
    overflow: auto;
    display: grid;
    gap: 10px;
}
.media-folder-btn {
    text-align: left;
    padding: 12px 14px;
    border: 1px solid #eadfd4;
    border-radius: 14px;
    background: #fff;
    color: #4a382b;
}
.media-folder-btn.active {
    background: #6e4a32;
    color: #fff;
    border-color: #6e4a32;
}
.media-assets {
    padding: 18px;
    overflow: auto;
}
.media-assets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
}
.media-thumb-card {
    border: 1px solid #eadfd4;
    border-radius: 18px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    padding: 0;
}
.media-thumb-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.media-thumb-meta {
    padding: 12px;
}
.media-thumb-title {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #34281f;
    word-break: break-word;
}
.media-empty {
    padding: 24px;
    color: #7a6b5f;
}
@media (max-width: 980px) {
    .admin-shell { flex-direction: column; }
    .admin-sidebar { width: 100%; height: auto; position: relative; }
    .grid.cols-3, .form-grid, .gallery-grid { grid-template-columns: 1fr; }
    .toolbar, .admin-topbar { flex-direction: column; align-items: stretch; }
    .media-browser-body { grid-template-columns: 1fr; }
}
