:root {
    --bg: #f7f7f7;
    --ink: #1f1f1f;
    --muted: #5a5a5a;
    --accent: #c6262d;
    --accent-strong: #a61f25;
    --accent-soft: #f5e7e8;
    --link: #1f5ea8;
    --surface: #ffffff;
    --stroke: #dedede;
    --shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    --radius-lg: 12px;
    --radius-md: 10px;
    --radius-sm: 8px;
}

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

body {
    font-family: "Segoe UI", "Arial", sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    min-height: 100vh;
    font-size: 14px;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    color: var(--accent-strong);
}

.app-shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 26px 18px 56px;
}

.site-header {
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.site-header.landing-header {
    padding: 14px 18px;
    border-left: 4px solid var(--accent);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

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

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 18px rgba(211, 32, 39, 0.25);
}

.brand-text h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0;
}

.subtitle {
    color: var(--muted);
    font-size: 12px;
    max-width: 640px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ghost-link {
    color: var(--link);
    font-weight: 600;
}

.nav-btn,
.page-btn,
.btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-btn,
.page-btn {
    padding: 9px 14px;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--stroke);
    color: var(--ink);
    font-weight: 600;
    transition: all 0.2s ease;
}

.nav-btn:hover,
.page-btn:hover {
    background: #f1f5f9;
    border-color: rgba(15, 23, 42, 0.2);
}

.nav-btn.active,
.page-btn.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent-strong);
}

.toolbar {
    display: grid;
    grid-template-columns: 1.4fr 0.6fr;
    gap: 18px;
    margin-bottom: 22px;
}

.toolbar-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f3f3f3;
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke);
}

.page-navigation .page-btn + .page-btn {
    border-left: none;
}

.page-navigation .page-btn {
    background: #ffffff;
    border-color: var(--stroke);
    color: var(--ink);
}

.page-navigation .page-btn:hover {
    background: #f5f5f5;
    border-color: #cfcfcf;
}

.page-navigation .page-btn.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent-strong);
}

.search-container {
    background: var(--surface);
    padding: 14px 16px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow);
}

.terms-container {
    background: var(--surface);
    padding: 14px 16px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow);
}

.terms-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.search-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#search-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #bfbfbf;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-hint {
    font-size: 12px;
    color: var(--muted);
}

.content,
.landing-main,
.admin-main {
    display: grid;
    gap: 24px;
}

.panels-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.panel-heading {
    background: var(--accent);
    color: #fff;
    padding: 9px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.panel-heading.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
}

.toggle-icon {
    font-size: 14px;
    transition: transform 0.2s ease;
}

.panel-body {
    max-height: 600px;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #fff;
}

.panel-body.collapsed {
    max-height: 0;
}

.panel-content {
    padding: 16px 18px 20px;
}

.panel-content h4 {
    font-size: 16px;
    margin-bottom: 6px;
}

.panel-content p {
    color: var(--muted);
    white-space: pre-wrap;
}

.static-profile .panel-heading {
    cursor: default;
}

.static-profile .panel-content p {
    margin: 0 0 12px;
    white-space: normal;
}

.static-profile .panel-content p:last-child {
    margin-bottom: 0;
}

.static-profile .panel-content h4 {
    margin-top: 18px;
}

.pdf-attachment {
    margin: 14px 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f7f7f7;
    border: 1px dashed rgba(15, 23, 42, 0.2);
}

.pdf-link {
    font-weight: 600;
    color: var(--link);
}

.entry-date {
    font-size: 12px;
    color: var(--muted);
}

.no-entries {
    background: var(--surface);
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(15, 23, 42, 0.08);
    text-align: left;
}

.no-entries a {
    color: var(--link);
    font-weight: 600;
}

.content-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke);
    padding: 20px;
    box-shadow: var(--shadow);
}

.landing-content {
    font-family: "Sora", "Segoe UI", "Arial", sans-serif;
    font-size: 15px;
    color: #2d2a26;
}

.terms h2 {
    font-size: 24px;
    margin-bottom: 12px;
}

.terms-actions {
    margin-top: 12px;
}

.terms-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px dashed rgba(15, 23, 42, 0.2);
    background: #f7f7f7;
    font-weight: 600;
    color: var(--link);
}

.terms-link:hover {
    color: var(--accent-strong);
    border-color: rgba(166, 31, 37, 0.4);
}

.admin-section {
    background: var(--surface);
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
}

.admin-section h2 {
    font-size: 16px;
    margin-bottom: 12px;
    color: var(--ink);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #bfbfbf;
    font-family: inherit;
    font-size: 13px;
}

.form-group textarea {
    min-height: 140px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.date-field {
    position: relative;
}

.date-placeholder {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 13px;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.date-field.has-value .date-placeholder,
.date-field:focus-within .date-placeholder {
    opacity: 0;
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--muted);
}

.btn {
    padding: 9px 16px;
    border-radius: 999px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
    background: #ededed;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 18px rgba(198, 38, 45, 0.22);
}

.landing-main {
    grid-template-columns: 1.7fr 0.9fr;
    align-items: start;
}

.landing-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.landing-title {
    font-size: 18px;
    font-weight: 700;
    color: #1f5ea8;
    border: 2px solid #2a63b8;
    display: inline-block;
    padding: 6px 10px;
    border-radius: 4px;
}

.profile-panel .panel-content h4 {
    margin-top: 6px;
}

.btn-secondary {
    background: #f2f2f2;
    color: var(--ink);
    margin-left: 8px;
}

.btn-edit {
    background: #f0b257;
    color: #5b3d0f;
}

.btn-delete {
    background: #ef6f5a;
    color: #fff;
}

.entries-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.entry-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--stroke);
    background: #ffffff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}

.entry-info h4 {
    margin-bottom: 6px;
}

.entry-preview {
    color: var(--muted);
}

.entry-page-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f1f1;
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.pdf-indicator {
    font-size: 13px;
    color: var(--link);
}

.page-management,
.filter-section {
    display: grid;
    gap: 12px;
}

.pages-list-admin {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.page-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--stroke);
    background: #ffffff;
}

.page-name {
    font-weight: 600;
}

.page-actions,
.entry-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.filter-section select {
    max-width: 260px;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.modal-content {
    background: var(--surface);
    margin: 5% auto;
    padding: 18px;
    border-radius: var(--radius-md);
    max-width: 600px;
    width: 90%;
    box-shadow: var(--shadow);
    border: 1px solid var(--stroke);
}

.close {
    float: right;
    font-size: 28px;
    cursor: pointer;
}

@media (max-width: 960px) {
    .toolbar {
        grid-template-columns: 1fr;
    }

    .landing-main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .app-shell {
        padding: 24px 16px 48px;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .brand-text h1 {
        font-size: 24px;
    }

    .entry-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .entry-actions {
        width: 100%;
    }

    .entry-actions .btn {
        flex: 1;
    }
}
