:root {
    --red: #c8102e;
    --blue: #1a73e8;
    --sidebar: #e8f3fb;
    --ink: #2b2b2b;
    --line: #dfe6ec;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Open Sans', -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: var(--ink);
}

.back-to-site, .top-bar-link {
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
    font-size: .95rem;
}
.back-to-site:hover { text-decoration: underline; }
.top-bar-link { position: absolute; top: 14px; left: 18px; z-index: 10; }

/* ───────────── Login ───────────── */
.login-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(rgba(255,255,255,.35), rgba(255,255,255,.35)),
                url('../assets/cards-2937475-wpp1717615994785.jpg') center/cover no-repeat fixed;
}
.login-card {
    background: #fff;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2.5rem 3rem;
    border-radius: 10px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    text-align: center;
}
.login-logo { height: 96px; margin-bottom: .5rem; }
.login-card h1 { font-size: 1.7rem; margin: .25rem 0 1.75rem; }
.login-card label {
    display: block;
    text-align: left;
    font-weight: 600;
    margin-bottom: .4rem;
}
.login-card input[type=password] {
    width: 100%;
    padding: .7rem .8rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    margin-bottom: 1.5rem;
}
.login-card input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
.login-card button {
    background: var(--blue);
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: .65rem 1.6rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}
.login-card button:hover { background: #1666d0; }
.login-error {
    background: #fdecea;
    color: #b3261e;
    border-radius: 6px;
    padding: .6rem .8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ───────────── Portal shell ───────────── */
.portal-body { background: #fff; }
.portal-shell { display: flex; min-height: 100vh; }

.portal-sidebar {
    width: 280px;
    flex: 0 0 280px;
    background: var(--sidebar);
    border-right: 2px solid #bcd9ef;
    padding: 1.5rem 1.25rem 2rem;
    display: flex;
    flex-direction: column;
}
.sidebar-brand { text-align: center; margin-top: 2.5rem; margin-bottom: 1.5rem; }
.sidebar-brand img { height: 86px; }
.sidebar-brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: .5rem 0 0;
    color: var(--ink);
    font-family: 'Open Sans', sans-serif;
}

.sidebar-nav { display: flex; flex-direction: column; gap: .9rem; margin-bottom: 1.5rem; }
.sidebar-nav a {
    color: var(--blue);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 600;
}
.sidebar-nav a:hover { text-decoration: underline; }
.sidebar-nav a.active { color: var(--red); font-weight: 700; }
.sidebar-nav a.ext { color: var(--ink); font-weight: 600; }
.sidebar-nav a.ext:hover { color: var(--red); }
.sidebar-nav .arrow { font-weight: 700; }

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-top: auto;
}
.btn-file, .btn-save {
    display: block;
    text-align: center;
    border: 0;
    border-radius: 8px;
    padding: .65rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
.btn-file { background: var(--blue); color: #fff; }
.btn-file:hover { background: #1666d0; }
.btn-save { background: #1e8e3e; color: #fff; }
.btn-save:hover { background: #197a34; }
.btn-save:disabled { opacity: .7; cursor: default; }
.sidebar-logout {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .9rem;
    color: #888;
    text-decoration: none;
}
.sidebar-logout:hover { color: var(--red); }

/* ───────────── Editor ───────────── */
.portal-main { flex: 1; padding: 2rem 2.5rem 4rem; min-width: 0; }
.editor-head h1 { margin: 0; font-size: 2rem; }
.editor-head .hint { color: #777; margin: .25rem 0 1.5rem; }

.editor-block { margin-bottom: 2rem; }
.block-label {
    display: block;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: .5rem;
    color: var(--red);
}

/* toast */
.toast-msg {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e8e3e;
    color: #fff;
    padding: .8rem 1.25rem;
    border-radius: 8px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .2s, transform .2s;
    pointer-events: none;
}
.toast-msg.show { opacity: 1; transform: translateY(0); }
.toast-msg.error { background: #c5221f; }

/* ───────────── File viewer ───────────── */
.fileviewer-body { background: #f6f8fa; }
.fv-wrap { max-width: 1050px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
.fv-head { margin-bottom: 1.5rem; }
.fv-head h1 { margin: .5rem 0 0; }
.fv-notice {
    background: #e6f4ea; color: #137333;
    padding: .6rem .9rem; border-radius: 6px; font-weight: 600;
}
.fv-notice.error { background: #fce8e6; color: #c5221f; }
.fv-upload {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    padding: 1rem 1.25rem; margin-bottom: 2rem;
}
.fv-upload button {
    background: var(--blue); color: #fff; border: 0; border-radius: 6px;
    padding: .5rem 1.25rem; font-weight: 700; cursor: pointer;
}
.fv-hint { color: #888; font-size: .9rem; }
.fv-section { margin: 1.5rem 0 1rem; font-size: 1.25rem; }
.fv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.25rem;
}
.fv-item {
    margin: 0; background: #fff; border: 1px solid var(--line);
    border-radius: 10px; padding: .75rem; text-align: center;
}
.fv-item img { width: 100%; height: 130px; object-fit: contain; }
.fv-doc {
    height: 130px; display: flex; align-items: center; justify-content: center;
    background: #f1f3f4; color: #c5221f; font-weight: 800; border-radius: 6px;
}
.fv-item figcaption {
    font-size: .82rem; margin: .5rem 0 .35rem; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.fv-url {
    width: 100%; font-size: .72rem; border: 1px solid var(--line);
    border-radius: 5px; padding: .3rem; color: #555; cursor: pointer; background: #fafafa;
}
.fv-copied { display: block; color: #137333; font-size: .72rem; height: 1em; }

/* ───────────── Responsive ───────────── */
@media (max-width: 800px) {
    .portal-shell { flex-direction: column; }
    .portal-sidebar { width: 100%; flex-basis: auto; border-right: 0; border-bottom: 2px solid #bcd9ef; }
    .portal-main { padding: 1.5rem 1.25rem 3rem; }
}
