/* =========================================================
   Page-specific styles — Nature Theme
   Mobile-first, validated across breakpoints
   ========================================================= */

/* ---------- Auth pages ---------- */
.auth-wrap {
    min-height: calc(100vh - var(--topbar-h));
    display: grid; grid-template-columns: 1fr; align-items: stretch;
    background: var(--surface);
}
.auth-art {
    background:
      linear-gradient(135deg, #0F2A1D 0%, #2D6A4F 100%);
    color: var(--ivory);
    padding: 40px 24px;
    display: flex; flex-direction: column; justify-content: center;
    position: relative; overflow: hidden;
}
.auth-art::before {
    content: ''; position: absolute; right: -80px; top: -80px;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(149,213,178,.18) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-art::after {
    content: ''; position: absolute; left: -60px; bottom: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(221,161,94,.16) 0%, transparent 70%);
    border-radius: 50%;
}
.auth-art h1 { color: var(--gold-soft); font-size: clamp(1.6rem, 4vw, 3.2rem); position: relative; z-index: 1; }
.auth-copy {
    color: rgba(251,252,244,.82);
    max-width: 480px;
    font-size: 1rem;
    position: relative; z-index: 1;
}
.auth-art .quote {
    font-style: italic; font-size: 1rem; line-height: 1.7; color: rgba(251,252,244,.88);
    border-left: 3px solid var(--gold); padding-left: 18px; margin-top: 24px;
    position: relative; z-index: 1;
}
.auth-art .quote .author { display: block; margin-top: 12px; font-style: normal; color: var(--gold-soft); font-family: var(--font-ui); font-size: .9rem; letter-spacing: .1em; }

.auth-form {
    background: var(--ivory);
    padding: 40px 24px;
    display: flex; flex-direction: column; justify-content: center;
}
.auth-form .form-box { max-width: 420px; width: 100%; margin: 0 auto; }
.auth-form h2 { font-size: 1.7rem; }
.auth-form .auth-title {
    font-family: var(--font-serif);
    color: var(--ink); font-size: 1.7rem; margin-bottom: 8px;
}
.auth-form .alt { font-family: var(--font-ui); font-size: .9rem; color: var(--text-muted); margin-top: 18px; text-align: center; }
.auth-form .alt a { color: var(--emerald); font-weight: 600; }
.auth-form .alt-back { margin-top: 8px; }
.auth-form .alt-back a { color: var(--text-muted); }

@media (min-width: 980px) {
    .auth-wrap { grid-template-columns: 1fr 1fr; }
    .auth-art, .auth-form { padding: 60px; }
    .auth-art .quote { font-size: 1.1rem; }
}
@media (max-width: 720px) {
    .auth-wrap { display: flex; flex-direction: column; }
    .auth-form { padding: 28px 20px; }
    .auth-art { display: none; }
}

/* ---------- Landing / hero ---------- */
.hero {
    background:
      linear-gradient(135deg, #0F2A1D 0%, #1B4332 50%, #2D6A4F 100%);
    color: var(--ivory);
    padding: clamp(44px, 8vw, 88px) 0 clamp(44px, 8vw, 84px);
    margin: 0 0 40px;
    border-bottom: 1px solid rgba(221,161,94,.45);
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; right: -10%; top: -10%;
    width: 60%; height: 120%;
    background:
        radial-gradient(circle at 50% 50%, rgba(149,213,178,.15) 0%, transparent 60%);
    pointer-events: none;
}
.hero::after {
    content: ''; position: absolute; left: -8%; bottom: -20%;
    width: 50%; height: 80%;
    background:
        radial-gradient(circle at 50% 50%, rgba(221,161,94,.15) 0%, transparent 60%);
    pointer-events: none;
}
.hero-inner { width: min(100%, var(--container)); margin: 0 auto; padding: 0 var(--content-pad); position: relative; z-index: 1; }
.hero-eyebrow {
    color: var(--gold-soft);
    letter-spacing: .25em; font-family: var(--font-ui); font-size: .75rem;
    font-weight: 600; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 8px;
}
.hero-eyebrow::before {
    content: ''; width: 24px; height: 1px; background: var(--gold-soft);
}
.hero h1 {
    color: var(--ivory); font-size: clamp(2rem, 5vw, 4.15rem);
    line-height: 1.05; margin: 12px 0 14px; max-width: 860px;
}
.hero h1 .highlight { color: var(--gold-soft); font-style: italic; }
.hero p { color: rgba(251,252,244,.88); font-size: 1.02rem; max-width: 580px; }
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, max-content));
    gap: 24px;
    margin-top: 30px;
    color: rgba(251,252,244,.88);
    font-family: var(--font-ui);
}
.hero-stats > div { min-width: 0; }
.hero-stats strong {
    display: block;
    font-family: var(--font-serif);
    font-size: clamp(1.35rem, 4vw, 1.8rem);
    line-height: 1;
    color: var(--gold-soft);
}

@media (min-width: 900px) {
    .hero { margin-bottom: 48px; }
    .hero p { font-size: 1.15rem; }
}
@media (max-width: 640px) {
    .hero-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px; margin-top: 22px;
        padding: 14px 12px;
        background: rgba(0,0,0,.18);
        border: 1px solid rgba(221,161,94,.25);
        border-radius: var(--r-lg);
        text-align: center;
    }
    .hero-stats > div { font-size: .7rem; line-height: 1.3; }
    .hero-stats strong { font-size: 1.1rem; margin-bottom: 2px; }
}

