:root {
  color-scheme: light;
  --ink: #193438;
  --muted: #748587;
  --teal: #123b3d;
  --teal-2: #1d5d5a;
  --mint: #e7f2eb;
  --gold: #c99d5d;
  --paper: #f5f7f4;
  --line: #e8ece8;
  --white: #fff;
  --shadow: 0 14px 40px rgba(27, 55, 53, .07);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: "Vazirmatn", Tahoma, sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 258px; flex: 0 0 258px; padding: 27px 18px 20px; background: var(--teal); color: #e7f0eb; display: flex; flex-direction: column; min-height: 100vh; position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 7px 30px; }
.brand-mark { width: 46px; height: 46px; flex: 0 0 46px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: #fff; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand strong { display: block; font-size: 16px; font-weight: 700; }
.brand small { display: block; max-width: 168px; color: #a9bfba; margin-top: 2px; font-size: 10px; line-height: 1.6; }
.sidebar-label { color: #87a19b; font-size: 10px; letter-spacing: .04em; padding: 6px 12px 9px; }
.nav-list { display: grid; gap: 5px; }
.nav-link { border: 0; width: 100%; padding: 11px 12px; border-radius: 10px; background: transparent; color: #bdceca; text-align: right; display: flex; align-items: center; gap: 11px; transition: background .22s ease, color .22s ease, transform .22s ease; }
.nav-link[hidden] { display: none; }
.nav-link:hover { color: white; background: rgba(255,255,255,.07); transform: translateX(-2px); }
.nav-link.active { background: #e9f1e9; color: var(--teal); font-weight: 700; box-shadow: 0 5px 16px rgba(3, 21, 22, .1); }
.nav-icon { display: inline-grid; place-items: center; width: 21px; font-size: 19px; line-height: 1; }
.nav-count { margin-right: auto; font-size: 10px; color: #d3b77f; }
.nav-link.active .nav-count { color: var(--teal-2); }
.sidebar-spacer { flex: 1; min-height: 35px; }
.sidebar-note { padding: 16px; border: 1px solid rgba(231, 240, 235, .13); background: rgba(255,255,255,.035); border-radius: 13px; }
.note-spark { color: #d5b274; font-size: 18px; }
.sidebar-note strong { display: block; margin-top: 8px; font-size: 12px; }
.sidebar-note p { color: #a6bbb5; font-size: 10px; line-height: 1.9; margin: 6px 0 0; }
.sidebar-footer { color: #9ab0aa; font-size: 9px; padding: 18px 4px 0; display: flex; gap: 7px; align-items: center; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #78c693; box-shadow: 0 0 0 4px rgba(120,198,147,.1); }
.main-area { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.topbar { height: 76px; flex: 0 0 76px; background: rgba(255,255,255,.82); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 38px; }
.breadcrumb { color: #98a5a3; font-size: 12px; }
.breadcrumb b { color: #c3ccca; padding: 0 7px; font-weight: 400; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.today { color: #859290; font-size: 11px; }
.today .date-pair { align-items: flex-start; }
.date-pair { display: inline-flex; flex-direction: column; gap: 1px; line-height: 1.45; white-space: nowrap; }
.date-pair small { color: #8d9996; font-size: 9px; }
.icon-button, .mobile-menu { border: 1px solid var(--line); background: white; color: var(--teal); width: 36px; height: 36px; border-radius: 10px; font-size: 18px; transition: .2s ease; }
.icon-button:hover { border-color: #b7c9be; background: var(--mint); transform: translateY(-2px); }
.profile-chip { border-right: 1px solid var(--line); padding-right: 15px; display: flex; gap: 9px; align-items: center; }
.profile-avatar { width: 35px; height: 35px; border-radius: 50%; display: grid; place-items: center; background: #e7efe8; color: var(--teal); font-weight: 700; }
.profile-chip strong { display: block; font-size: 10px; }
.profile-chip small { display: block; color: #94a09d; font-size: 9px; margin-top: 2px; }
.mobile-menu { display: none; }
.page-content { width: min(1420px, 100%); margin: 0 auto; padding: 30px 38px 18px; flex: 1; animation: page-in .38s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 23px; }
.eyebrow { color: #9a8058; font-size: 10px; font-weight: 600; letter-spacing: .04em; }
h1 { margin: 5px 0 0; font-size: clamp(22px, 2.3vw, 29px); letter-spacing: -.035em; font-weight: 700; }
.page-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.button { border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; font-size: 11px; font-weight: 600; transition: .2s ease; display: inline-flex; gap: 7px; align-items: center; justify-content: center; white-space: nowrap; }
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--teal); color: white; box-shadow: 0 5px 12px rgba(18,59,61,.12); }
.button-primary:hover { background: #1c5352; }
.button-quiet { background: white; color: #586d6b; border-color: var(--line); }
.button-danger { background: #faeeee; color: #9c4545; border-color: #efd7d7; }
.button-gold { background: #f3eadb; color: #886b3e; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { background: var(--white); border: 1px solid var(--line); border-radius: 13px; padding: 17px 18px; min-height: 119px; position: relative; overflow: hidden; box-shadow: 0 5px 22px rgba(27,55,53,.025); transition: .23s ease; animation: card-in .45s ease both; }
.metric-card:nth-child(2) { animation-delay: .06s; }.metric-card:nth-child(3) { animation-delay: .12s; }.metric-card:nth-child(4) { animation-delay: .18s; }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.metric-card::after { content: ""; width: 72px; height: 72px; background: var(--metric-tint, #eaf3ec); border-radius: 50%; position: absolute; left: -22px; bottom: -34px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: #788785; font-size: 10px; position: relative; z-index: 1; }
.metric-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; background: var(--metric-tint, #eaf3ec); color: var(--metric-color, #39796d); font-size: 17px; }
.metric-value { font-size: 26px; font-weight: 700; line-height: 1; margin: 14px 0 7px; letter-spacing: -.04em; position: relative; z-index: 1; }
.metric-hint { color: #9aa6a2; font-size: 9px; position: relative; z-index: 1; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .92fr); gap: 16px; align-items: stretch; }
.panel { background: white; border: 1px solid var(--line); border-radius: 13px; padding: 19px; box-shadow: 0 5px 22px rgba(27,55,53,.025); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.panel-heading h2 { font-size: 13px; margin: 0; font-weight: 700; }
.panel-heading p { color: #98a4a1; font-size: 9px; margin: 4px 0 0; }
.text-button { color: var(--teal-2); font-size: 10px; border: 0; background: transparent; }
.month-select { border: 1px solid var(--line); background: #fff; padding: 6px 9px; color: #697977; border-radius: 7px; font-size: 9px; }
.chart-wrap { height: 192px; display: flex; align-items: stretch; gap: 11px; padding-top: 9px; }
.chart-y { color: #a0aaa7; font-size: 8px; display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 24px; }
.chart-area { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: space-around; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, #f0f3f0 48px); }
.chart-group { display: flex; flex: 1; justify-content: center; align-items: flex-end; gap: 4px; height: 100%; position: relative; padding-bottom: 24px; }
.bar { display: block; width: min(12px, 32%); min-height: 3px; border-radius: 5px 5px 2px 2px; height: var(--bar-height, 3%); background: #4a9281; transition: height .5s ease, filter .2s ease; }
.bar.secondary { background: #d5b77c; }
.chart-group:hover .bar { filter: brightness(.9); }
.chart-label { position: absolute; bottom: 3px; right: 50%; transform: translateX(50%); color: #a0aaa7; font-size: 8px; white-space: nowrap; }
.legend { display: flex; gap: 15px; color: #82908d; font-size: 9px; margin-top: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; background: #4a9281; }.legend .legend-gold { background: #d5b77c; }
.chart-empty { color: #a0aaa7; font-size: 9px; align-self: center; position: absolute; top: 43%; right: 50%; transform: translate(50%,-50%); background: rgba(255,255,255,.88); padding: 5px 9px; border-radius: 6px; }
.side-stack { display: grid; gap: 16px; grid-template-rows: 1fr 1fr; }
.activity-list { display: grid; gap: 12px; }
.activity-item { display: flex; align-items: center; gap: 9px; min-width: 0; }
.activity-icon { flex: 0 0 30px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #39796d; background: #edf4ee; }
.activity-copy { min-width: 0; flex: 1; }
.activity-copy strong { display: block; font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-copy small { color: #9aa6a2; font-size: 8px; }
.activity-value { color: #66817b; font-size: 9px; }
.mini-rule { border: 0; border-top: 1px solid #f0f2ef; margin: 12px 0; }
.formula-box { background: #f3f7f2; border-radius: 10px; padding: 12px 13px; }
.formula-box strong { font-size: 10px; display: block; margin-bottom: 7px; }
.formula-line { color: #6d8079; font-size: 9px; line-height: 1.9; }
.formula-line b { color: var(--teal-2); font-weight: 600; }
.table-panel { padding: 0; overflow: hidden; }
.table-toolbar { padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.table-toolbar h2 { margin: 0; font-size: 12px; }
.table-tools { display: flex; align-items: center; gap: 8px; }
.search-box { border: 1px solid var(--line); background: #fbfcfa; color: var(--ink); border-radius: 8px; padding: 8px 11px; font-size: 10px; width: 205px; outline: none; transition: border-color .2s; }
.search-box:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: #6e9a89; box-shadow: 0 0 0 3px rgba(77,139,116,.1); outline: none; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; white-space: nowrap; }
thead { background: #fafbf9; color: #84918e; font-size: 9px; }
th { padding: 12px 16px; font-weight: 600; }
td { padding: 12px 16px; border-top: 1px solid #f0f2ef; color: #586b68; font-size: 10px; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: #fbfcf9; }
.book-name { color: #334d4a; font-weight: 600; }
.book-author { color: #9aa5a2; font-size: 9px; margin-top: 3px; }
.pill { display: inline-flex; padding: 4px 8px; border-radius: 99px; font-size: 8px; background: #edf4ee; color: #48806c; }
.pill.gold { background: #f6f0e5; color: #9b7a42; }
.pill.gray { background: #f0f2f1; color: #70807d; }
.row-action { border: 0; color: #74918a; background: transparent; font-size: 10px; }
.row-action:hover { color: #a35347; }
.empty-state { text-align: center; padding: 35px 20px; color: #9aa6a2; font-size: 10px; }
.empty-state strong { display: block; color: #556b66; font-size: 11px; margin-bottom: 5px; }
.empty-symbol { color: #a2b9ae; font-size: 24px; display: block; margin-bottom: 9px; }
.subtle-note { color: #889793; font-size: 9px; line-height: 1.9; }
.summary-strip { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 15px; }
.inventory-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.summary-tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.summary-tile span { color: #84918e; display: block; font-size: 9px; }
.summary-tile strong { display: block; margin-top: 5px; font-size: 17px; }
.modal { border: 0; padding: 0; border-radius: 16px; width: min(580px, calc(100% - 28px)); box-shadow: 0 25px 90px rgba(7,29,30,.25); color: var(--ink); max-height: 90vh; }
.modal::backdrop { background: rgba(8,28,30,.48); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .22s ease both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(9px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-card { padding: 27px; position: relative; }
.modal-close { position: absolute; left: 18px; top: 13px; border: 0; background: transparent; color: #879692; font-size: 25px; }
.modal-eyebrow { font-size: 9px; color: #a38555; font-weight: 600; }
.modal-card h2 { font-size: 20px; margin: 5px 0 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-height: 58vh; overflow-y: auto; padding: 2px 2px 7px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.date-calendar-hint { color: #84918e; font-size: 9px; line-height: 1.5; }
.field.full { grid-column: 1 / -1; }
.field label { color: #657874; font-size: 10px; }
.field input, .field select, .field textarea { border: 1px solid #e3e9e4; background: #fcfdfb; padding: 10px 11px; border-radius: 8px; font-size: 11px; color: var(--ink); width: 100%; }
.field input[type="file"] { padding: 8px; font-size: 10px; }
.field textarea { resize: vertical; min-height: 75px; }
.form-actions { display: flex; justify-content: flex-start; gap: 8px; margin-top: 20px; }
.toast { position: fixed; bottom: 22px; left: 22px; background: #173d3c; color: white; padding: 11px 16px; border-radius: 9px; font-size: 10px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .25s ease; z-index: 10; }
.toast.show { opacity: 1; transform: translateY(0); }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.report-card { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 17px; }
.report-card h3 { margin: 0 0 12px; font-size: 12px; }
.report-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f0f2ef; color: #71817e; font-size: 10px; }
.report-row:last-child { border-bottom: 0; }.report-row strong { color: #35534e; }
.formula-card { background: #edf4ee; border-radius: 10px; padding: 13px; margin-top: 10px; color: #58716a; font-size: 9px; line-height: 1.9; }
.formula-card strong { display: block; color: #295e51; margin-bottom: 4px; font-size: 10px; }
.filter-select { border: 1px solid var(--line); border-radius: 8px; background: white; padding: 8px; color: #657874; font-size: 10px; }
.page-footer { padding: 13px 38px 17px; color: #a2adaa; font-size: 9px; border-top: 1px solid var(--line); }
.page-footer span { padding: 0 5px; color: var(--gold); }
.app-shell { display: none; }
.app-shell.ready { display: flex; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 35px 20px 70px; position: relative; overflow: hidden; background: radial-gradient(ellipse at 10% 12%, rgba(201,157,93,.13), transparent 35%), radial-gradient(ellipse at 92% 84%, rgba(38,113,97,.13), transparent 36%), #f5f7f4; }
.auth-screen[hidden] { display: none; }
.auth-decoration { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.auth-decoration span { position: absolute; border: 1px solid rgba(30,83,74,.07); border-radius: 50%; width: 430px; height: 430px; }
.auth-decoration span:nth-child(1) { top: -270px; right: -120px; }
.auth-decoration span:nth-child(2) { bottom: -315px; left: -90px; width: 520px; height: 520px; }
.auth-decoration span:nth-child(3) { top: 19%; left: 12%; width: 90px; height: 90px; border-color: rgba(201,157,93,.16); }
.auth-card { width: min(440px, 100%); background: rgba(255,255,255,.94); border: 1px solid #e8ece8; border-radius: 18px; padding: 30px 34px 25px; box-shadow: 0 24px 80px rgba(27,55,53,.1); position: relative; z-index: 1; animation: card-in .5s ease both; }
.auth-brand { color: var(--ink); padding: 0; margin-bottom: 32px; }
.auth-brand small { color: #84918e; }
.auth-intro { margin-bottom: 22px; }
.auth-intro h1 { font-size: 23px; margin-top: 6px; }
.auth-intro p { margin: 8px 0 0; color: #879491; font-size: 11px; }
.login-form { display: grid; gap: 15px; }
.login-form .field { gap: 7px; }
.login-form .field > span, .field > span { color: #657874; font-size: 10px; }
.login-form .field input { padding: 12px; }
.login-button { width: 100%; padding: 12px 15px; margin-top: 3px; justify-content: space-between; }
.login-button span { font-size: 16px; }
.login-button:disabled { opacity: .7; cursor: wait; }
.is-loading::after { content: ""; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.45); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-message { min-height: 15px; color: #477a67; font-size: 10px; }
.login-message.error { color: #a64e43; }
.auth-footnote { border-top: 1px solid #eef1ed; padding-top: 15px; display: flex; align-items: center; gap: 8px; color: #8c9995; font-size: 9px; line-height: 1.8; }
.auth-caption { position: absolute; bottom: 20px; color: #9da8a4; font-size: 9px; text-align: center; }
.signout-button { padding: 8px 10px; font-size: 9px; }
.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 13px 0 17px; }
.quick-action { display: flex; flex-direction: column; align-items: flex-start; text-align: right; gap: 5px; border: 1px solid var(--line); background: #fcfdfb; border-radius: 10px; padding: 13px; transition: .2s ease; color: var(--ink); }
.quick-action:hover { transform: translateY(-2px); border-color: #c7d7cd; box-shadow: var(--shadow); }
.quick-action > span { color: var(--teal-2); font-size: 19px; }
.quick-action strong { font-size: 10px; }
.quick-action small { color: #91a09c; font-size: 8px; }
.field input[type="password"] { letter-spacing: .04em; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.library-card { background: white; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; box-shadow: 0 5px 22px rgba(27,55,53,.025); transition: .22s ease; animation: card-in .4s ease both; }
.library-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.library-card-main { width: 100%; text-align: right; display: flex; flex-direction: column; border: 0; background: transparent; padding: 17px 18px 13px; color: var(--ink); }
.library-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.library-symbol { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; color: #39796d; background: #edf4ee; font-size: 19px; }
.library-card-title { font-size: 15px; margin-bottom: 10px; }
.library-card-line { color: #788885; font-size: 10px; margin: 3px 0; }
.library-card-footer { display: flex; gap: 6px; align-items: center; margin-top: 13px; padding-top: 10px; border-top: 1px solid #f0f2ef; font-size: 9px; color: #71847d; }
.library-card-footer b { color: #c99d5d; }
.library-card-footer > span { margin-right: auto; color: var(--teal-2); }
.library-edit { width: 100%; text-align: right; padding: 10px 18px; border: 0; border-top: 1px solid #f0f2ef; background: #fbfcfa; color: #69817a; font-size: 9px; transition: background .2s; }
.library-edit:hover { background: #f0f5ef; color: var(--teal); }
.library-detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; padding: 13px; border-radius: 10px; background: #f7f9f6; color: #7a8985; font-size: 9px; line-height: 1.8; }
.library-detail-meta b { color: #38564f; font-weight: 600; }
.library-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.detail-stat { display: flex; flex-direction: column; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 11px; }
.detail-stat span { color: #81908c; font-size: 8px; }
.detail-stat strong { color: #35574e; font-size: 17px; }
.detail-stat small { color: #9aa6a2; font-size: 8px; }
.library-detail-footer { color: #82908d; font-size: 9px; line-height: 1.9; margin-top: 12px; }
.book-summary { display: block; max-width: 240px; overflow: hidden; color: #83918d; font-size: 9px; text-overflow: ellipsis; }
.book-description { white-space: pre-wrap; min-height: 100px; margin-top: 15px; padding: 16px; border-radius: 10px; background: #f7f9f6; color: #62736f; font-size: 11px; line-height: 2; }
[hidden] { display: none !important; }
@media (max-width: 1050px) {
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { width: 224px; flex-basis: 224px; }
  .page-content { padding-right: 25px; padding-left: 25px; }
  .topbar { padding: 0 25px; }
  .metric-grid { gap: 10px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.3fr) minmax(230px, .9fr); }
}
@media (max-width: 800px) {
  .sidebar { position: fixed; right: 0; top: 0; bottom: 0; width: 270px; transform: translateX(105%); transition: transform .25s ease; box-shadow: -10px 0 35px rgba(0,0,0,.14); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: inline-grid; place-items: center; }
  .topbar { justify-content: flex-start; gap: 12px; height: 65px; flex-basis: 65px; padding: 0 18px; }
  .top-actions { margin-right: auto; gap: 8px; }
  .today, .profile-chip small { display: none; }
  .profile-chip { padding-right: 8px; }
  .profile-chip strong { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .page-content { padding: 24px 18px 16px; }
  .page-footer { padding: 13px 18px; }
}
@media (max-width: 560px) {
  .library-grid { grid-template-columns: 1fr; }
  .library-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-detail-meta { grid-template-columns: 1fr; gap: 6px; }
  .auth-card { padding: 24px 21px 21px; }
  .auth-brand { margin-bottom: 25px; }
  .quick-actions { grid-template-columns: 1fr; }
  .quick-action { flex-direction: row; align-items: center; }
  .quick-action small { margin-right: auto; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 108px; padding: 13px; }
  .metric-value { font-size: 23px; margin-top: 12px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading > .button { align-self: stretch; }
  .side-stack, .report-grid { grid-template-columns: 1fr; }
  .summary-strip { gap: 6px; }
  .summary-tile { padding: 10px; }
  .table-toolbar { align-items: flex-start; flex-direction: column; }
  .table-tools { width: 100%; }
  .search-box { flex: 1; width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .modal-card { padding: 23px 18px; }
  .breadcrumb { font-size: 10px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
.theme-toggle-auth { position: absolute; top: 16px; left: 16px; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e4ece8;
  --muted: #a6b5b0;
  --teal: #102b2d;
  --teal-2: #77b9a8;
  --mint: #243a34;
  --paper: #111918;
  --line: #2b3a37;
  --white: #1b2725;
  --shadow: 0 14px 40px rgba(0, 0, 0, .28);
}
:root[data-theme="dark"] body { background: var(--paper); color: var(--ink); }
:root[data-theme="dark"] .topbar,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .summary-tile,
:root[data-theme="dark"] .library-card,
:root[data-theme="dark"] .report-card,
:root[data-theme="dark"] .detail-stat,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .modal-card {
  background-color: #1b2725;
  color: var(--ink);
  border-color: var(--line);
}
:root[data-theme="dark"] .topbar { background: rgba(27, 39, 37, .96); }
:root[data-theme="dark"] .auth-screen {
  background: radial-gradient(ellipse at 10% 12%, rgba(201,157,93,.08), transparent 35%),
    radial-gradient(ellipse at 92% 84%, rgba(38,113,97,.14), transparent 36%), #111918;
}
:root[data-theme="dark"] .auth-brand,
:root[data-theme="dark"] .breadcrumb strong,
:root[data-theme="dark"] .metric-value,
:root[data-theme="dark"] .panel-heading h2,
:root[data-theme="dark"] .table-toolbar h2,
:root[data-theme="dark"] .book-name,
:root[data-theme="dark"] .library-card-title,
:root[data-theme="dark"] .report-card h3,
:root[data-theme="dark"] .report-row strong,
:root[data-theme="dark"] .detail-stat strong,
:root[data-theme="dark"] .library-detail-meta b,
:root[data-theme="dark"] .modal-card h2,
:root[data-theme="dark"] .field > span,
:root[data-theme="dark"] .login-form .field > span { color: var(--ink); }
:root[data-theme="dark"] .breadcrumb,
:root[data-theme="dark"] .today,
:root[data-theme="dark"] .date-pair small,
:root[data-theme="dark"] .metric-top,
:root[data-theme="dark"] .metric-hint,
:root[data-theme="dark"] .panel-heading p,
:root[data-theme="dark"] .book-author,
:root[data-theme="dark"] .page-subtitle,
:root[data-theme="dark"] .page-footer,
:root[data-theme="dark"] .subtle-note,
:root[data-theme="dark"] .date-calendar-hint,
:root[data-theme="dark"] .library-card-line,
:root[data-theme="dark"] .library-detail-meta,
:root[data-theme="dark"] .library-detail-footer,
:root[data-theme="dark"] .detail-stat span,
:root[data-theme="dark"] .detail-stat small,
:root[data-theme="dark"] .report-row,
:root[data-theme="dark"] .auth-intro p,
:root[data-theme="dark"] .auth-brand small,
:root[data-theme="dark"] .auth-footnote,
:root[data-theme="dark"] .auth-caption { color: #a6b5b0; }
:root[data-theme="dark"] .button-quiet,
:root[data-theme="dark"] .icon-button,
:root[data-theme="dark"] .filter-select,
:root[data-theme="dark"] .month-select,
:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .field textarea {
  background: #24322f;
  color: var(--ink);
  border-color: #3a4b46;
}
:root[data-theme="dark"] .search-box::placeholder,
:root[data-theme="dark"] .field input::placeholder,
:root[data-theme="dark"] .field textarea::placeholder { color: #9aaba5; }
:root[data-theme="dark"] .button-primary { background: #286d60; color: #f5fbf8; }
:root[data-theme="dark"] .button-primary:hover { background: #348574; }
:root[data-theme="dark"] .nav-link.active { background: #d3e6dc; color: #153533; }
:root[data-theme="dark"] .nav-link.active .nav-count { color: #285d52; }
:root[data-theme="dark"] thead { background: #202d2b; color: #b2c0bb; }
:root[data-theme="dark"] td { color: #c2cec9; border-color: #2b3936; }
:root[data-theme="dark"] tbody tr:hover { background: #22312e; }
:root[data-theme="dark"] .pill { background: #243d35; color: #a7d6c0; }
:root[data-theme="dark"] .pill.gold { background: #40372a; color: #e0c58f; }
:root[data-theme="dark"] .pill.gray { background: #303b39; color: #b3bfba; }
:root[data-theme="dark"] .formula-card,
:root[data-theme="dark"] .formula-box { background: #21332e; color: #bdcec5; }
:root[data-theme="dark"] .formula-card strong,
:root[data-theme="dark"] .formula-box strong,
:root[data-theme="dark"] .formula-line b { color: #9bcab5; }
:root[data-theme="dark"] .quick-action { background: #202e2b; border-color: var(--line); color: var(--ink); }
:root[data-theme="dark"] .quick-action small,
:root[data-theme="dark"] .activity-copy small,
:root[data-theme="dark"] .activity-value { color: #a5b4ae; }
:root[data-theme="dark"] .activity-icon,
:root[data-theme="dark"] .library-symbol { background: #253c35; color: #9dcbb4; }
:root[data-theme="dark"] .library-edit { background: #202d2b; border-color: var(--line); color: #b3c5bc; }
:root[data-theme="dark"] .library-edit:hover { background: #293b36; }
:root[data-theme="dark"] .library-detail-meta { background: #202d2b; }
:root[data-theme="dark"] .report-row { border-color: #2b3936; }
:root[data-theme="dark"] .chart-area { background: repeating-linear-gradient(to bottom, transparent 0, transparent 47px, #2a3935 48px); }
:root[data-theme="dark"] .chart-empty { background: rgba(27, 39, 37, .92); color: #b0beb8; }
:root[data-theme="dark"] .empty-state { color: #a6b5b0; }
:root[data-theme="dark"] .empty-state strong { color: #d4dfda; }
:root[data-theme="dark"] .modal-close { color: #b2c0bb; }
:root[data-theme="dark"] .page-footer { border-color: var(--line); }
:root[data-theme="dark"] .profile-chip { border-color: var(--line); }
:root[data-theme="dark"] .profile-avatar { background: #294039; color: #c3e3d2; }
:root[data-theme="dark"] .sidebar-footer { color: #b0c1ba; }
:root[data-theme="dark"] .auth-card { box-shadow: 0 24px 80px rgba(0, 0, 0, .32); }
:root[data-theme="dark"] .auth-footnote { border-color: var(--line); }
