:root {
  color-scheme: light;
  --paper: #f8f8f5;
  --surface: #fdfdfb;
  --soft: #efefea;
  --ink: #26282a;
  --muted: #717477;
  --faint: #a3a5a3;
  --line: #deded8;
  --strong-line: #303235;
  --accent: #31577d;
  --accent-soft: #dfe7ed;
  --sun: #a85e55;
  --sat: #667d93;
  --weekend: #f2f2ee;
  --danger: #a64a43;
  --shadow: 0 24px 70px rgba(29, 32, 34, .18);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "Yu Gothic UI", sans-serif;
  --serif: "Yu Mincho", "Hiragino Mincho ProN", "Source Han Serif SC", "Noto Serif CJK SC", serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #181917; --surface: #1c1d1a; --soft: #242520; --ink: #e8e7e1;
  --muted: #aaa9a2; --faint: #73736d; --line: #30312c; --strong-line: #deddd6;
  --accent: #8ba9ca; --accent-soft: #293746; --sun: #d08b80; --sat: #93a5b8;
  --weekend: #1b1c19; --danger: #e0837c; --shadow: 0 24px 70px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }
html { height: 100%; }
body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font: 14px/1.55 var(--sans); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.eyebrow { color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .28em; text-transform: uppercase; }

.topbar { height: 62px; display: flex; align-items: center; gap: 34px; padding: 0 24px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); position: relative; z-index: 20; }
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; white-space: nowrap; }
.brand strong { font: 600 18px/1 var(--serif); letter-spacing: .28em; }
.brand span { color: var(--faint); font-size: 8px; letter-spacing: .25em; }
.view-tabs { align-self: stretch; display: flex; gap: 20px; }
.view-tabs button { padding: 0 2px; border-bottom: 1.5px solid transparent; color: var(--faint); letter-spacing: .12em; }
.view-tabs button:hover, .view-tabs button.active { color: var(--ink); }
.view-tabs button.active { border-color: var(--ink); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.theme-button, .icon-button { width: 38px; height: 38px; display: grid; place-items: center; color: var(--muted); }
.logout-button { padding: 6px 8px; color: var(--faint); font-size: 11px; letter-spacing: .08em; }
.logout-button:hover { color: var(--ink); }
.primary-button, .secondary-button { min-height: 40px; padding: 9px 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--ink); letter-spacing: .05em; text-decoration: none; }
.primary-button { background: var(--ink); color: var(--paper); }
.primary-button:hover { background: var(--accent); border-color: var(--accent); }
.primary-button.compact { min-height: 36px; padding: 7px 14px; font-size: 12px; }
.secondary-button { border-color: var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: var(--ink); }

