/* ── AperioLibrum – Internal Styles ── */
:root {
    --bg-side: #084066;
    --bg-side-hover: #0d5a8a;
    --bg-main: #f5f5f5;
    --text-main: #222;
    --line: #e2e6ea;
    --primary: #084066;
    --primary-light: #0d5a8a;
    --success: #2ecc71;
    --hover-row: #f0f4ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
}

/* ── Layout ── */
.layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
    background: linear-gradient(180deg, #084066 0%, #063050 100%);
    color: #fff;
    padding: 24px 14px;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar h1 {
    margin: 0 0 24px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}

/* ── Nav buttons ── */
.nav-btn {
    display: block;
    text-decoration: none;
    width: 100%;
    border: 0;
    margin: 3px 0;
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.85);
    background: transparent;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s, color 0.15s, transform 0.15s, box-shadow 0.2s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(3px);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sidebar-divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    margin: 10px 0;
}

/* ── Visibility helpers ── */
.visible {
    display: block !important;
}

.invisible {
    display: none !important;
}

.hidden {
    display: none;
}

/* ── Sidebar search ── */
#sidebar-search-input {
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
}

#sidebar-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-search-results {
    margin-bottom: 12px;
    font-size: 13px;
    max-height: 190px;
    overflow: auto;
    border-radius: 10px;
}

.search-item,
.search-empty {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    transition: background 0.15s;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.18);
}

.search-empty {
    color: rgba(255, 255, 255, 0.6);
}

/* ── Main content ── */
.content {
    padding: 28px 32px;
    height: 100vh;
    overflow-y: auto;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.content::-webkit-scrollbar {
    width: 6px;
}

.content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.content-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 12px;
}

.content-header h2 {
    margin: 0;
    font-size: 22px;
    color: var(--primary);
}

/* ── Refresh button ── */
.refresh-btn {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.refresh-btn:hover {
    background: #f0f4ff;
    box-shadow: 0 2px 8px rgba(8, 64, 102, 0.12);
    transform: translateY(-1px);
}

.refresh-btn img {
    display: block;
}

.refresh-btn.spinning img {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Tables ── */
.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 700px;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    background: #f0f4ff;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover {
    background: var(--hover-row);
}

td a,
.book-meta-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s;
}

td a:hover,
.book-meta-item a:hover {
    text-decoration: underline;
    color: var(--primary-light);
}

/* ── Inputs & buttons ── */
input,
button {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 64, 102, 0.12);
}

select {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}

