/* ============================================================
   Server Trung Gian – Style (NukeViet-like admin theme)
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:   #c62828;
    --primary-d: #9e1f1f;
    --primary-l: #ef5350;
    --accent:    #d4a017;
    --heading:   #7f1010;
    --success:   #2e7d32;
    --danger:    #b71c1c;
    --warning:   #e65100;
    --info:      #c62828;
    --bg:        #fffafa;
    --bg-drum:   url('theme/dantri/images/trongdong.svg');
    --bg-drum-overlay: linear-gradient(135deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 248, 248, 0.86) 100%);
    --bg-drum-full: var(--bg-drum-overlay), var(--bg-drum);
    --sidebar-w: 220px;
    --header-h:  52px;
    --radius:    6px;
    --shadow:    0 2px 8px rgba(198, 40, 40, 0.08);
}

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 13px;
    color: #333;
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Nền trống đồng — phủ full trang */
body.stg-app,
.login-page {
    min-height: 100vh;
    background-color: #fff8f8;
    background-image: var(--bg-drum-full);
    background-size: cover, cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-d); text-decoration: underline; }

/* ---- LAYOUT ---- */
#stg-wrap { display: flex; min-height: 100vh; }

/* ---- HEADER ---- */
#stg-header {
    position: fixed; top: 0; left: 0; right: 0; height: var(--header-h);
    background: linear-gradient(135deg, #e53935 0%, #b71c1c 100%);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 18px; z-index: 100; box-shadow: 0 2px 10px rgba(183, 28, 28, 0.25);
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
}
#stg-header .header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
#stg-header .logo { color: #fff; font-size: 18px; font-weight: 700; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; min-width: 0; }
#stg-header .logo span { font-size: 22px; flex-shrink: 0; }
#stg-header .logo .logo-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#stg-header .top-right { display: flex; align-items: center; gap: 14px; color: #ffe8e8; font-size: 12px; flex-shrink: 0; }
#stg-header .top-right a { color: #fff; opacity: .9; }
#stg-header .top-right a:hover { color: #fff; opacity: 1; text-decoration: none; }
#stg-header .header-user { display: flex; align-items: center; gap: 4px; max-width: 180px; }
#stg-header .header-user-name { color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; display: inline-block; }
#stg-header .header-role { background: rgba(255,255,255,.15); padding: 1px 7px; border-radius: 10px; font-size: 10px; margin-left: 2px; white-space: nowrap; }
.stg-notif { position: relative; }
.stg-notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 8px;
    background: rgba(255,255,255,.12);
    color: #fff;
    cursor: pointer;
}
.stg-notif-bell:hover { background: rgba(255,255,255,.22); }
.stg-notif-icon { font-size: 16px; line-height: 1; }
.stg-notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ffeb3b;
    color: #7a1b1b;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.stg-notif-badge.is-empty { display: none; }
