:root {
    --ink: #111827;
    --muted: #667085;
    --line: #d8e0ea;
    --surface: #ffffff;
    --surface-soft: #f5f7fa;
    --page: #edf1f5;
    --nav: #101827;
    --nav-soft: #1c2738;
    --accent: #0f8177;
    --accent-dark: #0a655e;
    --accent-soft: #e5f4f1;
    --danger: #b42318;
    --warning: #9a6700;
    --success: #087a55;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--page);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    background: var(--page);
    font-size: 15px;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .48;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 28px;
    height: 100vh;
    padding: 28px 20px 20px;
    color: #f8fafc;
    background: var(--nav);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-mark {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: #fff;
    background: var(--accent);
    font-size: 15px;
    font-weight: 800;
}

.brand > span:last-child {
    min-width: 0;
}

.brand strong,
.brand small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand strong {
    font-size: 15px;
    font-weight: 650;
}

.brand small {
    margin-top: 3px;
    color: #aeb9ca;
    font-size: 12px;
}

.sidebar nav {
    display: grid;
    align-content: start;
    gap: 6px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 7px;
    color: #c7d0dd;
    font-weight: 550;
}

.sidebar nav a span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    border-radius: 6px;
    color: #dce4ee;
    background: var(--nav-soft);
    font-size: 10px;
    font-weight: 800;
}

.sidebar nav a.active,
.sidebar nav a:hover {
    color: #fff;
    background: #1b2637;
}

.sidebar nav a.active span {
    color: #fff;
    background: var(--accent);
}

.sidebar-footer {
    display: grid;
    gap: 9px;
}

.account-name {
    overflow: hidden;
    color: #bec8d6;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer button {
    width: 100%;
    min-height: 39px;
    border: 1px solid #344054;
    border-radius: 7px;
    color: #fff;
    background: #202b3d;
    font-weight: 600;
}

.workspace {
    min-width: 0;
    padding: 28px 30px 50px;
}

.topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 20px;
    align-items: center;
    margin-bottom: 24px;
}

.page-title span {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.page-title h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.15;
}

.quota-card {
    display: grid;
    grid-template-columns: auto auto;
    column-gap: 16px;
    align-items: center;
    min-width: 220px;
    padding: 12px 14px;
    border: 1px solid #b9ded8;
    border-radius: 8px;
    background: var(--accent-soft);
}

.quota-card > span {
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.quota-card strong {
    grid-row: 1 / span 2;
    grid-column: 2;
    color: var(--accent-dark);
    font-size: 26px;
    line-height: 1;
    text-align: right;
}

.quota-card strong small {
    font-size: 13px;
    font-weight: 600;
}

.quota-card em {
    color: #3f645f;
    font-size: 11px;
    font-style: normal;
}

.quota-card.empty {
    border-color: #f0d5d2;
    background: #fff2f0;
}

.quota-card.empty strong,
.quota-card.empty > span {
    color: var(--danger);
}

.menu-button {
    display: none;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #c9d7e6;
    border-radius: 7px;
    color: #344054;
    background: #f8fafc;
}

.notice.success {
    border-color: #b7dfcf;
    color: var(--success);
    background: #ecf9f3;
}

.notice.error {
    border-color: #f0c8c4;
    color: var(--danger);
    background: #fff1f0;
}

.notice.warning {
    border-color: #ecd7a4;
    color: var(--warning);
    background: #fff9e8;
}

.toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #cfd8e3;
}

.toolbar > div {
    display: grid;
    gap: 3px;
}

.toolbar strong {
    font-size: 16px;
}

.toolbar span {
    color: var(--muted);
    font-size: 12px;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(220px, 320px) auto;
    gap: 7px;
}

.search-form input,
.login-card input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
    font-weight: 400;
    outline: none;
}

.search-form input:focus,
.login-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 129, 119, .12);
}

.search-form button,
.row-action,
.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 0 14px;
    color: #344054;
    background: #fff;
    font-weight: 650;
}

.row-actions {
    display: grid;
    gap: 6px;
    justify-items: stretch;
    min-width: 126px;
}

.row-actions form {
    margin: 0;
}