button.primary,
button.success,
button.danger {
    margin-top: 4px;
    border: 0;
    border-radius: 10px;
    color: #fff;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

button.primary:hover,
button.success:hover,
button.danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

button.primary:active,
button.success:active,
button.danger:active {
    transform: scale(0.97);
}

button.primary {
    background: var(--primary);
}

button.primary:hover {
    background: var(--primary-light);
}

button.success {
    background: var(--success) !important;
}

button.danger {
    background: #d9534f !important;
}

.delete-btn {
    border: 0;
    border-radius: 8px;
    background: #d9534f;
    color: #fff;
    padding: 7px 10px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.delete-btn:hover {
    opacity: 0.85;
}

/* ── Action buttons row ── */
.file-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.file-actions button {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px 14px;
    margin: 0;
    cursor: pointer;
    font-weight: 600;
    background: #fff;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.file-actions button:hover {
    background: #f0f4ff;
    box-shadow: 0 2px 8px rgba(8, 64, 102, 0.1);
    transform: translateY(-1px);
}

.file-actions button.primary,
.file-actions button.success {
    border: 0;
    color: #fff;
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(8, 64, 102, 0.25);
}

.file-actions button.primary:hover {
    background: var(--primary-light);
}

.file-api-note {
    margin: 0 0 10px;
    color: #555;
    font-size: 13px;
}

.hidden-file-input {
    display: none;
}

/* ── Forms ── */
.inline-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.inline-form.short {
    grid-template-columns: 160px 1fr 220px;
}

.filter-form {
    margin-bottom: 14px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 8px 0 16px;
    flex-wrap: wrap;
}

.filter-bar input[type="text"] {
    flex: 1;
    min-width: 180px;
}

.filter-bar a {
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.filter-bar a:hover {
    text-decoration: underline;
}

/* ── Demo-style search wrapper ── */
.demo-wrap {
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

.demo-wrap input {
    width: 100%;
    padding: 16px 20px;
    font-size: 18px;
    border: 2px solid var(--line);
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.demo-wrap input:focus {
    border-color: var(--primary);
}

.book-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-top: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s, opacity 0.2s;
    z-index: 50;
}

.book-results.visible {
    max-height: 400px;
    opacity: 1;
    overflow-y: auto;
}

.book-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.book-result:last-child { border-bottom: none; }
.book-result:hover { background: #f8f9fb; }
.book-result.empty { color: #999; justify-content: center; }

.book-info { text-align: left; }
.book-title { display: block; font-weight: 600; font-size: 15px; color: var(--text-main); }
.book-genre { display: block; font-size: 13px; color: #888; margin-top: 2px; }

.card-form {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    display: grid;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-form h3 {
    margin: 0 0 6px;
    color: var(--primary);
}

/* ── Status messages ── */
.status-message {
    margin-top: 14px;
    min-height: 24px;
    font-weight: 600;
    font-size: 14px;
}

.status-message.error {
    color: #c0392b;
}

.status-message.ok,
.status-message.success {
    color: #27ae60;
}

/* ── Name suggestions (login flow) ── */
.suggestion-label {
    margin: 12px 0 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

#suggestionList {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-btn {
    padding: 8px 16px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: #e8f4f8;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.suggestion-btn:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-1px);
}

/* ── Back buttons (login flow) ── */
button#backToLibraryBtn,
button#backToUsersFromPasswordBtn,
button#backToUsersFromCodeBtn {
    background: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 18px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.2s, color 0.2s;
}

button#backToLibraryBtn:hover,
button#backToUsersFromPasswordBtn:hover,
button#backToUsersFromCodeBtn:hover {
    background: var(--bg);
    color: var(--primary);
}

/* ── Dashboard widgets ── */
.widget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.widget-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.widget-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(8, 64, 102, 0.1);
}

.widget-value {
    font-size: 34px;
    font-weight: 800;
    color: var(--primary);
}

.widget-label {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.widget-card.alert {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.widget-card.alert .widget-value {
    color: #c0392b;
}

/* ── Status badges ── */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #e8e8e8;
    color: #555;
}

.badge[class*="available"] {
    background: #d4edda;
    color: #155724;
}

.badge[class*="loaned"] {
    background: #fdecec;
    color: #c0392b;
}

.badge[class*="reserved"] {
    background: #fff3cd;
    color: #856404;
}

/* ── Modal overlay ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden {
    display: none;
}

.member-edit-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    display: grid;
    gap: 12px;
    width: 100%;
    max-width: 480px;
    margin: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
}

.member-edit-panel h3 {
    margin: 0 0 4px;
    color: var(--primary);
    font-size: 18px;
}

.member-edit-panel label {
    font-weight: 600;
    font-size: 14px;
    color: #444;
}

.member-edit-panel input,
.member-edit-panel select {
    width: 100%;
}

/* ── Charts ── */
.chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 8px 0 28px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bar-label {
    width: 160px;
    text-align: right;
    font-size: 13px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    flex: 1;
    height: 20px;
    background: #e9eef5;
    border-radius: 6px;
    overflow: hidden;
}

.bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 6px;
    min-width: 2px;
    transition: width 0.4s ease;
}

.bar-count {
    width: 36px;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}

/* ── Loading spinner ── */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    display: none;
    opacity: 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--line);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ── Login page ── */
.hero-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: linear-gradient(135deg, #084066 0%, #0d5a8a 50%, #1a7ab5 100%);
    min-height: calc(100vh - 65px);
}

.hero-card {
    background: #fff;
    padding: 40px;
    border-radius: 14px;
    border: none;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.hero-card h2 {
    color: var(--primary);
    font-size: 28px;
    margin-top: 0;
    margin-bottom: 20px;
}

.hero-card label {
    font-weight: 600;
    font-size: 14px;
    color: #444;
}

.hero-card input[type="text"],
.hero-card input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border: 2px solid var(--line);
    border-radius: 10px;
    margin-top: 4px;
    margin-bottom: 8px;
}

.hero-card input[type="text"]:focus,
.hero-card input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 64, 102, 0.12);
}

.hero-card input[type="submit"],
.hero-card button {
    padding: 12px 28px;
    font-size: 16px;
    font-weight: 700;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.hero-card input[type="submit"] {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(8, 64, 102, 0.35);
}

.hero-card input[type="submit"]:hover {
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(8, 64, 102, 0.45);
}

.hero-card button {
    background: #f0f0f0;
    color: #444;
    margin-left: 8px;
}

.hero-card button:hover {
    background: #e0e0e0;
}

.hero-card button.primary {
    background: var(--primary);
    color: #fff;
    margin-left: 0;
}

.hero-card button.primary:hover {
    background: var(--primary-light);
}

/* ── User search dropdown (login) ── */
#usersSearchInput {
    margin-top: 12px;
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    border: 2px solid var(--line);
    border-radius: 10px;
}

#usersSearchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 64, 102, 0.12);
}

#usersSearchMenu {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

#usersSearchMenu li a {
    display: block;
    padding: 12px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s;
}

