:root {
  color-scheme: light;
  --bg: #f4f6f7;
  --panel: #ffffff;
  --panel-soft: #f9fbfb;
  --line: #d7dee2;
  --line-strong: #c8d2d7;
  --text: #253039;
  --muted: #62717a;
  --quiet: #8a98a0;
  --accent: #126b63;
  --accent-dark: #0b514c;
  --ink: #11181d;
  --gold: #9f6a13;
  --green: #277452;
  --blue: #245f9f;
  --shadow: 0 1px 2px rgba(20, 31, 38, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  font-feature-settings: "palt";
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

.topbar {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 86px;
  padding: 0 28px;
  background:
    radial-gradient(circle at 18% 12%, rgba(38, 165, 151, 0.38), transparent 28%),
    radial-gradient(circle at 92% 18%, rgba(30, 124, 120, 0.42), transparent 30%),
    linear-gradient(110deg, #075c58 0%, #07524e 54%, #064440 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 10px 24px rgba(11, 42, 40, 0.18);
}

.topbar::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  opacity: 0.28;
  content: "";
}

.topbar::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, #54d2c1, #f0c76a, #83b7ff, #54d2c1);
  background-size: 260% 100%;
  animation: headerLineFlow 9s linear infinite;
  content: "";
}

.header-left {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.database-mark {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
}

.database-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

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

.brand-copy h1 {
  margin: 0;
  color: #fff;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 850;
  letter-spacing: 0;
}

.mobile-title,
.mobile-menu-button,
.mobile-search-toggle,
.mobile-menu-backdrop,
.mobile-menu {
  display: none;
}

.top-actions .mobile-search-toggle {
  display: none;
}

.header-search {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  flex: 0 1 460px;
  max-width: 460px;
  min-width: 300px;
  margin-right: auto;
  height: 46px;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(6, 35, 33, 0.18);
}

.header-keyword-wrap {
  flex: 1;
  min-width: 0;
  height: 100%;
}

.header-keyword-wrap input {
  height: 100%;
  border: 0;
  border-radius: 7px 0 0 7px;
  padding: 0 20px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
}

.header-search-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  height: 100%;
  min-height: 0;
  padding: 0 20px;
  border: 0;
  border-left: 1px solid rgba(8, 81, 76, 0.14);
  border-radius: 0 7px 7px 0;
  background: #fff;
  color: #1b2a31;
  font-size: 14px;
  font-weight: 840;
}

.library-toolbar {
  display: none;
}

.header-search-button::before {
  width: 20px;
  height: 20px;
  background: url("./assets/ui/search-icon.png") center / contain no-repeat;
  content: "";
}

.mobile-search-icon {
  display: block;
  width: 24px;
  height: 24px;
  background: url("./assets/ui/search-icon.png") center / contain no-repeat;
  filter: invert(1);
}

.top-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 0 0 auto;
  color: #fff;
}

.admin-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 116px;
  min-height: 46px;
  padding: 0 13px;
  border-color: rgba(255, 255, 255, 0.54);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: none;
  backdrop-filter: blur(8px);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.admin-link:hover {
  border-color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

#adminCreateOpen {
  border-color: var(--accent);
  background: #fff;
  color: var(--accent);
}

#adminCreateOpen:hover {
  border-color: var(--accent-dark);
  background: #f1f8f6;
  color: var(--accent-dark);
}

.header-icon-button {
  position: relative;
  display: grid;
  grid-template-rows: 27px auto;
  align-items: start;
  justify-items: center;
  gap: 3px;
  min-width: 66px;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.94);
  font-size: 11px;
  font-weight: 760;
}

.header-icon-button strong {
  position: absolute;
  top: -4px;
  right: 16px;
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: #e8f6f3;
  color: var(--accent-dark);
  font-size: 11px;
  line-height: 1;
}

.bookmark-icon,
.history-icon,
.login-icon {
  position: relative;
  display: block;
  width: 25px;
  height: 25px;
}

