/* Libryate design system — tokens taken from the Figma file (material theme + admin kit) */
:root {
  --primary: #004AAD;          /* key-colors/primary */
  --primary-95: #EEF0FF;       /* primary95: search fields, chips, tabs */
  --primary-90: #DCE2FF;
  --secondary: #E0711E;        /* key-colors/secondary: active nav, accents */
  --secondary-98: #FFF8F5;     /* sidebar, cards */
  --secondary-95: #FFEDE5;
  --secondary-90: #FFDBC8;
  --secondary-70: #FF8D40;
  --n10: #1C1B1B;              /* neutral10: headings */
  --n22: #222222;
  --n30: #484646;
  --n35: #545252;
  --n40: #605E5E;
  --n60: #939090;              /* inactive nav */
  --n70: #ADAAAA;              /* card borders */
  --n80: #C9C6C5;              /* panel borders */
  --n90: #E5E2E1;
  --nv80: #C5C6D0;
  --text-primary: #252D3C;
  --text-secondary: #344054;
  --text-tertiary: #777F8C;
  --font-secondary: #5A5D6C;
  --icon: #667085;
  --bg-light: #F9F9FA;
  --page-bg: #FBF8F7;
  --success: #22A447;
  --warning: #F0B400;
  --error: #F6505C;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-2: 0 1px 8px rgba(16, 24, 40, .06), 0 1px 10px rgba(16, 24, 40, .1);
  --font: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-ui: 'Poppins', 'Lato', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--n10); background: #fff; font-size: 14px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; color: var(--n10); }