#usersSearchMenu li a:hover {
    background: #f0f4ff;
}

#usersSearchMenu li.search-empty {
    padding: 12px 16px;
    color: #999;
}

/* ── Code display (login) ── */
.code-display {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: 6px;
    color: var(--primary);
    background: #f0f4ff;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: 18px 28px;
    display: inline-block;
    margin: 14px 0;
    font-family: 'Courier New', monospace;
}

#codeInput {
    font-size: 24px;
    letter-spacing: 8px;
    text-align: center;
    width: 220px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    border: 2px solid var(--line);
    border-radius: 10px;
}

#codeInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 64, 102, 0.12);
}

/* ── Session hint (login) ── */
#sessionHint {
    margin-top: 14px;
    font-size: 14px;
    color: #555;
}

#sessionHint a {
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 600;
}

/* ── Book detail ── */
.book-count {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

.book-count.hidden {
    display: none;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #999;
    font-size: 15px;
}

.book-detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.book-detail-actions button {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    background: #fff;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.book-detail-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.book-detail-actions button.primary {
    border: 0;
    color: #fff;
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(8, 64, 102, 0.25);
}

.book-detail-actions button.danger {
    border: 0;
    color: #fff;
    background: #d9534f;
}

.back-link {
    font-size: 14px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    text-decoration: underline;
}

.book-meta {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin: 10px 0 22px;
    font-size: 15px;
    color: #555;
}

.book-meta-item strong {
    color: var(--text-main);
}

.queue-position {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

/* ── Password change form (member page) ── */
.password-change-form {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    max-width: 420px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.password-change-form label {
    display: block;
    margin-top: 12px;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
    color: #444;
}

.password-change-form input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
}

.password-change-form input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 64, 102, 0.12);
}

.password-change-form .file-actions {
    margin-top: 16px;
}

/* ── Password strength bar ── */
.password-strength {
    margin: 8px 0 12px;
}

.strength-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    transition: width 0.3s, background 0.3s;
}

