:root {
    --pena-ink: #28183b;
    --pena-muted: #5e526b;
    --pena-background: #f7f3fc;
    --pena-surface: #fff;
    --pena-primary: #6d28d9;
    --pena-primary-hover: #5521a8;
    --pena-soft: #ede3fa;
    --pena-soft-hover: #e0cef5;
    --pena-border: #cbbbdf;
    --pena-divider: #e6dbf0;
    --pena-table-heading: #f3edfa;
    --pena-focus: #a45f00;
    --pena-shadow: #3218501c;
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    color: var(--pena-ink);
    background: var(--pena-background);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
a { color: var(--pena-primary); }
a:hover { color: var(--pena-primary-hover); }
button {
    border: 0;
    border-radius: 10px;
    background: var(--pena-primary);
    color: #fff;
    padding: .8rem 1.3rem;
    cursor: pointer;
    font-weight: 700;
}
button:hover { background: var(--pena-primary-hover); }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, a:focus-visible {
    outline: 3px solid var(--pena-focus);
    outline-offset: 3px;
}

.auth-page { display: grid; place-items: center; padding: 1.5rem; }
.auth-card {
    background: var(--pena-surface);
    border: 1px solid var(--pena-divider);
    border-radius: 18px;
    box-shadow: 0 16px 50px var(--pena-shadow);
    width: min(100%, 420px);
    padding: 2rem;
}
.brand {
    display: inline-flex;
    max-width: 100%;
    min-width: 0;
    padding: .75rem;
    border-radius: 10px;
    background: var(--pena-primary);
    color: var(--pena-primary);
}
.brand__logo { display: block; width: 230px; max-width: 100%; height: auto; }
.auth-card > .brand { display: flex; width: fit-content; margin-inline: auto; }
.topbar .brand { width: 180px; padding: .5rem; }
h1 { font-size: 1.8rem; margin: 2rem 0 .5rem; }
p { line-height: 1.5; color: var(--pena-muted); }
.auth-card form { display: grid; gap: .65rem; margin-top: 1.5rem; }
label { font-weight: 700; }
input { border: 1px solid var(--pena-border); border-radius: 8px; padding: .75rem; min-width: 0; }
form button { margin-top: .8rem; }
.error { color: #a11; font-weight: 700; }
.success { color: #176536; font-weight: 700; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 3rem);
    background: var(--pena-surface);
    border-bottom: 1px solid var(--pena-divider);
    box-shadow: 0 2px 10px var(--pena-shadow);
}
.secondary { background: var(--pena-soft); color: var(--pena-ink); }
.secondary:hover { background: var(--pena-soft-hover); color: var(--pena-ink); }
.dashboard { max-width: 1000px; margin: 4rem auto; padding: 0 1.5rem; }
.panel { background: var(--pena-surface); border-radius: 14px; padding: 1.5rem; margin: 2rem 0; }
.panel h2 { margin-top: 0; }
.form-stack { display: grid; gap: .6rem; max-width: 440px; }
.form-stack button { justify-self: start; }
.form-stack select {
    font: inherit;
    border: 1px solid var(--pena-border);
    border-radius: 8px;
    padding: .75rem;
    min-width: 0;
    background: var(--pena-surface);
    color: inherit;
}
.form-stack p { margin: .25rem 0; }
.notice {
    background: var(--pena-surface);
    border-left: 5px solid #b36b00;
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 2rem;
}
.notice h2 { margin-top: 0; }
.order-list { padding-left: 1.5rem; }
.order-list li {
    background: var(--pena-surface);
    border-radius: 10px;
    padding: .7rem 1rem;
    margin: .5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.order-controls { display: flex; gap: .4rem; }
.order-controls button { padding: .4rem .8rem; }

@media (max-width: 480px) {
    .auth-card { padding: 1.5rem; }
    .dashboard { margin: 2rem auto; }
    .order-list li { align-items: flex-start; }
    .order-controls { flex-direction: column; }
}

/* Editorial workspace: shared by every authenticated administration screen. */
.admin-icon { width: 22px; height: 22px; flex: 0 0 auto; }
.admin-app { min-width: 0; }
.admin-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 248px; display: flex; flex-direction: column; overflow-y: auto; padding: 32px 20px 24px; background: #25133d; color: #eee5ff; }
.sidebar-brand { display: block; padding: 0 12px; }
.sidebar-brand .brand { background: transparent; padding: 0; }
.sidebar-caption { margin: 44px 14px 14px; color: #b5a1ce; font-size: .65rem; font-weight: 700; letter-spacing: .14em; }
.sidebar-nav { display: grid; gap: 7px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 11px 14px; border-radius: 10px; color: #d5c7e8; text-decoration: none; font-size: .94rem; font-weight: 600; }
.sidebar-nav a:hover { color: #fff; background: #ffffff0d; }
.sidebar-nav a[aria-current] { background: #6d28d9; color: #fff; box-shadow: 0 5px 18px #0002; }
.sidebar-foot { margin-top: auto; padding: 28px 14px 0; font-size: .76rem; color: #b5a1ce; display: flex; align-items: center; gap: 8px; }
.sidebar-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #c4b5fd; }
.admin-workspace { min-height: 100vh; margin-left: 248px; display: flex; flex-direction: column; }
.workspace-header { min-height: 94px; padding: 20px clamp(20px, 4vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #fff; border-bottom: 1px solid var(--pena-divider); }
.workspace-eyebrow, .workspace-title { display: block; }
.workspace-eyebrow { color: var(--pena-muted); font-size: .62rem; letter-spacing: .14em; font-weight: 700; }
.workspace-title { margin-top: 6px; font-weight: 650; font-size: .94rem; }
.workspace-account { display: flex; align-items: center; gap: 12px; min-width: 0; }
.workspace-account form button { margin: 0; padding: .65rem .9rem; }
.account-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--pena-soft); color: var(--pena-primary); font-weight: 700; }
.account-description { display: grid; gap: 3px; max-width: 210px; }
.account-description strong { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-description small { font-size: .7rem; color: var(--pena-muted); }
.admin-app .dashboard { width: 100%; max-width: 1260px; margin: 0 auto; padding: 40px clamp(20px, 4vw, 48px); flex: 1; min-width: 0; }
.admin-app h1 { font-size: clamp(1.65rem, 2.5vw, 2.15rem); letter-spacing: -.035em; line-height: 1.2; margin: 8px 0 14px; }
.admin-app h2 { font-size: 1.2rem; letter-spacing: -.02em; }
.admin-app p { font-size: .94rem; }
.workspace-footer { display: flex; justify-content: space-between; gap: 15px; padding: 22px clamp(20px, 4vw, 48px); border-top: 1px solid var(--pena-divider); color: var(--pena-muted); font-size: .7rem; }
.overview-hero { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding-bottom: 24px; }
.eyebrow { font-size: .65rem; font-weight: 750; letter-spacing: .14em; color: var(--pena-primary); }
.overview-hero p { margin: 0; line-height: 1.7; }
.primary-link { display: inline-flex; align-items: center; justify-content: center; gap: 10px; flex-shrink: 0; min-height: 46px; padding: 12px 20px; border-radius: 10px; background: var(--pena-primary); color: #fff; text-decoration: none; font-weight: 650; font-size: .9rem; box-shadow: 0 5px 14px #6d28d91f; }
.primary-link:hover { color: #fff; background: var(--pena-primary-hover); }
.primary-link > span { font-size: 1.3rem; font-weight: 400; }
.editorial-notice { display: flex; align-items: center; gap: 16px; padding: 20px 24px; border: 1px solid #e6d5b6; border-radius: 12px; background: #fffaf1; }
.editorial-notice > .admin-icon { color: #976011; }
.editorial-notice div { flex: 1; }
.editorial-notice strong { font-size: .9rem; color: #684410; }
.editorial-notice p { margin: 5px 0 0; font-size: .8rem; color: #796344; }
.status-pill { display: inline-flex; padding: 6px 10px; border-radius: 30px; background: #f4e6ca; color: #684410; font-size: .67rem; font-weight: 700; white-space: nowrap; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 32px 0 18px; }
.section-heading h2 { margin: 0; }
.section-heading > span { color: var(--pena-muted); font-size: .75rem; }
.workspace-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.workspace-card { display: flex; flex-direction: column; padding: 24px; background: #fff; border: 1px solid var(--pena-divider); border-radius: 14px; color: var(--pena-primary); text-decoration: none; box-shadow: 0 3px 9px #25133d03; transition: border-color .18s, box-shadow .18s, transform .18s; }
.workspace-card:hover { color: var(--pena-primary); border-color: #c4a5e9; box-shadow: 0 12px 25px #25133d0c; transform: translateY(-3px); }
.card-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #eee5ff; color: #6d28d9; }
.card-icon--blue { background: #e9f1ff; color: #4068ab; }
.card-icon--pink { background: #f8eafa; color: #994c9e; }
.workspace-card h3 { font-size: 1rem; margin: 19px 0 8px; color: var(--pena-ink); line-height: 1.4; }
.workspace-card p { margin: 0 0 24px; font-size: .82rem; line-height: 1.65; }
.card-action { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 16px; border-top: 1px solid #f0eaf7; font-size: .75rem; font-weight: 650; }
.card-action .admin-icon { width: 17px; height: 17px; }
.admin-app .panel { border: 1px solid var(--pena-divider); box-shadow: 0 3px 10px #25133d03; }
.admin-app .form-stack { gap: .65rem; }
.admin-app .form-stack > label { margin-top: .6rem; font-size: .85rem; }
.admin-app .form-stack > input, .admin-app .form-stack > select, .admin-app .form-stack > textarea { background: #fff; transition: border-color .15s; }
.admin-app input:focus, .admin-app textarea:focus, .admin-app select:focus { border-color: var(--pena-primary); }
.admin-app .content-table-wrap { border: 1px solid var(--pena-divider); }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 10000; padding: 12px 20px; background: #fff; border-radius: 8px; }
.skip-link:focus { top: 12px; }
@media (max-width: 1220px) { .workspace-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .account-description { max-width: 130px; } }
@media (max-width: 1000px) {
    .admin-sidebar { position: static; width: 100%; padding: 18px 20px 12px; }
    .sidebar-brand { width: 175px; padding: 0; }
    .sidebar-caption, .sidebar-foot { display: none; }
    .sidebar-nav { display: flex; overflow-x: auto; gap: 6px; margin-top: 18px; padding: 4px 2px; }
    .sidebar-nav a { white-space: nowrap; flex-shrink: 0; font-size: .8rem; min-height: 42px; padding: 8px 12px; }
    .sidebar-nav .admin-icon { width: 18px; height: 18px; }
    .admin-workspace { margin-left: 0; min-height: calc(100vh - 140px); }
    .workspace-header { min-height: 80px; }
}
@media (max-width: 600px) {
    .workspace-header { gap: 12px; }
    .workspace-title { font-size: .82rem; }
    .account-description, .account-avatar { display: none; }
    .admin-app .dashboard { padding-top: 28px; }
    .overview-hero { align-items: flex-start; flex-direction: column; gap: 20px; }
    .workspace-cards { grid-template-columns: 1fr; }
    .workspace-card { padding: 22px; }
    .editorial-notice { padding: 18px; align-items: flex-start; }
    .editorial-notice > .admin-icon, .editorial-notice > .status-pill, .section-heading > span { display: none; }
    .workspace-footer { flex-direction: column; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { .workspace-card, .admin-app input, .admin-app textarea, .admin-app select { transition: none; } .workspace-card:hover { transform: none; } }

/* Clear touch targets, including links whose action navigates to another screen. */
.action-link { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; padding:10px 15px; border:1px solid var(--pena-primary); border-radius:10px; background:var(--pena-primary); color:#fff; text-decoration:none; font-size:.875rem; font-weight:650; line-height:1.4; text-align:center; }
.action-link:hover { background:var(--pena-primary-hover); border-color:var(--pena-primary-hover); color:#fff; }
.action-link--secondary { background:var(--pena-soft); color:var(--pena-primary); border-color:var(--pena-divider); }
.action-link--secondary:hover { background:var(--pena-soft-hover); border-color:var(--pena-border); color:var(--pena-primary-hover); }
.admin-workspace, .content-heading > div, .overview-hero > div { min-width:0; }
.admin-app h1, .admin-app h2, .admin-app p, .admin-app label { overflow-wrap:anywhere; }
.post-preview { overflow-wrap:anywhere; }
.post-preview iframe { max-width:100%; }
.post-preview table { display:block; max-width:100%; overflow-x:auto; }
@media(max-width:1000px) {
    .sidebar-nav { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); overflow:visible; }
    .sidebar-nav a { min-width:0; white-space:normal; min-height:44px; }
    .admin-app input, .admin-app select, .admin-app textarea { font-size:16px; }
    .admin-app button:not(.jodit-container button), .admin-app .button-link, .admin-app .post-pagination__link { min-height:44px; }
    .order-controls { flex-direction:row; flex-wrap:wrap; }
    .order-controls button { min-width:44px; margin:0; }
    .order-list { padding-left:0; }
    .order-list li { flex-wrap:wrap; }
    .order-list li > span:first-of-type { flex:1 1 180px; }
    .form-stack { max-width:100%; }
    .form-stack > input, .form-stack > select, .form-stack > textarea { width:100%; }
    .post-categories { grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr)); min-width:0; }
}
@media(max-width:600px) {
    .admin-sidebar { padding:16px 16px 12px; }
    .sidebar-brand { width:145px; }
    .sidebar-nav { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); overflow:visible; gap:6px; margin-top:14px; }
    .sidebar-nav a { min-width:0; white-space:normal; min-height:44px; }
    .admin-app .dashboard { padding-left:16px; padding-right:16px; }
    .admin-app .panel { padding:16px; }
    .admin-app .button-link { max-width:100%; }
    .admin-app .post-categories label { display:flex; align-items:center; gap:8px; min-height:44px; }
    .post-categories input[type=checkbox] { flex-shrink:0; width:20px; height:20px; }
    .post-preview { padding:16px; }
}
