:root {
    color-scheme: light;
    --color-ink: #111827;
    --color-muted: #64748b;
    --color-subtle: #94a3b8;
    --color-border: #e2e8f0;
    --color-panel: #ffffff;
    --color-page: #eef3f8;
    --color-sidebar: #101a2b;
    --color-sidebar-soft: #1c2a41;
    --color-primary: #2869e8;
    --color-primary-strong: #1d4fd7;
    --color-primary-soft: #eaf1ff;
    --color-accent: #dc4c4c;
    --color-success: #1f9d68;
    --color-warning: #f08a24;
    --color-purple: #7c6ee6;
    --shadow-panel: 0 10px 28px rgba(15, 23, 42, 0.09);
    --shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.06);
    --sidebar-width: 264px;
    --topbar-height: 64px;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    color: #111827;
    color: var(--color-ink);
    background: #eef3f8;
    background: var(--color-page);
    font-family: Arial, "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

body:not(.auth-page) {
    min-width: calc(var(--sidebar-width) + 320px);
}

a {
    color: inherit;
}

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

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

.app-header {
    min-height: 0;
}

.auth-page .app-header,
.app-header-public {
    min-height: 64px;
    display: flex;
    align-items: center;
    padding: 0 32px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    background: rgba(255, 255, 255, 0.9);
}

.app-header-public + .page-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 56px;
}

.auth-brand {
    color: var(--color-primary-strong);
    font-size: 17px;
    font-weight: 800;
    text-decoration: none;
}

.app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 264px;
    width: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px 16px 16px;
    color: #cbd5e1;
    background: #101a2b;
    background: linear-gradient(180deg, #101a2b 0%, #172235 46%, #0f1726 100%);
    box-shadow: 12px 0 30px rgba(15, 23, 42, 0.18);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: #ffffff;
    font-size: 17px;
    font-weight: 800;
    text-decoration: none;
}

.brand-text {
    min-width: 0;
    overflow: hidden;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-nav {
    display: grid;
    gap: 6px;
    margin-top: 14px;
}

.side-nav-link {
    min-height: 40px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    padding: 10px 12px;
    border-radius: 7px;
    color: #c8d2df;
    line-height: 1.2;
    text-decoration: none;
}

.side-nav-link .nav-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.side-nav-link:hover,
.side-nav-link.is-active {
    color: #ffffff;
    background: linear-gradient(135deg, #2f6df3, #1f58d8);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding: 10px 12px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
    color: #9aa9bd;
}

.sidebar-footer a {
    color: #cbd5e1;
    font-size: 13px;
    text-decoration: none;
}

.app-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 264px;
    left: var(--sidebar-width);
    inset: 0 0 auto var(--sidebar-width);
    z-index: 25;
    height: 64px;
    height: var(--topbar-height);
    display: flex;
    display: grid;
    grid-template-columns: minmax(140px, 1fr) minmax(260px, 420px) auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
}

.breadcrumb {
    min-width: 0;
    overflow: hidden;
    color: #475569;
    font-size: 13px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.breadcrumb span {
    margin: 0 10px;
    color: #cbd5e1;
}

.global-search {
    width: 100%;
    max-width: 420px;
    min-width: 0;
    height: 38px;
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    background: #ffffff;
}

.global-search input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 12px;
    border: 0;
    outline: 0;
    color: var(--color-ink);
    background: transparent;
}

.global-search button {
    width: 42px;
    flex: 0 0 42px;
    height: 100%;
    border: 0;
    color: #64748b;
    background: transparent;
    cursor: pointer;
}

.topbar-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 11px;
    min-width: 0;
    color: #334155;
    white-space: nowrap;
}

.user-summary {
    min-width: 0;
    max-width: 240px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #f8fafc;
}

.user-meta {
    min-width: 0;
    display: grid;
    gap: 2px;
    line-height: 1.12;
}

