/* =========================================================================
   Naskah Jadi — Katalog Buku
   Mobile-first · editorial · minimalis
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
    --paper: #faf7f2;
    --paper-soft: #f4efe7;
    --surface: #ffffff;
    --ink: #14213d;
    --ink-2: #2b3653;
    --muted: #6b7280;
    --line: #e7e0d6;
    --line-strong: #d9cfc0;
    --accent: #b5552f;
    --accent-dark: #974426;

    --radius: 16px;
    --radius-sm: 11px;
    --shadow-sm: 0 1px 2px rgba(20, 33, 61, .05), 0 10px 24px -18px rgba(20, 33, 61, .45);
    --shadow-md: 0 18px 40px -22px rgba(20, 33, 61, .45);

    --maxw: 1120px;
    --gutter: clamp(1rem, 4.5vw, 2.5rem);

    --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    max-width: 100%;
    overflow-x: hidden;
    background: var(--paper);
    color: var(--ink-2);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -0.015em;
    overflow-wrap: anywhere;
}

p {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

img, svg, video {
    display: block;
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.container.narrow {
    max-width: 720px;
}

/* Hindari judul tertutup header sticky saat lompat ke anchor */
[id] {
    scroll-margin-top: 84px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -120px;
    z-index: 100;
    padding: .7rem 1.1rem;
    border-radius: 8px;
    background: var(--ink);
    color: #fdf8f1;
    font-size: .9rem;
    font-weight: 600;
    transition: top .2s ease;
}

.skip-link:focus {
    top: .75rem;
}

/* ---------- Typography atoms ---------- */
.eyebrow {
    margin: 0 0 .6rem;
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.section-title {
    font-size: clamp(1.75rem, 5.5vw, 2.6rem);
}

.catalog-meta {
    margin-top: .6rem;
    color: var(--muted);
    font-size: .9rem;
}

.catalog-meta strong {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
}

/* ---------- Header & navigation ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(250, 247, 242, .9);
    backdrop-filter: saturate(150%) blur(10px);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 62px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--ink);
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--ink);
    color: #f7e9d8;
    font-family: var(--font-serif);
    font-size: .85rem;
}

.brand-name {
    font-size: 1.08rem;
}

/* Hamburger */
.nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.nav-toggle-bar {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform .22s ease, opacity .22s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-list {
    display: flex;
    flex-direction: column;
    padding: .5rem var(--gutter) 1rem;
}

.nav-list a {
    position: relative;
    display: block;
    min-height: 48px;
    padding: .8rem .25rem;
    color: var(--ink-2);
    font-weight: 500;
    transition: color .18s ease;
}

.nav-list a:hover,
.nav-list a[aria-current="page"] {
    color: var(--ink);
}

.site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    display: none;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
}

.site-nav.is-open {
    display: block;
}

/* ---------- Buttons ---------- */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 48px;
    padding: .7rem 1.35rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #fdf8f1;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: transform .15s ease, background .18s ease, border-color .18s ease, color .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.button:hover {
    background: #0e1729;
}

.button:active {
    transform: translateY(1px);
}

.button-outline {
    background: transparent;
    border-color: var(--line-strong);
    color: var(--ink);
}

.button-outline:hover {
    background: var(--surface);
    border-color: var(--ink);
}

.button-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}

.button-ghost:hover {
    background: rgba(20, 33, 61, .05);
    color: var(--ink);
}

.button-danger {
    background: transparent;
    border-color: #e4c4b8;
    color: var(--accent-dark);
}

.button-danger:hover {
    background: #fbeee8;
    border-color: var(--accent);
}

.button-sm {
    min-height: 42px;
    padding: .45rem .95rem;
    font-size: .875rem;
}

.button-block {
    width: 100%;
}

/* Form logout tampil seperti tautan (tombol tetap untuk aksesibilitas) */
.logout-form {
    display: inline;
    margin: 0;
}

/* Form inline untuk aksi baris (tombol hapus) */
.inline-form {
    display: inline-flex;
    margin: 0;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font: inherit;
    line-height: inherit;
}

/* ---------- Hero ---------- */
.hero {
    padding-block: clamp(3rem, 10vw, 6.5rem) clamp(2rem, 5vw, 3rem);
    border-bottom: 1px solid var(--line);
}

.hero-title {
    max-width: 16ch;
    font-size: clamp(2.2rem, 10vw, 4.25rem);
    font-weight: 500;
}

.hero-text {
    margin-top: 1.25rem;
    max-width: 56ch;
    color: var(--muted);
    font-size: clamp(1rem, 3.8vw, 1.15rem);
}

