:root {
  color-scheme: light dark;
  --page: #f2f4f2;
  --surface: #ffffff;
  --surface-soft: #e8ede9;
  --text: #202622;
  --muted: #647068;
  --border: #d2dad4;
  --border-strong: #b8c4bc;
  --header: #26312c;
  --header-muted: #c8d4cd;
  --accent: #b63d55;
  --accent-strong: #922f44;
  --green: #316750;
  --green-strong: #25503f;
  --focus: #1972a8;
  --danger: #a82f35;
  --warning-bg: #fff3cf;
  --warning-text: #624b10;
  --viewer: #101412;
  --viewer-surface: #252b27;
  --viewer-text: #f5f7f5;
  --shadow: 0 12px 32px rgba(27, 38, 31, 0.11);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

[hidden] {
  display: none !important;
}

.album-mark,
.section-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.primary-button,
.secondary-button,
.icon-button,
.viewer-icon,
.viewer-nav,
.password-toggle,
.header-command {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 15px;
  white-space: nowrap;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 750;
}

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

.secondary-button {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 650;
}

.secondary-button:hover {
  border-color: var(--green);
  color: var(--green);
}

.compact-button {
  min-height: 36px;
  padding: 6px 11px;
  font-size: 14px;
}

.icon-button {
  width: 42px;
  padding: 0;
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  font-size: 21px;
}

.full-button {
  width: 100%;
}

/* Login */

.login-page {
  background: var(--page);
}

.login-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 56%) minmax(360px, 44%);
}

.login-intro {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--header);
  color: #ffffff;
  padding: 72px max(54px, calc((100vw - 1180px) / 2));
}

.login-intro .album-mark {
  color: #ef9aaa;
}

.login-intro h1 {
  max-width: 720px;
  margin: 0;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 48px;
  line-height: 1.17;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.login-subtitle {
  margin: 18px 0 0;
  color: #d9e5de;
  font-size: 21px;
}

.login-description {
  max-width: 36rem;
  margin: 12px 0 0;
  color: var(--header-muted);
}

.login-panel {
  width: min(400px, calc(100% - 48px));
  align-self: center;
  justify-self: center;
  margin: 40px 24px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--surface);
  padding: 30px;
  box-shadow: var(--shadow);
}

.login-panel h2 {
  margin: 0;
  font-size: 23px;
}

.login-panel > p {
  margin: 7px 0 24px;
  color: var(--muted);
}

.login-panel label {
  display: block;
  margin-bottom: 8px;
  font-weight: 750;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
}

.password-row input,
.form-grid input,
.form-grid textarea,
.form-grid select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 12px;
}

.password-toggle {
  padding: 8px 10px;
  background: var(--surface-soft);
  border-color: var(--border-strong);
  color: var(--green-strong);
  font-size: 14px;
  font-weight: 750;
}

.form-error {
  min-height: 25px;
  margin: 8px 0;
  color: var(--danger);
  font-size: 14px;
}

.back-link {
  display: inline-block;
  margin-top: 19px;
  color: var(--green);
  font-weight: 650;
}

/* Timeline header and controls */

.site-header {
  background: var(--header);
  color: #ffffff;
  border-bottom: 4px solid var(--accent);
}

