:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --line: #dbe5ef;
    --text: #1d2c3d;
    --muted: #607085;
    --primary: #0f6cbd;
    --primary-dark: #0b4f8a;
    --success-bg: #ddf8e8;
    --success-text: #177245;
    --warning-bg: #fff1cf;
    --warning-text: #9a6a00;
    --danger-bg: #ffe0e0;
    --danger-text: #b12626;
    --secondary-bg: #edf1f5;
    --secondary-text: #536273;
    --shadow: 0 18px 48px rgba(16, 35, 63, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Segoe UI', Tahoma, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; }
code { background: #eef3f8; padding: 2px 6px; border-radius: 6px; }

.shell { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, #0d2646 0%, #154276 100%); color: #fff; padding: 24px 18px; }
.brand { font-size: 22px; font-weight: 800; margin-bottom: 24px; }
.brand small { display: block; opacity: .72; font-size: 12px; margin-top: 6px; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav a { color: rgba(255,255,255,.86); text-decoration: none; padding: 12px 14px; border-radius: 14px; transition: .2s ease; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.main { padding: 24px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.crumb { color: var(--muted); font-size: 13px; }
.panel-wrap { display: flex; flex-direction: column; gap: 20px; }
.flash { padding: 14px 16px; border-radius: 12px; font-weight: 600; }
.flash.success { background: var(--success-bg); color: var(--success-text); }
.flash.error { background: var(--danger-bg); color: var(--danger-text); }

.lib-page-header,
.lib-toolbar,
.lib-form-actions,
.lib-quick-actions,
.lib-grid-transaction { display: flex; gap: 16px; }
.lib-page-header,
.lib-toolbar,
.lib-form-actions { align-items: center; justify-content: space-between; }
.lib-page-header { margin-bottom: 20px; flex-wrap: wrap; }
.lib-page-header h1 { margin: 0 0 4px; font-size: 30px; }
.lib-page-header p { margin: 0; color: var(--muted); }
.lib-panel,
.lib-card,
.catalog-card,
.service-card,
.detail-card,
.hero-stat-card,
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); }
.lib-grid-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.lib-card strong { display: block; font-size: 28px; color: #10233f; }
.lib-card span { color: var(--muted); }
.lib-grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.lib-grid-form label, .auth-form label { display: flex; flex-direction: column; gap: 8px; font-weight: 600; color: #263445; }
.lib-grid-form input, .lib-grid-form select, .lib-grid-form textarea, .scan-input, .lib-toolbar input, .lib-toolbar select, .auth-form input, .hero-search input, .catalog-filter-bar input, .catalog-filter-bar select {
    width: 100%; border: 1px solid #cfd8e3; border-radius: 14px; padding: 12px 14px; font-size: 14px; background: #fff;
}
.lib-span-full { grid-column: 1 / -1; }
.lib-table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.lib-table th, .lib-table td { padding: 12px; border-bottom: 1px solid #ebeff5; text-align: left; vertical-align: middle; }
.lib-empty, .public-empty { text-align: center; color: #7a8594; padding: 24px; background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; }
.btn { border: 0; border-radius: 14px; padding: 11px 18px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; cursor: pointer; transition: .2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary-bg); color: #223249; }
.lib-grid-transaction { display: grid; grid-template-columns: 360px 1fr; align-items: start; }
.lib-scan-result { min-height: 100px; margin-top: 16px; padding: 16px; border-radius: 14px; background: #f7fafc; border: 1px dashed #d2dbe6; }
.badge { display: inline-block; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-primary { background: #dbeeff; color: #0f5da6; }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-secondary { background: var(--secondary-bg); color: var(--secondary-text); }

.auth-body { min-height: 100vh; background: linear-gradient(135deg, #081f3d 0%, #114b8b 50%, #f4f7fb 50%, #f4f7fb 100%); }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.2fr .8fr; }
.auth-visual { display: flex; align-items: center; justify-content: center; padding: 48px; color: #fff; }
.auth-visual-inner { max-width: 520px; }
.auth-kicker, .hero-chip, .section-kicker { display: inline-block; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.14); color: inherit; font-size: 12px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.auth-visual h1 { font-size: 48px; line-height: 1.08; margin: 18px 0; }
.auth-visual p { color: rgba(255,255,255,.84); font-size: 17px; }
.auth-card-wrap { display: flex; align-items: center; justify-content: center; padding: 32px; }
.auth-card { width: min(460px, 100%); padding: 30px; }
.auth-card-header h2 { margin: 12px 0 6px; font-size: 32px; }
.auth-card-header p, .auth-hint { color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.auth-submit { width: 100%; }

.public-body { min-height:100vh; display:flex; flex-direction:column; background: linear-gradient(180deg, #f7fafc 0%, #eef4fb 100%); }
.public-header { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: 18px 28px; backdrop-filter: blur(16px); background: rgba(247,250,252,.88); border-bottom: 1px solid rgba(219,229,239,.85); }
.public-brand { font-size: 22px; font-weight: 800; text-decoration: none; color: #0e2a4c; }
.public-nav { display: flex; align-items: center; gap: 18px; }
.public-nav a { text-decoration: none; color: #27415c; font-weight: 600; }
.public-flash-wrap { padding: 18px 28px 0; }
.hero-section { display: grid; grid-template-columns: 1.25fr .75fr; gap: 24px; padding: 56px 28px 28px; align-items: stretch; }
.hero-copy { background: radial-gradient(circle at top left, #e9f4ff 0%, #ffffff 55%); border: 1px solid var(--line); border-radius: 28px; padding: 36px; box-shadow: var(--shadow); }
.hero-copy h1 { font-size: 50px; line-height: 1.04; margin: 18px 0; color: #10233f; }
.hero-copy p { color: var(--muted); font-size: 17px; max-width: 760px; }
.hero-search { display: flex; gap: 12px; margin: 22px 0 18px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hero-stat-card { display: flex; flex-direction: column; justify-content: space-between; min-height: 150px; background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%); }
.hero-stat-card strong { font-size: 34px; color: #0d335d; }
.hero-stat-card span { color: var(--muted); font-weight: 600; }
.public-section { padding: 18px 28px 40px; }
.compact-top { padding-top: 32px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 20px; }
.section-head h1, .section-head h2 { margin: 8px 0 0; font-size: 34px; color: #10233f; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.catalog-card { min-height: 220px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%); }
.catalog-card h3 { margin: 0; font-size: 22px; line-height: 1.2; }
.catalog-card h3 a { text-decoration: none; color: #10233f; }
.catalog-card p, .catalog-line { margin: 0; color: var(--muted); }
.catalog-meta { color: #0f6cbd; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.catalog-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.wide-card { min-height: 260px; }
.catalog-filter-bar { display: grid; grid-template-columns: 1fr 220px 150px; gap: 12px; margin-bottom: 20px; }
.service-strip { padding-top: 10px; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.service-card h3 { margin-top: 0; margin-bottom: 8px; }
.service-card p { margin: 0; color: var(--muted); }
.detail-section .back-link { display: inline-block; margin-bottom: 16px; color: #0f6cbd; text-decoration: none; font-weight: 700; }
.detail-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; margin-bottom: 18px; }
.detail-main { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px; box-shadow: var(--shadow); }
.detail-main h1 { margin: 10px 0; font-size: 40px; }
.detail-author { font-size: 18px; color: var(--muted); margin-bottom: 16px; }
.detail-copy { color: #38506a; line-height: 1.7; margin-top: 18px; }
.detail-side { display: grid; gap: 12px; }
.detail-card strong { display: block; margin-bottom: 6px; }
 .public-footer { margin-top: auto; padding: 28px; display: flex; justify-content: space-between; gap: 16px; background: #0d2646; color: rgba(255,255,255,.9); }
.public-footer p { color: rgba(255,255,255,.72); }
.footer-links { display: flex; gap: 14px; align-items: start; flex-wrap: wrap; }
.footer-links a { color: #fff; text-decoration: none; }

@media (max-width: 1100px) {
    .hero-section, .detail-grid, .auth-shell, .shell { grid-template-columns: 1fr; }
    .hero-copy h1 { font-size: 40px; }
    .auth-visual { min-height: 320px; }
}

@media (max-width: 900px) {
    .lib-grid-summary, .lib-grid-form, .lib-grid-transaction, .hero-panel, .catalog-filter-bar { grid-template-columns: 1fr; }
    .lib-page-header, .lib-toolbar, .lib-form-actions, .topbar, .public-header, .public-nav, .hero-search, .section-head, .public-footer { flex-direction: column; align-items: stretch; }
    .main, .public-section, .hero-section, .public-flash-wrap { padding-left: 16px; padding-right: 16px; }
    .public-header { padding: 16px; }
    .hero-copy { padding: 24px; }
    .hero-copy h1 { font-size: 34px; }
    .detail-main h1 { font-size: 30px; }
    .topbar-user { justify-content: space-between; }
}
.brand-with-logo, .brand-inline { display:flex; align-items:center; gap:12px; }
.brand-logo { width:44px; height:44px; object-fit:contain; border-radius:12px; background:#fff; padding:6px; }
.topbar-logo { width:34px; height:34px; object-fit:contain; border-radius:10px; background:#fff; padding:4px; }
.auth-logo { width:78px; height:78px; object-fit:contain; border-radius:18px; background:rgba(255,255,255,.12); padding:10px; margin-bottom:18px; }
.member-hero { display:flex; gap:18px; align-items:center; }
.member-photo-wrap { flex-shrink:0; }
.member-photo { width:96px; height:96px; border-radius:24px; object-fit:cover; background:#eef4fb; display:flex; align-items:center; justify-content:center; font-size:36px; font-weight:800; color:#0f6cbd; }
.member-photo-fallback { border:2px dashed #b8d0ea; }
@media (max-width: 900px) { .member-hero { flex-direction:column; align-items:flex-start; } }
.action-col { white-space: nowrap; }
.num-col { text-align: right; }
.report-chart-list { display:flex; flex-direction:column; gap:12px; }
.report-chart-row { display:grid; grid-template-columns: minmax(220px, 1.2fr) 2fr 70px; gap:12px; align-items:center; }
.report-chart-label { font-weight:600; color:#29435f; }
.report-chart-bar-wrap { height:14px; background:#e8f0f8; border-radius:999px; overflow:hidden; }
.report-chart-bar { height:100%; border-radius:999px; background:linear-gradient(90deg, #0f6cbd 0%, #5ba4ea 100%); }
.report-chart-value { text-align:right; font-weight:700; color:#173b68; }
.auth-links { margin-top: 14px; display:flex; justify-content:center; }
.auth-back { width:100%; }
@media (max-width: 900px) { .report-chart-row { grid-template-columns: 1fr; } .report-chart-value { text-align:left; } }