.hero-meta {
    margin-top: 1.75rem;
    color: var(--muted);
    font-size: .95rem;
}

.hero-meta strong {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
}

/* ---------- Catalog ---------- */
.catalog {
    padding-block: clamp(2.5rem, 7vw, 4.5rem);
}

.section-head {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.search {
    width: 100%;
}

.search-input {
    width: 100%;
    min-height: 50px;
    padding: .8rem 1.1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.search-input::placeholder {
    color: #9aa1ad;
}

.search-input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(20, 33, 61, .08);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 2rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: .4rem 1rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.chip:hover {
    border-color: var(--ink);
    color: var(--ink);
}

.chip.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fdf8f1;
}

/* ---------- Category dropdown (public) ---------- */
.category-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: 2rem;
}

.select-wrap {
    position: relative;
    flex: 1 1 220px;
    max-width: 320px;
}

.select-input {
    width: 100%;
    min-height: 50px;
    padding: .8rem 2.6rem .8rem 1.1rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2314213d' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.1rem center;
    background-size: 11px 8px;
    color: var(--ink);
    font-weight: 600;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color .18s ease, box-shadow .18s ease;
    -webkit-tap-highlight-color: transparent;
}

.select-input:hover {
    border-color: var(--ink);
}

.select-input:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(20, 33, 61, .08);
}

/* ---------- Book cards ---------- */
.book-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.1rem;
}

.book-card {
    display: flex;
}

.book-card[hidden] {
    display: none;
}

.book-card-link {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 1.6rem 1.4rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    -webkit-tap-highlight-color: transparent;
}

.book-card-link:hover {
    transform: translateY(-4px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.book-index {
    font-family: var(--font-serif);
    font-size: 1.9rem;
    line-height: 1;
    color: var(--accent);
}

.book-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: .4rem;
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--line);
}

.book-title {
    font-size: 1.32rem;
    font-weight: 600;
}

.book-author {
    color: var(--muted);
    font-size: .9rem;
}

.book-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: .1rem;
    color: var(--ink-2);
    font-size: .93rem;
}

.book-cta {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: .45rem;
    min-height: 44px;
    margin-top: 1.4rem;
    padding: .5rem 1.15rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink);
    font-size: .85rem;
    font-weight: 600;
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.book-cta span {
    transition: transform .18s ease;
}

.book-card-link:hover .book-cta {
    background: var(--ink);
    border-color: var(--ink);
    color: #fdf8f1;
}

.book-card-link:hover .book-cta span {
    transform: translateX(3px);
}

/* ---------- Compact book list (public) ---------- */
.book-list {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--line);
}

.book-item {
    border-bottom: 1px solid var(--line);
}

.book-item[hidden] {
    display: none;
}

.book-item-link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem .25rem;
    transition: background .15s ease, padding .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.book-item-link:hover {
    background: var(--surface);
    padding-inline: .85rem;
}

.book-item-title {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
}

.book-item-link:hover .book-item-title {
    color: var(--accent-dark);
}

.book-item-category {
    flex-shrink: 0;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ---------- Category groups (public) ---------- */
.cat-groups {
    display: flex;
    flex-direction: column;
    gap: clamp(2.25rem, 6vw, 3.5rem);
}

.cat-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.1rem;
    padding-bottom: .6rem;
    border-bottom: 1px solid var(--line);
}

.cat-group-title {
    font-size: clamp(1.15rem, 4vw, 1.5rem);
    letter-spacing: .02em;
}

.cat-group-count {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* ---------- Empty states ---------- */
.empty-state {
    margin: 0;
    padding: clamp(2.25rem, 7vw, 3.5rem) 1.5rem;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    color: var(--muted);
    text-align: center;
}

.empty-title {
    display: block;
    margin-bottom: .5rem;
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
}

.empty-text {
    display: block;
    max-width: 48ch;
    margin-inline: auto;
    color: var(--muted);
    font-size: .95rem;
}

.empty-state .button {
    margin-top: 1.5rem;
}

.empty-state[hidden] {
    display: none;
}

.empty-inline {
    padding-block: 2.5rem;
}

.empty-inline .empty-title {
    font-size: 1.1rem;
}

.empty-hero {
    padding-block: clamp(3rem, 10vw, 5rem);
}

/* ---------- About ---------- */
.about {
    padding-block: clamp(3rem, 8vw, 5.5rem);
    border-top: 1px solid var(--line);
    background: var(--paper-soft);
}

.about-inner {
    display: grid;
    gap: 1.5rem;
}

.about-text p {
    max-width: 62ch;
    color: var(--ink-2);
}

.about-text p + p {
    margin-top: 1rem;
}

/* ---------- Book detail / outline ---------- */
.detail-wrap {
    padding-block: clamp(1.5rem, 5vw, 2.5rem) clamp(3rem, 8vw, 5rem);
}

.back-row {
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-height: 44px;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 500;
    transition: color .18s ease;
}

.back-link:hover {
    color: var(--ink);
}

.book-detail {
    max-width: 820px;
}

.detail-head {
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--line);
}