.header-inner {
  width: min(1280px, calc(100% - 40px));
  min-height: 154px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand-block {
  min-width: 0;
}

.brand-block .album-mark {
  color: #ef9aaa;
}

.brand-block h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", "STSong", serif;
  font-size: 32px;
  line-height: 1.22;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.brand-block > p:last-child {
  margin: 7px 0 0;
  color: var(--header-muted);
}

.header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-command {
  min-width: 112px;
  background: #ffffff;
  border-color: #ffffff;
  color: var(--header);
  font-weight: 750;
}

.header-command > span:first-child {
  width: 18px;
  font-size: 18px;
  line-height: 1;
  text-align: center;
}

.share-command {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.logout-command {
  background: transparent;
  border-color: #66766d;
  color: #e4ebe7;
}

.header-command:hover {
  transform: translateY(-1px);
}

.browser-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-bottom: 1px solid #e4ce86;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
}

.toolbar-band {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(29, 39, 33, 0.06);
}

.toolbar-inner {
  width: min(1280px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.filter-row,
.order-control {
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar,
.order-control::-webkit-scrollbar {
  display: none;
}

.filter-button,
.order-control button {
  min-height: 40px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 7px 13px;
  white-space: nowrap;
  font-weight: 650;
}

.filter-button:last-child,
.order-control button:last-child {
  border-right: 0;
}

.filter-button.is-active {
  background: var(--green);
  color: #ffffff;
}

.order-control button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.toolbar-options {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.toolbar-options select {
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 30px 7px 11px;
}

.year-nav {
  width: min(1280px, calc(100% - 40px));
  min-height: 20px;
  margin: 14px auto 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.year-nav:empty {
  display: none;
}

.year-nav button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
  padding: 7px 10px;
  cursor: pointer;
}

/* Timeline content */

.content-shell {
  width: min(1280px, calc(100% - 24px));
  margin: 28px auto 120px;
}

.month-section {
  scroll-margin-top: 92px;
  margin-bottom: 38px;
}

.month-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 4px 13px;
  font-size: 20px;
  font-weight: 800;
}

.month-section h2::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.media-tile {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--surface-soft);
  box-shadow: 0 2px 9px rgba(24, 34, 28, 0.08);
}

.media-tile.is-selected {
  border-color: var(--accent);
}

.media-open {
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.media-open img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: opacity 160ms ease, transform 160ms ease;
}

.media-open:hover img {
  opacity: 0.92;
  transform: scale(1.015);
}

.media-badge {
  position: absolute;
  left: 7px;
  bottom: 7px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(20, 27, 23, 0.86);
  color: #ffffff;
  font-size: 12px;
  pointer-events: none;
}

.selection-check {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: rgba(20, 27, 23, 0.58);
  color: #ffffff;
  font-weight: 850;
  pointer-events: none;
}

.selection-mode .selection-check {
  display: flex;
}

.media-tile.is-selected .selection-check {
  background: var(--accent);
}

.tile-retry {
  position: absolute;
  left: 50%;
  bottom: 42%;
  display: none;
  transform: translateX(-50%);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 6px 11px;
  cursor: pointer;
}

.media-tile.has-error .tile-retry {
  display: block;
}

.media-tile.has-error .media-open img {
  visibility: hidden;
}

.empty-state {
  max-width: 600px;
  margin: 76px auto;
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.empty-state h2 {
  margin: 16px 0 7px;
  color: var(--text);
  font-size: 23px;
}

.empty-state p {
  max-width: 430px;
  margin: 0 auto;
}

.empty-art {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 8px 8px 0 var(--surface-soft);
}

.empty-art img {
  width: 52px;
  height: 52px;
  image-rendering: auto;
}

.loading-state,
.load-error {
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.load-more {
  margin: 22px auto;
}

.selection-bar {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(760px, calc(100% - 24px));
  min-height: 68px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 10px 12px 10px 18px;
}

#selection-count {
  font-weight: 750;
}

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

/* Viewer */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--viewer);
  color: var(--viewer-text);
}

.viewer-topbar {
  min-height: 76px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: max(12px, env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid #303832;
}

.viewer-date {
  margin: 0;
  color: #ffffff;
  font-size: 16px;
  font-weight: 650;
}

.viewer-location {
  margin: 3px 0 0;
  color: #b9c4bd;
  font-size: 13px;
}

.viewer-title {
  max-width: min(70vw, 720px);
  margin: 4px 0 0;
  overflow: hidden;
  color: #ffffff;
  font-size: 17px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-icon {
  width: 44px;
  padding: 0;
  background: var(--viewer-surface);
  border-color: #536058;
  color: #ffffff;
  font-size: 28px;
}

.viewer-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: none;
}

.viewer-stage img,
.viewer-stage video {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  transform-origin: center;
  will-change: transform;
}

.viewer-stage video {
  width: min(100%, 1200px);
}

.viewer-motion-play {
  position: absolute;
  z-index: 2;
  width: 58px;
  height: 58px;
  padding: 0 0 0 4px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(18, 24, 20, 0.74);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

.viewer-motion-play:hover {
  background: rgba(31, 42, 35, 0.9);
}

.viewer-failure {
  color: #d3dad5;
  text-align: center;
}

.viewer-failure p {
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 16px;
}

.viewer-failure strong {
  color: #ffffff;
  font-size: 18px;
}

.viewer-failure span {
  color: #aebbb3;
  font-size: 14px;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 46px;
  height: 54px;
  transform: translateY(-50%);
  padding: 0;
  background: rgba(37, 43, 39, 0.82);
  border-color: #536058;
  color: #ffffff;
  font-size: 36px;
}

.viewer-prev {
  left: 12px;
}

.viewer-next {
  right: 12px;
}

.viewer-bottom {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid #303832;
}

.viewer-description {
  max-width: 38rem;
  margin: 0;
  color: #d3dad5;
}

.viewer-badges,
.viewer-downloads {
  display: flex;
  align-items: center;
  gap: 7px;
}

.viewer-badges span {
  padding: 3px 7px;
  border: 1px solid #59665e;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
}

.viewer-downloads {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.viewer-downloads .secondary-button {
  background: var(--viewer-surface);
  border-color: #59665e;
  color: #ffffff;
}

.viewer-open {
  overflow: hidden;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(26px, env(safe-area-inset-bottom));
  z-index: 200;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  border-radius: 6px;
  background: var(--header);
  color: #ffffff;
  box-shadow: var(--shadow);
  padding: 10px 15px;
  text-align: center;
}

/* Management */

.manage-header {
  background: var(--header);
  color: #ffffff;
  border-bottom: 4px solid var(--accent);
}

.manage-header-inner {
  width: min(1040px, calc(100% - 40px));
  min-height: 118px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.manage-header .album-mark {
  color: #ef9aaa;
}

.manage-header h1 {
  margin: 0;
  font-size: 29px;
}

.manage-shell {
  width: min(1040px, calc(100% - 40px));
  margin: 28px auto 90px;
}

.manage-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}

.manage-nav a {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.manage-nav a:last-child {
  border-right: 0;
}

.manage-nav a:hover {
  background: var(--surface-soft);
  color: var(--green);
}

.stats-band {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  background: transparent;
}

.stats-band div {
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 18px;
  border-right: 1px solid var(--border);
}

.stats-band div:last-child {
  border-right: 0;
}

.stats-band strong {
  font-size: 25px;
  line-height: 1.2;
}

.stats-band span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.manage-panel {
  margin-top: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 26px;
  box-shadow: 0 5px 18px rgba(27, 38, 31, 0.06);
}

.manage-panel-heading {
  min-height: 46px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--border);
}

.manage-panel-heading h2 {
  margin: 0;
  font-size: 22px;
}

.manage-panel-heading p:not(.section-kicker) {
  margin: 4px 0 0;
  color: var(--muted);
}

#manage-save-status,
#upload-state,
#password-status {
  min-width: 120px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
}

.security-note {
  color: var(--muted);
  font-size: 13px;
}

.status-success {
  color: var(--green);
}

.status-error {
  color: var(--danger);
}

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

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.form-grid textarea {
  resize: vertical;
}

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

.manage-actions,
.upload-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.file-picker {
  min-height: 106px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--page);
  padding: 20px;
  cursor: pointer;
}

.file-picker:hover {
  border-color: var(--green);
  background: var(--surface-soft);
}

.file-picker-symbol {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--green);
  color: #ffffff;
  font-size: 28px;
  font-weight: 500;
}

.file-picker > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.file-picker strong {
  font-size: 17px;
}

.file-picker small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#upload-progress {
  width: 100%;
  height: 8px;
  display: block;
  margin-top: 16px;
  accent-color: var(--accent);
}

#upload-progress-label {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.upload-history {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.upload-history h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.upload-jobs {
  display: flex;
  flex-direction: column;
}