.app-shell { height: calc(100vh - 62px); display: grid; grid-template-columns: 252px minmax(0, 1fr) 330px; }
.sidebar { border-right: 1px solid var(--line); padding: 22px 18px 18px; display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.search-box { height: 38px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); color: var(--faint); }
.search-box svg { width: 17px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 12px; }
.search-box input::placeholder { color: var(--faint); }
.filter-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 0 10px; color: var(--muted); font-size: 11px; letter-spacing: .05em; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { display: block; width: 30px; height: 16px; border-radius: 20px; background: var(--line); position: relative; transition: .15s; }
.switch i::after { content: ""; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(14px); }
.sidebar-section-title { margin: 8px 5px 7px; display: flex; justify-content: space-between; color: var(--faint); font-size: 10px; letter-spacing: .22em; }
.sidebar-section-title b { font-weight: 500; letter-spacing: 0; }
.manga-list { min-height: 0; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.manga-row { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 4px; text-align: left; border-bottom: 1px solid transparent; }
.manga-row:hover { background: var(--soft); }
.mini-cover, .cover-preview { background: var(--soft); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; position: relative; color: var(--faint); font: 600 14px var(--serif); }
.mini-cover > *, .cover-preview > *, .library-cover > *, .detail-cover > * { grid-area: 1 / 1; }
.mini-cover img, .cover-preview img, .library-cover img, .detail-cover img { position: relative; z-index: 1; }
.mini-cover { width: 32px; height: 45px; }
.mini-cover img, .cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.manga-row-text { min-width: 0; }
.manga-row-text b, .manga-row-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manga-row-text b { font-size: 12px; }
.manga-row-text span { color: var(--faint); font-size: 10px; margin-top: 2px; }
.row-mark { width: 3px; height: 22px; background: var(--mark); }
.empty-side { padding: 28px 10px; color: var(--faint); text-align: center; font-size: 12px; }
.sidebar-foot { margin-top: auto; padding-top: 16px; display: flex; gap: 8px; color: var(--faint); font-size: 10px; letter-spacing: .05em; }
.sidebar-foot a:hover { color: var(--accent); }
.sidebar-foot button { padding: 0; color: inherit; text-decoration: underline; }

.main-content { min-width: 0; overflow: auto; padding: 20px 24px 12px; }
.view-panel { display: none; min-height: 100%; }
.view-panel.active { display: flex; flex-direction: column; }
.calendar-toolbar { min-height: 46px; display: flex; align-items: center; gap: 18px; margin-bottom: 12px; }
.month-nav { display: flex; align-items: center; gap: 9px; }
.month-nav h1 { min-width: 145px; margin: 0; font-weight: 500; }
.month-nav h1 b { font: 500 30px/1 var(--serif); }
.month-nav h1 span { color: var(--faint); font-size: 11px; letter-spacing: .1em; margin-right: 6px; }
.month-nav h1 i { font: normal 14px var(--serif); }
.nav-arrow { width: 30px; height: 34px; color: var(--faint); font: 22px var(--serif); }
.nav-arrow:hover { color: var(--ink); }
.text-button { padding: 4px 1px; border-bottom: 1px solid var(--faint); color: var(--muted); font-size: 11px; letter-spacing: .12em; }
.calendar-summary { margin-left: auto; color: var(--faint); font-size: 10px; letter-spacing: .08em; }
.weekdays { display: grid; grid-template-columns: repeat(7, 1fr); padding: 0 8px 7px 0; }
.weekdays span { text-align: right; color: var(--faint); font: 600 10px var(--serif); letter-spacing: .2em; }
.weekdays .sat { color: var(--sat); } .weekdays .sun { color: var(--sun); }
.calendar-grid { flex: 1; min-height: 620px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(92px, 1fr)); border-top: 1.5px solid var(--strong-line); border-left: 1px solid var(--line); }
.calendar-cell { min-width: 0; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; text-align: left; overflow: hidden; }
.calendar-cell:hover, .calendar-cell.selected { background: var(--soft); }
.calendar-cell.outside { opacity: .38; }
.calendar-cell.weekend { background-color: var(--weekend); }
.calendar-cell.today { box-shadow: inset 0 3px 0 var(--accent); }
.cell-top { display: flex; align-items: baseline; min-height: 20px; gap: 7px; }
.cell-day { font: 500 15px var(--serif); }
.calendar-cell.sunday .cell-day { color: var(--sun); } .calendar-cell.saturday .cell-day { color: var(--sat); }
.today-label { color: var(--accent); font-size: 8px; letter-spacing: .15em; }
.cell-events { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; }
.event-chip { min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 10px; }
.event-chip::before { content: ""; flex: none; width: 2px; height: 13px; background: var(--mark); }
.event-chip b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.event-chip em { margin-left: auto; color: var(--faint); font-style: normal; font-size: 9px; }
.more-events { padding-left: 8px; color: var(--faint); font-size: 9px; }