h1 { font-size: 32px; font-weight: 700; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: .4px solid var(--n80); margin: 16px 0; }
.icon { width: 24px; height: 24px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 32px; height: 32px; }
.muted { color: var(--text-tertiary); }
.small { font-size: 12px; }
.ui { font-family: var(--font-ui); }
.hidden { display: none !important; }
.row { display: flex; gap: 16px; align-items: center; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Buttons ------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent; font: 600 14px/1 var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #003D8F; }
.btn-accent { background: var(--secondary); color: #fff; }
.btn-accent:hover { background: #C9611A; }
.btn-light { background: var(--primary-95); color: var(--primary); border-color: #B9C4F5; }
.btn-outline { background: #fff; color: var(--n10); border-color: var(--n80); font-weight: 500; }
.btn-outline:hover { border-color: var(--n60); }
.btn-danger { background: #FFF0F1; color: var(--error); border-color: #FFD2D5; }
.btn-ghost { background: transparent; color: var(--primary); padding: 0 8px; }
.btn-block { width: 100%; height: 48px; font-size: 16px; font-weight: 500; }
.btn-sm { height: 28px; padding: 0 12px; font: 500 12px/1 var(--font-ui); border-radius: var(--radius); }
.btn:disabled, .btn.disabled { background: #CACAD3; border-color: #CACAD3; color: #fff; cursor: not-allowed; }
.chip-btn { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 6px 12px 6px 8px; background: #fff; border: .4px solid var(--nv80); border-radius: var(--radius); box-shadow: var(--shadow-1); font: 500 12px/1.5 var(--font-ui); color: var(--n35); cursor: pointer; text-decoration: none !important; }
.chip-btn .icon { width: 16px; height: 16px; }
.link-accent { color: var(--secondary); font-weight: 700; }

/* Forms ----------------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field > span, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--n22); }
.input, .select, .textarea { width: 100%; height: 48px; padding: 0 12px; border: 1px solid #E4E4E7; border-radius: var(--radius); background: #fff; font: 400 15px var(--font); color: var(--n10); outline: none; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 120px; padding: 12px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%23667085' stroke-width='1.6' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0, 74, 173, .12); }
.input::placeholder, .textarea::placeholder { color: #8A8A93; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--error); }
.error-text { color: var(--error); font-size: 12px; margin-top: 4px; }
.help { color: var(--text-tertiary); font-size: 12px; margin-top: 4px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--icon); cursor: pointer; padding: 4px; }
.search { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: .4px solid var(--n80); background: var(--bg-light); border-radius: var(--radius); }
.search input { border: 0; outline: none; background: transparent; width: 100%; font: 400 12px var(--font-ui); }
.search-lg { height: 48px; border-radius: 999px; background: var(--primary-95); border: 0; padding: 0 18px; }
.search-lg input { font-size: 14px; }
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--secondary); margin: 2px 0 0; flex: none; }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #E4E4E7; border-radius: 999px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + span { background: var(--secondary); }
.switch input:checked + span::before { transform: translateX(18px); }
.radio-card { display: block; border: 1px solid #E4E4E7; border-radius: var(--radius); padding: 14px 16px; cursor: pointer; position: relative; background: #fff; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:checked) { border-color: var(--secondary); background: var(--secondary-98); }
.radio-card .tick { position: absolute; right: 14px; top: 14px; color: #D4D4D8; }
.radio-card:has(input:checked) .tick { color: var(--secondary); }
.otp { display: flex; gap: 12px; }
.otp input { width: 48px; height: 48px; text-align: center; font-size: 18px; border: 1px solid #E4E4E7; border-radius: var(--radius); background: #FAFAFA; }
.pill-check { display: inline-flex; }
.pill-check input { display: none; }
.pill-check span { display: inline-block; padding: 6px 12px; border: 1px solid #D4D4D8; border-radius: 999px; color: var(--n40); cursor: pointer; font-size: 14px; }
.pill-check input:checked + span { border-color: var(--secondary); background: var(--secondary-98); color: var(--secondary); }
.strength { display: flex; gap: 6px; margin: 6px 0 12px; }
.strength i { flex: 1; height: 3px; border-radius: 3px; background: var(--primary-95); }
.strength i.on { background: var(--secondary); }

/* Alerts -------------------------------------------------------------- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.alert-success { background: #EDFAF1; border-color: #BDE8CB; color: #146C2E; }
.alert-error { background: #FFF0F1; border-color: #FFD2D5; color: #B42318; }
.alert-info { background: var(--primary-95); border-color: #C7D2FE; color: var(--primary); }

/* Status text (tables) ------------------------------------------------ */
.status { font: 500 12px/1.5 var(--font-ui); }
.st-approved, .st-paid, .st-completed, .st-active, .st-success { color: var(--success); }
.st-under_review, .st-processing, .st-requested { color: var(--secondary); }
.st-pending, .st-on_hold, .st-trialing, .st-paused { color: var(--warning); }
.st-rejected, .st-failed, .st-suspended, .st-expired, .st-deactivated, .st-cancelled { color: var(--error); }
.st-new, .st-draft, .st-closed, .st-abandoned { color: var(--n35); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font: 500 11px/1.6 var(--font-ui); background: var(--primary-95); color: var(--primary); }
.badge-accent { background: var(--secondary-95); color: var(--secondary); }
.badge-gray { background: #F2F2F3; color: var(--n35); }

/* ===== Admin panel (Figma: Admin page) ===================================== */
.admin { display: flex; min-height: 100vh; background: #fff; }
.admin-side { width: 250px; flex: none; background: var(--secondary-98); padding: 24px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-logo { display: flex; align-items: center; height: 60px; padding: 8px; margin-bottom: 16px; }
.admin-logo img { max-height: 44px; width: auto; }
.wordmark { font: 800 28px/1 var(--font); letter-spacing: -.5px; color: var(--primary); }
.wordmark::after { content: '.'; color: var(--secondary); }
.nav-group { margin-top: 16px; }
.nav-title { font: 700 12px/1.58 var(--font); letter-spacing: 1.8px; text-transform: uppercase; color: var(--n10); margin-bottom: 8px; }
.nav-item { white-space: nowrap; display: flex; align-items: center; gap: 8px; height: 40px; padding: 8px; border-radius: var(--radius); color: var(--n60); font: 700 14px/1.5 var(--font); letter-spacing: .07px; text-decoration: none !important; }
.nav-item .icon { color: var(--n60); }
.nav-item span { padding: 3.7px 7.4px; }
.nav-item:hover { background: rgba(224, 113, 30, .08); }
.nav-item.active { background: var(--secondary); color: #fff; }
.nav-item.active .icon { color: #fff; }
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: #fff; position: sticky; top: 0; z-index: 20; }
.admin-top .crumb { font: 700 14px/1.5 var(--font); color: var(--text-primary); }
.top-actions { display: flex; align-items: center; gap: 16px; }
.bell { position: relative; width: 44px; height: 44px; border-radius: 50%; background: #E9E9EA; display: grid; place-items: center; color: var(--n10); }
.bell .dot { position: absolute; top: 9px; right: 11px; width: 9px; height: 9px; border-radius: 50%; background: var(--error); border: 2px solid #E9E9EA; }
.avatar { width: 50px; height: 50px; border-radius: 50%; background: #BFE3F6; display: grid; place-items: center; overflow: hidden; color: var(--primary); font-weight: 700; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; border: 1.5px solid #fff; }
.avatar-lg { width: 80px; height: 80px; font-size: 24px; background: #111; color: #fff; }
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.admin-content { padding: 8px 16px 40px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; }
.page-head h1 { font: 500 16px/27px var(--font); margin: 0; color: var(--n10); }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: #fff; border: .5px solid var(--n90); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 6px; z-index: 50; display: none; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font: 400 13px var(--font-ui); color: var(--n10); text-align: left; cursor: pointer; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg-light); }
.dropdown-menu .danger { color: var(--error); }

/* Cards & stats */
.card { background: #fff; border: .4px solid var(--n80); border-radius: var(--radius); padding: 16.4px; }
.card-plain { border-color: var(--n70); }
.card-title { font: 700 16px/1.5 var(--font); margin: 0; }
.stat-label { font: 500 12px/1.5 var(--font); color: var(--n10); }
.stat-value { font: 500 40px/1.2 var(--font); letter-spacing: -.8px; color: var(--n10); margin-top: 8px; }
.tabs-pill { display: inline-flex; background: var(--primary-95); border-radius: var(--radius); padding: 2px; gap: 8px; }
.tabs-pill a, .tabs-pill button { min-width: 100px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 5px; font: 500 12px/1.5 var(--font-ui); color: var(--n10); cursor: pointer; text-decoration: none; padding: 0 10px; }
.tabs-pill .active { background: #fff; }
.tabs-chip { display: flex; gap: 8px; }
.tabs-chip a { height: 28px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 8px; border: .4px solid var(--n70); color: var(--n10); font: 600 12px var(--font-ui); text-decoration: none; }
.tabs-chip a.active { background: var(--primary-95); border-color: var(--primary-95); color: var(--primary); }
.tabs-line { display: flex; gap: 24px; border-bottom: 1px solid #EEE; margin-bottom: 16px; overflow-x: auto; }
.tabs-line a { padding: 10px 0; color: var(--n35); font-size: 14px; white-space: nowrap; text-decoration: none; border-bottom: 2px solid transparent; }
.tabs-line a.active { color: var(--n10); border-bottom-color: var(--secondary); font-weight: 600; }

/* Data table (Figma: User Management, Content Approval…) */
.table-card { border: .4px solid var(--n80); border-radius: var(--radius); background: #fff; }
.table-tools { display: flex; align-items: center; gap: 12px; padding: 8px; flex-wrap: wrap; }
.table-tools .search { flex: 1; min-width: 220px; max-width: 460px; }
.table-tools .count { margin-left: auto; font: 400 12px var(--font-ui); color: var(--text-tertiary); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font: 600 12px/1.5 var(--font-ui); color: var(--n10); padding: 10px 12px; border-top: .4px solid var(--n90); border-bottom: .4px solid var(--n90); white-space: nowrap; background: #fff; }
table.data td { padding: 14px 12px; color: #262527; vertical-align: middle; border-bottom: .4px solid #F2F0EF; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #FCFBFB; }
table.data .cb { width: 36px; }
table.data .cb input { width: 16px; height: 16px; accent-color: var(--secondary); }
table.data .actions { width: 70px; text-align: center; }
table.data .strong { font-weight: 700; color: var(--text-primary); }
.thumb { width: 22px; height: 30px; object-fit: cover; border-radius: 2px; background: #EEE; flex: none; }
.dots { border: 0; background: transparent; cursor: pointer; padding: 4px 8px; border-radius: 6px; color: var(--n10); }
.dots:hover { background: var(--bg-light); }
.empty { padding: 48px 16px; text-align: center; color: var(--text-tertiary); }
.pagination { display: flex; justify-content: center; align-items: center; gap: 4px; padding: 16px 0; }
.pagination a, .pagination span { min-width: 28px; height: 28px; display: grid; place-items: center; font: 400 12px var(--font-ui); color: var(--n10); border-radius: 6px; text-decoration: none; padding: 0 6px; }
.pagination .current { background: var(--primary-95); color: var(--primary); font-weight: 600; }
.pagination .disabled { color: var(--n80); }

/* Drawer (Figma: Profile Details / Add Member / Author Content) */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(28, 27, 27, .35); z-index: 90; display: none; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(523px, 100%); background: #fff; z-index: 100; box-shadow: -8px 0 24px rgba(0,0,0,.08); display: none; flex-direction: column; }
.drawer.open, .drawer-backdrop.open { display: flex; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; }
.drawer-head h2 { font: 400 16px var(--font); margin: 0; color: var(--text-primary); }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 24px 24px; }
.drawer-foot { border-top: 1px solid #EEE; padding: 16px 24px; display: flex; justify-content: flex-end; gap: 8px; }
.close-x { width: 24px; height: 24px; border-radius: 50%; background: #71717A; color: #fff; border: 0; display: grid; place-items: center; cursor: pointer; }
.close-x .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: 14px; }
.kv dt { color: var(--n10); }
.kv dd { margin: 0; text-align: right; color: var(--n10); }
.perm-list label { display: flex; justify-content: space-between; align-items: center; border: 1px solid #E4E4E7; border-radius: 4px; padding: 10px 8px; margin-bottom: 8px; font-size: 14px; cursor: pointer; }
.perm-list input { width: 18px; height: 18px; accent-color: var(--secondary); }

/* Charts (pure CSS/SVG) */
.chart { position: relative; height: 320px; display: flex; flex-direction: column; }
.chart-grid { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.chart-grid div { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 18px; height: 18px; color: var(--text-tertiary); }
.chart-grid div span { width: 28px; }
.chart-grid div i { flex: 1; border-top: 1px solid #E8E8EB; }
.chart-svg { position: absolute; left: 36px; top: 9px; width: calc(100% - 36px); height: calc(100% - 44px); }
.chart-x { display: flex; justify-content: space-between; padding: 8px 0 0 36px; font-size: 12px; color: var(--text-tertiary); }
.gauge { position: relative; width: 210px; height: 105px; overflow: hidden; margin: 8px auto 0; }
.gauge svg { width: 210px; height: 105px; }
.gauge .g-label { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; }
.list-row { display: flex; justify-content: space-between; gap: 12px; font: 400 12px/1.5 var(--font-ui); color: var(--text-secondary); padding: 10px 0; border-bottom: .2px solid var(--n80); }
.list-row:last-child { border-bottom: 0; }
.list-row .t { font-weight: 600; }
.list-row .n { font-weight: 700; color: var(--secondary); text-align: right; }

/* Auth (admin) */
.auth-page { min-height: 100vh; background: var(--page-bg); display: flex; flex-direction: column; align-items: center; padding: 120px 16px 40px; }
.auth-card { width: 100%; max-width: 448px; background: #fff; border: 1px solid #EDEAE9; border-radius: var(--radius); padding: 24px; margin-top: 48px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }

/* ===== Reader / author web app (mirrors the mobile Figma screens) ====== */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: #fff; }
.app-top { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid #F1EEED; }
.app-top-inner { max-width: 1200px; margin: 0 auto; height: 64px; display: flex; align-items: center; gap: 24px; padding: 0 16px; }
.app-nav { display: flex; gap: 4px; }
.app-nav a { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: var(--radius); color: var(--n60); font-weight: 600; text-decoration: none; }
.app-nav a.active { color: var(--primary); background: var(--primary-95); }
.app-main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 24px 16px 96px; }
.bottom-nav { display: none; }
@media (max-width: 760px) {
  .app-nav { display: none; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: 72px; background: #fff; border-top: 1px solid #EEE; z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--n60); font-size: 13px; text-decoration: none; }
  .bottom-nav a.active { color: var(--primary); }
  h1 { font-size: 26px; }
}
.greet { display: flex; align-items: center; gap: 12px; }
.greet .avatar { width: 40px; height: 40px; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 12px; }
.section-head h2 { font-size: 16px; margin: 0; }
.see-all { color: var(--secondary); font-weight: 700; font-size: 14px; }
.h-scroll { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.h-scroll > * { scroll-snap-align: start; flex: none; }
.cover { aspect-ratio: 2 / 3; width: 100%; object-fit: cover; border-radius: 2px; background: linear-gradient(135deg, #E9EDF8, #FDEBDD); box-shadow: 0 6px 14px rgba(0,0,0,.18); }
.cover-fallback { aspect-ratio: 2 / 3; width: 100%; border-radius: 2px; display: flex; align-items: flex-end; padding: 12px; color: #fff; font-weight: 800; font-size: 15px; line-height: 1.2; background: linear-gradient(160deg, var(--secondary), #A8470A); box-shadow: 0 6px 14px rgba(0,0,0,.18); }
.book-tile { width: 132px; text-decoration: none !important; color: var(--n10); }
.book-tile .t { margin-top: 10px; font-weight: 700; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-tile .a { color: var(--n60); font-size: 12px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 24px 16px; }
.continue-card { width: 300px; display: flex; gap: 12px; background: var(--secondary-98); border: 1px solid var(--secondary-90); border-radius: var(--radius); padding: 10px; text-decoration: none !important; color: var(--n10); }
.continue-card img, .continue-card .cover-fallback { width: 64px; height: 96px; aspect-ratio: auto; object-fit: cover; font-size: 10px; }
.progress { height: 8px; background: #E5E4E3; border-radius: 999px; overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; background: var(--secondary); border-radius: 999px; }
.mini-actions { display: flex; gap: 16px; color: var(--n30); font-size: 14px; }
.mini-actions span { display: inline-flex; align-items: center; gap: 6px; }
.stars { color: var(--secondary); letter-spacing: 2px; font-size: 16px; }
.author-bubble { width: 84px; text-align: center; font-size: 12px; color: var(--n30); text-decoration: none !important; }
.author-bubble .avatar { width: 84px; height: 84px; background: #F8E2D2; font-size: 26px; margin-bottom: 6px; }
.cat-chip { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; background: var(--primary-95); border-radius: 999px; color: var(--n10); font-size: 15px; white-space: nowrap; text-decoration: none !important; }
.cat-chip.active { background: var(--primary); color: #fff; }
.quote { text-align: center; font-style: italic; color: var(--n22); max-width: 560px; margin: 0 auto 20px; }
.filter-pills { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 16px; }
.filter-pills a { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #D4D4D8; color: var(--n40); white-space: nowrap; text-decoration: none; }
.filter-pills a.active { border-color: var(--secondary); color: var(--n10); background: var(--secondary-98); }
.sort-line { display: flex; align-items: center; gap: 12px; color: var(--n30); font-size: 14px; margin-bottom: 16px; }
.sort-line::after { content: ''; order: 2; flex: 1; border-top: 1px solid #EEE; }
.sort-line select { order: 3; border: 0; background: none; font: inherit; color: var(--n10); }
.settings-list { border-top: 1px solid #F1F1F1; }
.settings-list > a, .settings-list > div, .settings-list > button, .settings-list > label { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 0; border: 0; border-bottom: 1px solid #F1F1F1; background: none; color: var(--n22); font: inherit; text-decoration: none; cursor: pointer; text-align: left; }
.settings-list .icon { color: var(--n35); width: 20px; height: 20px; }
.settings-list .grow + .icon { color: var(--n35); }
.logout-btn { display: flex; justify-content: center; align-items: center; gap: 8px; width: 100%; height: 48px; background: #FFF3F1; color: var(--error); border: 0; border-radius: var(--radius); font: 600 14px var(--font); cursor: pointer; }
.plan-card { border: 1px solid #D9D6F5; border-radius: 16px; padding: 24px; text-align: center; background: #fff; box-shadow: 0 18px 30px -18px rgba(0, 74, 173, .35); }
.plan-price { font: 500 44px/1.1 var(--font-ui); margin: 10px 0; letter-spacing: -1px; }
.benefit { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--secondary-90); background: var(--secondary-98); border-radius: var(--radius); margin-bottom: 10px; }
.benefit.off { background: #fff; border-color: #D4D4D8; }
.benefit .icon { color: var(--secondary); width: 18px; height: 18px; margin-top: 2px; }
.benefit.off .icon { color: var(--n60); }
.checkout-box { background: var(--primary-95); border: 1px solid #8FA6E8; border-radius: 12px; padding: 16px; }
.summary-box { background: var(--bg-light); border-radius: 12px; padding: 16px; }
.notif { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid #F3F3F3; }
.notif .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--secondary); margin-top: 7px; flex: none; }
.notif.read .dot { background: #D4D4D8; }
.dropzone { border: 1.5px dashed var(--secondary-70); background: var(--secondary-98); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; min-height: 130px; cursor: pointer; font-size: 13px; color: var(--n30); position: relative; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone img { max-height: 110px; }

/* Reader */
.reader { max-width: 760px; margin: 0 auto; }
.reader-top { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.reader-title { font-weight: 600; text-align: center; flex: 1; }
.reader-page { font-family: Georgia, 'Times New Roman', serif; font-size: 18px; line-height: 1.75; color: #1D1D1F; padding: 8px 0 40px; position: relative; user-select: text; }
.reader-page h1, .reader-page h2 { font-family: var(--font); text-align: center; }
.reader-page .chapter-label { text-align: center; color: var(--n35); font-family: var(--font); font-size: 16px; }
.reader.no-copy .reader-page { -webkit-user-select: text; }
mark.hl { background: #8BD48F; padding: 0 1px; border-radius: 2px; }
mark.tts { background: #FFE8A3; }
.watermark { position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: .05; display: flex; flex-wrap: wrap; align-content: space-around; justify-content: space-around; font-size: 18px; transform: rotate(-18deg); overflow: hidden; }
.reader-bar { position: sticky; bottom: 0; background: #fff; padding: 12px 0; display: flex; gap: 12px; align-items: center; border-top: 1px solid #F1F1F1; }
.chapter-nav { flex: 1; display: flex; justify-content: space-between; align-items: center; background: var(--primary-95); border-radius: 999px; height: 48px; padding: 0 14px; font-weight: 600; }
.chapter-nav button, .icon-btn { border: 0; background: none; cursor: pointer; color: var(--primary); display: grid; place-items: center; padding: 6px; border-radius: 50%; }
.icon-btn:hover { background: var(--primary-95); }
.icon-btn:disabled { color: var(--n80); cursor: default; }
.sel-menu { position: absolute; z-index: 60; background: #111; color: #fff; border-radius: 8px; display: none; padding: 4px; box-shadow: var(--shadow-2); }
.sel-menu button { background: none; border: 0; color: #fff; padding: 8px 12px; font: 500 14px var(--font); cursor: pointer; border-radius: 6px; }
.sel-menu button:hover { background: rgba(255,255,255,.12); }
.sel-menu::after { content: ''; position: absolute; bottom: -6px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: #111; }
.side-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); background: #fff; box-shadow: -8px 0 24px rgba(0,0,0,.08); z-index: 80; transform: translateX(100%); transition: transform .2s; display: flex; flex-direction: column; }
.side-panel.open { transform: none; }
.pdf-frame { width: 100%; height: calc(100vh - 160px); border: 0; background: #F4F4F5; border-radius: var(--radius); }

/* Public site */
.site-head { border-bottom: 1px solid #F1EEED; background: #fff; }
.site-head .inner, .site-foot .inner, .container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.site-head .inner { height: 72px; display: flex; align-items: center; gap: 24px; }
.site-nav { display: flex; gap: 20px; flex: 1; }
.site-nav a { color: var(--n30); font-weight: 600; }
.hero { padding: 64px 0; background: linear-gradient(180deg, var(--secondary-98), #fff); }
.hero h1 { font-size: 44px; max-width: 640px; }
.hero p { font-size: 18px; color: var(--n35); max-width: 560px; }
.site-foot { border-top: 1px solid #F1EEED; padding: 32px 0; margin-top: 48px; color: var(--n35); }
.site-foot .inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
@media (max-width: 760px) { .site-nav { display: none; } .hero h1 { font-size: 32px; } }
.prose { max-width: 760px; font-size: 16px; line-height: 1.75; }
.prose img { border-radius: var(--radius); }

/* Install */
.install { max-width: 720px; margin: 40px auto; padding: 0 16px; }
.check-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #EEE; }
.ok { color: var(--success); font-weight: 700; }
.bad { color: var(--error); font-weight: 700; }

body.dark { background: #141414; color: #EEE; }
body.dark .app-shell, body.dark .app-top, body.dark .bottom-nav { background: #141414; border-color: #2A2A2A; }
body.dark h1, body.dark h2, body.dark h3, body.dark .reader-page { color: #EEE; }
body.dark .reader-bar { background: #141414; border-color: #2A2A2A; }