.row-rewrite {
    width: 100%;
    min-height: 36px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    padding: 0 10px;
    color: #fff;
    background: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.article-list {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.article-row {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    min-height: 116px;
    padding: 12px;
    border-bottom: 1px solid #e4e9f0;
}

.article-row:last-child {
    border-bottom: 0;
}

.article-row:hover {
    background: #fbfcfd;
}

.article-row-image {
    display: block;
    width: 112px;
    height: 86px;
    overflow: hidden;
    border-radius: 6px;
    background: #e8edf3;
}

.article-row-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-row-image.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8390a2;
    font-size: 11px;
}

.article-row-content {
    min-width: 0;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    color: var(--muted);
    font-size: 11px;
}

.article-meta span + span::before {
    margin-right: 7px;
    content: "/";
    color: #a7b0bd;
}

.article-meta em {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 999px;
    padding: 0 8px;
    color: var(--accent-dark);
    background: var(--accent-soft);
    font-size: 10px;
    font-style: normal;
    font-weight: 750;
}

.article-row h2 {
    margin: 6px 0 5px;
    font-size: 17px;
    line-height: 1.3;
}

.article-row h2 a:hover {
    color: var(--accent-dark);
}

.article-row p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: #536174;
    font-size: 13px;
    line-height: 1.45;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 16px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-weight: 650;
}

.pagination a.active {
    border-color: var(--accent);
    color: #fff;
    background: var(--accent);
}

.empty-state {
    display: grid;
    justify-items: center;
    gap: 7px;
    min-height: 240px;
    align-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--muted);
    background: #fff;
    text-align: center;
}

.empty-state strong {
    color: var(--ink);
    font-size: 18px;
}

.detail-top-actions {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 15px;
}

.primary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    padding: 0 16px;
    color: #fff;
    background: var(--accent);
    font-weight: 700;
}

.primary-button:hover:not(:disabled) {
    border-color: var(--accent-dark);
    background: var(--accent-dark);
}

.article-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 820px);
    gap: 14px;
    align-items: start;
}

.article-detail-grid.has-rewrite {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-panel {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.detail-panel.rewritten {
    border-color: #b9ded8;
    background: #fbfefd;
}

.detail-panel h2 {
    margin: 12px 0 22px;
    font-size: 25px;
    line-height: 1.25;
}

.article-body {
    color: #303b4a;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 16px;
    line-height: 1.75;
}

.image-panel {
    display: grid;
    gap: 8px;
    max-width: 820px;
    margin-top: 14px;
}

.image-panel span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.image-panel img {
    display: block;
    width: 100%;
    max-height: 520px;
    border-radius: 8px;
    object-fit: contain;
    object-position: left top;
    background: #dfe5ec;
}

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--nav);
}

.login-card {
    width: min(100%, 420px);
    padding: 30px;
    border: 1px solid #2a3648;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.login-brand span:not(.brand-mark) {
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.login-brand h1 {
    margin: 3px 0 0;
    font-size: 24px;
}

.login-card form {
    display: grid;
    gap: 15px;
}

.login-card label {
    display: grid;
    gap: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.login-card .primary-button {
    width: 100%;
    margin-top: 5px;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(15, 23, 42, .55);
}

@media (max-width: 980px) {
    .article-detail-grid.has-rewrite {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        z-index: 40;
        width: min(84vw, 290px);
        transform: translateX(-105%);
        transition: transform .2s ease;
    }

    .menu-open .sidebar {
        transform: translateX(0);
    }

    .workspace {
        padding: 18px 14px 36px;
    }

    .topbar {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px;
    }

    .menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        border: 1px solid var(--line);
        border-radius: 7px;
        padding: 0 12px;
        color: var(--ink);
        background: #fff;
        font-weight: 700;
    }

    .page-title h1 {
        font-size: 23px;
    }

    .quota-card {
        grid-column: 1 / -1;
        width: 100%;
    }

    .toolbar {
        display: grid;
        align-items: stretch;
    }

    .search-form {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .article-row {
        grid-template-columns: 86px minmax(0, 1fr);
        gap: 11px;
        min-height: 104px;
        padding: 10px;
    }

    .article-row-image {
        width: 86px;
        height: 72px;
    }

    .article-row h2 {
        font-size: 15px;
    }

    .article-row p {
        display: none;
    }

    .row-actions {
        grid-column: 2;
        justify-self: start;
        grid-template-columns: auto auto;
        min-width: 0;
    }

    .row-action,
    .row-rewrite {
        min-height: 32px;
        padding: 0 10px;
        font-size: 12px;
    }

    .detail-top-actions {
        align-items: stretch;
    }

    .detail-top-actions form,
    .detail-top-actions .primary-button {
        width: 100%;
    }

    .detail-panel {
        padding: 18px;
    }

    .detail-panel h2 {
        font-size: 21px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 22px;
    }

    .search-form,
    .detail-top-actions {
        grid-template-columns: 1fr;
    }

    .detail-top-actions {
        display: grid;
    }

    .article-row {
        grid-template-columns: 70px minmax(0, 1fr);
    }

    .article-row-image {
        width: 70px;
        height: 66px;
    }

    .article-meta span:nth-child(2) {
        display: none;
    }
}