.day-panel { min-width: 0; position: relative; border-left: 1px solid var(--line); display: grid; grid-template-columns: 31px minmax(0, 1fr); background: var(--paper); }
.vertical-label { writing-mode: vertical-rl; border-right: 1px solid var(--line); padding-top: 22px; display: flex; align-items: center; color: var(--faint); font: 10px var(--serif); letter-spacing: .5em; }
.panel-close { display: none; }
.day-panel-content { overflow: auto; padding: 21px 18px 30px; }
.day-heading { display: flex; align-items: baseline; gap: 9px; padding-bottom: 13px; border-bottom: 1.5px solid var(--strong-line); }
.day-heading h2 { margin: 0; font: 600 22px var(--serif); }
.day-heading span { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.day-heading i { margin-left: auto; color: var(--accent); font-style: normal; font-size: 9px; letter-spacing: .15em; }
.panel-section-title { margin: 20px 0 3px; color: var(--faint); font-size: 10px; letter-spacing: .25em; }
.day-event { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.day-event .mini-cover { width: 46px; height: 65px; }
.day-event h3 { margin: 0 0 4px; font: 600 15px/1.35 var(--serif); }
.event-meta { color: var(--muted); font-size: 10px; }
.event-meta strong { color: var(--accent); }
.event-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.event-links a, .event-links button { color: var(--muted); border-bottom: 1px solid var(--faint); font-size: 10px; text-decoration: none; letter-spacing: .05em; }
.event-links a:hover, .event-links button:hover { color: var(--accent); border-color: var(--accent); }
.no-events { padding: 52px 10px; text-align: center; color: var(--faint); }
.no-events b { display: block; font: 28px var(--serif); margin-bottom: 8px; }
.no-events p { margin: 0; font-size: 11px; letter-spacing: .08em; }

.library-head { display: flex; justify-content: space-between; align-items: end; padding: 5px 3px 18px; border-bottom: 1.5px solid var(--strong-line); }
.library-head h1 { margin: 4px 0 0; font: 500 30px var(--serif); letter-spacing: .08em; }
.library-count { color: var(--faint); font-size: 11px; }
.library-grid { padding: 20px 0 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 24px 18px; }
.library-card { min-width: 0; text-align: left; }
.library-cover { aspect-ratio: 3 / 4.25; background: var(--soft); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; position: relative; color: var(--faint); font: 32px var(--serif); }
.library-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.library-card:hover img { transform: scale(1.025); }
.follow-badge { position: absolute; right: 8px; top: 8px; background: color-mix(in srgb, var(--paper) 90%, transparent); padding: 3px 7px; color: var(--accent); font-size: 9px; }
.library-card h2 { margin: 10px 0 3px; font: 600 15px/1.4 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-card p { margin: 0; color: var(--faint); font-size: 10px; }
.library-empty { grid-column: 1 / -1; padding: 90px 20px; text-align: center; color: var(--faint); }

.week-toolbar { min-height: 67px; display: flex; align-items: end; gap: 22px; padding: 4px 3px 17px; border-bottom: 1.5px solid var(--strong-line); }
.week-toolbar h1 { margin: 4px 0 0; font: 500 25px var(--serif); letter-spacing: .06em; }
.week-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 1px; }
.week-grid { flex: 1; min-height: 620px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); }
.week-day { min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--paper); }
.week-day.weekend { background: var(--weekend); }
.week-day.today { box-shadow: inset 0 3px 0 var(--accent); }
.week-day-head { min-height: 72px; padding: 13px 12px 10px; border-bottom: 1px solid var(--line); }
.week-day-head span { display: block; color: var(--faint); font: 600 10px var(--serif); letter-spacing: .2em; }
.week-day-head b { display: block; margin-top: 3px; font: 500 23px var(--serif); }
.week-day.saturday .week-day-head b, .week-day.saturday .week-day-head span { color: var(--sat); }
.week-day.sunday .week-day-head b, .week-day.sunday .week-day-head span { color: var(--sun); }
.week-day.today .week-day-head b { color: var(--accent); }
.week-day-head i { display: block; min-height: 14px; margin-top: 3px; color: var(--accent); font-style: normal; font-size: 8px; letter-spacing: .12em; }
.week-events { padding: 12px 9px 24px; display: flex; flex-direction: column; gap: 13px; }
.week-manga-card { width: 100%; min-width: 0; text-align: left; }
.week-cover { width: 100%; aspect-ratio: 3 / 4.15; display: grid; place-items: center; overflow: hidden; position: relative; border: 1px solid var(--line); background: var(--soft); color: var(--faint); font: 25px var(--serif); }
.week-cover > * { grid-area: 1 / 1; }
.week-cover img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.week-manga-card:hover .week-cover img { transform: scale(1.025); }
.week-manga-card h2 { margin: 7px 1px 2px; overflow: hidden; text-overflow: ellipsis; font: 600 12px/1.4 var(--serif); }
.week-manga-card p { margin: 0 1px; color: var(--faint); font-size: 9px; }
.week-empty { padding: 30px 5px; text-align: center; color: var(--faint); font: 18px var(--serif); }