.user-pill,
.role-label {
    display: block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-pill {
    font-weight: 700;
}

.role-label {
    color: #64748b;
    font-size: 13px;
}

.auth-page {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    isolation: isolate;
    background: #edf4ff;
}

.auth-page::before {
    content: "";
    position: fixed;
    inset: -22px;
    z-index: -2;
    background:
        linear-gradient(90deg, rgba(241, 246, 255, 0.76), rgba(249, 252, 255, 0.64)),
        url("../images/library-login.svg") center / cover no-repeat;
    filter: blur(10px) saturate(0.78);
    transform: scale(1.04);
}

.auth-page::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.18) 34%, rgba(227, 237, 255, 0.5) 100%),
        linear-gradient(180deg, rgba(247, 250, 255, 0.68), rgba(231, 239, 255, 0.78));
}

.auth-shell {
    width: min(960px, calc(100% - 32px));
    min-height: 100vh;
    display: grid;
    place-items: center;
    margin: 0 auto;
    padding: 48px 0;
}

.page-shell {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 56px;
}

body:not(.auth-page) .page-shell {
    width: auto;
    max-width: none;
    margin-left: 264px;
    margin-left: var(--sidebar-width);
    padding: 82px 24px 44px;
    padding: calc(var(--topbar-height) + 18px) 24px 44px;
}

body:not(.auth-page) .dashboard-shell {
    max-width: 1360px;
    margin-right: auto;
}

.login-panel,
.notice-panel,
.dashboard-hero,
.workspace-card,
.toolbar-panel,
.table-panel,
.form-panel,
.report-card,
.dashboard-panel,
.metric-card,
.shortcut-card {
    border: 1px solid #e2e8f0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: #ffffff;
    background: var(--color-panel);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.09);
    box-shadow: var(--shadow-panel);
}

.login-panel {
    width: min(540px, 100%);
    padding: 44px 64px 56px;
}

.auth-page .login-panel {
    border-color: rgba(219, 229, 244, 0.78);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px rgba(51, 65, 85, 0.16);
}

.login-card-head {
    display: grid;
    gap: 12px;
    justify-items: center;
    margin-bottom: 34px;
    text-align: center;
}

.login-brand-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
}

.login-brand-mark {
    width: 58px;
    height: 58px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: #1372e8;
}

.login-brand-mark svg {
    width: 100%;
    height: 100%;
}

.login-card-head h1 {
    margin: 0;
    color: #0f2546;
    font-size: 34px;
    font-weight: 900;
    line-height: 1.14;
}

.login-subtitle {
    margin: 0;
    color: #6f7b8a;
    font-size: 18px;
    line-height: 1.4;
}

.login-error {
    margin: 0 0 20px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: 27px;
    line-height: 1.18;
}

h2 {
    margin-bottom: 10px;
    font-size: 18px;
    line-height: 1.25;
}

.login-form {
    display: grid;
    gap: 20px;
}

.login-form label,
.search-form label,
.dashboard-search-form label,
.form-field label {
    color: #475569;
    font-size: 13px;
    font-weight: 800;
}

.login-form .login-control,
.search-form input,
.search-form select,
.dashboard-search-form input,
.dashboard-search-form select,
.book-form input,
.book-form select,
.category-form input,
.category-form textarea,
.reader-form input,
.reader-form select,
.user-form input,
.user-form select,
.borrow-form input {
    width: 100%;
    min-height: 38px;
    padding: 8px 11px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-ink);
    background: #ffffff;
    outline: 0;
}

.login-form .login-control:focus,
.search-form input:focus,
.search-form select:focus,
.dashboard-search-form input:focus,
.dashboard-search-form select:focus,
.book-form input:focus,
.book-form select:focus,
.category-form input:focus,
.category-form textarea:focus,
.reader-form input:focus,
.reader-form select:focus,
.user-form input:focus,
.user-form select:focus,
.borrow-form input:focus,
.global-search:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(40, 105, 232, 0.14);
}

.login-field {
    display: grid;
    gap: 6px;
}