/* ---------- Sections ---------- */
.section-title {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
    margin-bottom: 20px;
    min-width: 0;
}
.section-title h2 { margin: 0; flex: 1 1 auto; min-width: 0; }
.section-title > .btn,
.section-title > a.btn { flex: 0 0 auto; }
.section-title h2 small {
    display: block; font-family: var(--font-ui); font-size: .72rem;
    color: var(--emerald); font-weight: 700;
    letter-spacing: .18em; text-transform: uppercase; margin-bottom: 6px;
}

/* ---------- Book grid ---------- */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
    gap: 14px;
}
@media (min-width: 600px) {
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
}
@media (min-width: 900px) {
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
}
.book-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s, border-color .2s;
    text-decoration: none;
    color: var(--text);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--line);
    min-width: 0;
}
.book-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--emerald);
}
.book-cover {
    aspect-ratio: 2/3; background: var(--ink); position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .badge-views {
    position: absolute; bottom: 8px; right: 8px;
    background: rgba(15,42,29,.85); color: var(--gold-soft);
    font-family: var(--font-ui); font-size: .7rem; padding: 3px 8px; border-radius: 999px;
    display: flex; align-items: center; gap: 4px;
}
.book-cover .badge-views i { width: 12px; height: 12px; }
.book-info { padding: 12px 14px 14px; flex: 1; display: flex; flex-direction: column; }
.book-info .title {
    font-family: var(--font-serif); font-weight: 700; font-size: .95rem;
    line-height: 1.3; margin-bottom: 4px; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.book-info .author { font-family: var(--font-ui); font-size: .78rem; color: var(--text-muted); margin-bottom: 8px; }
.book-info .meta {
    display: flex; justify-content: space-between;
    font-family: var(--font-ui); font-size: .72rem; color: var(--text-muted);
    margin-top: auto; gap: 6px; flex-wrap: wrap;
}

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    margin-bottom: 20px;
}
.filter-bar .input { flex: 1 1 240px; min-width: 0; padding: 10px 14px; font-size: .92rem; }
.filter-bar .select { flex: 0 1 auto; min-width: 160px; padding: 10px 36px 10px 14px; font-size: .92rem; }
.filter-bar .btn { flex: 0 0 auto; min-height: 42px; }
.filter-chip {
    padding: 6px 14px; border-radius: 999px;
    background: var(--parchment); color: var(--ink-2);
    font-family: var(--font-ui); font-size: .82rem;
    border: 1px solid var(--line);
    transition: all .15s; white-space: nowrap;
    text-decoration: none;
}
.filter-chip:hover { border-color: var(--emerald); background: var(--ivory); }
.filter-chip.active { background: var(--emerald); color: white; border-color: var(--emerald); }

/* ---------- Book detail ---------- */
.book-detail {
    display: grid; grid-template-columns: 1fr; gap: 24px;
    align-items: flex-start;
}
.book-detail-cover {
    aspect-ratio: 2/3; border-radius: var(--r-lg); overflow: hidden;
    box-shadow: 0 30px 60px rgba(15,42,29,.3); border: 1px solid var(--gold);
    max-width: 220px; margin: 0 auto;
}
.book-detail h1 { font-size: clamp(1.5rem, 3.6vw, 2.4rem); margin-bottom: 6px; }
.book-detail .author { font-family: var(--font-body); font-style: italic; font-size: 1.1rem; color: var(--bark); margin-bottom: 14px; }
.book-detail .meta-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.book-detail .description { font-size: 1rem; line-height: 1.8; color: var(--text-soft); }

.review-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.review-head .name { font-weight: 600; font-family: var(--font-ui); }
.review-head .when { color: var(--text-muted); font-size: .85rem; font-family: var(--font-ui); }

@media (min-width: 800px) {
    .book-detail { grid-template-columns: 280px 1fr; gap: 40px; }
    .book-detail-cover { max-width: none; margin: 0; }
}

/* ---------- Reader (FULL IMMERSIVE) ---------- */
body.reader-mode { background: var(--ink); }
body.reader-mode .topbar,
body.reader-mode .footer { display: none; }
body.reader-mode .main { max-width: 100%; margin: 0; padding: 0; min-height: 100vh; }
body.reader-mode .flash-wrap { max-width: 100%; padding: 8px 12px; margin: 0; }

.reader-wrap {
    min-height: 100vh;
    background: var(--ink);
    display: flex; flex-direction: column;
}
.reader-toolbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(15,42,29,.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(221,161,94,.25);
    color: var(--ivory);
    padding: 10px 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    font-family: var(--font-ui);
}
.reader-toolbar .reader-back {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 12px; border-radius: var(--r);
    background: rgba(255,255,255,.06);
    color: var(--ivory); text-decoration: none;
    font-size: .85rem; border: 1px solid rgba(221,161,94,.25);
}
.reader-toolbar .reader-back:hover { background: rgba(221,161,94,.18); color: var(--gold-soft); }
.reader-toolbar .reader-back i { width: 16px; height: 16px; }
.reader-toolbar .reader-title { min-width: 0; text-align: center; padding: 0 8px; }
.reader-toolbar .reader-title .t {
    font-family: var(--font-serif); color: var(--gold-soft);
    font-size: 1.05rem; font-weight: 700; line-height: 1.1;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reader-toolbar .reader-title .a {
    font-size: .78rem; opacity: .7;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reader-controls { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.reader-btn {
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(221,161,94,.25);
    color: var(--ivory);
    padding: 8px;
    width: 38px; height: 38px;
    border-radius: var(--r);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s;
}
.reader-btn:hover { background: rgba(221,161,94,.18); border-color: var(--gold); color: var(--gold-soft); }
.reader-btn:disabled { opacity: .4; cursor: not-allowed; }
.reader-btn i { width: 18px; height: 18px; }
.reader-page-info {
    color: var(--gold-soft);
    font-family: var(--font-ui); font-size: .82rem;
    padding: 0 8px; white-space: nowrap;
}

.reader-canvas-wrap {
    flex: 1;
    padding: 16px 8px 32px;
    overflow: auto;
    text-align: center;
    background: var(--ink);
}
.reader-canvas-wrap canvas {
    box-shadow: 0 30px 80px rgba(0,0,0,.5);
    border-radius: 4px;
    max-width: 100%; height: auto;
    background: white;
}

@media (max-width: 720px) {
    .reader-toolbar { grid-template-columns: 1fr; gap: 8px; }
    .reader-toolbar .reader-title { text-align: left; padding: 0; }
    .reader-toolbar .reader-title .t { font-size: .95rem; }
    .reader-controls { justify-content: center; flex-wrap: wrap; }
    .reader-btn { width: 36px; height: 36px; }
    .reader-canvas-wrap { padding: 8px; }
}

/* ---------- Profile ---------- */
.profile-header {
    background: linear-gradient(135deg, #0F2A1D 0%, #2D6A4F 100%);
    color: var(--ivory);
    padding: 28px 20px;
    border-radius: var(--r-xl);
    border: 1px solid var(--gold);
    box-shadow: var(--shadow-lg);
    display: flex; flex-direction: column; gap: 18px; align-items: center;
    text-align: center;
    margin-bottom: 24px;
    position: relative; overflow: hidden;
}
.profile-header::before {
    content: ''; position: absolute; top: -60px; right: -60px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(149,213,178,.18) 0%, transparent 70%);
    border-radius: 50%;
}
.profile-header::after {
    content: ''; position: absolute; bottom: -80px; left: 30%;
    width: 280px; height: 280px;
    background: radial-gradient(circle, rgba(221,161,94,.14) 0%, transparent 70%);
    border-radius: 50%;
}
.profile-header > * { position: relative; z-index: 1; }
.profile-header h1 { color: var(--ivory); margin-bottom: 4px; font-size: clamp(1.5rem, 4vw, 2.4rem); }
.profile-header .username {
    color: var(--gold-soft); font-family: var(--font-ui);
    display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
    justify-content: center;
}
.profile-header .bio {
    color: rgba(251,252,244,.88); font-style: italic;
    max-width: 600px; margin-top: 12px; line-height: 1.6;
}
.profile-stats {
    display: flex; gap: 20px; margin-top: 14px;
    justify-content: center; flex-wrap: wrap;
}
.profile-stats div { font-family: var(--font-ui); }
.profile-stats strong {
    display: block; font-family: var(--font-serif); font-size: 1.4rem;
    color: var(--gold-soft);
}
.profile-stats span {
    font-size: .7rem; color: rgba(251,252,244,.65);
    text-transform: uppercase; letter-spacing: .12em;
}
.profile-actions {
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
    align-items: center;
}

.profile-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }

@media (min-width: 800px) {
    .profile-header {
        flex-direction: row;
        align-items: center;
        text-align: left;
        padding: 36px 32px;
        gap: 28px;
    }
    .profile-header > div:nth-of-type(1) { flex: 1; min-width: 0; }
    .profile-header .username { justify-content: flex-start; }
    .profile-stats { justify-content: flex-start; }
    .profile-actions { flex-direction: row; align-items: center; flex-wrap: wrap; }
}
@media (min-width: 1000px) {
    .profile-grid { grid-template-columns: 280px 1fr; }
}

/* ---------- Feed / Posts ---------- */
.feed-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: flex-start;
}
.feed-side { display: none; }
@media (min-width: 900px) {
    .feed-layout { grid-template-columns: 240px minmax(0, 1fr); gap: 20px; }
    .feed-side {
        display: block;
        position: sticky;
        top: calc(var(--topbar-h) + 16px);
        max-height: calc(100vh - var(--topbar-h) - 24px);
        overflow-y: auto;
        scrollbar-width: thin;
    }
}
@media (min-width: 1180px) {
    .feed-layout { grid-template-columns: 240px minmax(0, 1fr) 280px; gap: 24px; }
    .feed-side.feed-right { display: block; }
}
.feed-layout > main { min-width: 0; }

.side-card { padding: 16px; }
.side-card h4 {
    font-family: var(--font-ui); font-size: .72rem;
    letter-spacing: .15em; text-transform: uppercase;
    color: var(--emerald); font-weight: 700; margin-bottom: 12px;
}
.side-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--r);
    color: var(--text); font-family: var(--font-ui); font-size: .9rem;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.side-link:hover { background: var(--parchment); }
.side-link i { width: 16px; height: 16px; color: var(--ink-3); flex-shrink: 0; }
.side-link.active { background: var(--emerald); color: white; }
.side-link.active i { color: var(--gold-soft); }

/* Friend suggestions in sidebar */
.suggest-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    min-width: 0;
}
.suggest-row:last-child { border-bottom: 0; }
.suggest-row > .avatar { flex: 0 0 auto; }
.suggest-row > form { flex: 0 0 auto; margin: 0; }
.suggest-info { flex: 1 1 auto; min-width: 0; overflow: hidden; }
.suggest-name {
    font-family: var(--font-ui); font-size: .88rem; font-weight: 600;
    color: var(--ink); text-decoration: none; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.suggest-name:hover { color: var(--emerald); }
.suggest-uname {
    font-size: .75rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Side books grid */
.side-books-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.side-book-thumb { display: block; text-decoration: none; }
.side-book-thumb img {
    width: 100%; aspect-ratio: 2/3; object-fit: cover;
    border-radius: 6px; border: 1px solid var(--line);
    transition: border-color .15s;
}
.side-book-thumb:hover img { border-color: var(--emerald); }

.composer {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 14px; margin-bottom: 16px;
}
.composer-row { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.composer textarea {
    width: 100%; min-height: 70px; resize: vertical;
    border: 0; outline: none; font-family: var(--font-body); font-size: 1rem;
    background: transparent;
}
.composer-actions {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
.composer-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.composer-tools button, .composer-tools .check {
    background: transparent; border: 0; color: var(--text-muted); cursor: pointer;
    padding: 6px 10px; border-radius: var(--r); display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-ui); font-size: .85rem;
}
.composer-tools button:hover, .composer-tools .check:hover {
    background: var(--parchment); color: var(--ink);
}

.post {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 16px; margin-bottom: 14px;
    transition: border-color .15s, box-shadow .15s;
}
.post:hover { border-color: var(--sage); box-shadow: var(--shadow-sm); }
.post-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.post-head .meta { flex: 1; min-width: 0; }
.post-head .meta .name-row {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.post-head .name {
    font-weight: 600; color: var(--ink);
    font-family: var(--font-ui); text-decoration: none;
}
.post-head .name:hover { color: var(--emerald); }
.post-head .when { font-family: var(--font-ui); font-size: .78rem; color: var(--text-muted); }
.post-content { font-size: .98rem; line-height: 1.7; white-space: pre-wrap; word-wrap: break-word; }
.post-image {
    margin-top: 10px; border-radius: var(--r); overflow: hidden;
    border: 1px solid var(--line); max-height: 460px;
}
.post-image img { width: 100%; object-fit: cover; }
.post-book {
    margin-top: 10px;
    display: flex; gap: 12px; padding: 10px;
    border: 1px dashed var(--emerald); border-radius: var(--r);
    background: rgba(149,213,178,.08);
    min-width: 0; text-decoration: none; color: inherit;
}
.post-book img { width: 50px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.post-book > div { min-width: 0; }
.post-book .t { font-family: var(--font-serif); font-weight: 700; }
.post-book .a { font-size: .85rem; color: var(--text-muted); font-family: var(--font-ui); }
.post-actions {
    display: flex; gap: 4px; margin-top: 12px; padding-top: 10px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}
.post-actions button, .post-actions a {
    background: transparent; border: 0; color: var(--text-muted); cursor: pointer;
    padding: 8px 12px; border-radius: var(--r); display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-ui); font-size: .85rem; font-weight: 500;
    text-decoration: none;
}
.post-actions button:hover, .post-actions a:hover { background: var(--parchment); color: var(--ink); }
.post-actions .liked { color: var(--burgundy); }
.post-actions .liked i { fill: var(--burgundy); }

.post-comments { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.comment { display: flex; gap: 10px; margin-bottom: 10px; }
.comment .bubble { background: var(--parchment); padding: 8px 14px; border-radius: 14px; flex: 1; min-width: 0; word-wrap: break-word; }
.comment .bubble .n { font-weight: 600; font-family: var(--font-ui); font-size: .85rem; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.comment-form input {
    flex: 1; min-width: 0; padding: 8px 14px; border-radius: 999px;
    border: 1px solid var(--line); font-family: var(--font-body); background: var(--ivory);
}
.comment-form input:focus { outline: none; border-color: var(--emerald); }

/* Post detail */
.post-detail-wrap { max-width: 780px; margin: 0 auto; }
.comments-title {
    font-family: var(--font-ui); font-size: .8rem;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--emerald); font-weight: 700; margin-bottom: 14px;
}
.comment .bubble .n {
    color: var(--ink); text-decoration: none; font-weight: 600;
}
.comment .bubble .n:hover { color: var(--emerald); }
.comment .bubble .when-ago {
    color: var(--text-muted); font-size: .75rem; font-family: var(--font-ui);
}
.comment-del-btn {
    color: var(--text-muted); width: 32px; height: 32px;
}
.comment-del-btn:hover { background: var(--parchment); color: var(--burgundy); }
.comment-del-btn i { width: 14px; height: 14px; }

/* Public chat / forum */
.forum-intro { margin-bottom: 24px; }
.room-card .room-meta {
    display: flex; gap: 14px; margin-top: 8px;
    color: var(--text-muted);
    font-size: .78rem; font-family: var(--font-ui);
}
.room-card .room-meta i {
    width: 12px; height: 12px; vertical-align: -2px; margin-right: 2px;
}
.room-header {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
    margin-bottom: 16px;
}
.room-header-info { min-width: 0; }
.room-header-info h2 { margin: 0; font-size: clamp(1.2rem, 2.5vw, 1.6rem); }
.room-header-info p { margin: 0; font-size: .9rem; }
.chat-layout-single { grid-template-columns: 1fr !important; }
.chat-page-wrap > .room-header {
    flex: 0 0 auto;
    padding: 12px var(--content-pad);
    margin: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.msg-author {
    font-size: .78rem; font-family: var(--font-ui);
    font-weight: 600; margin-bottom: 4px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.msg-author-name { color: var(--ink); text-decoration: none; }
.msg-author-name:hover { color: var(--emerald); }
.role-badge-sm { font-size: .58rem; padding: 2px 7px; }
.msg-del-link {
    color: var(--text-muted); font-size: .72rem;
    text-decoration: underline;
}
.msg-del-link:hover { color: var(--burgundy); }

/* ---------- Chat (DM) ---------- */
.chat-page-wrap {
    display: flex; flex-direction: column;
    flex: 1; min-height: 0;
    width: 100%;
}
.chat-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0;
    overflow: hidden;
    flex: 1;
    min-width: 0;
    min-height: 0;
}
body.chat-page .main > .chat-layout { height: 100%; }
body.chat-page .main > .chat-layout-wrapper {
    flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.chat-sidebar {
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column;
    background: var(--ivory);
    min-width: 0;
}
.chat-sidebar .head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: 8px;
}
.chat-sidebar .head h3 { margin: 0; font-size: 1.15rem; }
.chat-sidebar .list { flex: 1; overflow-y: auto; }
.chat-thread {
    display: flex; gap: 10px; padding: 12px 14px; cursor: pointer; align-items: center;
    border-bottom: 1px solid var(--line);
    text-decoration: none; color: var(--text);
    min-width: 0;
}
.chat-thread:hover, .chat-thread.active { background: var(--parchment); }
.chat-thread.active { border-left: 3px solid var(--emerald); }
.chat-thread img { flex-shrink: 0; }
.chat-thread .info { flex: 1; min-width: 0; }
.chat-thread .n { font-weight: 600; font-family: var(--font-ui); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread .last { color: var(--text-muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread .badge-unread {
    background: var(--burgundy); color: white; font-size: .7rem; padding: 2px 8px;
    border-radius: 999px; font-family: var(--font-ui); flex-shrink: 0; font-weight: 700;
}

.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    display: flex; gap: 10px; align-items: center;
}
.chat-header .name { font-family: var(--font-ui); font-weight: 600; }
.chat-header .icon-btn { color: var(--text); width: 36px; height: 36px; }
.chat-header .icon-btn:hover { background: var(--parchment); color: var(--ink); }

.chat-body {
    flex: 1; overflow-y: auto; padding: 16px;
    background:
      radial-gradient(circle at 20% 20%, rgba(149,213,178,.08), transparent 40%),
      radial-gradient(circle at 80% 80%, rgba(221,161,94,.05), transparent 40%),
      var(--ivory);
}
.chat-msg { display: flex; gap: 8px; margin-bottom: 12px; max-width: 85%; min-width: 0; }
.chat-msg > div { min-width: 0; }
.chat-msg .bubble {
    padding: 10px 14px; border-radius: 16px;
    background: var(--parchment); color: var(--ink);
    box-shadow: var(--shadow-sm); font-size: .95rem;
    word-wrap: break-word; min-width: 0;
}
.chat-msg .when {
    font-size: .7rem; color: var(--text-muted);
    margin-top: 4px; font-family: var(--font-ui);
}
.chat-msg.mine { margin-left: auto; flex-direction: row-reverse; }
.chat-msg.mine .bubble {
    background: linear-gradient(135deg, var(--emerald), var(--ink-3)); color: var(--ivory);
}
.chat-msg.mine .when { text-align: right; }

.chat-input {
    display: flex; gap: 8px; padding: 12px 16px;
    border-top: 1px solid var(--line); background: var(--surface);
    align-items: center;
}
.chat-input input {
    flex: 1; padding: 10px 16px; border-radius: 999px;
    border: 1px solid var(--line); font-family: var(--font-body);
    font-size: .95rem; min-width: 0; background: var(--ivory);
}
.chat-input input:focus { outline: none; border-color: var(--emerald); }
.chat-input .btn { flex-shrink: 0; }

.chat-empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: var(--text-muted); padding: 32px 20px; text-align: center;
}
.chat-empty i { width: 56px; height: 56px; color: var(--emerald); margin-bottom: 12px; }
.chat-empty h3 { color: var(--ink); margin-bottom: 8px; }
.chat-empty p { max-width: 360px; }
.chat-empty .actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; justify-content: center; }

/* Mobile chat: side-by-side switching */
@media (max-width: 760px) {
    .chat-layout {
        margin: 0;
        border-left: 0;
        border-right: 0;
        border-top: 0;
    }
    .chat-layout.has-peer .chat-sidebar { display: none; }
    .chat-layout:not(.has-peer) .chat-main { display: none; }
    .chat-back-btn { display: inline-flex; }
    .chat-msg { max-width: 90%; }
    .chat-page-wrap > .room-header { padding: 10px 12px; gap: 8px; }
    .chat-page-wrap > .room-header h2 { font-size: 1.05rem; }
    .chat-page-wrap > .room-header p { font-size: .82rem; }
}
@media (min-width: 760px) { .chat-layout { grid-template-columns: 300px minmax(0, 1fr); } }
@media (min-width: 1000px) { .chat-layout { grid-template-columns: 340px minmax(0, 1fr); } }

/* ---------- Public chat rooms ---------- */
.rooms-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 24px; }
.room-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 18px; transition: all .2s; text-decoration: none; color: var(--text);
    display: flex; flex-direction: column; gap: 8px;
}
.room-card:hover {
    border-color: var(--emerald); transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.room-card .icon {
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, var(--emerald), var(--ink-3));
    color: var(--gold-soft);
    display: inline-flex; align-items: center; justify-content: center;
}
.room-card h3 { margin: 0; font-size: 1.15rem; }
.room-card .desc { color: var(--text-muted); font-size: .9rem; }
@media (min-width: 600px) {
    .rooms-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* ---------- Reading list ---------- */
.rl-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.rl-col {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 16px;
}
.rl-col h3 {
    display: flex; align-items: center; gap: 8px;
    padding-bottom: 10px; border-bottom: 2px solid var(--gold);
    margin-bottom: 12px; font-size: 1.1rem;
}
.rl-col h3 i { color: var(--emerald); }
.rl-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rl-item:last-child { border-bottom: 0; }
.rl-item img { width: 50px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.rl-item .info { flex: 1; min-width: 0; }
.rl-item .info .t {
    font-family: var(--font-serif); font-weight: 700; font-size: .95rem; line-height: 1.3;
    color: var(--ink); text-decoration: none; display: block;
}
.rl-item .info .t:hover { color: var(--emerald); }
.rl-item .info .a { font-size: .8rem; color: var(--text-muted); }
.rl-count {
    font-size: .85rem; font-family: var(--font-ui); font-weight: normal;
    color: var(--text-muted);
}
.rl-empty {
    font-family: var(--font-ui); font-size: .9rem; text-align: center;
    padding: 30px 0; color: var(--text-muted); margin: 0;
}
.rl-progress-text {
    font-size: .75rem; color: var(--text-muted);
    font-family: var(--font-ui); margin-top: 4px;
}

/* Profile review tab */
.review-thumb {
    border-radius: 6px !important;
    width: 48px !important; height: 64px !important;
    object-fit: cover !important;
    border: 1px solid var(--line);
}
.star-icon { width: 14px !important; height: 14px !important; color: #d6cfb8; }
.star-icon.filled { color: var(--gold); fill: currentColor; }

/* Tag sizes */
.tag.tag-sm { font-size: .7rem; padding: 2px 8px; }

/* Search results post link */
.search-post-link {
    display: block; text-decoration: none; color: var(--text);
}
.search-post-link:hover {
    border-color: var(--emerald);
    box-shadow: var(--shadow-sm);
}
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--emerald), var(--gold)); }
@media (min-width: 760px) { .rl-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Notifications ---------- */
.notif-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.notif-item {
    display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line);
    text-decoration: none; color: var(--text);
    transition: background .15s;
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--parchment); }
.notif-item.unread { background: rgba(149,213,178,.12); border-left: 3px solid var(--emerald); }
.notif-item .icon {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px;
    background: linear-gradient(135deg, var(--emerald), var(--ink-3));
    color: var(--gold-soft);
    display: inline-flex; align-items: center; justify-content: center;
}
.notif-item .msg { flex: 1; min-width: 0; }
.notif-item .when { font-size: .78rem; color: var(--text-muted); font-family: var(--font-ui); }

/* ---------- Events ---------- */
.event-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 16px; margin-bottom: 12px;
    display: grid; grid-template-columns: 70px 1fr; gap: 14px; align-items: flex-start;
}
.event-date {
    background: linear-gradient(135deg, var(--ink-2), var(--emerald));
    color: var(--gold-soft); border-radius: var(--r); text-align: center;
    padding: 10px 6px; font-family: var(--font-ui);
}
.event-date .d { font-family: var(--font-serif); font-size: 1.5rem; font-weight: 800; line-height: 1; color: var(--ivory); }
.event-date .m { font-size: .68rem; letter-spacing: .15em; text-transform: uppercase; }
.event-card h3 { margin: 0 0 4px; font-size: 1.1rem; }
.event-card .meta { font-family: var(--font-ui); font-size: .82rem; color: var(--text-muted); line-height: 1.6; }
.event-card .meta-icon {
    width: 14px; height: 14px; vertical-align: -2px; margin-right: 1px;
}
.event-desc { margin-top: 8px; margin-bottom: 0; line-height: 1.65; }
.rsvp-form { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; }
.event-past { opacity: .7; }
.event-past h3 { margin: 0; font-size: 1rem; }
.event-date-past { background: linear-gradient(135deg, #58605A, #6B7B6F) !important; }
.event-card > div:last-child > form,
.event-card > form {
    grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap;
}
.event-card .btn { flex: 1 1 auto; min-width: 0; }
@media (min-width: 760px) {
    .event-card { grid-template-columns: 80px 1fr auto; gap: 18px; align-items: center; }
    .event-card > form { grid-column: auto; }
    .event-card .btn { flex: 0 0 auto; }
}

/* ---------- Admin layout ---------- */
.admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: flex-start;
}
.admin-side {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 14px;
}
.admin-side h4 {
    font-family: var(--font-ui); font-size: .72rem;
    letter-spacing: .15em; text-transform: uppercase;
    color: var(--emerald); font-weight: 700;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 6px;
}
.admin-side h4 i { width: 14px; height: 14px; }
.admin-side .side-link { width: 100%; }
.admin-side hr { margin: 10px 0; }
.admin-layout > div:not(.admin-side) { min-width: 0; }
@media (min-width: 1000px) {
    .admin-layout { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
    .admin-side { position: sticky; top: calc(var(--topbar-h) + 16px); }
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); padding: 18px;
    position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; top: -25px; right: -25px;
    width: 90px; height: 90px;
    background: radial-gradient(circle, rgba(149,213,178,.18) 0%, transparent 70%);
    border-radius: 50%;
}
.stat-card h5 {
    font-family: var(--font-ui); font-size: .7rem; text-transform: uppercase;
    letter-spacing: .15em; color: var(--text-muted); margin-bottom: 6px;
    font-weight: 600;
}
.stat-card .num {
    font-family: var(--font-serif); font-size: 1.9rem; font-weight: 800;
    color: var(--ink); line-height: 1;
}
.stat-card .sub { font-family: var(--font-ui); font-size: .78rem; color: var(--text-muted); margin-top: 6px; }
.stat-card .icon {
    position: absolute; right: 14px; top: 14px;
    color: var(--emerald); width: 22px; height: 22px;
}
@media (min-width: 720px) { .admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .admin-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1300px) { .admin-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* Admin twocol */
.admin-twocol { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 1100px) { .admin-twocol { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; } }

/* Admin tables: konsisten dgn .table-wrap, mobile auto-scroll */
.admin-layout .card:has(> .table) { padding: 0; overflow: hidden; }
.admin-layout .card:has(> .table) > h3 { padding: 16px 16px 0; }
.admin-layout .card > .table { margin: 8px 0 0; }

/* ---------- Search ---------- */
.search-section { margin-bottom: 28px; }
.search-section h3 { padding-bottom: 8px; border-bottom: 2px solid var(--gold); margin-bottom: 14px; }

/* ---------- Friends ---------- */
.friend-grid {
    display: grid; gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.friend-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 16px; text-align: center; transition: border-color .15s, box-shadow .15s;
    text-decoration: none; color: var(--text); display: flex; flex-direction: column;
    align-items: center; gap: 4px;
}
.friend-card:hover { border-color: var(--emerald); box-shadow: var(--shadow-sm); }
.friend-card .avatar-lg { margin: 0 auto; }
.friend-card .name { font-weight: 700; font-family: var(--font-ui); margin-top: 8px; line-height: 1.2; }
.friend-card .uname { color: var(--text-muted); font-size: .82rem; font-family: var(--font-ui); margin-bottom: 8px; }
.friend-card .actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; width: 100%; }
.friend-card-link {
    display: flex; flex-direction: column; align-items: center;
    text-decoration: none; color: inherit; gap: 4px; width: 100%;
}
.friend-card-link:hover .name { color: var(--emerald); }
@media (min-width: 600px) {
    .friend-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
}

/* ---------- Error pages ---------- */
.err-page {
    text-align: center; padding: 60px 16px; max-width: 600px; margin: 0 auto;
}
.err-page .code {
    font-family: var(--font-serif); font-size: clamp(5rem, 18vw, 8rem);
    font-weight: 900; color: var(--gold); line-height: 1;
}
.err-page h2 { font-size: clamp(1.4rem, 4vw, 2rem); margin: 12px 0; }
.err-page p { color: var(--text-muted); }

/* ---------- Feature grid (home dashboard) ---------- */
.feature-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px; margin: 28px 0;
}
.feature-card {
    padding: 22px; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); text-align: center; transition: all .2s;
    text-decoration: none; color: var(--text);
}
.feature-card:hover {
    border-color: var(--emerald); transform: translateY(-3px); box-shadow: var(--shadow);
}
.feature-card .icon {
    width: 56px; height: 56px; margin: 0 auto 12px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--emerald), var(--ink-3));
    color: var(--gold-soft);
    display: inline-flex; align-items: center; justify-content: center;
}
.feature-card .icon i { width: 28px; height: 28px; }
.feature-card h3 { margin-bottom: 6px; font-size: 1.05rem; }
.feature-card p { color: var(--text-muted); font-size: .88rem; margin: 0; line-height: 1.5; }