.scrim { display: none; position: fixed; inset: 0; background: rgba(18, 20, 20, .44); z-index: 45; }
.scrim.show { display: block; }
dialog { color: var(--ink); background: var(--paper); border: 1px solid var(--line); padding: 0; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(18, 20, 20, .55); backdrop-filter: blur(2px); }
.editor-dialog { width: min(780px, calc(100vw - 32px)); max-height: min(880px, calc(100vh - 32px)); }
.editor-dialog form { max-height: inherit; display: flex; flex-direction: column; }
.dialog-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 17px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 3px 0 0; font: 600 22px var(--serif); letter-spacing: .08em; }
.dialog-close { width: 36px; height: 36px; color: var(--muted); font-size: 22px; }
.dialog-body { padding: 24px; overflow: auto; }
.dialog-foot { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--paper); }
.dialog-foot p { margin: 0 auto 0 0; color: var(--danger); font-size: 11px; }
.cover-editor { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 22px; padding-bottom: 25px; }
.cover-preview.large { width: 130px; height: 184px; font-size: 32px; }
.cover-actions h3 { margin: 5px 0; font: 600 16px var(--serif); }
.cover-actions > p { max-width: 430px; margin: 0 0 14px; color: var(--muted); font-size: 11px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.file-button input { display: none; }
.form-section { padding: 21px 0; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-heading b { font: 600 15px var(--serif); letter-spacing: .12em; }
.section-heading span { color: var(--faint); font: 12px var(--serif); }
.form-grid { display: grid; gap: 14px 16px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.field > span i { color: var(--sun); font-style: normal; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; background: var(--surface); padding: 10px 11px; outline: 0; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field input[type="color"] { height: 41px; padding: 4px; }
.color-field > span { display: flex; align-items: center; justify-content: space-between; }
.color-field > span button { padding: 0; color: var(--accent); border-bottom: 1px solid var(--accent); font-size: 9px; letter-spacing: .04em; }
.color-control { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: stretch; }
.color-control input[type="color"] { position: relative; z-index: 1; }
.color-control output { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0; background: var(--surface); color: var(--muted); font: 11px ui-monospace, "Cascadia Mono", monospace; letter-spacing: .08em; }
.color-control.flash output { color: var(--paper); background: var(--picked-color); border-color: var(--picked-color); }
.compact-field { margin-top: 13px; }
.check-field { align-self: end; min-height: 41px; display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.check-field input { accent-color: var(--accent); }
.form-note { margin: 10px 0 0; color: var(--faint); font-size: 10px; }
.form-note.lead { margin: -8px 0 14px; }
.repeat-list { display: flex; flex-direction: column; gap: 8px; }
.repeat-row { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr) 34px; gap: 8px; }
.repeat-row input { min-width: 0; border: 1px solid var(--line); background: var(--surface); padding: 9px 10px; outline: 0; }
.repeat-row input:focus { border-color: var(--accent); }
.repeat-row button { color: var(--faint); font-size: 18px; }
.add-row-button { margin-top: 9px; color: var(--accent); font-size: 11px; border-bottom: 1px solid var(--accent); padding: 2px 0; }
.repeat-title { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 600; }
.repeat-title.with-gap { margin-top: 20px; }

.detail-dialog { width: min(760px, calc(100vw - 32px)); max-height: min(780px, calc(100vh - 32px)); overflow: auto; }
.dialog-close.floating { position: absolute; top: 12px; right: 12px; z-index: 2; background: color-mix(in srgb, var(--paper) 88%, transparent); }
.detail-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 330px; }
.detail-cover { min-height: 330px; background: var(--soft); display: grid; place-items: center; color: var(--faint); font: 42px var(--serif); overflow: hidden; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-info { padding: 40px 34px 28px; }
.detail-info h2 { margin: 5px 0 12px; font: 600 28px/1.35 var(--serif); letter-spacing: .05em; }
.detail-original-title { margin: -7px 0 12px; color: var(--faint); font-size: 10px; letter-spacing: .06em; }
.status-line { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 10px; }
.status-line i { width: 3px; height: 16px; background: var(--mark); }
.detail-description { color: var(--muted); font-size: 12px; line-height: 1.8; min-height: 48px; }
.detail-actions { display: flex; gap: 8px; margin-top: 20px; }
.detail-sections { padding: 0 34px 32px; }
.detail-section { padding: 19px 0; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 10px; color: var(--faint); font-size: 10px; letter-spacing: .23em; }
.detail-line, .detail-link { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 7px 0; font-size: 12px; }
.detail-line span, .detail-link span { color: var(--muted); }
.detail-link { text-decoration: none; border-bottom: 1px dotted var(--line); }
.detail-link:hover { color: var(--accent); }
.danger-button { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); white-space: nowrap; }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 26px; transform: translate(-50%, 12px); padding: 9px 18px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-nav { display: none; }

.auth-page { min-height: 100%; display: grid; grid-template-columns: minmax(280px, .82fr) minmax(420px, 1.18fr); overflow: auto; }
.auth-aside { min-height: 100vh; padding: 44px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; background: var(--weekend); position: relative; overflow: hidden; }
.auth-aside::after { content: "暦"; position: absolute; right: -24px; bottom: -90px; color: color-mix(in srgb, var(--faint) 10%, transparent); font: 420px/1 var(--serif); pointer-events: none; }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; position: relative; z-index: 1; }
.auth-brand strong { font: 600 24px var(--serif); letter-spacing: .3em; }
.auth-brand span { color: var(--faint); font-size: 8px; letter-spacing: .3em; }
.auth-note { max-width: 330px; position: relative; z-index: 1; }
.auth-note i { display: block; width: 30px; height: 2px; margin-bottom: 18px; background: var(--accent); }
.auth-note p { margin: 0; color: var(--muted); font: 16px/1.9 var(--serif); letter-spacing: .06em; }
.auth-main { min-height: 100vh; padding: 48px clamp(28px, 8vw, 110px); display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { margin: 7px 0 10px; font: 600 31px var(--serif); letter-spacing: .08em; }
.auth-card > p { margin: 0 0 30px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.auth-form { padding-top: 23px; border-top: 1.5px solid var(--strong-line); }
.auth-form .field { margin-bottom: 16px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 58px; }
.password-toggle { position: absolute; right: 8px; bottom: 7px; padding: 4px; color: var(--faint); font-size: 10px; }
.auth-submit { width: 100%; margin-top: 6px; }
.auth-status { min-height: 20px; margin: 13px 0 0; color: var(--danger); font-size: 11px; }
.auth-security { display: flex; gap: 9px; align-items: flex-start; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10px; }
.auth-security svg { flex: none; width: 16px; height: 16px; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 232px minmax(0, 1fr); }
  .day-panel { position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); transform: translateX(105%); transition: transform .2s; box-shadow: var(--shadow); }
  .day-panel.open { transform: translateX(0); }
  .panel-close { display: grid; place-items: center; position: absolute; top: 9px; right: 9px; width: 34px; height: 34px; z-index: 2; font-size: 20px; }
}

@media (max-width: 820px) {
  body { overflow: auto; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topbar { height: 56px; padding: 0 13px; gap: 10px; position: sticky; top: 0; }
  .mobile-only { display: grid !important; }
  .brand strong { font-size: 16px; letter-spacing: .2em; }
  .brand span, .view-tabs, .theme-button, .top-actions .primary-button { display: none; }
  .top-actions { margin-left: auto; }
  .app-shell { display: block; height: auto; }
  .sidebar { position: fixed; z-index: 60; inset: 0 auto 0 0; width: min(310px, 88vw); transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .main-content { overflow: visible; padding: 14px 12px 20px; }
  .calendar-toolbar { margin-bottom: 8px; }
  .calendar-summary { display: none; }
  .month-nav h1 { min-width: 132px; }
  .calendar-grid { min-height: 590px; grid-template-rows: repeat(6, minmax(88px, 1fr)); }
  .calendar-cell { padding: 6px; }
  .mobile-nav { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(12px); }
  .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--faint); font-size: 9px; }
  .mobile-nav button span { font: 17px var(--serif); }
  .mobile-nav button.active { color: var(--accent); }
  .toast { bottom: 78px; }
  .auth-body { padding-bottom: 0; }
  .auth-page { display: block; }
  .auth-aside { min-height: 180px; padding: 28px 24px; border: 0; border-bottom: 1px solid var(--line); }
  .auth-aside::after { font-size: 220px; right: -8px; bottom: -55px; }
  .auth-note { display: none; }
  .auth-main { min-height: calc(100vh - 180px); padding: 34px 24px 50px; }
  .week-toolbar { align-items: center; flex-wrap: wrap; gap: 8px 16px; padding: 4px 4px 14px; }
  .week-toolbar h1 { font-size: 21px; }
  .week-actions { margin-left: auto; }
  .week-grid { min-height: 0; display: flex; flex-direction: column; border-top: 1.5px solid var(--strong-line); }
  .week-day { display: grid; grid-template-columns: 70px minmax(0, 1fr); border-bottom: 1px solid var(--line); }
  .week-day-head { min-height: 100%; border-bottom: 0; border-right: 1px solid var(--line); padding: 15px 10px; }
  .week-day-head b { font-size: 21px; }
  .week-events { min-height: 92px; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
  .week-manga-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); grid-template-rows: auto auto 1fr; column-gap: 11px; align-content: center; }
  .week-cover { grid-row: 1 / 4; width: 54px; height: 76px; aspect-ratio: auto; }
  .week-manga-card h2 { margin: 0 0 3px; font-size: 13px; white-space: normal; }
  .week-manga-card p { margin: 0; }
  .week-empty { padding: 22px 8px; font-size: 14px; text-align: left; }
}

@media (max-width: 560px) {
  .main-content { padding-inline: 8px; }
  .calendar-toolbar { padding: 0 3px; gap: 8px; }
  .month-nav { gap: 2px; }
  .month-nav h1 { min-width: 118px; }
  .month-nav h1 b { font-size: 25px; }
  .text-button { margin-left: auto; }
  .weekdays { padding-right: 3px; }
  .calendar-grid { min-height: 520px; grid-template-rows: repeat(6, minmax(76px, 1fr)); }
  .calendar-cell { padding: 5px; }
  .cell-events { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .event-chip { width: 8px; height: 8px; overflow: hidden; background: var(--mark); border-radius: 50%; }
  .event-chip::before, .event-chip > * { display: none; }
  .more-events { padding: 0; font-size: 8px; }
  .library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 10px; }
  .editor-dialog { width: 100vw; height: 100dvh; max-height: none; border: 0; margin: 0; }
  .editor-dialog form { height: 100%; max-height: none; }
  .dialog-head, .dialog-body, .dialog-foot { padding-left: 16px; padding-right: 16px; }
  .dialog-body { padding-top: 18px; }
  .cover-editor { grid-template-columns: 98px minmax(0, 1fr); gap: 14px; }
  .cover-preview.large { width: 98px; height: 139px; }
  .cover-actions .secondary-button { padding: 7px 9px; font-size: 10px; }
  .form-grid.two { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .repeat-row { grid-template-columns: 1fr 34px; }
  .repeat-row input:nth-child(2) { grid-row: 2; }
  .repeat-row button { grid-row: 1 / 3; grid-column: 2; }
  .dialog-foot p { display: none; }
  .detail-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); height: fit-content; border: 1px solid var(--line); margin: auto; overscroll-behavior: contain; }
  .dialog-close.floating { position: sticky; float: right; top: 8px; right: 8px; margin-bottom: -44px; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px); }
  .detail-hero { display: flex; flex-direction: column; min-height: 0; }
  .detail-cover { width: 142px; min-height: 0; aspect-ratio: 3 / 4.2; margin: 24px auto 0; border: 1px solid var(--line); flex: none; }
  .detail-info { padding: 19px 18px 18px; text-align: center; }
  .detail-info > .eyebrow { display: block; }
  .detail-info h2 { margin-top: 7px; font-size: 22px; }
  .detail-original-title { text-align: center; }
  .status-line { justify-content: center; flex-wrap: wrap; }
  .detail-description { font-size: 11px; }
  .detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-actions > * { padding-inline: 9px; }
  .detail-sections { padding: 0 18px calc(24px + env(safe-area-inset-bottom)); }
  .detail-section { padding: 17px 0; }
}

@media (max-width: 360px) {
  .detail-actions { grid-template-columns: 1fr; }
  .detail-line { align-items: flex-start; flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