.login-input-shell {
    min-height: 58px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 0 18px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.login-password-shell {
    grid-template-columns: 34px minmax(0, 1fr) 42px;
}

.login-input-shell:focus-within {
    border-color: #2d7df0;
    box-shadow: 0 0 0 3px rgba(45, 125, 240, 0.13);
}

.login-input-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.login-input-icon svg,
.password-toggle svg {
    width: 24px;
    height: 24px;
}

.login-input-shell .login-control {
    width: 100%;
    min-width: 0;
    min-height: 56px;
    padding: 0;
    border: 0;
    color: #111827;
    background: transparent;
    box-shadow: none;
}

.login-input-shell .login-control:focus {
    box-shadow: none;
}

.login-input-shell .login-control::placeholder {
    color: #7b8494;
}

.password-toggle {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    color: #747b89;
    background: transparent;
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: #1d4fd7;
    background: #eef5ff;
    outline: 0;
}

.login-role-group {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 26px;
    margin: 4px 0 0;
    padding: 0;
    border: 0;
}

.login-role-title {
    flex: 0 0 auto;
    padding: 0;
    color: #1f2937;
    font-size: 16px;
    font-weight: 800;
}

.login-role-options {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 26px;
    flex: 1 1 auto;
}

.login-role-options label,
.login-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4b5563;
    font-size: 16px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.login-role-options input,
.login-check input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    margin: 0;
    accent-color: #1478ef;
}

.login-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 2px;
}

.forgot-password-link {
    border: 0;
    padding: 0;
    color: #1478c8;
    background: transparent;
    font-size: 16px;
    cursor: pointer;
}

.forgot-password-link:hover,
.forgot-password-link:focus-visible {
    color: #0f5da8;
    text-decoration: underline;
    outline: 0;
}

.login-help-message {
    margin: -10px 0 0;
    padding: 9px 12px;
    border: 1px solid rgba(20, 120, 200, 0.16);
    border-radius: 8px;
    color: #31536f;
    background: #f3f8ff;
    font-size: 13px;
}

.button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.button-primary {
    color: #ffffff;
    background: var(--color-primary);
    box-shadow: 0 6px 14px rgba(40, 105, 232, 0.22);
}

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

.button-secondary {
    color: #475569;
    border-color: var(--color-border);
    background: #ffffff;
}

.button-secondary:hover {
    color: var(--color-primary-strong);
    border-color: #bcd0ff;
    background: #f8fbff;
}

.button-danger {
    color: #ffffff;
    background: var(--color-accent);
}