/* ---------- CTA box ---------- */
.cta-box {
    margin-top: 44px;
    padding: 32px 24px;
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-3) 100%);
    color: var(--ivory);
    border-radius: var(--r-lg);
    border: 1px solid rgba(221,161,94,.45);
    text-align: center;
    position: relative; overflow: hidden;
}
.cta-box::before {
    content: ''; position: absolute; right: -40px; top: -40px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(221,161,94,.18), transparent 70%);
    border-radius: 50%;
}
.cta-box > * { position: relative; z-index: 1; }
.cta-box h2 { color: var(--gold-soft); }
.cta-box p { color: rgba(251,252,244,.85); max-width: 560px; margin: 0 auto 20px; }
@media (min-width: 720px) { .cta-box { padding: 42px 40px; margin-top: 52px; } }

/* =========================================================
   MOBILE OVERRIDES (<=640px)
   ========================================================= */
@media (max-width: 640px) {
    /* Profile */
    .profile-header {
        padding: 22px 16px; gap: 14px; border-radius: var(--r-lg);
    }
    .profile-header h1 { font-size: 1.4rem; }
    .profile-header .bio { font-size: .92rem; }
    .profile-stats { gap: 14px; }
    .profile-stats strong { font-size: 1.2rem; }
    .profile-actions { width: 100%; }
    .profile-actions .btn,
    .profile-actions form { flex: 1 1 auto; min-width: 0; }
    .profile-actions form .btn { width: 100%; }

    /* Hero */
    .hero h1 { font-size: 1.7rem; line-height: 1.15; }
    .hero p { font-size: .95rem; }
    .hero-actions { gap: 8px; }
    .hero-actions .btn { flex: 1 1 100%; min-width: 0; }

    /* Section title */
    .section-title { gap: 8px; align-items: flex-start; flex-direction: column; }
    .section-title > .btn { width: 100%; padding: 8px 12px; font-size: .82rem; }

    /* Book grid */
    .book-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .book-info { padding: 10px 12px 12px; }
    .book-info .title { font-size: .88rem; }

    /* Book detail */
    .book-detail .meta-row { gap: 6px; }
    .book-detail .meta-row .btn { flex: 1 1 auto; min-width: 0; padding: 9px 12px; font-size: .85rem; }

    /* Filter bar */
    .filter-bar { padding: 10px 12px; gap: 8px; flex-direction: column; align-items: stretch; }
    .filter-bar .input,
    .filter-bar .select { flex: 1 1 auto; min-width: 0; width: 100%; }
    .filter-bar .btn { width: 100%; }

    /* Card */
    .card, .card-classic { padding: 16px; }

    /* Composer */
    .composer { padding: 12px; }
    .composer-row { gap: 8px; }
    .composer textarea { min-height: 56px; font-size: .95rem; }
    .composer-actions { gap: 6px; padding-top: 10px; }
    .composer-tools button { padding: 5px 8px; font-size: .78rem; }
    .composer-tools button span,
    .composer-tools .check span { display: none; }

    /* Post */
    .post { padding: 14px; }
    .post-head .name { font-size: .92rem; }
    .post-image { max-height: 320px; }
    .post-actions { gap: 2px; }
    .post-actions button, .post-actions a { padding: 6px 8px; font-size: .8rem; }

    .post-book { padding: 8px; gap: 8px; }
    .post-book img { width: 42px; }

    .comment .bubble { padding: 7px 12px; font-size: .88rem; }

    /* Chat */
    .chat-sidebar .head { padding: 12px 14px; }
    .chat-thread { padding: 10px 12px; }
    .chat-body { padding: 12px; }
    .chat-msg .bubble { font-size: .92rem; padding: 9px 12px; }
    .chat-input { padding: 10px 12px; gap: 6px; }
    .chat-input input { padding: 9px 14px; font-size: 16px; }
    .chat-input .btn { padding: 9px 14px; min-width: 44px; }

    /* Public chat rooms */
    .room-card { padding: 14px; }
    .room-card h3 { font-size: 1rem; }

    /* Reading list */
    .rl-col { padding: 12px; }
    .rl-col h3 { font-size: 1rem; }
    .rl-item img { width: 42px; }
    .rl-item .info .t { font-size: .9rem; }

    /* Notifications */
    .notif-item { padding: 12px 14px; gap: 10px; }
    .notif-item .icon { width: 32px; height: 32px; }

    /* Events */
    .event-card { padding: 12px; gap: 10px; grid-template-columns: 60px 1fr; }
    .event-date .d { font-size: 1.25rem; }
    .event-card h3 { font-size: 1rem; }
    .event-card .meta { font-size: .78rem; }

    /* Admin stats */
    .admin-stats { gap: 8px; grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: 14px; }
    .stat-card .num { font-size: 1.4rem; }
    .stat-card::after { width: 60px; height: 60px; top: -15px; right: -15px; }
    .stat-card .icon { top: 10px; right: 10px; width: 18px; height: 18px; }

    /* Admin sidebar collapsed inline */
    .admin-side { padding: 12px; }
    .admin-side .side-link { font-size: .88rem; padding: 9px 11px; }

    /* Error page */
    .err-page { padding: 36px 12px; }
    .err-page .code { font-size: 5rem; }

    /* Feature grid */
    .feature-grid { grid-template-columns: 1fr; gap: 10px; margin: 20px 0; }
    .feature-card { padding: 18px; }
    .feature-card .icon { width: 48px; height: 48px; }
    .feature-card .icon i { width: 24px; height: 24px; }

    /* Auth */
    .auth-form { padding: 28px 20px; }
    .auth-form .form-box { max-width: 100%; }

    /* Tabs */
    .tabs { padding-bottom: 2px; }
    .tabs a { padding: 10px 12px; font-size: .85rem; }

    .filter-chip { padding: 6px 12px; font-size: .78rem; }

    /* Friend grid */
    .friend-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .friend-card { padding: 12px; }
    .friend-card .name { font-size: .9rem; }

    .rooms-grid { gap: 10px; }

    .modal { padding: 20px; width: 100%; }
}

/* Mobile kecil (<=380px) */
@media (max-width: 380px) {
    .book-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .book-info .title { font-size: .82rem; }
    .book-info .author { font-size: .72rem; }
    .profile-stats { gap: 10px; }
    .profile-stats strong { font-size: 1.1rem; }
    .profile-stats span { font-size: .65rem; }
    .hero h1 { font-size: 1.5rem; }
    .admin-stats { grid-template-columns: 1fr; }
    .event-card { grid-template-columns: 56px 1fr; gap: 8px; padding: 10px; }
    .event-date .d { font-size: 1.1rem; }
    .friend-grid { grid-template-columns: 1fr; }
    .feature-card h3 { font-size: .98rem; }
}
