/* Admin panel theme — teal/navy on AdminLTE 4 */
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../vendor/fonts/plus-jakarta-sans.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --teal-950: #04211f;
    --teal-900: #063a35;
    --teal-800: #075e54;
    --teal-700: #0f766e;
    --teal-600: #0d9488;
    --gold: #d99e2b;
    --cream: #f6f7f3;
    --ink: #122a2e;
    --muted: #64777a;
    --line: #e3e8e4;
    --admin-radius: 16px;
    --sidebar-w: 272px;
    --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}
body.admin-body { font-family: var(--font); background: #eef1ec; color: var(--ink); }
body.admin-body h1, body.admin-body h2, body.admin-body h3, body.admin-body h4 { font-family: var(--font); letter-spacing: -.02em; }

/* ------------------------------------------------------------ header */
.app-header { border-bottom: 1px solid rgba(6, 58, 53, .08); min-height: 64px; background: #fff !important; position: sticky; top: 0; z-index: 1035; box-shadow: 0 4px 20px rgba(6, 58, 53, .04); }
.app-header .navbar-nav { flex-direction: row; align-items: center; }
.app-header .nav-link { color: #3d5559; border-radius: 10px; }
.app-header .nav-link:hover { background: var(--cream); color: var(--teal-700); }
.navbar-page-title { font-weight: 700; color: var(--teal-900); font-size: .95rem; padding-left: 8px; }
.sidebar-toggle { font-size: 1.3rem; }
.nav-dot { position: absolute; top: 4px; right: 2px; font-size: .58rem; padding: 2px 4px; border-radius: 6px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(150deg, var(--teal-600), var(--teal-900)); color: #fff; font-size: .72rem; font-weight: 800; display: inline-grid; place-items: center; letter-spacing: .02em; }
.user-name { font-size: .85rem; font-weight: 700; color: #2c4448; }
.user-menu .dropdown-menu { border: 0; border-radius: 14px; padding: 8px; min-width: 220px; }
.user-menu .dropdown-item { border-radius: 9px; font-size: .86rem; font-weight: 600; padding: .55rem .7rem; display: flex; align-items: center; gap: 9px; }
.user-menu .dropdown-item:hover { background: var(--cream); color: var(--teal-800); }
.user-menu .dropdown-item i { color: var(--teal-600); }
.user-menu .dropdown-item.text-danger i { color: inherit; }

/* ------------------------------------------------------------ sidebar */
.app-sidebar { width: var(--sidebar-w); background: linear-gradient(180deg, #052b27 0%, var(--teal-950) 100%) !important; border-right: 0; }
.sidebar-brand { height: 64px; display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.sidebar-brand .brand-link { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; width: 100%; }
.sidebar-brand .brand-image { width: 38px; height: 38px; opacity: 1; box-shadow: none; }
.sidebar-brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidebar-brand .brand-text strong { font-size: .92rem; font-weight: 800; color: #fff; letter-spacing: -.01em; }
.sidebar-brand .brand-text small { font-size: .64rem; color: rgba(255, 255, 255, .55); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-wrapper { display: flex; flex-direction: column; height: calc(100% - 64px); }
.sidebar-menu { padding: 14px 12px 24px; gap: 2px; }
.sidebar-menu .nav-header { font-size: .62rem; font-weight: 800; letter-spacing: .16em; color: rgba(255, 255, 255, .32); padding: 16px 12px 6px; text-transform: uppercase; }
.sidebar-menu .nav-link { display: flex; align-items: center; gap: 11px; color: rgba(255, 255, 255, .72); border-radius: 11px; padding: .58rem .75rem; font-size: .855rem; font-weight: 600; transition: background .18s ease, color .18s ease; }
.sidebar-menu .nav-link p { margin: 0; }
.sidebar-menu .nav-link .nav-icon { font-size: 1.02rem; width: 20px; text-align: center; color: rgba(255, 255, 255, .5); transition: color .18s ease; }
.sidebar-menu .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-menu .nav-link:hover .nav-icon { color: var(--gold); }
.sidebar-menu .nav-link.active { background: linear-gradient(100deg, rgba(13, 148, 136, .38), rgba(13, 148, 136, .12)); color: #fff; box-shadow: inset 0 0 0 1px rgba(20, 184, 166, .25); }
.sidebar-menu .nav-link.active .nav-icon { color: #5eead4; }
.nav-badge { margin-left: auto; font-size: .62rem; font-weight: 800; border-radius: 999px; padding: .12rem .45rem; }
.sidebar-foot { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255, 255, 255, .07); display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot a, .sidebar-foot button { display: flex; align-items: center; gap: 9px; background: none; border: 0; color: rgba(255, 255, 255, .58); font-size: .8rem; font-weight: 600; padding: .5rem .6rem; border-radius: 9px; text-decoration: none; font-family: var(--font); text-align: left; }
.sidebar-foot a:hover, .sidebar-foot button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-foot i { width: 17px; }

/* ------------------------------------------------------------ content */
.app-main { background: #eef1ec; }
.app-content-header { padding: 22px 0 6px; }
.app-page-title { font-size: 1.5rem; font-weight: 800; color: var(--teal-950); margin: 0; }
.app-content-header .breadcrumb { font-size: .74rem; --bs-breadcrumb-divider-color: #9aaba7; }
.app-content-header .breadcrumb a { color: var(--muted); text-decoration: none; font-weight: 600; }
.app-content-header .breadcrumb-item.active { color: var(--teal-800); font-weight: 700; }
.app-content { padding-bottom: 26px; }
.admin-alert { border: 0; border-radius: 12px; font-size: .85rem; box-shadow: 0 4px 14px rgba(6, 58, 53, .06); }
.app-footer { border-top: 1px solid rgba(6, 58, 53, .07); font-size: .78rem; color: var(--muted); background: #fff; }

.card { border: 1px solid rgba(6, 58, 53, .07); border-radius: var(--admin-radius); box-shadow: 0 2px 10px rgba(6, 58, 53, .04); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); padding: 16px 20px; border-radius: var(--admin-radius) var(--admin-radius) 0 0 !important; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h2, .card-header h3, .card-title { font-size: 1rem; font-weight: 800; margin: 0; color: var(--teal-950); }
.card-body { padding: 20px; }
.card-footer { background: #fff; border-top: 1px solid var(--line); padding: 14px 20px; border-radius: 0 0 var(--admin-radius) var(--admin-radius) !important; }

/* stat cards */
.stat-card { position: relative; overflow: hidden; padding: 20px; height: 100%; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 1.25rem; background: rgba(15, 118, 110, .1); color: var(--teal-700); margin-bottom: 14px; }
.stat-card .stat-icon.gold { background: rgba(217, 158, 43, .14); color: #a97711; }
.stat-card .stat-icon.blue { background: rgba(29, 78, 216, .1); color: #1d4ed8; }
.stat-card .stat-icon.red { background: rgba(220, 38, 38, .1); color: #b91c1c; }
.stat-card .stat-label { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; color: var(--teal-950); line-height: 1.1; letter-spacing: -.03em; margin: 2px 0 4px; }
.stat-card .stat-trend { font-size: .74rem; color: var(--muted); font-weight: 600; }
.stat-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(15, 118, 110, .05); }

/* tables */
.table { margin: 0; font-size: .86rem; --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .8rem .85rem; vertical-align: middle; border-bottom-color: #eef2ee; }
.table thead th { background: #f8faf7; font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: #64777a; font-weight: 800; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-hover tbody tr:hover > * { background: #fafcf9; }
.table-responsive { border-radius: 0 0 var(--admin-radius) var(--admin-radius); }
.thumb { width: 56px; height: 42px; border-radius: 8px; object-fit: cover; background: #eef2ee; }
.thumb-round { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.table-title { font-weight: 700; color: var(--teal-950); }
.table-sub { font-size: .72rem; color: var(--muted); }
.badge { font-weight: 700; border-radius: 999px; padding: .32rem .6rem; font-size: .68rem; }
.badge-soft-success { background: #e6f5ed; color: #157347; }
.badge-soft-warning { background: #fcf3df; color: #93610a; }
.badge-soft-danger { background: #fdeaea; color: #b02a2a; }
.badge-soft-info { background: #e6f2f6; color: #0c6478; }
.badge-soft-secondary { background: #eef1ee; color: #5b6f6c; }
.action-btns { display: flex; gap: 5px; justify-content: flex-end; }
.action-btns .btn { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; font-size: .82rem; border-radius: 9px; }

/* forms */
.form-label { font-size: .8rem; font-weight: 700; color: #334b4f; margin-bottom: 5px; }
.form-label .req { color: #dc2626; }
.form-control, .form-select { border: 1.5px solid #dde5e1; border-radius: 10px; font-size: .87rem; padding: .58rem .8rem; font-family: var(--font); color: var(--ink); background: #fcfdfc; }
.form-control:focus, .form-select:focus { border-color: var(--teal-600); box-shadow: 0 0 0 4px rgba(13, 148, 136, .1); background: #fff; }
.form-control::placeholder { color: #a2b1ad; }
.form-text { font-size: .73rem; color: var(--muted); }
.form-check-input:checked { background-color: var(--teal-700); border-color: var(--teal-700); }
.form-switch .form-check-input:focus { border-color: var(--teal-500, #14b8a6); }
textarea.form-control { min-height: 96px; }
.input-group-text { border: 1.5px solid #dde5e1; background: #f6f8f5; color: var(--muted); border-radius: 10px; }

.btn { font-weight: 700; border-radius: 10px; font-size: .86rem; padding: .55rem 1rem; }
.btn-primary { background: var(--teal-700); border-color: var(--teal-700); }
.btn-primary:hover, .btn-primary:focus { background: var(--teal-800); border-color: var(--teal-800); }
.btn-outline-primary { color: var(--teal-700); border-color: var(--teal-700); }
.btn-outline-primary:hover { background: var(--teal-700); border-color: var(--teal-700); }
.btn-accent { background: var(--gold); border-color: var(--gold); color: #241a05; }
.btn-accent:hover { background: #b8811b; border-color: #b8811b; color: #fff; }
.btn-light { background: #fff; border-color: var(--line); color: #3d5559; }
.btn-light:hover { background: var(--cream); border-color: #cfdad6; color: var(--teal-800); }
.btn-danger { background: #dc3545; border-color: #dc3545; }
.btn-sm { font-size: .78rem; padding: .38rem .72rem; border-radius: 8px; }

/* toolbar */
.table-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.table-toolbar .search-box { position: relative; flex: 1 1 260px; max-width: 360px; }
.table-toolbar .search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #97a8a4; font-size: .85rem; }
.table-toolbar .search-box input { padding-left: 34px; }

/* image upload */
.image-field { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.image-preview { width: 120px; height: 90px; border-radius: 12px; border: 1px dashed #c7d4cf; background: #f6f8f5; object-fit: cover; display: grid; place-items: center; color: #a3b2ae; font-size: 1.4rem; overflow: hidden; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-field-body { flex: 1 1 220px; min-width: 200px; }

/* rich text */
.editor-wrap .ql-toolbar { border-radius: 10px 10px 0 0; border-color: #dde5e1; background: #f8faf7; }
.editor-wrap .ql-container { border-radius: 0 0 10px 10px; border-color: #dde5e1; font-family: var(--font); font-size: .9rem; min-height: 260px; background: #fff; }
.editor-wrap .ql-editor { min-height: 260px; }
.editor-wrap .ql-editor h2 { font-size: 1.3rem; }

/* modals: forms wrap header/body/footer, so restore the scrollable flex chain */
.modal-dialog-scrollable .modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal-dialog-scrollable .modal-content > form > .modal-header,
.modal-dialog-scrollable .modal-content > form > .modal-footer { flex-shrink: 0; }
.modal-dialog-scrollable .modal-content > form > .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* misc admin components */
.section-box { border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; background: #fff; }
.section-box > h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.section-box > h3 i { color: var(--teal-600); }
.empty-row { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-row i { font-size: 2.4rem; color: #b9c7c3; display: block; margin-bottom: 8px; }
.empty-row p { margin: 0; font-size: .86rem; }

/* database page */
.db-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.db-status .item { background: #f8faf7; border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.db-status .item strong { display: block; font-size: 1.5rem; color: var(--teal-900); line-height: 1.1; }
.db-status .item span { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.migration-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.migration-list li { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; font-size: .82rem; }
.migration-list li i { color: var(--gold); }

.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.log-list li { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: .84rem; }
.log-list li:last-child { border-bottom: 0; }
.log-list .log-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(15, 118, 110, .08); color: var(--teal-700); }
.log-list .log-time { font-size: .72rem; color: var(--muted); }

/* letters */
.letter-detail-row { display: flex; justify-content: space-between; gap: 14px; padding: .6rem 0; border-bottom: 1px dashed var(--line); font-size: .87rem; }
.letter-detail-row:last-child { border-bottom: 0; }
.letter-detail-row span:first-child { color: var(--muted); font-weight: 600; }
.letter-detail-row span:last-child { font-weight: 700; text-align: right; overflow-wrap: anywhere; }

/* login */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at 15% 20%, rgba(13, 148, 136, .35), transparent 45%), radial-gradient(circle at 85% 80%, rgba(217, 158, 43, .18), transparent 45%), #04211f; font-family: var(--font); }
.login-card { width: 100%; max-width: 430px; background: rgba(255, 255, 255, .98); border-radius: 24px; padding: 36px 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand img { width: 48px; height: 48px; }
.login-brand strong { display: block; color: var(--teal-950); font-size: 1.05rem; line-height: 1.2; }
.login-brand small { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.login-card h1 { font-size: 1.35rem; font-weight: 800; color: var(--teal-950); margin-bottom: 4px; }
.login-card .lead { font-size: .84rem; color: var(--muted); margin-bottom: 22px; }
.login-card .form-control { padding: .7rem .9rem; }
.login-card .btn { padding: .7rem 1rem; font-size: .9rem; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line, #e5e7eb); }
.btn-google { background: #fff; border: 1px solid var(--line, #d7dde5); color: #1f2937; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-google i { color: #4285f4; }
.btn-google:hover, .btn-google:focus { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; }
.login-hint { margin: 10px 0 0; font-size: .72rem; line-height: 1.45; color: var(--muted); text-align: center; }
.login-foot { margin-top: 20px; text-align: center; font-size: .76rem; color: var(--muted); }
.login-foot a { color: var(--teal-700); font-weight: 700; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); padding: 6px; }

/* profile / settings */
.settings-group { margin-bottom: 26px; }
.settings-group h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 800; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.settings-group h3 i { color: var(--teal-600); }
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.profile-avatar { width: 74px; height: 74px; border-radius: 50%; background: linear-gradient(150deg, var(--teal-600), var(--teal-900)); color: #fff; display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; }

/* charts */
.chart-holder { position: relative; height: 320px; }
.chart-holder canvas { max-height: 320px; }

/* pager */
.pagination { gap: 4px; margin: 0; }
.page-link { border: 1px solid var(--line); border-radius: 8px !important; color: var(--teal-800); font-weight: 700; font-size: .8rem; padding: .4rem .65rem; }
.page-item.active .page-link { background: var(--teal-700); border-color: var(--teal-700); }
.page-item.disabled .page-link { color: #b3c0bc; }

@media (max-width: 991.98px) {
    .app-sidebar { width: var(--sidebar-w); }
    .sidebar-menu { padding-bottom: 12px; }
}
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack > tbody { display: block; }
    .table-stack > tbody > tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .table-stack > tbody > tr:last-child { border-bottom: 0; }
    .table-stack > tbody > tr > td { display: grid; grid-template-columns: 86px minmax(0, 1fr); gap: 2px 10px; align-items: start; padding: .3rem 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
    .table-stack > tbody > tr > td::before { content: attr(data-label); grid-column: 1; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: #64777a; padding-top: 3px; }
    .table-stack > tbody > tr > td > * { grid-column: 2; min-width: 0; }
    .table-stack > tbody > tr > td > .badge { justify-self: start; }
    .table-stack > tbody > tr > td.table-actions { display: block; padding-top: .6rem; }
    .table-stack > tbody > tr > td.table-actions::before { display: none; }
    .table-stack > tbody > tr > td.table-actions .action-btns { justify-content: flex-start; }
    .table-stack .thumb { width: 68px; height: 50px; }
}

@media (max-width: 575.98px) {
    .app-content-header { padding-top: 14px; }
    .app-page-title { font-size: 1.25rem; }
    .card-body { padding: 16px; }
    .db-status { grid-template-columns: 1fr 1fr 1fr; }
    .table > :not(caption) > * > * { padding: .65rem .55rem; }
    .table-stack > tbody > tr { padding: 10px 10px; }
    .table-stack > tbody > tr > td { grid-template-columns: 78px minmax(0, 1fr); gap: 8px; }
}

/* ------------------------------------------------------------ captcha */
.captcha-field .captcha-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.captcha-field img { display: block; width: 240px; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; }
.captcha-field input { max-width: 280px; letter-spacing: .16em; font-weight: 700; }