.button-danger:hover {
    background: #b93737;
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.login-form .button-primary {
    margin-top: 12px;
}

.login-form .login-submit {
    width: 100%;
    min-height: 58px;
    margin-top: 4px;
    border-radius: 8px;
    font-size: 21px;
    box-shadow: 0 10px 22px rgba(20, 104, 234, 0.26);
}

.message {
    margin-bottom: 16px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.message-error {
    color: #9f1d1d;
    border: 1px solid rgba(220, 76, 76, 0.26);
    background: #fff1f1;
}

.message-success {
    color: #11633f;
    border: 1px solid rgba(31, 157, 104, 0.26);
    background: #ecfdf5;
}

.dashboard-hero {
    padding: 24px 26px;
    margin-bottom: 18px;
}

.dashboard-welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.dashboard-welcome > div:first-child {
    min-width: 0;
}

.dashboard-welcome p {
    max-width: 760px;
}

.dashboard-welcome p:last-child,
.workspace-card p:last-child,
.notice-panel p:last-child {
    margin-bottom: 0;
}

.welcome-user {
    min-width: 150px;
    max-width: 240px;
    display: grid;
    gap: 4px;
    padding: 11px 14px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: var(--color-primary-soft);
}

.welcome-user span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.welcome-user strong {
    color: var(--color-primary-strong);
}

.dashboard-metrics {
    display: flex;
    flex-wrap: wrap;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.metric-card {
    flex: 1 1 230px;
    min-width: 0;
    min-height: 98px;
    display: block;
    padding: 18px 20px;
}

.metric-card-empty {
    grid-column: 1 / -1;
}

.metric-card > div {
    min-width: 0;
}

.metric-card h2 {
    margin-bottom: 5px;
    color: #475569;
    font-size: 13px;
}

.metric-value {
    margin-bottom: 4px;
    font-size: 24px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.metric-value small {
    font-size: 13px;
    font-weight: 800;
}

.metric-trend {
    margin-bottom: 0;
    color: #64748b;
    font-size: 12px;
}

.trend-up {
    color: #e05252;
}

.trend-down {
    color: #1f9d68;
}

.dashboard-grid {
    display: flex;
    flex-wrap: wrap;
    display: grid;
    grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.3fr);
    gap: 18px;
    margin-bottom: 18px;
}

.dashboard-panel {
    flex: 1 1 360px;
    min-width: 0;
    padding: 16px;
}

.dashboard-panel h2 {
    margin-bottom: 14px;
    font-size: 16px;
}

.dashboard-search-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 16px;
    align-items: end;
}

.search-field {
    display: grid;
    gap: 7px;
}

.dashboard-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-heading h2 {
    margin-bottom: 0;
}

.panel-heading span,
.table-panel-compact h2 span {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.panel-heading a,
.text-link {
    color: var(--color-primary);
    font-weight: 800;
    text-decoration: none;
}

.rank-chart {
    height: 162px;
    display: grid;
    grid-template-columns: repeat(10, minmax(26px, 1fr));
    align-items: end;
    gap: 10px;
    padding: 6px 4px 0;
    border-top: 1px solid #eef2f7;
    background:
        linear-gradient(to top, rgba(226, 232, 240, 0.62) 1px, transparent 1px) 0 0 / 100% 32px;
}

.rank-item {
    height: 138px;
    display: grid;
    grid-template-rows: 18px 1fr 22px;
    justify-items: center;
    align-items: end;
    min-width: 0;
}

.rank-value {
    color: #475569;
    font-size: 11px;
    font-weight: 800;
}

.rank-bar {
    width: 24px;
    height: var(--bar-height);
    min-height: 18px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #4b83f3, #2869e8);
    box-shadow: 0 4px 10px rgba(40, 105, 232, 0.18);
}

.rank-item small {
    max-width: 68px;
    overflow: hidden;
    color: #475569;
    font-size: 11px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-table-grid {
    display: flex;
    flex-wrap: wrap;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
    align-items: start;
    gap: 18px;
}

.table-panel-wide {
    grid-column: span 1;
}

.table-panel-compact {
    min-width: 0;
    padding: 14px 16px;
}

.table-panel-compact h2 {
    margin-bottom: 12px;
    font-size: 16px;
}

.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.reader-shortcut-grid {
    margin-top: 16px;
}

.shortcut-card {
    min-height: 100px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 14px;
    grid-template-rows: auto auto;
    gap: 5px 13px;
    align-items: center;
    padding: 16px;
    text-decoration: none;
}

.shortcut-card::after {
    content: "›";
    grid-row: 1 / 3;
    grid-column: 2;
    color: #94a3b8;
    font-size: 24px;
}

.shortcut-card strong {
    align-self: end;
}

.shortcut-card small {
    align-self: start;
    color: #64748b;
    line-height: 1.35;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.workspace-card {
    min-height: 156px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
}

.workspace-card p {
    color: var(--color-muted);
}

.workspace-card .button {
    margin-top: auto;
}

.report-card {
    min-height: 136px;
    padding: 18px;
}

.report-card h2 {
    color: var(--color-muted);
    font-size: 13px;
}

.report-card-alert {
    border-color: rgba(220, 76, 76, 0.28);
}

.report-metric {
    margin-bottom: 0;
    color: var(--color-primary-strong);
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
}

.notice-panel {
    max-width: 680px;
    padding: 28px;
}

.role-actions {
    margin-top: 18px;
}

.catalog-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
}

.catalog-hero .button {
    margin-top: 0;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-panel,
.table-panel,
.form-panel {
    padding: 20px;
    margin-bottom: 18px;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr)) auto auto auto;
    gap: 10px;
    align-items: end;
}

.borrowing-search-form {
    grid-template-columns: repeat(3, minmax(130px, 1fr)) auto auto;
}

.system-log-search-form {
    grid-template-columns: repeat(4, minmax(130px, 1fr)) auto auto;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 13px;
}

.dashboard-data-table {
    min-width: 720px;
    font-size: 12px;
}

.borrowing-table {
    min-width: 980px;
}

.user-table,
.system-log-table,
.category-table {
    min-width: 980px;
}

.data-table th,
.data-table td {
    padding: 10px 9px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.dashboard-data-table th,
.dashboard-data-table td {
    padding: 7px 8px;
}

.data-table th {
    color: #475569;
    font-size: 12px;
    font-weight: 900;
    background: #f8fafc;
}

.data-table tbody tr:hover {
    background: #f8fbff;
}

.empty-state {
    margin-bottom: 0;
    color: var(--color-muted);
}

.status-pill {
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-available,
.status-active,
.status-success {
    color: #148158;
    background: #dcfce7;
}

.status-unavailable,
.status-suspended {
    color: #b45309;
    background: #fff3df;
}

.status-archived,
.status-inactive,
.status-returned,
.status-unknown {
    color: #64748b;
    background: #eef2f7;
}

.status-failure,
.status-overdue {
    color: #c24141;
    background: #fee2e2;
}

.stock-plus {
    color: #16a34a;
    font-weight: 800;
}

.stock-return {
    color: #1d4ed8;
    font-weight: 800;
}

.overdue-days {
    color: #dc2626;
    font-weight: 900;
}

.muted-text {
    color: var(--color-muted);
    font-size: 12px;
}

.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.table-actions form {
    margin: 0;
}

.form-panel {
    max-width: 900px;
}

.book-form,
.category-form,
.reader-form,
.user-form,
.borrow-form {
    display: grid;
    gap: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-field {
    display: grid;
    gap: 6px;
}

.form-field-wide {
    grid-column: 1 / -1;
}

.category-form textarea {
    min-height: 112px;
    resize: vertical;
}

.field-error {
    color: #b93737;
    font-size: 13px;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 1180px) {
    .dashboard-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .metric-card {
        flex-basis: calc(50% - 9px);
    }

    .dashboard-grid,
    .dashboard-table-grid {
        grid-template-columns: 1fr;
    }

    .shortcut-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 960px) {
    .app-topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        padding: 0 14px;
    }

    .breadcrumb {
        display: none;
    }

    .topbar-actions {
        justify-content: flex-end;
    }

    .user-summary {
        max-width: 180px;
    }

    .user-pill,
    .role-label {
        max-width: 140px;
    }

    .global-search {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 720px) {
    .auth-page .app-header {
        padding: 0 16px;
    }

    .auth-shell {
        width: min(100%, calc(100% - 24px));
        padding: 24px 0;
    }

    .auth-page .login-panel {
        padding: 30px 22px 34px;
    }

    .login-card-head {
        gap: 8px;
        margin-bottom: 26px;
    }

    .login-brand-row {
        gap: 12px;
    }

    .login-brand-mark {
        width: 42px;
        height: 42px;
    }

    .login-card-head h1 {
        font-size: 26px;
    }

    .login-subtitle {
        font-size: 15px;
    }

    .login-input-shell {
        min-height: 52px;
        grid-template-columns: 28px minmax(0, 1fr);
        gap: 10px;
        padding: 0 14px;
    }

    .login-password-shell {
        grid-template-columns: 28px minmax(0, 1fr) 38px;
    }

    .login-input-shell .login-control {
        min-height: 50px;
    }

    .login-role-group {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .login-role-options {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
        flex-wrap: wrap;
    }

    .login-role-options label,
    .login-check,
    .forgot-password-link {
        font-size: 14px;
    }

    .login-form .login-submit {
        min-height: 52px;
        font-size: 18px;
    }

    h1 {
        font-size: 24px;
    }

    .dashboard-welcome,
    .catalog-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-metrics,
    .dashboard-search-form,
    .side-nav,
    .shortcut-grid,
    .search-form,
    .borrowing-search-form,
    .system-log-search-form,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .metric-card,
    .dashboard-panel {
        flex-basis: 100%;
    }

    .rank-chart {
        grid-template-columns: repeat(5, minmax(36px, 1fr));
        height: auto;
    }

    .rank-item {
        height: 132px;
    }

    .dashboard-form-actions,
    .topbar-actions {
        flex-wrap: wrap;
    }

    .dashboard-form-actions .button {
        flex: 1 1 120px;
    }

    .login-panel,
    .notice-panel,
    .dashboard-hero,
    .workspace-card,
    .report-card,
    .toolbar-panel,
    .table-panel,
    .form-panel,
    .dashboard-panel,
    .metric-card,
    .shortcut-card {
        box-shadow: none;
    }
}