.detail-category {
    color: var(--accent);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.detail-title {
    margin-top: .5rem;
    font-size: clamp(1.6rem, 6vw, 2.25rem);
    font-weight: 500;
}

.detail-byline {
    margin-top: .75rem;
    color: var(--muted);
    font-size: 1rem;
}

.detail-author {
    color: var(--ink);
    font-weight: 600;
}

.dot {
    margin: 0 .5rem;
    color: var(--line-strong);
}

.detail-section {
    padding-block: 1.75rem;
}

.detail-section + .detail-section {
    border-top: 1px solid var(--line);
}

.prose {
    max-width: 68ch;
    color: var(--ink-2);
    line-height: 1.85;
}

/* Outline hierarchy */
.outline {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.chapter-head {
    padding-top: .9rem;
    border-top: 1px solid var(--line-strong);
}

.chapter-label {
    margin: 0 0 .3rem;
    color: var(--accent);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.chapter-title {
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0;
}

.chapter-summary {
    margin-top: .35rem;
    max-width: 68ch;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.75;
}

.section-list {
    display: flex;
    flex-direction: column;
    margin-top: 1.1rem;
    border-left: 2px solid var(--line);
}

.section-item {
    display: grid;
    grid-template-columns: 2.6rem 1fr;
    gap: .6rem;
    padding: .6rem 0 .6rem 1rem;
}

.section-number {
    padding-top: .12rem;
    color: var(--accent);
    font-family: var(--font-serif);
    font-size: .95rem;
    font-weight: 600;
}

.section-name {
    display: block;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.6;
}

.section-desc {
    display: block;
    margin-top: .15rem;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
}

.detail-foot {
    padding-top: 2rem;
}

/* ---------- Footer ---------- */
.site-footer {
    margin-top: 2rem;
    border-top: 1px solid var(--line);
    background: var(--paper-soft);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-block: 2.5rem;
}

.footer-brand {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
}

.footer-note,
.footer-copy {
    color: var(--muted);
    font-size: .85rem;
}

.footer-meta {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.footer-admin {
    color: var(--muted);
    font-size: .85rem;
}

.footer-admin:hover {
    color: var(--ink);
}

/* =========================================================================
   Admin
   ========================================================================= */
.admin-body {
    background: var(--paper);
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.admin-header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .35rem 1rem;
    min-height: 64px;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem 1rem;
}

.admin-nav-link {
    position: relative;
    padding: .35rem 0;
    color: var(--muted);
    font-size: .9rem;
    font-weight: 500;
    transition: color .18s ease;
}

.admin-nav-link:hover {
    color: var(--ink);
}

.admin-nav-link.is-active {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 5px;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
}

.link-muted {
    color: var(--muted);
    font-size: .9rem;
}

.link-muted:hover {
    color: var(--ink);
}

.admin-main {
    padding-block: clamp(1.75rem, 5vw, 3rem) 4rem;
}

.admin-title-row {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.admin-count {
    color: var(--muted);
    font-size: .9rem;
}

.admin-count strong {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: 1.2rem;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.admin-row {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.admin-row-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.admin-row-meta {
    margin-top: .2rem;
    color: var(--muted);
    font-size: .875rem;
}

.admin-row-count {
    margin-top: .35rem;
    color: var(--accent);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.admin-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.admin-row-cat {
    display: inline-block;
    margin-bottom: .25rem;
    color: var(--accent);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 2rem;
}

/* Dashboard statistics */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: clamp(1.25rem, 5vw, 1.75rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.stat-value {
    color: var(--ink);
    font-family: var(--font-serif);
    font-size: clamp(2rem, 8vw, 2.75rem);
    font-weight: 600;
    line-height: 1;
}

.stat-label {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
}

/* Tabel data (kategori) */
.data-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: .9rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: .93rem;
}

.data-table thead th {
    color: var(--muted);
    font-size: .72rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    background: var(--paper-soft);
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table .th-actions,
.data-table td[data-label="Aksi"] {
    text-align: right;
}

.cell-strong {
    color: var(--ink);
    font-weight: 600;
}

.table-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

/* ---------- Forms ---------- */
.form-card {
    margin-top: 1.75rem;
    padding: clamp(1.25rem, 5vw, 2.25rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: 1.1rem;
}

.field:last-child {
    margin-bottom: 0;
}

.field label {
    color: var(--ink);
    font-size: .88rem;
    font-weight: 600;
}

.req {
    color: var(--accent);
}

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: .75rem .9rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--paper);
    transition: border-color .18s ease, box-shadow .18s ease;
}

.field input,
.field select {
    min-height: 48px;
}

.field textarea {
    resize: vertical;
    min-height: 72px;
    line-height: 1.6;
}

.field-hint {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.55;
}

.field-hint strong {
    color: var(--ink-2);
}

.outline-input {
    min-height: 280px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: .9rem;
    line-height: 1.75;
    tab-size: 4;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--ink);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(20, 33, 61, .08);
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding-top: .5rem;
    border-top: 1px solid var(--line);
}

.form-actions .button {
    width: 100%;
}

/* ---------- Alerts ---------- */
.alert {
    padding: .85rem 1.1rem;
    margin: 0 0 1.25rem;
    border-radius: var(--radius-sm);
    font-size: .9rem;
}

.alert[hidden] {
    display: none;
}

.alert-error {
    border: 1px solid #e4c4b8;
    background: #fbeee8;
    color: var(--accent-dark);
}

.alert-success {
    border: 1px solid #cfe0cf;
    background: #eef4ec;
    color: #38613a;
}

/* ---------- Auth ---------- */
.auth {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(1.25rem, 6vw, 3rem) var(--gutter);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: clamp(1.5rem, 7vw, 2.5rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-md);
}

.brand-center {
    justify-content: center;
    margin-bottom: 1.5rem;
}

.auth-head {
    margin-bottom: 1.5rem;
}

.auth-title {
    font-size: clamp(1.5rem, 6vw, 1.9rem);
}

.auth-text {
    margin-top: .5rem;
    color: var(--muted);
    font-size: .92rem;
}

.auth-foot {
    margin-top: 1.5rem;
    text-align: center;
    font-size: .875rem;
}

.auth-foot a {
    color: var(--muted);
}

.auth-foot a:hover {
    color: var(--ink);
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (min-width: 560px) {
    .section-head {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }

    .search {
        max-width: 320px;
    }

    .form-actions {
        flex-direction: row;
    }

    .form-actions .button {
        width: auto;
    }
}

@media (min-width: 680px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }

    .about-inner {
        grid-template-columns: 1fr 1.3fr;
        gap: 2.5rem;
        align-items: start;
    }
}

/* Desktop navigation */
@media (min-width: 720px) {
    .nav-toggle {
        display: none;
    }

    .site-nav {
        position: static;
        display: block;
        background: none;
        border: 0;
        box-shadow: none;
    }

    .nav-list {
        flex-direction: row;
        align-items: center;
        gap: 1.6rem;
        padding: 0;
    }

    .nav-list a {
        min-height: auto;
        padding: .4rem 0;
        font-size: .95rem;
    }

    .nav-list a[aria-current="page"]::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -3px;
        height: 2px;
        background: var(--accent);
    }

    .footer-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .footer-meta {
        align-items: flex-end;
    }

    .admin-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .admin-row-main {
        min-width: 0;
    }
}

@media (min-width: 768px) {
    .admin-title-row {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
    }
}

@media (min-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Tabel kategori menjadi kartu di layar kecil + header admin tidak sticky */
@media (max-width: 640px) {
    .admin-header {
        position: static;
    }

    .data-table thead {
        display: none;
    }

    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }

    .data-table {
        border: 0;
        border-radius: 0;
        background: none;
    }

    .data-table tr {
        margin-bottom: .85rem;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }

    .data-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        text-align: right;
    }

    .data-table td:last-child {
        border-bottom: 0;
    }

    .data-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: .72rem;
        font-weight: 700;
        letter-spacing: .1em;
        text-transform: uppercase;
        text-align: left;
    }
}

/* Layar sangat kecil: sembunyikan nama brand di header admin agar tidak meluber */
@media (max-width: 400px) {
    .admin-header .brand-name {
        display: none;
    }

    .admin-nav {
        gap: .6rem;
    }

    .admin-main {
        padding-block: 1.5rem 3rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        transition: none !important;
        animation: none !important;
    }
}