.bookmark-icon {
  width: 27px;
  height: 27px;
  background: url("./assets/ui/bookmark-icon.png") center / contain no-repeat;
}

.history-icon {
  width: 27px;
  height: 27px;
  background: url("./assets/ui/history-icon.png") center / 24px 24px no-repeat;
}

.login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 121px;
  padding-top: 0;
  padding-right: 18px;
  padding-bottom: 0;
  padding-left: 14px;
  border-color: rgba(255, 255, 255, 0.62);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 14px;
  font-weight: 820;
}

.admin-link,
.login-button {
  min-height: 46px;
}

.dummy-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

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

.dummy-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 15, 19, 0.64);
}

.dummy-dialog {
  position: relative;
  z-index: 1;
  width: min(460px, calc(100vw - 48px));
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.dummy-dialog p {
  margin: 0 0 6px;
  color: var(--quiet);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.dummy-dialog h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 20px;
}

.dummy-copy {
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
}

.dummy-dialog button {
  width: 100%;
  margin-top: 22px;
}

.login-icon {
  width: 28px;
  height: 28px;
  background: url("./assets/ui/login-icon.png") center / contain no-repeat;
}

.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@keyframes headerLineFlow {
  from {
    background-position: 0% 0;
  }

  to {
    background-position: 260% 0;
  }
}

h2 {
  margin: 0 0 14px;
  font-size: 15px;
}

h3 {
  margin: 0;
  font-size: 14px;
}

p {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.admin-page {
  padding: 16px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-header p,
.admin-panel-header p {
  margin: 0 0 4px;
  color: var(--quiet);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.35;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.admin-panel-header h3 {
  color: var(--ink);
  font-size: 16px;
}

.admin-sort {
  display: grid;
  gap: 5px;
  min-width: 148px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-sort select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.admin-search {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(215, 222, 226, 0.72);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-search input {
  height: 38px;
  font-size: 13px;
}

.admin-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 16px;
  row-gap: 16px;
  padding: 16px 0 0;
  background: #f5f7f8;
}

.admin-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(199, 210, 216, 0.9);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(20, 31, 38, 0.06);
}

.admin-row:last-child {
  border-bottom: 1px solid rgba(199, 210, 216, 0.9);
}

.admin-thumb {
  display: block;
  width: 118px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(215, 222, 226, 0.72);
  border-radius: 6px;
  background: var(--panel-soft);
}

.admin-fields {
  display: grid;
  min-width: 0;
  gap: 10px;
}

.admin-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(223, 229, 232, 0.8);
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.admin-meta strong {
  color: var(--blue);
  font-size: 13px;
}

.admin-field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.admin-fields label,
.admin-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-fields input,
.admin-fields textarea,
.admin-form input,
.admin-form textarea {
  min-width: 0;
  background: #fbfcfc;
  font-size: 13px;
}

.admin-fields textarea {
  min-height: 68px;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 2px;
}

.admin-save {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
}

.admin-delete {
  min-height: 34px;
  padding: 6px 12px;
  border-color: #c74848;
  background: #fff;
  color: #b72d2d;
  font-size: 12px;
  font-weight: 800;
}

.admin-delete:hover {
  border-color: #a92929;
  background: #fff5f5;
  color: #9b2020;
}

.admin-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.admin-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-status.success {
  color: var(--accent-dark);
}

.admin-status.error {
  color: #9b2c2c;
}

.admin-empty {
  grid-column: 1 / -1;
  padding: 22px 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-create-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-create-modal.hidden {
  display: none;
}

.admin-create-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 15, 19, 0.66);
}

.admin-create-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, calc(100vw - 48px));
  max-height: min(760px, calc(100vh - 48px));
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.admin-create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.admin-create-head p {
  margin: 0 0 4px;
  color: var(--quiet);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-create-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.panel,
.content {
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  overflow: hidden;
  padding: 0;
  align-self: start;
  display: grid;
  align-content: stretch;
  grid-template-rows: auto minmax(0, 1fr);
}

.sidebar section {
  padding: 16px;
  padding-top: 10px;
  border-bottom: 1px solid var(--line);
}

.sidebar section:last-child {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border-bottom: 0;
}

.panel-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.25;
}

.filter-heading {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.filter-toggle {
  display: block;
  width: auto;
  margin: 0 0 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  cursor: default;
}

.filter-content {
  min-height: 0;
}

.quick-list {
  display: grid;
  gap: 4px;
}

.quick-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

.quick-list button.active,
.quick-list button:hover {
  border-color: var(--line);
  background: var(--panel-soft);
  color: var(--ink);
}

.quick-list button:hover {
  box-shadow: 0 6px 14px rgba(20, 31, 38, 0.06);
  transform: translateX(2px);
}

.quick-list button:active {
  transform: translateX(2px);
}

.quick-list strong {
  color: var(--quiet);
  font-size: 11px;
  font-weight: 760;
}

.category-list button.active {
  border-color: rgba(18, 107, 99, 0.34);
  background: #eaf3f1;
  color: var(--accent-dark);
}

.category-list button:active {
  transform: translateX(2px);
}

.field-label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag-scroll {
  min-height: 0;
  max-height: 100%;
  overflow: auto;
  padding-right: 2px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.tag-chip {
  flex: 0 1 auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 30px;
  padding: 5px 10px;
  background: #fbfcfc;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}

.tag-chip:hover {
  border-color: rgba(18, 107, 99, 0.26);
  background: #f1f7f6;
  color: var(--accent-dark);
  box-shadow: 0 5px 12px rgba(20, 31, 38, 0.05);
  transform: translateY(-1px);
}

.tag-chip:active {
  transform: translateY(-1px);
}

.tag-chip.active {
  background: #e8f3f1;
  border-color: var(--accent);
  color: var(--accent-dark);
}

.tag-show-more {
  display: none;
}

.library-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow);
}

.category-header {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: var(--shadow);
}

.category-header p {
  margin: 0;
  color: var(--quiet);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.category-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.category-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-box {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.search-box span {
  color: var(--quiet);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-box input {
  height: 38px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 12px;
}

.asset-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  content-visibility: auto;
  contain-intrinsic-size: 300px 350px;
  cursor: pointer;
  user-select: none;
}

.asset-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px rgba(20, 31, 38, 0.08);
  transform: translateY(-1px);
}

.asset-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 8px 18px rgba(18, 107, 99, 0.12);
}

.asset-button {
  position: relative;
  width: 100%;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--panel-soft);
  cursor: pointer;
}

.asset-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.asset-status,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.asset-status {
  position: absolute;
  right: 9px;
  top: 9px;
}

.status-review {
  background: #fff2dc;
  color: #925a08;
}

.status-approved {
  background: #e1f5ea;
  color: #176943;
}

.asset-body {
  padding: 12px 12px 13px;
}

.asset-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.file-badge,
.asset-state {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.file-badge {
  background: #edf2f5;
  color: #4e5f68;
}

.asset-state {
  background: #e8f3f1;
  color: var(--accent-dark);
}

.asset-state.needs-review {
  background: #fff5df;
  color: #85590f;
}

.asset-body p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.asset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 50px;
  margin-top: 10px;
  overflow: hidden;
}

.asset-tags span {
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 3px;
  background: #edf3f2;
  color: #1d665f;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-open {
  overflow: hidden;
}

.asset-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
}

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

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 15, 19, 0.68);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 56px));
  max-height: min(760px, calc(100vh - 56px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.modal-actions {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: flex;
  gap: 8px;
}

.modal-action {
  min-height: 32px;
  padding: 6px 10px;
  border-color: rgba(17, 24, 29, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bookmark-action.active {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.bookmark-action {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
}

.bookmark-action.active:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  color: #fff;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 2.5vh 2.5vw;
  opacity: 0;
  transition: opacity 220ms ease;
}

.image-viewer.hidden {
  display: none;
}

.image-viewer.is-open {
  opacity: 1;
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 8, 11, 0.82);
}

.image-viewer-close {
  position: absolute;
  top: calc(2.5vh + 10px);
  right: calc(2.5vw + 10px);
  z-index: 2;
  display: grid;
  width: 42px;
  height: 42px;
  min-height: 42px;
  place-items: center;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
  color: #182229;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.image-viewer-close:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: #fff;
  color: #0d151a;
}

.full-image {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.52);
  transform: scale(0.965);
  opacity: 0;
  transition: transform 260ms ease, opacity 220ms ease;
}

.image-viewer.is-open .full-image {
  transform: scale(1);
  opacity: 1;
}

.modal-detail {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(340px, 0.8fr);
  max-height: inherit;
  min-width: 0;
}

.modal-media {
  min-width: 0;
  background: #101820;
}

.modal-info {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border-left: 1px solid rgba(215, 222, 226, 0.56);
  background: linear-gradient(180deg, #fff 0%, #fbfcfc 100%);
}

.inspector-top {
  padding: 22px 24px 11px;
  border-bottom: 0;
}

.inspector-top h2 {
  margin: 0;
  color: #666;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 780;
}

.detail-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(760px, calc(100vh - 56px));
  object-fit: cover;
  border: 0;
  border-radius: 0;
  background: #101820;
}

.detail-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  min-height: 0;
  padding: 12px 24px 22px;
}

.detail-heading::after {
  position: absolute;
  right: 24px;
  bottom: 0;
  left: 24px;
  height: 1px;
  background: linear-gradient(90deg, rgba(202, 211, 216, 0), rgba(202, 211, 216, 0.78) 13%, rgba(202, 211, 216, 0.78) 87%, rgba(202, 211, 216, 0));
  content: "";
}

.asset-id {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 7px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f6;
  color: #61717a;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.detail-heading h2 {
  margin: 0;
  color: #1c2931;
  font-size: 20px;
  line-height: 1.36;
  font-weight: 820;
}

.confidence-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 24px 0;
  padding: 13px 14px;
  background: #f6f9f9;
  border: 1px solid rgba(218, 226, 229, 0.72);
  border-radius: 6px;
  color: #667780;
}