.strength-fill.weak { background: #e74c3c; }
.strength-fill.fair { background: #e67e22; }
.strength-fill.medium { background: #f1c40f; }
.strength-fill.strong { background: #2ecc71; }
.strength-fill.very-strong { background: #27ae60; }

.strength-label {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    display: block;
}

.strength-label:empty {
    display: none;
}

/* ── Library search wrapper (login) ── */
.library-search-wrap {
    position: relative;
    width: 100%;
}

.library-search-wrap .book-results {
    max-height: 200px;
}

.library-search-wrap .book-result {
    padding: 10px 14px;
    cursor: pointer;
}

.library-search-wrap .book-result:hover {
    background: #f0f4ff;
}

/* ── Quick links (dashboard) ── */
.quick-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0 28px;
}

.quick-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--primary);
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(8, 64, 102, 0.2);
}

.quick-links a:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(8, 64, 102, 0.3);
}

/* ── Import section ── */
.import-section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.import-section h3 {
    margin: 0 0 12px;
    color: var(--primary);
}

.import-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.import-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.import-options input[type="radio"] {
    accent-color: var(--primary);
}

.conflict-list {
    background: #fdf2f2;
    border: 1px solid #e74c3c;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
    max-height: 200px;
    overflow-y: auto;
}

.conflict-list ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #c0392b;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
        padding: 12px 14px;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        overflow-y: visible;
    }

    .sidebar h1 {
        width: 100%;
        margin: 0 0 8px;
        font-size: 18px;
    }

    .nav-btn {
        display: inline-block;
        width: auto;
        padding: 8px 12px;
        font-size: 13px;
        margin: 2px;
    }

    .nav-btn:hover {
        transform: none;
    }

    .sidebar-divider {
        display: none;
    }

    .sidebar > div {
        margin-top: 0 !important;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .content {
        height: auto;
        min-height: calc(100vh - 120px);
        padding: 16px;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .content-header h2 {
        font-size: 18px;
    }

    .table-wrap {
        overflow-x: auto;
    }

    table {
        min-width: 500px;
    }

    .widget-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .widget-value {
        font-size: 24px;
    }

    .inline-form {
        grid-template-columns: 1fr;
    }

    .inline-form.short {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar input[type="text"] {
        min-width: 0;
    }

    .file-actions {
        flex-direction: column;
    }

    .file-actions button {
        width: 100%;
        text-align: center;
    }

    .book-detail-actions {
        flex-direction: column;
    }

    .book-detail-actions button {
        width: 100%;
    }

    .member-edit-panel {
        max-width: 100%;
        margin: 8px;
        padding: 16px;
    }

    .modal-overlay {
        padding: 8px;
    }

    .hero-card {
        padding: 24px;
        margin: 8px;
    }

    .hero-container {
        padding: 20px;
    }

    .password-change-form {
        max-width: 100%;
    }

    .chart {
        overflow-x: auto;
    }

    .bar-label {
        width: 100px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .widget-grid {
        grid-template-columns: 1fr;
    }

    .badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero-sub {
        font-size: 15px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .steps {
        flex-direction: column;
    }

    .step-arrow {
        transform: rotate(90deg);
    }
}

/* ── Sub-tabs (settings page import) ── */
.loan-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
}

.loan-tab {
    padding: 10px 20px;
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background: #f8f9fb;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.loan-tab:hover {
    background: #eef1f5;
    color: var(--text-main);
}

.loan-tab.active {
    background: #fff;
    color: var(--primary);
    border-color: var(--primary);
    border-bottom-color: #fff;
    position: relative;
    z-index: 1;
}

.loan-tab-content.hidden {
    display: none;
}

/* ── Autocomplete dropdown ── */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.2s, opacity 0.15s;
    z-index: 60;
}

.autocomplete-results.visible {
    max-height: 300px;
    opacity: 1;
    overflow-y: auto;
}

.autocomplete-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.1s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: #f0f4ff;
}

.autocomplete-item.empty {
    color: #999;
    cursor: default;
    text-align: center;
}

.autocomplete-item.empty:hover {
    background: transparent;
}

/* ── Excel-like table ── */
.excel-wrap {
    overflow-x: auto;
}

.excel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.excel-table th {
    background: #f8f9fb;
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--line);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.excel-table td {
    padding: 0;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.cell-editable {
    cursor: text;
    padding: 10px 14px;
    min-height: 40px;
    transition: background 0.1s;
}

.cell-editable:hover {
    background: #f0f4ff;
}

.cell-input {
    width: 100%;
    border: 2px solid var(--primary);
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fff;
}

.cell-select select {
    width: 100%;
    border: 2px solid var(--primary);
    border-radius: 4px;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    background: #fff;
}

.cell-code {
    padding: 10px 14px;
    color: #888;
    font-family: monospace;
    font-size: 13px;
}

.cell-actions {
    padding: 8px 14px;
    white-space: nowrap;
    display: flex;
    gap: 6px;
}

.cell-actions button {
    padding: 6px 12px;
    font-size: 12px;
}

tr.dirty td {
    background: #fffde7;
}

tr.dirty td.cell-editable:hover {
    background: #fff9c4;
}

tr.new-row td {
    background: #f0fff0;
}

.row-save, .row-create {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.row-cancel {
    padding: 6px 12px;
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.row-delete {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
}

/* ── Import section (settings page) ── */
.import-section {
    background: #fff;
    border: 1px solid var(--primary);
    border-radius: 0 12px 12px 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.import-samples {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.import-sample-label {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.import-sample-btn {
    padding: 5px 12px;
    font-size: 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s;
}

.import-sample-btn:hover {
    background: #f0f4ff;
    border-color: var(--primary);
    color: var(--primary);
}

.import-options {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8f9fb;
    border-radius: 8px;
}

.import-options label {
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.import-file-name {
    font-size: 13px;
    color: #666;
    align-self: center;
}
