:root {
    --bg: #f7f7f7;
    --ink: #1f1f1f;
    --muted: #5a5a5a;
    --accent: #63b3ff;
    --accent-strong: #3f9df5;
    --accent-soft: #e8f4ff;
    --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: transparent;
    border: none;
    border-radius: 0;
    padding: 6px 0 10px;
    margin-bottom: 12px;
    box-shadow: none;
}

.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(99, 179, 255, 0.25);
}

.brand-text h1 {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0;
}

.brand-text h1 a {
    color: var(--accent);
}

.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;
}

.profile-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-container.is-collapsed {
    display: none;
}

.profile-controls {
    justify-content: flex-start;
}

.profile-toggle-btn {
    min-width: 220px;
}

.panels-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.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: min(70vh, 640px);
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s ease;
    background: #fff;
}

.panel-body.collapsed {
    max-height: 0;
    overflow: hidden;
}

.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;
}

.files-section {
    margin-top: 12px;
}

.files {
    margin: 8px 0 0 18px;
    color: var(--ink);
}

.files li {
    margin-bottom: 6px;
}

.profile-files-group .files li {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-files-group .files a {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

.file-meta {
    color: var(--muted);
    font-size: 12px;
}

.static-profile .panel-heading {
    cursor: default;
}

.static-profile .panel-content p {
    margin: 0 0 12px;
    white-space: pre-line;
}

.static-profile .panel-content p.profile-section {
    font-weight: 700;
    font-size: 18px;
    color: var(--ink);
    margin-top: 18px;
}

.static-profile .panel-content p:last-child {
    margin-bottom: 0;
}

.static-profile .panel-content h4 {
    margin-top: 18px;
}

.profile-logo {
    margin: 0 0 16px;
}

.profile-logo img {
    max-width: 300px;
    width: 100%;
    height: auto;
    display: block;
}

.profile-container .panel-content {
    padding: 22px 26px 80px;
    font-size: 16px;
}

.static-profile .panel-body {
    max-height: none;
    min-height: auto;
    overflow: visible;
}

.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(63, 157, 245, 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(99, 179, 255, 0.22);
}

.btn-new-page {
    background: #79c3ff;
    border-color: #79c3ff;
    box-shadow: 0 10px 18px rgba(121, 195, 255, 0.22);
}

.btn-new-page:hover {
    background: #66b8fb;
}

.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: #fc0b02;
    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-wrap: wrap;
    gap: 8px;
}

.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--stroke);
    background: #ffffff;
    flex: 1 1 320px;
}

.page-name {
    font-weight: 600;
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.page-actions,
.entry-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-small {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.btn-compact {
    padding: 6px 12px;
    font-size: 12px;
    line-height: 1.2;
}

.btn-static {
    transition: none;
}

.btn.btn-static:hover {
    background: var(--accent);
    transform: none;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    min-width: 32px;
    min-height: 32px;
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-toggle {
    border: 1px solid var(--stroke);
    background: #f7f7f7;
    color: #333;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
}

.admin-section.collapsed .section-body {
    display: none;
}

.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%;
    max-height: 90vh;
    overflow-y: auto;
    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;
    }

    .modal-content {
        margin: 2% auto;
        width: 95%;
        padding: 14px;
    }

    .page-item {
        flex: 1 1 100%;
    }

    .panel-controls {
        margin-bottom: 4px;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast {
        max-width: 100%;
    }
}
.entry-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.entry-heading {
  margin: 0 0 12px 0;
  font-weight: 600;
}

.meta-row {
  margin-bottom: 6px;
}

.btn.btn-static.btn-new-page:hover {
    background: #66b8fb;
}

/* ── Footer ── */
.site-footer {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid var(--stroke);
    text-align: center;
}

.site-footer p {
    font-size: 12px;
    color: var(--muted);
}

/* ── Toast notifications ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    max-width: 380px;
}

.toast-success {
    background: #22c55e;
}

.toast-error {
    background: #ef4444;
}

.toast-info {
    background: var(--accent-strong);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ── Enhanced admin header ── */
.admin-main .admin-section > h2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.entry-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 700;
    min-width: 28px;
}

/* ── Better admin entry cards ── */
.entry-item {
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.entry-item:hover {
    border-color: var(--accent);
    box-shadow: 0 12px 28px rgba(99, 179, 255, 0.12);
}

.entry-info h4 {
    color: var(--ink);
    font-size: 15px;
    line-height: 1.4;
}

/* ── Better button styling ── */
.btn-primary:hover {
    background: var(--accent-strong);
    box-shadow: 0 12px 22px rgba(63, 157, 245, 0.28);
}

.btn-delete {
    transition: background 0.2s ease;
}

.btn-delete:hover {
    background: #d90800;
}

.btn-edit:hover {
    background: #e5a240;
}

/* ── Section header enhanced ── */
.section-header h2 {
    margin: 0;
}

.section-toggle {
    transition: all 0.2s ease;
}

.section-toggle:hover {
    background: #eaeaea;
    border-color: #bbb;
}

/* ── Panel heading hover effect ── */
.panel-heading:hover {
    filter: brightness(1.05);
}

/* ── Admin nav buttons ── */
.header-actions .nav-btn:first-child {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: transparent;
}

.header-actions .nav-btn:first-child:hover {
    background: #d4ecff;
}

.header-actions .nav-btn:last-child {
    background: #fee2e2;
    color: #991b1b;
    border-color: transparent;
}

.header-actions .nav-btn:last-child:hover {
    background: #fecaca;
}

/* ── Empty state styling ── */
.no-files {
    color: var(--muted);
    font-style: italic;
    font-size: 13px;
}

/* ── Search results count ── */
.search-results-count {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 500;
}

/* ── Admin filter enhanced ── */
.filter-section {
    margin-bottom: 16px;
}

.filter-section select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--stroke);
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
}

.filter-section select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Panel meta improved ── */
.panel-meta {
    background: #f9fafb;
    padding: 10px 14px;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
    margin-bottom: 12px;
}

.meta-row strong {
    color: var(--ink);
}
