* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #efefef;
    color: #111;
}

.topbar {
    width: 100%;
    background: #c40000;
    color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.topbar-inner {
    width: min(80%, 1500px);
    margin: 0 auto;
    min-height: 76px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    padding: 0 12px;
}

.brand a {
    color: #fff;
    text-decoration: none;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 24px;
    justify-content: flex-end;
}

.topbar-version {
    justify-self: center;
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 0.04em;
    opacity: 0.95;
}

.topnav a {
    color: #fff;
    text-decoration: none;
    font-size: 20px;
    font-weight: 600;
}

.topnav a:hover,
.brand a:hover {
    color: #ffd35a;
}

@media (max-width: 900px) {
    .topbar-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 8px;
        padding: 10px 12px;
    }

    .topnav {
        justify-content: center;
        flex-wrap: wrap;
        gap: 14px;
    }
}

.page-shell {
    width: min(80%, 1500px);
    margin: 28px auto;
    padding: 0 12px;
}

.app-card {
    background: #fff;
    border: 1px solid #e3b9b9;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    padding: 20px;
}

.narrow-card {
    max-width: 760px;
    margin: 0 auto;
}

.layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.sidebar {
    width: 320px;
    flex: 0 0 320px;
    padding-right: 12px;
    border-right: 1px solid #edd0d0;
}

.content {
    flex: 1;
    min-width: 0;
    padding-left: 4px;
}

.box {
    background: #fff;
    border: 1px solid #efcaca;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 18px;
}

h2, h3 {
    margin-top: 0;
    color: #222;
}

h2 {
    font-size: 28px;
    padding-bottom: 10px;
    border-bottom: 2px solid #222;
    margin-bottom: 18px;
}

h3 {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #777;
    margin-bottom: 16px;
}

a {
    color: #111;
    text-decoration: none;
}

a:hover {
    color: #c40000;
}

.menu-top,
.cat-block ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-top li,
.cat-block li {
    margin: 10px 0;
}

.menu-top a.active,
.cat-block a.active {
    color: #c40000;
    font-weight: 700;
}

.day-list a {
    display: inline-block;
    padding: 2px 0;
}

.day-list a.day-active {
    color: #c40000;
    font-weight: 700;
}

.btn-small {
    margin-top: 8px;
    font-size: 12px;
    padding: 6px 10px;
}

.scope-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
}

.scope-public {
    background: #e6ffe9;
    color: #12712c;
    border-color: #b6ebc0;
}

.scope-private {
    background: #f1f1f1;
    color: #2f2f2f;
    border-color: #d0d0d0;
}

.cat-block {
    margin-bottom: 12px;
}

details summary {
    cursor: pointer;
    font-weight: 700;
    padding: 8px 0 8px 4px;
}

.cat-block ul {
    padding-left: 18px;
    margin-top: 4px;
}

.form-row {
    margin-bottom: 8px;
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 7px 9px;
    border: 1px solid #bbb;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: #111;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

button,
.btn,
.btn-danger {
    display: inline-block;
    border: 0;
    border-radius: 9px;
    padding: 7px 11px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    font-weight: 600;
}

button,
.btn {
    background: #c40000;
    color: #fff;
}

button:hover,
.btn:hover {
    background: #980000;
    color: #fff;
}

.btn-danger {
    background: #6e0000;
    color: #fff;
}

.btn-danger:hover {
    background: #4f0000;
    color: #fff;
}

.editor-actions,
.article-actions {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    margin-top: 0;
    margin-bottom: 0;
}

.article-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: nowrap;
}

.article-meta-left,
.article-meta-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.article-meta-date,
.article-meta-author {
    font-size: 12px;
    color: #666;
    font-weight: 400;
    line-height: 1.2;
}

.article-meta-separator {
    font-size: 12px;
    color: #888;
    line-height: 1.2;
}

.article-status-text {
    font-size: 12px;
    color: #666;
    font-weight: 400;
    line-height: 1.2;
}

.todo-form {
    margin-bottom: 14px;
}

.todo-add-row {
    display: flex;
    gap: 8px;
}

.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.todo-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    border: 1px solid #e2e2e2;
    border-radius: 10px;
    padding: 8px;
    background: #fff;
}

.todo-item.done {
    border-color: #9ad49f;
    background: #f3fff4;
}

.todo-item.pending {
    border-color: #efb1b1;
    background: #fff7f7;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: #2a7a31;
}

.todo-inline {
    margin: 0;
}

.todo-check {
    min-width: 34px;
    padding: 6px 8px;
}

.todo-check.is-done {
    background: #2f9a3a;
}

.todo-check.is-pending {
    background: #c23434;
}

.todo-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.todo-arrows {
    display: flex;
    flex-direction: column;
    line-height: 1;
    gap: 1px;
}

.todo-edit-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.todo-edit-form input[type="text"] {
    min-width: 260px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    border-radius: 0;
    border: 0;
    background: transparent;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.icon-btn:hover {
    background: transparent;
    color: #c40000;
}

.icon-edit {
    color: #b06e00;
}

.icon-delete {
    color: #af2020;
}

.icon-move {
    color: #2f2f2f;
    font-size: 13px;
}


.icon-forward {
    color: #0c63b4;
    font-size: 15px;
}

.icon-save {
    color: #2f9a3a;
}

.icon-cancel {
    color: #777;
}

.msg {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
}

.msg.error {
    background: #ffe0e0;
    color: #8a0000;
    border: 1px solid #e2aaaa;
}

.msg.success {
    background: #e5ffe5;
    color: #0a6a0a;
    border: 1px solid #a8d7a8;
}

.muted {
    color: #777;
    font-size: 14px;
}

.editor-form-compact .form-row {
    margin-bottom: 6px;
}

.editor-form-compact label {
    font-size: 13px;
    margin-bottom: 4px;
}

.editor-form-compact input[type="text"],
.editor-form-compact select,
.editor-form-compact textarea {
    border-color: #c8c8c8;
    border-radius: 8px;
}

.editor-form-compact textarea {
    min-height: 130px;
}

.article-view {
    overflow-wrap: break-word;
    line-height: 1.6;
    font-size: 17px;
}

.article-view img {
    max-width: 100%;
    height: auto;
}

.article-view table {
    width: 100%;
    border-collapse: collapse;
}

.article-view table td,
.article-view table th {
    border: 1px solid #ddd;
    padding: 8px;
}

.login-wrap {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 0;
}

.login-box {
    margin-bottom: 0;
}

@media (max-width: 1200px) {
    .topbar-inner,
    .page-shell {
        width: min(92%, 1500px);
    }
}

@media (max-width: 980px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex: none;
        padding-right: 0;
        border-right: 0;
        border-bottom: 1px solid #edd0d0;
        padding-bottom: 14px;
    }

    .content {
        padding-left: 0;
    }

    .topbar-inner {
        min-height: auto;
        padding-top: 14px;
        padding-bottom: 14px;
        flex-direction: column;
        align-items: flex-start;
    }

    .topnav {
        gap: 16px;
        flex-wrap: wrap;
    }

    .brand a {
        font-size: 28px;
    }

    .topnav a {
        font-size: 18px;
    }
}