.confidence-copy {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 9px;
  font-weight: 760;
}

.confidence-track {
  overflow: hidden;
  height: 5px;
  border-radius: 999px;
  background: #dde8e7;
}

.confidence-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16786e, #2aa091);
}

.confidence-box strong {
  color: var(--blue);
  font-size: 20px;
  font-weight: 820;
}

.detail-field {
  position: relative;
  min-width: 0;
  padding: 22px 24px 0;
}

.detail-field + .detail-field {
  padding-top: 24px;
}

.field-label {
  color: #5f7079;
  font-size: 13px;
  font-weight: 820;
}

.readonly-value {
  margin-top: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.readonly-value.memo {
  margin-top: 11px;
  padding: 14px 15px;
  margin-bottom: 20px;
  border-left: 3px solid rgba(22, 120, 110, 0.42);
  border-radius: 0 6px 6px 0;
  background: rgba(246, 249, 249, 0.9);
  color: var(--text);
  font-weight: 620;
}

.readonly-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  margin-top: 11px;
}

.readonly-tags span {
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 5px;
  background: #eaf3f1;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.hidden {
  display: none;
}

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

.empty-state h2 {
  color: var(--text);
}

.content > .library-toolbar {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .topbar::before,
  .topbar::after,
  .quick-list button,
  .tag-chip {
    animation: none;
    transition: none;
  }

  .quick-list button:hover,
  .quick-list button:active,
  .tag-chip:hover,
  .tag-chip:active {
    transform: none;
  }
}

