:root {
    --gold: #a38047;
    --gold-dark: #866739;
    --black: #0b0b0b;
    --white: #ffffff;
    --page: #f4f3ef;
    --card: #ffffff;
    --border: rgba(0, 0, 0, .09);
    --muted: #737373;
    --danger: #b83b3b;
    --radius-lg: 28px;
    --radius-md: 18px;
    --shadow: 0 24px 70px rgba(0, 0, 0, .08);
    --transition: all .28s cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: 'Inter', sans-serif; color: var(--black); background: var(--page); }
body { min-height: 100vh; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
em { color: var(--gold); font-style: italic; }
[hidden] { display: none !important; }

.panel-logo {
    color: #fff;
    text-decoration: none;
    font-size: 27px;
    font-weight: 700;
    letter-spacing: -1.2px;
}
.panel-logo span, .login-mobile-logo span { color: var(--gold); }

/* Login */
.login-body {
    padding: 24px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 15% 15%, rgba(163, 128, 71, .14), transparent 26%),
        #efeee9;
}
.login-shell {
    width: min(1180px, 100%);
    min-height: min(760px, calc(100vh - 48px));
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    overflow: hidden;
    border-radius: 34px;
    box-shadow: var(--shadow);
    background: #fff;
}
.login-brand-panel {
    position: relative;
    overflow: hidden;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #fff;
    background:
        radial-gradient(circle at 77% 25%, rgba(163, 128, 71, .42), transparent 25%),
        linear-gradient(145deg, #1d1d1d 0%, #050505 75%);
}
.login-brand-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: .12;
    background-image:
        linear-gradient(rgba(255,255,255,.4) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.4) 1px, transparent 1px);
    background-size: 48px 48px;
}
.login-brand-panel > * { position: relative; z-index: 1; }
.login-brand-copy { max-width: 570px; }
.panel-badge, .login-kicker, .page-kicker {
    display: inline-block;
    color: var(--gold);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .13em;
}
.login-brand-copy h1 {
    margin: 20px 0 24px;
    font-size: clamp(48px, 5vw, 72px);
    line-height: 1.02;
    letter-spacing: -3.5px;
    font-weight: 600;
}
.login-brand-copy p { max-width: 520px; color: #bbb; font-size: 17px; line-height: 1.65; }
.login-orbit {
    position: absolute;
    right: -55px;
    bottom: -60px;
    width: 270px;
    height: 270px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 50%;
    background: rgba(255,255,255,.05);
    backdrop-filter: blur(10px);
}
.login-orbit i { font-size: 72px; color: var(--gold); transform: translate(-20px, -20px); }
.login-form-panel { padding: 50px; display: grid; place-items: center; }
.login-form-wrap { width: min(410px, 100%); }
.login-mobile-logo { display: none; margin-bottom: 44px; font-size: 25px; font-weight: 700; }
.login-form-wrap h2 { margin: 10px 0 11px; font-size: 42px; letter-spacing: -2px; }
.login-help { margin-bottom: 34px; color: var(--muted); line-height: 1.55; }
.panel-form { display: grid; gap: 20px; }
.security-note { margin-top: 26px; color: #777; font-size: 12px; line-height: 1.5; text-align: center; }
.security-note i { color: var(--gold); margin-right: 5px; }

/* Fields */
.field-group { display: grid; gap: 9px; }
.field-group > span, .field-heading > span { font-size: 13px; font-weight: 700; color: #2c2c2c; }
.field-group input, .field-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    color: #111;
    outline: none;
    transition: var(--transition);
}
.field-group input { min-height: 50px; padding: 0 15px; }
.field-group textarea { padding: 14px 15px; resize: vertical; line-height: 1.55; }
.field-group input:focus, .field-group textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(163,128,71,.1); }
.field-group small, .field-heading small { color: #8a8a8a; font-size: 11px; }
.field-control {
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 15px;
    transition: var(--transition);
}
.field-control:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(163,128,71,.1); }
.field-control > i { color: var(--gold); }
.field-control input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; }
.field-icon-button { border: 0; background: transparent; color: #777; }
.form-message { min-height: 18px; font-size: 13px; line-height: 1.4; }
.form-message.error { color: var(--danger); }
.form-message.success { color: #26784b; }

/* Buttons */
.button {
    min-height: 46px;
    padding: 0 18px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 999px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: var(--transition);
}
.button:hover { transform: translateY(-2px); }
.button:disabled { opacity: .55; pointer-events: none; }
.button-primary { color: #fff; background: var(--gold); box-shadow: 0 10px 24px rgba(163,128,71,.2); }
.button-primary:hover { background: var(--gold-dark); }
.button-secondary { color: #222; background: #eeece6; border: 1px solid var(--border); }
.button-danger { color: #fff; background: var(--danger); }
.button-full { width: 100%; min-height: 54px; justify-content: space-between; padding: 0 22px; }
.text-button { margin-top: 12px; border: 0; background: transparent; color: var(--danger); font-size: 12px; font-weight: 700; }

/* Dashboard layout */
.panel-body { background: var(--page); }
.panel-layout { min-height: 100vh; display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.panel-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 270px;
    padding: 28px 22px;
    display: flex;
    flex-direction: column;
    color: #fff;
    background: #101010;
    z-index: 40;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.sidebar-close { display: none; color: #fff; background: transparent; border: 0; font-size: 22px; }
.sidebar-nav { margin-top: 54px; display: grid; gap: 8px; }
.sidebar-nav a {
    min-height: 48px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    gap: 13px;
    color: #aaa;
    border-radius: 13px;
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}
.sidebar-nav a:hover, .sidebar-nav a.active { color: #fff; background: rgba(163,128,71,.18); }
.sidebar-nav a.active i { color: var(--gold); }
.sidebar-bottom { margin-top: auto; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-user { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.sidebar-avatar { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 50%; color: var(--gold); background: rgba(255,255,255,.08); }
.sidebar-user strong, .sidebar-user span { display: block; }
.sidebar-user strong { font-size: 12px; }
.sidebar-user span { max-width: 155px; overflow: hidden; text-overflow: ellipsis; color: #888; font-size: 10px; white-space: nowrap; }
.sidebar-logout { width: 100%; padding: 10px 0; display: flex; align-items: center; gap: 8px; border: 0; color: #aaa; background: transparent; font-size: 12px; }
.sidebar-logout:hover { color: #fff; }
.panel-main { grid-column: 2; min-width: 0; padding: 38px 42px 65px; }
.panel-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.panel-topbar h1 { margin-top: 6px; font-size: 38px; letter-spacing: -2px; }
.mobile-sidebar-button { display: none; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 26px; }
.stat-card { min-height: 126px; padding: 22px; display: flex; align-items: center; gap: 17px; background: #fff; border: 1px solid var(--border); border-radius: 22px; }
.stat-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; color: var(--gold); background: #f1eee6; font-size: 20px; }
.stat-card span, .stat-card strong { display: block; }
.stat-card span { margin-bottom: 5px; color: #777; font-size: 12px; }
.stat-card strong { font-size: 28px; }
.content-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 12px 45px rgba(0,0,0,.035); }
.content-card-header { padding: 25px 27px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--border); }
.content-card-header h2 { margin-bottom: 5px; font-size: 20px; }
.content-card-header p { color: #777; font-size: 12px; }
.panel-search { width: 250px; min-height: 44px; padding: 0 14px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--border); border-radius: 999px; background: #f8f7f4; }
.panel-search i { color: var(--gold); }
.panel-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; }
.dashboard-message { min-height: 270px; display: grid; place-content: center; justify-items: center; gap: 13px; color: #777; text-align: center; }
.panel-spinner { width: 34px; height: 34px; border: 3px solid rgba(163,128,71,.18); border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.table-wrap { overflow-x: auto; }
.articles-table { width: 100%; border-collapse: collapse; }
.articles-table th, .articles-table td { padding: 17px 22px; text-align: left; border-bottom: 1px solid rgba(0,0,0,.06); }
.articles-table th { color: #888; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.articles-table td { color: #555; font-size: 12px; }
.articles-table tr:last-child td { border-bottom: 0; }
.table-article { min-width: 260px; display: flex; align-items: center; gap: 13px; }
.table-thumb { width: 68px; height: 48px; flex: 0 0 auto; overflow: hidden; display: grid; place-items: center; border-radius: 11px; color: var(--gold); background: #efede7; }
.table-thumb img { width: 100%; height: 100%; object-fit: cover; }
.table-article strong, .table-article span { display: block; }
.table-article strong { max-width: 380px; color: #111; font-size: 13px; line-height: 1.35; }
.table-article span { margin-top: 4px; max-width: 330px; overflow: hidden; color: #999; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.status-badge { display: inline-flex; padding: 7px 10px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.status-published { color: #1f6e42; background: #e7f5ec; }
.status-draft { color: #85621d; background: #f8efd9; }
.table-actions { display: flex; justify-content: flex-end; gap: 7px; }
.icon-action { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 10px; color: #555; background: #fff; text-decoration: none; }
.icon-action:hover { color: var(--gold); border-color: rgba(163,128,71,.45); }
.icon-action.delete:hover { color: var(--danger); border-color: rgba(184,59,59,.4); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Editor */
.editor-main { padding-bottom: 90px; }
.editor-topbar { align-items: end; }
.back-link { display: inline-flex; align-items: center; gap: 7px; color: #666; text-decoration: none; font-size: 11px; font-weight: 700; }
.back-link:hover { color: var(--gold); }
.editor-actions-top { display: flex; gap: 10px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 23px; align-items: start; }
.editor-primary { min-width: 0; display: grid; gap: 23px; }
.editor-sidebar-column { display: grid; gap: 18px; position: sticky; top: 24px; }
.editor-card { padding: 28px; }
.editor-card > .field-group + .field-group, .editor-card > .field-group + .editor-field-group { margin-top: 24px; }
.title-field input { min-height: 62px; padding: 0 18px; font-size: 21px; font-weight: 600; letter-spacing: -.5px; }
.slug-row { margin: 10px 0 24px; display: flex; flex-wrap: wrap; gap: 7px; color: #888; font-size: 10px; }
.slug-row code { color: #666; }
.field-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.editor-field-group { margin-top: 25px; display: grid; gap: 10px; }
#editor { min-height: 420px; background: #fff; border-radius: 0 0 15px 15px; }
.ql-toolbar.ql-snow { border-color: var(--border); border-radius: 15px 15px 0 0; background: #f7f6f2; }
.ql-container.ql-snow { border-color: var(--border); border-radius: 0 0 15px 15px; font-family: 'Inter', sans-serif; font-size: 15px; }
.ql-editor { min-height: 420px; line-height: 1.75; }
.ql-editor img { max-width: 100%; border-radius: 16px; }
.section-form-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-form-heading h2 { margin-bottom: 6px; font-size: 18px; }
.section-form-heading p { color: #777; font-size: 11px; }
.section-form-heading > i { color: var(--gold); font-size: 28px; }
.form-two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.editor-side-card { padding: 23px; }
.editor-side-card h2 { margin-bottom: 20px; font-size: 17px; }
.switch-row { margin-top: 24px; padding-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 15px; border-top: 1px solid var(--border); cursor: pointer; }
.switch-row > span:first-child { flex: 1; }
.switch-row strong, .switch-row small { display: block; }
.switch-row strong { margin-bottom: 4px; font-size: 12px; }
.switch-row small { color: #888; font-size: 10px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-control { width: 42px; height: 24px; position: relative; flex: 0 0 auto; border-radius: 999px; background: #ddd; transition: var(--transition); }
.switch-control::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: var(--transition); }
.switch-row input:checked + .switch-control { background: var(--gold); }
.switch-row input:checked + .switch-control::after { transform: translateX(18px); }
.current-status-row { margin-top: 22px; padding-top: 18px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); color: #777; font-size: 11px; }
.cover-dropzone { min-height: 205px; overflow: hidden; display: grid; place-items: center; border: 1px dashed rgba(163,128,71,.55); border-radius: 18px; background: #faf8f3; cursor: pointer; }
.cover-placeholder { display: grid; justify-items: center; gap: 8px; color: #777; text-align: center; }
.cover-placeholder i { color: var(--gold); font-size: 35px; }
.cover-placeholder strong { color: #222; font-size: 12px; }
.cover-placeholder span { font-size: 9px; }
.cover-dropzone img { width: 100%; height: 205px; object-fit: cover; }
.editor-message { min-height: 0; padding: 0 8px; }
.saving-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0,0,0,.48); backdrop-filter: blur(5px); }
.saving-box { min-width: 220px; padding: 28px; display: grid; justify-items: center; gap: 13px; border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.saving-box p { color: #555; font-size: 12px; }

/* Modal and toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; padding: 20px; display: grid; place-items: center; background: rgba(0,0,0,.5); backdrop-filter: blur(5px); }
.confirm-modal { width: min(420px, 100%); padding: 34px; border-radius: 27px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.confirm-icon { width: 62px; height: 62px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; color: var(--danger); background: #faeaea; font-size: 24px; }
.confirm-modal h2 { margin-bottom: 10px; font-size: 23px; }
.confirm-modal p { color: #777; font-size: 13px; line-height: 1.55; }
.modal-actions { margin-top: 25px; display: flex; justify-content: center; gap: 10px; }
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 120; max-width: 340px; padding: 15px 18px; border-radius: 14px; color: #fff; background: #111; box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; }
.toast.error { background: var(--danger); }

@media (max-width: 1050px) {
    .editor-grid { grid-template-columns: 1fr; }
    .editor-sidebar-column { position: static; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 850px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { display: none; }
    .login-mobile-logo { display: block; }
    .panel-layout { display: block; }
    .panel-sidebar { transform: translateX(-105%); transition: var(--transition); box-shadow: 20px 0 50px rgba(0,0,0,.22); }
    .panel-sidebar.open { transform: translateX(0); }
    .sidebar-close, .mobile-sidebar-button { display: grid; place-items: center; }
    .panel-main { padding: 28px 22px 55px; }
    .panel-topbar { align-items: center; }
    .panel-topbar > div:first-of-type { margin-right: auto; }
    .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .login-body { padding: 0; background: #fff; }
    .login-shell { min-height: 100vh; border-radius: 0; box-shadow: none; }
    .login-form-panel { padding: 38px 24px; }
    .login-form-wrap h2 { font-size: 34px; }
    .panel-main { padding: 22px 15px 45px; }
    .panel-topbar { flex-wrap: wrap; }
    .panel-topbar h1 { font-size: 30px; }
    .panel-topbar > .button { margin-left: auto; padding: 0 14px; }
    .content-card-header { align-items: stretch; flex-direction: column; }
    .panel-search { width: 100%; }
    .articles-table th:nth-child(3), .articles-table td:nth-child(3),
    .articles-table th:nth-child(4), .articles-table td:nth-child(4) { display: none; }
    .articles-table th, .articles-table td { padding: 14px 12px; }
    .table-thumb { width: 54px; height: 42px; }
    .editor-topbar { align-items: flex-start; }
    .editor-actions-top { width: 100%; }
    .editor-actions-top .button { flex: 1; padding: 0 12px; }
    .editor-card, .editor-side-card { padding: 20px; border-radius: 22px; }
    .form-two-columns, .editor-sidebar-column { grid-template-columns: 1fr; }
    .field-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
}