.stg-notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(360px, calc(100vw - 24px));
    background: #fff;
    color: #222;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
    z-index: 1200;
    overflow: hidden;
}
.stg-notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    background: #fafafa;
}
.stg-notif-markall {
    border: 0;
    background: transparent;
    color: #c62828;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
}
.stg-notif-markall:hover { text-decoration: underline; }
.stg-notif-list { max-height: 360px; overflow-y: auto; }
.stg-notif-empty { padding: 18px 14px; color: #777; font-size: 13px; text-align: center; }
.stg-notif-item {
    display: block;
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: inherit !important;
    text-decoration: none !important;
}
.stg-notif-item:hover { background: #f7f7f7; }
.stg-notif-item.is-unread { background: #fff8f0; }
.stg-notif-title { font-size: 13px; font-weight: 600; line-height: 1.35; color: #222; }
.stg-notif-body { margin-top: 3px; font-size: 12px; color: #555; line-height: 1.4; }
.stg-notif-time { margin-top: 4px; font-size: 11px; color: #999; }
.stg-notif-footer {
    display: block;
    text-align: center;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    border-top: 1px solid #eee;
    background: #fafafa;
    color: #c62828 !important;
}
.notif-page-list { display: flex; flex-direction: column; gap: 8px; }
.notif-page-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
    color: inherit !important;
    text-decoration: none !important;
}
.notif-page-item:hover { border-color: #d0d0d0; background: #fafafa; }
.notif-page-item.is-unread { border-color: #f0c9a0; background: #fff8f0; }
.notif-page-main { min-width: 0; flex: 1; }
.notif-page-body { margin-top: 4px; font-size: 13px; color: #555; }
.notif-page-meta { display: flex; align-items: flex-start; gap: 8px; color: #888; font-size: 12px; white-space: nowrap; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: #c62828; margin-top: 4px; }
.btn-logout { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); color: #fff !important; padding: 4px 12px; border-radius: var(--radius); font-size: 12px; }
.btn-logout:hover { background: rgba(255,255,255,.32) !important; }
.btn-logout .logout-icon { line-height: 1; }

/* Hamburger (hidden on desktop) */
.stg-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    border: 0;
    border-radius: var(--radius);
    background: rgba(255,255,255,.12);
    cursor: pointer;
    flex-shrink: 0;
}
.stg-menu-toggle:hover { background: rgba(255,255,255,.22); }
.stg-menu-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 1px;
    transition: transform .2s, opacity .2s;
}
body.stg-nav-open .stg-menu-toggle .stg-menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.stg-nav-open .stg-menu-toggle .stg-menu-bar:nth-child(2) { opacity: 0; }
body.stg-nav-open .stg-menu-toggle .stg-menu-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.stg-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 10, 10, 0.45);
    z-index: 95;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

/* ---- SIDEBAR ---- */
#stg-sidebar {
    width: var(--sidebar-w); background: rgba(255, 255, 255, 0.94); padding-top: var(--header-h);
    position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 90;
    border-right: 1px solid #f5d5d5;
    box-shadow: 2px 0 12px rgba(198, 40, 40, 0.06);
}
#stg-sidebar nav ul { list-style: none; padding: 10px 0; }
#stg-sidebar nav ul li a {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 18px; color: #555; font-size: 13px;
    border-left: 3px solid transparent; transition: all .15s;
}
#stg-sidebar nav ul li a:hover,
#stg-sidebar nav ul li a.active {
    background: #fff5f5; color: var(--primary);
    border-left-color: var(--primary); text-decoration: none;
}
#stg-sidebar nav ul li a .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-sep { height: 1px; background: #fce8e8; margin: 6px 14px; }
.sidebar-label { padding: 10px 18px 4px; font-size: 10px; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; opacity: .75; }

/* ---- MAIN CONTENT ---- */
#stg-main {
    margin-left: var(--sidebar-w); padding-top: var(--header-h); min-height: 100vh; flex: 1;
    background: transparent;
}
#stg-content { padding: 22px; }

/* ---- PAGE HEADER ---- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.page-header h1 { font-size: 20px; color: var(--heading); font-weight: 600; }
.breadcrumb { font-size: 12px; color: #888; margin-top: 2px; }
.breadcrumb a { color: var(--primary); }

/* ---- CARDS ---- */
.card { background: rgba(255, 255, 255, 0.96); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; border: 1px solid #fce4e4; }
.card-header { padding: 12px 18px; border-bottom: 1px solid #fce8e8; display: flex; align-items: center; justify-content: space-between; background: #fffafa; border-radius: var(--radius) var(--radius) 0 0; }
.card-header h2 { font-size: 14px; font-weight: 600; color: var(--heading); }
.card-body { padding: 18px; }

/* ---- STATS ROW ---- */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; align-items: center; gap: 14px; border: 1px solid #fce8e8; }
.stat-box .stat-icon { font-size: 28px; }
.stat-box .stat-num { font-size: 26px; font-weight: 700; color: var(--heading); line-height: 1; }
.stat-box .stat-label { font-size: 11px; color: #888; margin-top: 2px; }
.stat-box.pending .stat-icon { color: #e8a000; }
.stat-box.approved .stat-icon { color: #3c763d; }
.stat-box.rejected .stat-icon { color: #a94442; }
.stat-box.revision .stat-icon { color: #b45309; }
.stat-box.denied .stat-icon { color: #a94442; }
.stat-box.draft .stat-icon { color: #777; }

/* ---- TABLES ---- */
.stg-table { width: 100%; border-collapse: collapse; }
.stg-table th { background: #fff0f0; padding: 9px 12px; text-align: left; font-size: 12px; color: var(--heading); font-weight: 600; border-bottom: 2px solid #f5d0d0; white-space: nowrap; }
.stg-table td { padding: 9px 12px; border-bottom: 1px solid #fce8e8; vertical-align: middle; }
.stg-table tbody tr:hover { background: #fff8f8; }
.stg-table .col-id { width: 50px; text-align: center; }
.stg-table .col-actions { width: 140px; text-align: center; white-space: nowrap; }
.stg-table .post-title { font-weight: 500; }
.stg-table .post-title small { display: block; font-size: 11px; color: #999; font-weight: 400; margin-top: 2px; }

/* Bài sync từ trang chính vs bài qua trung gian */
.stg-table tbody tr.stg-row-from-main {
    background: #eef2f6;
}
.stg-table tbody tr.stg-row-from-main:hover {
    background: #e4ebf2;
}
.stg-table tbody tr.stg-row-from-main {
    /* nền theo trạng thái bên dưới */
}
.stg-table tbody tr.stg-row-from-stg {
    /* nền theo trạng thái bên dưới */
}

/* Nền hàng theo trạng thái — pastel, không viền đậm */
.stg-table tbody tr.stg-row-status-draft {
    background: #f5f5f6;
}
.stg-table tbody tr.stg-row-status-draft:hover {
    background: #ececef;
}
.stg-table tbody tr.stg-row-status-pending {
    background: #fff9e9;
}
.stg-table tbody tr.stg-row-status-pending:hover {
    background: #fff3d6;
}
.stg-table tbody tr.stg-row-status-sent {
    background: #f0f7ff;
}
.stg-table tbody tr.stg-row-status-sent:hover {
    background: #e4f0ff;
}
.stg-table tbody tr.stg-row-status-approved {
    background: #eef9fb;
}
.stg-table tbody tr.stg-row-status-approved:hover {
    background: #e0f4f7;
}
.stg-table tbody tr.stg-row-status-published {
    background: #eef8f0;
}
.stg-table tbody tr.stg-row-status-published:hover {
    background: #e2f3e6;
}
.stg-table tbody tr.stg-row-status-revision {
    background: #fff8ef;
}
.stg-table tbody tr.stg-row-status-revision:hover {
    background: #fff1de;
}
.stg-table tbody tr.stg-row-status-denied {
    background: #faf5f6;
}
.stg-table tbody tr.stg-row-status-denied:hover {
    background: #f6ecee;
}
.stg-table tbody tr.stg-row-status-other {
    background: #fff;
}

/* Bài đã phản hồi / sửa lại sau yêu cầu chỉnh sửa */
.stg-table tbody tr.stg-row-revision-reply {
    background: #fff6ea !important;
}
.stg-table tbody tr.stg-row-revision-reply:hover {
    background: #ffefd8 !important;
}
.stg-table tbody tr.stg-row-revision-pending {
    background: #ffefd4 !important;
}
.stg-table tbody tr.stg-row-revision-pending .post-title {
    font-weight: 700;
    color: #8a3b00;
}
.stg-len-hint { color: #666; font-size: 12px; margin-top: 6px; }
.stg-len-hint.is-over { color: #a94442; font-weight: 600; }
.stg-field-warn { border-left: 4px solid #e67e22; }
.badge-revision-reply {
    display: inline-block;
    background: #d35400;
    color: #fff;
    border: 1px solid #a04000;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 4px;
    vertical-align: middle;
    letter-spacing: 0.01em;
}
.alert-revision-reply {
    background: #fff3e0;
    border: 1px solid #e67e22;
    color: #6d3b00;
    border-left: 5px solid #d35400;
}
.revision-rounds-hot {
    background: #fff1d6;
    border-color: #e67e22;
}
.revision-rounds-hot .revision-round-item:last-child strong {
    color: #c0392b;
}
.stg-post-source { margin: 4px 0 2px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.badge-from-main {
    background: #dce4ee;
    color: #3a4a5c;
    border: 1px solid #b8c6d6;
}
.badge-from-stg {
    background: #ffe8e8;
    color: #9e1f1f;
    border: 1px solid #f5c6cb;
}
.badge-from-gmail {
    background: #e8f1ff;
    color: #1a56a8;
    border: 1px solid #b6d0f5;
}
.badge-from-ctv {
    background: #eaf7ee;
    color: #1e6b3a;
    border: 1px solid #b7e0c2;
}
.stg-gmail-from {
    color: #64748b;
    font-size: 11px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
}
.btn.is-disabled,
.btn[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.35);
    box-shadow: none;
}

/* ---- BADGES ---- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-pending  { background: #fef3cd; color: #856404; border: 1px solid #ffd900; }
.badge-approved { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.badge-success  { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.badge-rejected { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.badge-denied {
    background: #fde8ea;
    color: #9f1239;
    border: 1px solid #f5c2c7;
}
.badge-revision-need {
    background: #fff8e6;
    color: #92400e;
    border: 1px solid #fde68a;
}
.badge-draft    { background: #e2e3e5; color: #383d41; border: 1px solid #d6d8db; }
.badge-sent     { background: #ffe8e8; color: #9e1f1f; border: 1px solid #f5c6cb; }
.stat-box.sent .stat-icon { color: var(--primary); }
.nav-badge { background: #e74c3c; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; margin-left: auto; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-box { background: #fff; border-radius: 8px; padding: 20px 24px; width: min(440px, 92vw); box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.modal-box h3 { margin-bottom: 10px; font-size: 16px; }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border-radius: var(--radius); border: 1px solid transparent; font-size: 13px; cursor: pointer; font-family: inherit; transition: all .15s; text-decoration: none; }
.btn:hover { text-decoration: none; filter: brightness(92%); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary-d); }
.btn-success { background: #5cb85c; color: #fff; border-color: #4cae4c; }
.btn-danger  { background: #d9534f; color: #fff; border-color: #d43f3a; }
.btn-warning { background: #f0ad4e; color: #fff; border-color: #eea236; }
.btn-default { background: #fff; color: #333; border-color: #ccc; }
.btn-info    { background: #5bc0de; color: #fff; border-color: #46b8da; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 12px; color: #444; margin-bottom: 5px; }
.form-control { width: 100%; padding: 7px 10px; border: 1px solid #ccd; border-radius: var(--radius); font-size: 13px; font-family: inherit; color: #333; background: #fff; transition: border-color .15s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(198, 40, 40, .15); }
.form-control-sm { padding: 4px 8px; font-size: 12px; }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-text { font-size: 11px; color: #888; margin-top: 3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.required::after { content: ' *'; color: #d9534f; }

/* ---- ALERTS ---- */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid transparent; font-size: 13px; }
.alert-success { background: #dff0d8; color: var(--success); border-color: #d6e9c6; }
.alert-danger   { background: #f2dede; color: var(--danger);  border-color: #ebccd1; }
.alert-warning  { background: #fcf8e3; color: var(--warning); border-color: #faebcc; }
.alert-info     { background: #fff5f5; color: var(--primary); border-color: #fce4e4; }

/* ---- EDITOR TOOLBAR OVERRIDE ---- */
#bodyhtml-editor.ck-editor__editable { min-height: 380px !important; }
#hometext-editor.ck-editor__editable { min-height: 120px !important; }
.ck-balloon-panel .ck-editor__editable,
.ck.ck-image-custom-form .ck-editor__editable { min-height: unset !important; }
.ck-editor__editable.ck-content,
.ck-content {
    font-family: 'Times New Roman', Times, serif !important;
    font-size: 18px !important;
    line-height: 1.6 !important;
    text-align: justify;
}
.ck.ck-toolbar { border-radius: var(--radius) var(--radius) 0 0 !important; background: #fff5f5 !important; border-color: #fce4e4 !important; }
.ck.ck-editor__main > .ck-editor__editable { border-radius: 0 0 var(--radius) var(--radius) !important; }

/* ---- EDITOR SECTION HEADERS ---- */
.editor-section-title { font-size: 12px; font-weight: 700; color: var(--heading); background: #fff5f5; padding: 6px 12px; border-left: 3px solid var(--primary); margin-bottom: 10px; border-radius: 0 var(--radius) var(--radius) 0; }

/* ---- REJECTION BOX ---- */
.reject-box { background: #fff3f3; border: 1px solid #f5c6cb; border-radius: var(--radius); padding: 10px 14px; margin-top: 6px; font-size: 12px; color: #721c24; }
.reject-box strong { display: block; margin-bottom: 2px; }
.revision-rounds {
    margin-top: 6px;
    font-size: 12px;
    color: #6a4b00;
    background: #fff8e6;
    border: 1px solid #f0e0a8;
    border-radius: var(--radius);
    padding: 6px 10px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: center;
}
.revision-rounds strong { color: #5a3e00; }
.revision-round-sep { color: #c9a84c; }
.revision-rounds-list {
    margin: 8px 0 0;
    padding: 0 0 0 16px;
    font-size: 12px;
    color: #555;
    list-style: disc;
}
.revision-rounds-list li { margin-bottom: 6px; }
.revision-rounds-list .rr-type { font-weight: 600; }
.revision-rounds-list .rr-request { color: #9a6b00; }
.revision-rounds-list .rr-reply { color: #0b6e4f; }
.revision-rounds-list .rr-time { color: #888; margin-left: 4px; }
.revision-rounds-list .rr-note { margin-top: 2px; color: #666; white-space: pre-wrap; }
.alert .revision-rounds { display: block; margin-top: 10px; }
.alert .revision-rounds-list { margin-bottom: 4px; }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 4px; margin-top: 14px; }
.pagination a, .pagination span { padding: 5px 10px; border: 1px solid #dde; border-radius: var(--radius); font-size: 12px; color: var(--primary); }
.pagination .active span { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination a:hover { background: #fff5f5; text-decoration: none; }

/* ---- LOGIN PAGE ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.login-box { background: #fff; border-radius: 10px; box-shadow: 0 10px 36px rgba(183, 28, 28, 0.18); width: min(380px, 100%); overflow: hidden; border: 1px solid #fce4e4; }
.login-logo { background: linear-gradient(135deg, #ef5350, #c62828); padding: 28px 24px 20px; text-align: center; }
.login-logo h1 { color: #fff; font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-logo p { color: rgba(255,255,255,.7); font-size: 12px; }
.login-logo .login-icon { font-size: 42px; margin-bottom: 10px; }
.login-form { padding: 24px; }
.login-form .form-group label { font-size: 13px; font-weight: 600; color: #444; }
.login-form .form-control { padding: 10px 12px; font-size: 14px; }
.login-form .btn-login { width: 100%; padding: 11px; font-size: 15px; font-weight: 600; margin-top: 6px; justify-content: center; }
.login-zalo-form { margin-bottom: 4px; }
.login-zalo-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #6b7280;
    text-align: center;
}
.login-form .btn-zalo {
    width: 100%;
    padding: 11px;
    font-size: 15px;
    font-weight: 600;
    justify-content: center;
    background: #0068ff;
    border: 1px solid #0052cc;
    color: #fff;
}
.login-form .btn-zalo:hover { background: #0052cc; color: #fff; }
.login-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 14px 0 10px;
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.login-or::before,
.login-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}
.login-or span { flex: 0 0 auto; }
.login-footer { padding: 12px 24px; background: #fffafa; border-top: 1px solid #fce8e8; text-align: center; font-size: 11px; color: #b08080; }

/* ---- FILTER BAR ---- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filter-bar .form-group { margin-bottom: 0; }
.filter-bar label { font-size: 11px; color: #666; margin-bottom: 3px; }

/* ---- LINK COPY ---- */
.link-copy-wrap { display: flex; align-items: center; gap: 6px; }
.link-copy-wrap input { flex: 1; font-size: 11px; color: #555; padding: 4px 8px; border: 1px solid #dde; border-radius: var(--radius); }
.btn-copy { font-size: 11px; padding: 3px 8px; }

.stg-img-upload-row { display: flex; gap: 8px; align-items: stretch; }
.stg-img-upload-row .form-control { flex: 1; min-width: 0; }
.stg-img-upload-row .btn { white-space: nowrap; align-self: stretch; }

/* ---- Ảnh đang upload: làm mờ + spinner ---- */
@keyframes stg-img-spin {
    to { transform: rotate(360deg); }
}
#img-preview {
    position: relative;
    display: inline-block;
    max-width: 100%;
}
#img-preview img {
    display: block;
    max-width: 100%;
    transition: filter .4s ease, opacity .4s ease, transform .4s ease;
}
#img-preview.stg-img-uploading img {
    filter: blur(12px) brightness(.92);
    opacity: .72;
    transform: scale(1.01);
}
#img-preview.stg-img-uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,.45);
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: stg-img-spin .7s linear infinite;
    box-shadow: 0 0 0 9999px rgba(0,0,0,.12);
    pointer-events: none;
    z-index: 2;
}
.ck-editor__editable .image > img,
.ck-editor__editable .image-inline img {
    transition: filter .4s ease, opacity .4s ease;
}
.ck-editor__editable .image:has(.ck-progress-bar) > img,
.ck-editor__editable .image-inline:has(.ck-progress-bar) img,
.ck-editor__editable img.stg-img-uploading,
.ck-editor__editable img[src^="blob:"] {
    filter: blur(14px) brightness(.93);
    opacity: .7;
}

/* ---- IMAGE CROP MODAL ---- */
body.stg-crop-open { overflow: hidden; }

.stg-crop-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10060;
    align-items: center;
    justify-content: center;
    padding: 12px;
}
.stg-crop-modal.is-open { display: flex; }

.stg-crop-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 18, 28, 0.62);
}

.stg-crop-modal-dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(920px, 96vw);
    max-height: min(92vh, 860px);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
    overflow: hidden;
}

.stg-crop-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8ee;
    background: #fafbfc;
}
.stg-crop-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #222;
}
.stg-crop-modal-close {
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    padding: 0 4px;
}
.stg-crop-modal-close:hover { color: #111; }

.stg-crop-modes {
    display: flex;
    gap: 8px;
    padding: 10px 16px 0;
    flex-wrap: wrap;
}
.stg-crop-modes .btn.is-active {
    border-color: var(--primary);
    color: #fff;
    background: var(--primary);
}
.stg-crop-hint {
    padding: 8px 16px 10px;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.stg-crop-modal-body {
    flex: 1;
    min-height: 280px;
    max-height: calc(92vh - 140px);
    background: #1a1d24;
    padding: 12px;
}
.stg-crop-stage {
    position: relative;
    width: 100%;
    height: min(58vh, 560px);
}
.stg-crop-stage > img#stg-crop-image {
    display: block;
    max-width: 100%;
}

/* Blur multi-region board */
.stg-blur-board {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.stg-blur-board[hidden] { display: none !important; }
.stg-blur-frame {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
}
.stg-blur-image {
    display: block;
    max-width: none;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}
.stg-blur-overlay {
    position: absolute;
    inset: 0;
    cursor: crosshair;
}
.stg-blur-region {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid rgba(255, 220, 80, 0.95);
    background: rgba(255, 200, 40, 0.18);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
    pointer-events: auto;
    cursor: pointer;
}
.stg-blur-region.is-oval { border-radius: 50%; }
.stg-blur-region.is-rect { border-radius: 2px; }
.stg-blur-region.is-selected {
    border-color: #ff5a5a;
    background: rgba(255, 80, 80, 0.22);
    z-index: 2;
}
.stg-blur-region.is-draft {
    border-style: dashed;
    border-color: #7ec8ff;
    background: rgba(80, 160, 255, 0.18);
    pointer-events: none;
}
.stg-blur-region-label {
    position: absolute;
    top: -9px;
    left: -9px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #222;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    font-weight: 700;
    pointer-events: none;
}
.stg-blur-region-x {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: #e33;
    color: #fff;
    font-size: 14px;
    line-height: 18px;
    cursor: pointer;
    padding: 0;
    display: none;
}
.stg-blur-region.is-selected .stg-blur-region-x,
.stg-blur-region:hover .stg-blur-region-x {
    display: block;
}
.stg-blur-count {
    font-size: 12px;
    color: #666;
    margin-left: 6px;
    white-space: nowrap;
}

.stg-crop-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #e8e8ee;
    background: #fff;
}
.stg-crop-ratios,
.stg-crop-actions,
.stg-crop-blur-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.stg-crop-ratios .btn.is-active,
.stg-crop-blur-opts .btn.is-active {
    border-color: var(--primary);
    color: var(--primary);
    background: #fff5f5;
}
.stg-crop-blur-label {
    font-size: 12px;
    color: #555;
    margin-right: 2px;
}

#img-prev-el { cursor: zoom-in; }
.ck-content img,
.ck-editor__editable img {
    cursor: zoom-in;
}

@media (max-width: 640px) {
    .stg-crop-toolbar { flex-direction: column; align-items: stretch; }
    .stg-crop-ratios,
    .stg-crop-actions { justify-content: center; }
    .stg-crop-stage { height: min(48vh, 420px); }
}

/* ---- PREVIEW MODAL (post.php) ---- */
body.stg-preview-modal-open { overflow: hidden; }

.stg-preview-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.stg-preview-modal.is-open { display: flex; }

.stg-preview-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 25, 40, 0.65);
    cursor: pointer;
}

.stg-preview-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(1120px, 100%);
    max-height: calc(100vh - 32px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stg-preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e53935 0%, #b71c1c 100%);
    color: #fff;
    flex-shrink: 0;
}

.stg-preview-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.stg-preview-modal-close {
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.stg-preview-modal-close:hover { background: rgba(255, 255, 255, 0.28); }

.stg-preview-modal-body {
    flex: 1;
    min-height: 0;
    background: #fff8f8;
}

.stg-preview-modal-body iframe {
    display: block;
    width: 100%;
    height: min(78vh, 820px);
    border: 0;
    background: #fff;
}

/* ---- SPLIT LAYOUTS (editor / admin) ---- */
.stg-split {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 18px;
    align-items: start;
}
.stg-split-editor { grid-template-columns: 1fr 300px; }
.stg-split-wide { grid-template-columns: 1fr 380px; }
.stg-split-2 { grid-template-columns: 1fr 1fr; }
.stg-table-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.stg-title-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 5px;
}
.stg-action-stack { display: flex; flex-direction: column; gap: 8px; }
.stg-quota-panels { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
    .stg-menu-toggle { display: flex; }

    #stg-sidebar {
        transform: translateX(-105%);
        transition: transform .22s ease;
        width: min(280px, 86vw);
        z-index: 110;
        box-shadow: 4px 0 24px rgba(0,0,0,.18);
        padding-bottom: env(safe-area-inset-bottom);
    }
    body.stg-nav-open #stg-sidebar { transform: translateX(0); }
    body.stg-nav-open { overflow: hidden; }
body.stg-nav-open .stg-sidebar-backdrop { display: block; }

    #stg-main { margin-left: 0; }
    #stg-content { padding: 14px 12px 24px; }

    #stg-header { gap: 8px; padding: 0 10px; }
    #stg-header .logo { font-size: 15px; }
    #stg-header .top-right { gap: 8px; }
    #stg-header .header-clock,
    #stg-header .logout-text,
    .hide-mobile { display: none !important; }
    #stg-header .header-user-name { max-width: 72px; }
    .btn-logout { padding: 6px 10px; min-height: 36px; }

    #stg-sidebar nav ul li a {
        padding: 12px 16px;
        font-size: 14px;
        min-height: 44px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .page-header h1 { font-size: 18px; }
    .page-header .btn { width: 100%; justify-content: center; min-height: 42px; }

    .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-box { padding: 12px; gap: 10px; }
    .stat-box .stat-num { font-size: 22px; }

    .form-row, .form-row-3,
    .stg-split, .stg-split-editor, .stg-split-wide, .stg-split-2 {
        grid-template-columns: 1fr !important;
    }

    .card-body { padding: 14px; }
    .filter-bar { flex-direction: column; align-items: stretch; }
    .filter-bar .form-group,
    .filter-bar .form-control,
    .filter-bar select,
    .filter-bar input[type="text"],
    .filter-bar input[type="search"] {
        width: 100% !important;
        max-width: 100% !important;
    }
    .filter-bar .btn { width: 100%; justify-content: center; min-height: 42px; }

    .stg-table th, .stg-table td { padding: 8px 10px; }
    .stg-table .col-actions { width: auto; }
    .stg-table .col-actions .btn { margin: 2px 0; }

    .btn { min-height: 36px; }
    .btn-sm { min-height: 32px; }

    .pagination { flex-wrap: wrap; }
    .pagination a, .pagination span { min-width: 36px; text-align: center; padding: 8px 10px; }

    .stg-img-upload-row { flex-direction: column; }
    .stg-img-upload-row .btn { width: 100%; justify-content: center; }

    .link-copy-wrap { flex-direction: column; align-items: stretch; }
    .modal-box { width: min(440px, 94vw); padding: 16px; max-height: 90vh; overflow-y: auto; }

    #bodyhtml-editor.ck-editor__editable { min-height: 260px !important; }
    .ck.ck-toolbar { flex-wrap: wrap !important; }
    .stg-title-actions { align-items: stretch; }
    .stg-title-actions .btn { width: 100%; justify-content: center; }

    body.stg-app,
    .login-page {
        background-attachment: scroll;
    }

    .stg-quota-panels { flex-direction: column; }
    .stg-quota-panels .stg-panel { min-width: 0 !important; width: 100%; }

    .stg-preview-modal { padding: 0; }
    .stg-preview-modal-dialog {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    .stg-preview-modal-body iframe { height: calc(100vh - 52px); }
}

@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr 1fr; }
    #stg-header .header-role { display: none; }
    #stg-header .logo .logo-text { max-width: 42vw; }
    .login-form { padding: 18px 16px; }
    .login-logo { padding: 22px 16px 16px; }
}

/* ---- SCROLLBAR ---- */
#stg-sidebar::-webkit-scrollbar { width: 4px; }
#stg-sidebar::-webkit-scrollbar-thumb { background: rgba(198, 40, 40, .15); border-radius: 2px; }

/* ---- THEME COMPONENTS ---- */
.card-quota { background: rgba(255, 255, 255, 0.94); border-color: #fce4e4; }
.card-quota > .card-header { background: linear-gradient(135deg, #fff8f8, #ffecec); border-bottom: 1px solid #fce4e4; }
.card-quota > .card-header h2 { color: var(--primary); }
.card-accent { border-color: #f5c6cb; }
.card-accent > .card-header { background: #fff0f0; color: var(--heading); }
.stg-accent { color: var(--primary); font-weight: 700; }
.stg-panel { background: #fff; padding: 12px; border: 1px solid #fce4e4; border-radius: var(--radius); }
.stg-progress-track { height: 8px; background: #fce8e8; border-radius: 4px; overflow: hidden; }
.stg-progress-bar { height: 100%; background: var(--primary); transition: width .2s; }
.stg-progress-bar.is-done { background: var(--success); }
.stg-table-head-soft { background: #fff5f5 !important; }
.stg-table-head-accent { background: #ffe8e8 !important; color: var(--primary) !important; }
.stg-table-cell-accent { background: #fff8f8 !important; }
.stg-code-box { background: #fff5f5; padding: 8px 10px; border-radius: var(--radius); border: 1px solid #fce4e4; font-size: 11px; }