@media (max-width: 1080px) {
  .topbar {
    flex-wrap: wrap;
    gap: 14px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .header-left {
    flex: 1 1 auto;
  }

  .header-search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .top-actions {
    gap: 14px;
  }

  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-list {
    grid-template-columns: 1fr;
  }

  .modal-detail {
    grid-template-columns: 1fr;
  }

  .modal-media {
    max-height: 46vh;
  }

  .detail-image {
    max-height: 46vh;
  }
}

@media (max-width: 760px) {
  .topbar,
  .app-shell {
    padding: 14px;
  }

  .topbar {
    position: relative;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-height: 64px;
    padding: 14px 12px;
    flex-wrap: nowrap;
    overflow: visible;
  }

  .header-left {
    flex: 0 1 auto;
    max-width: calc(100vw - 198px);
    min-width: 0;
    overflow: hidden;
    margin-left: 2px;
  }

  .mobile-menu-button {
    position: relative;
    z-index: 2;
    display: grid;
    flex: 0 0 28px;
    width: 28px;
    min-width: 28px;
    height: 32px;
    place-items: center;
    padding: 0;
    border: 0;
    background-color: transparent;
    background-image: url("./assets/ui/menu-icon.png");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 28px auto;
  }

  .mobile-menu-button span {
    display: none;
  }

  .brand-block {
    gap: 6px;
    min-width: 0;
  }

  .database-mark {
    width: 34px;
    height: 34px;
  }

  .desktop-title {
    display: none;
  }

  .mobile-title {
    display: inline;
  }

  .brand-copy h1 {
    font-size: 16px;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-search {
    position: absolute;
    top: calc(100% + 10px);
    left: 12px;
    right: 12px;
    z-index: 6;
    flex: 1 0 100%;
    display: none;
    grid-template-columns: 1fr auto;
    width: auto;
    max-width: none;
    height: 44px;
    min-width: 0;
    order: 0;
    overflow: hidden;
  }

  .topbar.search-open .header-search {
    display: grid;
  }

  .header-keyword-wrap,
  .header-search-button {
    width: 100%;
    height: 44px;
  }

  .header-keyword-wrap input,
  .header-search-button {
    border-radius: 0;
  }

  .header-keyword-wrap input {
    border-radius: 7px 0 0 7px;
  }

  .header-search-button {
    justify-content: center;
    border-top: 0;
    border-left: 1px solid rgba(8, 81, 76, 0.14);
    border-radius: 0 7px 7px 0;
  }

  .header-search-button {
    width: auto;
    padding: 0 16px;
  }

  .top-actions {
    position: absolute;
    top: 20px;
    right: 12px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 128px;
  }

  .top-actions > button,
  .top-actions .login-button {
    flex: 0 0 26px;
  }

  .top-actions .header-icon-button,
  .top-actions .login-button {
    display: grid;
    grid-template-rows: 26px;
    width: 26px;
    min-width: 26px;
    height: 26px;
    min-height: 26px;
    place-items: center;
    padding: 0;
    color: #fff;
  }

  .header-icon-button > span:not(.bookmark-icon):not(.history-icon):not(.mobile-search-icon),
  .login-label {
    display: none;
  }

  .header-icon-button strong {
    top: -6px;
    right: -6px;
  }

  .top-actions .mobile-search-toggle {
    display: grid;
  }

  .bookmark-icon,
  .history-icon,
  .mobile-search-icon,
  .login-icon {
    width: 23px;
    height: 23px;
  }

  .bookmark-icon {
    width: 29px !important;
    height: 29px !important;
  }

  .login-icon {
    width: 34px !important;
    height: 34px !important;
  }

  .history-icon {
    background-size: 23px 23px;
  }

  .admin-link {
    display: none;
  }

  .login-button {
    width: 26px;
    min-width: 26px;
    height: 26px;
    min-height: 26px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .mobile-menu {
    position: fixed;
    top: 70px;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: block;
    width: min(82vw, 330px);
    padding: 26px 18px 22px;
    overflow-y: auto;
    border: 0;
    background: #fff;
    box-shadow: 18px 28px 70px rgba(9, 19, 24, 0.24);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  .topbar.menu-open .mobile-menu {
    transform: translateX(0);
  }

  .mobile-menu-backdrop {
    position: fixed;
    top: 70px;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 25;
    display: none;
    pointer-events: none;
    background: rgba(9, 15, 19, 0);
    transition: background-color 220ms ease;
  }

  .topbar.menu-open .mobile-menu-backdrop {
    display: block;
    pointer-events: auto;
    background: rgba(9, 15, 19, 0.56);
  }

  .mobile-menu-main {
    display: flex;
    width: 100%;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    font-size: 15px;
    font-weight: 760;
  }

  .mobile-menu-main::after {
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    content: "";
  }

  .mobile-menu-main[aria-expanded="true"]::after {
    transform: rotate(135deg);
  }

  .mobile-menu-main:last-child {
    border-bottom: 0;
  }

  .mobile-menu-list,
  .mobile-tag-list {
    display: none;
    padding: 10px 0 14px;
  }

  .mobile-menu-list.is-open,
  .mobile-tag-list.is-open {
    display: grid;
  }

  .mobile-menu-list {
    gap: 4px;
  }

  .mobile-tag-list {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
  }

  .mobile-tag-list.is-open {
    display: flex;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .admin-page {
    padding: 14px;
  }

  .admin-header,
  .admin-panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-row {
    grid-template-columns: 1fr;
  }

  .admin-thumb {
    width: 100%;
  }

  .admin-field-grid {
    grid-template-columns: 1fr;
  }

  .asset-modal {
    padding: 14px;
    align-items: center;
    z-index: 80;
  }

  .modal-panel {
    width: calc(100vw - 28px);
    height: auto;
    max-height: calc(100dvh - 28px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.modal-open .topbar {
    display: none;
  }

  .modal-actions {
    top: 14px;
    right: 14px;
    left: 14px;
    justify-content: flex-end;
    gap: 10px;
  }

  .modal-action {
    min-width: 82px;
  }

  .modal-detail {
    max-height: none;
    overflow: visible;
  }

  .modal-info {
    overflow: visible;
    border-left: 0;
  }

  .modal-media {
    max-height: 38dvh;
  }

  .detail-image {
    max-height: 38dvh;
    object-fit: contain;
  }

  .bookmark-action,
  .bookmark-action.active {
    position: absolute;
    top: 14px;
    right: 197px;
    bottom: auto;
    margin: 0;
  }

  .readonly-value {
    margin-top: 13px;
  }

  .sidebar {
    display: none;
  }

  .sidebar section {
    padding: 7px;
  }

  .filter-section-collapsible {
    padding: 0;
  }

  .filter-section-collapsible .filter-toggle {
    position: relative;
    display: flex;
    width: 100%;
    margin: 0;
    min-height: 40px;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border: 0;
    background: #fff;
    color: var(--ink);
    font-size: 13px;
    font-weight: 820;
    cursor: pointer;
  }

  .filter-section-collapsible .filter-toggle::after {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 160ms ease;
    content: "";
  }

  .filter-section-collapsible.is-open .filter-toggle::after {
    transform: rotate(225deg) translate(-2px, -1px);
  }

  .filter-section-collapsible .filter-content {
    display: none;
    padding: 0 14px 14px;
  }

  .filter-section-collapsible.is-open .filter-content {
    display: block;
  }

  .library-toolbar {
    grid-template-columns: 1fr;
  }

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

  .tag-scroll {
    max-height: var(--tag-mobile-max-height, 304px);
    overflow: hidden;
    padding-right: 0;
    transition: max-height 180ms ease;
  }

  .tag-list {
    flex-wrap: wrap;
    width: 100%;
    max-width: none;
  }

  .tag-chip {
    flex: 0 1 auto;
    max-width: 100%;
    white-space: normal;
  }

  .tag-show-more {
    display: inline-flex;
    width: 100%;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
  }

  .tag-show-more.hidden {
    display: none;
  }
}