.upload-job {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  padding: 9px 0;
}

.upload-job:last-child {
  border-bottom: 0;
}

.upload-job > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.upload-job strong {
  font-size: 15px;
}

.upload-job span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.muted-text {
  margin: 8px 0;
  color: var(--muted);
}

.audit-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.audit-summary div {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 13px;
  border-right: 1px solid var(--border);
}

.audit-summary div:last-child {
  border-right: 0;
}

.audit-summary strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.audit-summary span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.audit-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 20px 0 12px;
}

.audit-filters label {
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.audit-filters select {
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 7px 34px 7px 10px;
}

.audit-table {
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
}

.audit-table-head,
.audit-row {
  display: grid;
  grid-template-columns: 180px minmax(220px, 1fr) minmax(150px, 220px) 64px;
  gap: 14px;
  align-items: center;
}

.audit-table-head {
  min-height: 40px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.audit-row {
  min-height: 68px;
  border-top: 1px solid var(--border);
  padding: 9px 0;
  font-size: 13px;
}

.audit-row time,
.audit-row code {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.audit-action {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.audit-action strong,
.audit-action span {
  overflow-wrap: anywhere;
}

.audit-action span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.audit-result-success,
.audit-result-warning {
  font-size: 12px;
  font-weight: 750;
}

.audit-result-success {
  color: var(--green);
}

.audit-result-warning {
  color: var(--danger);
}

.audit-empty {
  padding: 18px 0;
}

#load-more-audit {
  margin-top: 16px;
}

@media (max-width: 1040px) {
  .header-inner,
  .toolbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-inner {
    padding: 24px 0;
  }

  .header-actions {
    width: 100%;
  }

  .toolbar-inner {
    padding: 11px 0;
  }

  .filter-row,
  .toolbar-options {
    width: 100%;
  }

  .filter-button {
    flex: 1 0 auto;
  }

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

@media (max-width: 680px) {
  .login-shell {
    min-height: 100svh;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .login-intro {
    min-height: 250px;
    justify-content: flex-end;
    padding: 38px 24px;
  }

  .login-intro h1 {
    font-size: 35px;
  }

  .login-subtitle {
    margin-top: 12px;
    font-size: 18px;
  }

  .login-description {
    margin-top: 8px;
    font-size: 14px;
  }

  .login-panel {
    width: calc(100% - 32px);
    margin: 24px auto 34px;
    padding: 23px;
  }

  .header-inner {
    width: calc(100% - 24px);
    min-height: auto;
    gap: 20px;
    padding: 21px 0 17px;
  }

  .brand-block h1 {
    font-size: 26px;
  }

  .brand-block > p:last-child {
    font-size: 14px;
  }

  .header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .header-command {
    min-width: 0;
    min-height: 43px;
    padding: 7px 5px;
    gap: 4px;
    font-size: 13px;
  }

  .header-command > span:first-child {
    width: 16px;
    font-size: 16px;
  }

  .toolbar-inner {
    width: calc(100% - 16px);
    gap: 8px;
    padding: 9px 0;
  }

  .filter-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .filter-button {
    min-width: 0;
    padding: 7px 4px;
    font-size: 14px;
  }

  .toolbar-options {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) 86px;
    gap: 6px;
  }

  .select-label {
    display: none;
  }

  .toolbar-options select {
    width: 112px;
    min-width: 0;
    padding-left: 9px;
  }

  .order-control {
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-control button {
    min-width: 0;
    padding: 7px 4px;
    font-size: 13px;
  }

  #selection-toggle {
    min-width: 0;
    padding: 7px 5px;
    font-size: 13px;
  }

  .content-shell {
    width: calc(100% - 12px);
    margin-top: 18px;
  }

  .month-section {
    margin-bottom: 28px;
  }

  .month-section h2 {
    font-size: 18px;
  }

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

  .empty-state {
    margin: 56px 12px;
    padding: 36px 12px;
  }

  .selection-bar {
    align-items: flex-start;
    flex-direction: column;
    padding: 11px;
  }

  .selection-actions {
    width: 100%;
  }

  .selection-actions .primary-button,
  .selection-actions .secondary-button {
    min-width: 0;
    flex: 1;
    padding-inline: 7px;
  }

  .viewer-topbar {
    min-height: 68px;
    padding-inline: 12px;
  }

  .viewer-title {
    max-width: 68vw;
  }

  .viewer-nav {
    top: 47%;
    width: 40px;
    height: 48px;
  }

  .viewer-prev {
    left: 4px;
  }

  .viewer-next {
    right: 4px;
  }

  .viewer-bottom {
    min-height: 122px;
    align-items: flex-start;
    flex-direction: column;
    padding-inline: 10px;
  }

  .viewer-description {
    max-height: 48px;
    overflow: auto;
  }

  .viewer-badges {
    display: none;
  }

  .viewer-downloads {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: stretch;
    overflow-x: auto;
  }

  .viewer-downloads a {
    flex: 1 0 auto;
  }

  .manage-header-inner,
  .manage-shell {
    width: calc(100% - 24px);
  }

  .manage-header-inner {
    min-height: 108px;
  }

  .stats-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-band div {
    min-height: 74px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }

  .stats-band div:nth-child(3) {
    border-right: 0;
  }

  .stats-band div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .manage-panel {
    margin-top: 22px;
    padding: 18px;
  }

  .manage-panel-heading {
    min-height: 0;
    margin-bottom: 19px;
  }

  #manage-save-status,
  #upload-state,
  #password-status {
    min-width: 86px;
  }

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

  .wide-field {
    grid-column: auto;
  }

  .manage-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .file-picker {
    min-height: 96px;
    padding: 16px;
  }

  .file-picker-symbol {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .upload-actions {
    justify-content: space-between;
  }

  .upload-actions .primary-button {
    min-width: 0;
    flex: 1;
  }

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

  .manage-nav a {
    border-bottom: 1px solid var(--border);
  }

  .manage-nav a:nth-child(2n) {
    border-right: 0;
  }

  .manage-nav a:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .audit-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .audit-summary div:nth-child(3) {
    border-right: 0;
  }

  .audit-summary div:nth-child(-n + 3) {
    border-bottom: 1px solid var(--border);
  }

  .audit-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .audit-filters label {
    min-width: 0;
  }

  .audit-table-head {
    display: none;
  }

  .audit-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 12px;
    padding: 13px 0;
  }

  .audit-row time,
  .audit-action {
    grid-column: 1;
  }

  .audit-row code,
  .audit-row > span:last-child {
    grid-column: 2;
    text-align: right;
  }

  .audit-row time,
  .audit-row code {
    align-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .media-open img,
  .header-command {
    transition: none;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #151916;
    --surface: #202521;
    --surface-soft: #2a312c;
    --text: #eef2ef;
    --muted: #aeb9b1;
    --border: #3d4840;
    --border-strong: #536158;
    --header: #1d2521;
    --header-muted: #b7c5bc;
    --accent: #dc7187;
    --accent-strong: #c95d74;
    --green: #73a78e;
    --green-strong: #91bca6;
    --focus: #65b7ef;
    --danger: #ff9298;
    --warning-bg: #3c321a;
    --warning-text: #f0d99c;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
  }

  .primary-button {
    color: #1b1d1b;
  }

  .toolbar-band {
    background: rgba(32, 37, 33, 0.97);
  }

  .header-command {
    background: #f2f4f2;
    color: #202622;
  }

  .share-command {
    background: var(--accent);
    color: #1b1d1b;
  }

  .logout-command {
    background: transparent;
    color: #e4ebe7;
  }
}
