:root {
  --bg: #f4f6f8;
  --bg-soft: #eef2f5;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-strong: #ffffff;
  --panel-soft: #f8fafb;
  --ink: #18212b;
  --muted: #607080;
  --line: rgba(24, 33, 43, 0.1);
  --accent: #1774ff;
  --accent-soft: rgba(23, 116, 255, 0.1);
  --success: #1f9d61;
  --warning: #d18a00;
  --danger: #d64545;
  --shadow: 0 10px 24px rgba(24, 33, 43, 0.06);
  --shadow-soft: 0 4px 12px rgba(24, 33, 43, 0.04);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #11161b;
  --bg-soft: #171e25;
  --panel: rgba(23, 30, 37, 0.96);
  --panel-strong: #1b232c;
  --panel-soft: #202a34;
  --ink: #edf3f8;
  --muted: #9dafbf;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #5aa2ff;
  --accent-soft: rgba(90, 162, 255, 0.14);
  --success: #4cc589;
  --warning: #f2b84c;
  --danger: #ff7e7e;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.12);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
}

a {
  color: inherit;
}

.page-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 20px 64px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
  padding: 26px 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.82);
}

:root[data-theme="dark"] .hero {
  background: linear-gradient(180deg, rgba(27, 35, 44, 0.92), rgba(22, 29, 36, 0.96));
  border-color: rgba(255, 255, 255, 0.06);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 10px 0 0;
  font-size: clamp(2.1rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.nav-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.theme-switcher {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(24, 33, 43, 0.05);
  border: 1px solid rgba(24, 33, 43, 0.08);
}

:root[data-theme="dark"] .theme-switcher {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.theme-toggle {
  background: transparent;
  color: var(--ink);
  border: 0;
  padding: 8px 14px;
}

.theme-toggle.is-active {
  background: var(--ink);
  color: var(--panel-strong);
}

.top-nav a,
.ghost-button,
button,
.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.top-nav a,
.ghost-button,
.text-link {
  background: rgba(24, 33, 43, 0.05);
  border: 1px solid rgba(24, 33, 43, 0.08);
  color: var(--ink);
}

:root[data-theme="dark"] .top-nav a,
:root[data-theme="dark"] .ghost-button,
:root[data-theme="dark"] .text-link {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

button {
  background: var(--accent);
  color: white;
  box-shadow: none;
}

.danger-button {
  background: var(--danger);
  box-shadow: none;
}

.top-nav a:hover,
.ghost-button:hover,
button:hover,
.text-link:hover,
.settings-nav-link:hover,
.collection-button:hover,
.settings-card:hover,
.library-card:hover {
  transform: translateY(-1px);
}

.panel,
.stat-card,
.flash {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 24px;
  box-shadow: none;
  backdrop-filter: none;
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .stat-card,
:root[data-theme="dark"] .flash {
  border-color: rgba(255, 255, 255, 0.06);
}

.panel {
  padding: 24px;
}

.flash {
  padding: 16px 18px;
  margin-bottom: 18px;
  color: var(--accent);
  background: var(--accent-soft);
}

.stats-grid,
.library-grid,
.home-layout,
.viewer-layout,
.form-split,
.badge-grid {
  display: grid;
  gap: 18px;
}

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

.stat-card {
  padding: 18px 20px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 1.95rem;
  letter-spacing: -0.04em;
}

.success strong,
.success span {
  color: var(--success);
}

.warning strong,
.warning span {
  color: var(--warning);
}

.danger strong,
.danger span {
  color: var(--danger);
}

.home-layout {
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  margin-bottom: 18px;
}

.collections-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.viewer-layout {
  grid-template-columns: minmax(0, 1.3fr) minmax(330px, 0.82fr);
  margin-bottom: 18px;
  align-items: start;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2,
.library-card h3,
.collection-item h3,
.settings-card h3 {
  margin: 0 0 6px;
}

.section-head h2,
.panel h2 {
  letter-spacing: -0.03em;
}

.muted,
.empty,
.meta-line,
.pagination-status,
.pagination-disabled {
  color: var(--muted);
}

.empty {
  margin: 0;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: var(--panel-soft);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(23, 116, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(23, 116, 255, 0.12);
}

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

.library-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.library-card {
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  overflow: hidden;
}

.library-card:hover {
  border-color: rgba(23, 116, 255, 0.22);
}

.card-cover {
  display: flex;
  text-decoration: none;
}

.thumb-shell {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #ccd7e2, #8ca0b6);
}

:root[data-theme="dark"] .thumb-shell {
  background: linear-gradient(135deg, #243140, #131a22);
}

.video-cover {
  background:
    linear-gradient(180deg, rgba(18, 24, 30, 0.18), rgba(18, 24, 30, 0.78)),
    linear-gradient(135deg, #5d7286, #233444);
}

.audio-cover {
  background:
    linear-gradient(180deg, rgba(23, 116, 255, 0.22), rgba(23, 116, 255, 0.82)),
    linear-gradient(135deg, #5b96ff, #1c3869);
}

.cover-type {
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 0.78rem;
  color: white;
}

.card-cover strong {
  font-size: 1.16rem;
}

.card-body {
  padding: 16px 16px 18px;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.9em;
}

.badge-row,
.badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-badges {
  margin-top: 12px;
}

.card-owner {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.card-utility-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.card-utility-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  text-decoration: none;
  background: rgba(24, 33, 43, 0.05);
  color: var(--muted);
  border: 1px solid var(--line);
}

:root[data-theme="dark"] .card-utility-link {
  background: rgba(255, 255, 255, 0.05);
}

.card-utility-link svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.card-utility-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  background: rgba(24, 33, 43, 0.05);
  color: var(--muted);
  border: 1px solid var(--line);
}

:root[data-theme="dark"] .card-utility-button {
  background: rgba(255, 255, 255, 0.05);
}

.card-utility-button svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.card-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 18px;
  color: white;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(23, 116, 255, 0.1);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 700;
}

.badge-muted {
  background: rgba(24, 33, 43, 0.06);
  color: var(--muted);
}

.large-badge {
  padding: 10px 14px;
}

.progress-block {
  margin-top: 12px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-head strong {
  color: var(--ink);
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(24, 33, 43, 0.08);
  overflow: hidden;
}

:root[data-theme="dark"] .progress-bar {
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #6da8ff);
}

.auth-panel,
.settings-panel {
  max-width: 620px;
}

.settings-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.settings-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 11px 15px;
  border-radius: 999px;
  text-decoration: none;
  background: rgba(24, 33, 43, 0.05);
  border: 1px solid var(--line);
  font-weight: 800;
}

:root[data-theme="dark"] .settings-nav-link {
  background: rgba(255, 255, 255, 0.05);
}

.settings-nav-link-active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.settings-card-grid,
.settings-two-column {
  display: grid;
  gap: 18px;
}

.settings-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.settings-card {
  display: block;
  padding: 22px;
  border-radius: 24px;
  text-decoration: none;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.settings-card h3 {
  margin: 10px 0 8px;
  font-size: 1.16rem;
}

.settings-two-column {
  grid-template-columns: minmax(330px, 0.95fr) minmax(0, 1.05fr);
}

.inline-form {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 18px;
}

.share-filter-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
  min-width: 0;
}

.filter-reset-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  text-decoration: none;
  white-space: nowrap;
}

.collection-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.collection-item {
  padding: 0;
}

.collection-item-active {
  border-radius: 22px;
  background: var(--accent-soft);
}

.collection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.collection-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  padding: 18px 16px;
  text-decoration: none;
  border-radius: 20px;
  border: 1px solid transparent;
}

.collection-button:hover {
  background: rgba(24, 33, 43, 0.04);
  border-color: var(--line);
}

:root[data-theme="dark"] .collection-button:hover {
  background: rgba(255, 255, 255, 0.04);
}

.collection-item-active .collection-button {
  border-color: rgba(23, 116, 255, 0.2);
}

.collection-button-main {
  min-width: 0;
}

.collection-button-main h3,
.collection-button-main p {
  overflow-wrap: anywhere;
}

.collection-button-label {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.collection-arrow {
  display: inline-flex;
  margin-top: 10px;
  color: var(--accent);
  font-weight: 800;
}

.collection-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.collection-owner {
  color: var(--muted);
  font-size: 0.88rem;
}

.collection-delete-form {
  display: inline-flex;
}

.video-stage,
.audio-stage {
  border-radius: 24px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
}

.video-stage {
  aspect-ratio: 16 / 9;
}

.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.audio-stage {
  padding: 22px;
  background: linear-gradient(145deg, #dde7f2, #cddcf0);
}

:root[data-theme="dark"] .audio-stage {
  background: linear-gradient(145deg, #203041, #16222d);
}

audio,
video {
  width: 100%;
  display: block;
}

.meta-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.share-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.share-item {
  padding: 18px;
  border-radius: 22px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.share-item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.share-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.share-download-link {
  display: inline-flex;
  justify-content: center;
  width: 100%;
  margin-top: 14px;
}

.share-overview-input {
  min-width: 240px;
  font-size: 0.88rem;
}

.meta-card a {
  color: var(--accent);
  word-break: break-all;
}

.meta-preview-list {
  display: grid;
  gap: 12px;
}

.meta-preview-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.meta-preview-item span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.meta-preview-item strong,
.meta-preview-item a {
  word-break: break-word;
}

.meta-preview-item a {
  color: var(--accent);
}

.app-dialog {
  width: min(680px, calc(100vw - 24px));
  padding: 0;
  border: 0;
  background: transparent;
}

.app-dialog::backdrop {
  background: rgba(10, 14, 18, 0.56);
}

.dialog-backdrop-close {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.dialog-ghost-close {
  width: 100%;
  height: 100%;
  padding: 0;
  opacity: 0;
}

.dialog-card {
  position: relative;
  z-index: 1;
  margin: min(10vh, 72px) auto;
  padding: 22px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.dialog-card-wide {
  width: min(760px, calc(100vw - 24px));
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.dialog-head h2 {
  margin: 8px 0 0;
}

.dialog-close-button {
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
  background: rgba(24, 33, 43, 0.05);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.meta-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.table-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  background: rgba(24, 33, 43, 0.04);
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
}

:root[data-theme="dark"] thead th {
  background: rgba(255, 255, 255, 0.04);
}

tbody tr:hover {
  background: rgba(24, 33, 43, 0.03);
}

:root[data-theme="dark"] tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.user-admin-grid {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.user-admin-card {
  min-width: 0;
  padding: 18px;
  border-radius: 22px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.user-admin-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 14px;
  min-width: 0;
}

.user-admin-head h3 {
  margin: 0 0 4px;
  font-size: 1.08rem;
}

.user-admin-head > div,
.user-admin-head h3,
.user-admin-head p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-admin-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-admin-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  min-width: 0;
}

.user-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.user-admin-actions .inline-form {
  min-width: 0;
  max-width: 100%;
}

.user-admin-actions select {
  width: auto;
  min-width: 0;
  max-width: 100%;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}

@media (max-width: 920px) {
  .page-shell {
    padding: 16px 14px 48px;
  }

  .hero,
  .section-head,
  .collection-row,
  .user-admin-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-stack,
  .top-nav {
    justify-content: flex-start;
    align-items: flex-start;
  }

  .home-layout,
  .collections-layout,
  .viewer-layout,
  .settings-two-column,
  .form-split,
  .search-form,
  .collection-row {
    grid-template-columns: 1fr;
  }

  .collection-side {
    align-items: flex-start;
  }

  .hero {
    padding: 22px 20px;
  }
}

/* Refined media-library shell */
:root {
  --bg: #f3f5f2;
  --bg-soft: #e9eeea;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-soft: #f6f8f5;
  --ink: #17201d;
  --muted: #68746f;
  --line: #dfe5e1;
  --accent: #16725f;
  --accent-soft: #e1f1ec;
  --sidebar: #15241f;
  --sidebar-soft: #21342d;
  --sidebar-ink: #eef6f2;
  --success: #27815f;
  --warning: #b87317;
  --danger: #c64b4b;
  --shadow: 0 18px 48px rgba(22, 35, 30, 0.08);
  --shadow-soft: 0 8px 24px rgba(22, 35, 30, 0.06);
  font-family: "Pretendard Variable", "SUIT Variable", "Avenir Next", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #101714;
  --bg-soft: #15201c;
  --panel: #19231f;
  --panel-strong: #202c27;
  --panel-soft: #141d1a;
  --ink: #eef5f1;
  --muted: #9aaba4;
  --line: #2b3a34;
  --accent: #62c4a8;
  --accent-soft: rgba(98, 196, 168, 0.12);
  --sidebar: #0b110f;
  --sidebar-soft: #17231f;
  --sidebar-ink: #f2f7f4;
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.16);
}

body {
  background:
    radial-gradient(circle at 90% 0%, rgba(72, 135, 113, 0.1), transparent 32rem),
    var(--bg);
}

.app-layout {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 20px 20px;
  color: var(--sidebar-ink);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.045), transparent 38%),
    var(--sidebar);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand-lockup > span:last-child {
  display: grid;
  min-width: 0;
}

.brand-lockup strong {
  overflow: hidden;
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-lockup small {
  margin-top: 3px;
  color: rgba(238, 246, 242, 0.56);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.brand-mark {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  color: #10201a;
  background: #9ad9c4;
  font-family: Georgia, serif;
  font-size: 1.25rem;
  font-weight: 900;
}

.side-nav {
  display: grid;
  gap: 5px;
  margin-top: 46px;
}

.side-nav-label {
  padding: 0 12px 8px;
  color: rgba(238, 246, 242, 0.45);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.side-nav-section {
  margin-top: 24px;
}

.side-nav a {
  position: relative;
  padding: 12px 14px;
  border-radius: 11px;
  color: rgba(238, 246, 242, 0.72);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 750;
  transition: color 150ms ease, background 150ms ease;
}

.side-nav a:hover,
.side-nav a.is-active {
  color: #fff;
  background: var(--sidebar-soft);
}

.side-nav a.is-active::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: -20px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #8ed3bc;
  content: "";
}

.sidebar-footer {
  display: grid;
  gap: 14px;
  margin-top: auto;
}

.sidebar-footer .theme-switcher {
  width: 100%;
  padding: 4px;
  border-color: rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer .theme-toggle {
  flex: 1;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  color: rgba(238, 246, 242, 0.7);
  font-size: 0.75rem;
}

.sidebar-footer .theme-toggle.is-active {
  color: #10201a;
  background: #dff2eb;
}

.sidebar-account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-account > span:last-child {
  display: grid;
}

.sidebar-account strong {
  font-size: 0.84rem;
}

.sidebar-account small {
  margin-top: 2px;
  color: rgba(238, 246, 242, 0.48);
  font-size: 0.69rem;
  text-transform: uppercase;
}

.account-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 900;
}

.sidebar-footer form {
  margin: 0;
}

.sidebar-logout {
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(238, 246, 242, 0.72);
  background: transparent;
  box-shadow: none;
  font-size: 0.78rem;
}

.sidebar-logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.app-main {
  min-width: 0;
  padding: 38px clamp(22px, 4vw, 64px) 72px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  max-width: 1500px;
  margin: 0 auto 32px;
}

.page-header h1,
.public-title h1 {
  margin: 8px 0 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.055em;
}

.page-header-account,
.permission-chip {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel);
  font-size: 0.74rem;
  font-weight: 800;
}

.page-content,
.app-main > .flash {
  width: 100%;
  max-width: 1500px;
  margin-right: auto;
  margin-left: auto;
}

.page-content {
  animation: content-in 280ms ease both;
}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.public-page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.public-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0 34px;
}

.public-header .brand-lockup {
  color: var(--ink);
}

.public-header .brand-lockup small {
  color: var(--muted);
}

.public-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.public-title {
  margin: 44px 0 28px;
}

.eyebrow,
.section-kicker {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.section-kicker {
  margin: 0 0 8px;
}

.panel,
.stat-card,
.flash {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: none;
}

.panel {
  padding: clamp(20px, 3vw, 30px);
}

.page-content > section + section,
.page-content > .settings-layout + section {
  margin-top: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.18rem;
  letter-spacing: -0.025em;
}

.section-head .muted {
  margin-top: 7px;
}

button,
.text-link,
.ghost-button,
.top-nav a {
  min-height: 40px;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 800;
}

button {
  background: var(--accent);
}

button:hover,
.text-link:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

input,
select,
textarea {
  min-height: 45px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--panel-soft);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid var(--accent-soft);
  border-color: var(--accent);
}

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

.stat-card {
  min-height: 126px;
  padding: 22px;
}

.stat-card strong {
  color: var(--ink);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.library-grid {
  grid-template-columns: repeat(auto-fill, minmax(218px, 1fr));
  gap: 22px 18px;
}

.library-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.library-card:hover {
  transform: translateY(-3px);
  border-color: rgba(22, 114, 95, 0.35);
  box-shadow: var(--shadow-soft);
}

.card-cover,
.thumb-shell {
  aspect-ratio: 16 / 9;
  border-radius: 0;
  background: #dce4df;
}

.card-thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body {
  padding: 15px 15px 13px;
}

.card-title {
  min-height: 2.7em;
  margin: 0 0 11px;
  overflow: hidden;
  font-size: 0.94rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.compact-badges {
  min-height: 25px;
  overflow: hidden;
  white-space: nowrap;
}

.badge {
  border: 0;
  border-radius: 7px;
  background: var(--accent-soft);
  font-size: 0.7rem;
}

.card-utility-row {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.card-utility-link,
.card-utility-button {
  border-radius: 8px;
  background: transparent;
}

.settings-layout {
  gap: 20px;
}

.settings-nav {
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.settings-nav-link {
  border-radius: 9px;
  font-size: 0.78rem;
}

.settings-nav-link-active {
  color: var(--panel-strong);
  background: var(--ink);
}

:root[data-theme="dark"] .settings-nav-link.settings-nav-link-active {
  color: var(--bg);
  border-color: transparent;
  background: var(--ink);
}

.settings-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.settings-card {
  min-height: 178px;
  padding: 22px;
  border-color: var(--line);
  border-radius: 15px;
  background: var(--panel-soft);
  box-shadow: none;
}

.settings-card:hover {
  border-color: rgba(22, 114, 95, 0.4);
  background: var(--panel);
}

.security-summary-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.security-policy-panel {
  overflow: hidden;
}

.security-policy-form {
  margin-top: 24px;
}

.security-policy-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.policy-field {
  display: flex;
  min-width: 0;
  min-height: 150px;
  flex-direction: column;
  align-items: flex-start;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-soft);
}

.policy-field > span {
  font-size: 0.86rem;
  font-weight: 850;
}

.policy-field small {
  min-height: 3em;
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.policy-field input {
  width: 100%;
  margin-top: auto;
  font-size: 1.05rem;
  font-weight: 850;
}

.policy-field strong {
  margin-top: auto;
  color: var(--accent);
  font-size: 1.55rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
}

.form-actions .muted {
  margin: 0;
  font-size: 0.76rem;
}

.security-block-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.security-block-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-soft);
}

.security-block-card h3 {
  margin: 8px 0 5px;
  font-size: 0.92rem;
}

.security-block-card p {
  margin: 0;
  font-size: 0.76rem;
}

.security-block-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.74rem;
}

.security-event-badge {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 7px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.security-event-badge.danger {
  color: var(--danger);
  background: rgba(198, 75, 75, 0.1);
}

.share-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
}

.share-link-row input {
  width: 100%;
  min-width: 0;
}

.share-link-row-compact {
  min-width: min(300px, 70vw);
}

.copy-button {
  white-space: nowrap;
}

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

.check-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  cursor: pointer;
}

.check-option input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.check-option span {
  display: grid;
  gap: 4px;
}

.check-option strong {
  font-size: 0.85rem;
}

.check-option small,
.download-disabled-note {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.download-disabled-note {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.share-disclosure {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.share-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.share-disclosure > summary::-webkit-details-marker {
  display: none;
}

.share-disclosure > summary:hover {
  background: var(--panel-soft);
}

.share-disclosure-copy {
  display: grid;
  gap: 5px;
}

.share-disclosure-copy strong {
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.share-disclosure-copy small {
  color: var(--muted);
  font-size: 0.75rem;
}

.share-disclosure-side {
  display: flex;
  align-items: center;
  gap: 9px;
}

.share-disclosure-action {
  display: inline-flex;
  min-width: 54px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: #fff;
  background: var(--accent);
  font-size: 0.76rem;
  font-weight: 850;
}

.share-disclosure[open] .share-disclosure-action {
  font-size: 0;
}

.share-disclosure[open] .share-disclosure-action::after {
  content: "닫기";
  font-size: 0.76rem;
}

.share-disclosure-body {
  padding: 24px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
}

.share-existing-links {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.share-danger-zone {
  border-color: rgba(198, 75, 75, 0.28);
}

.share-danger-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.share-danger-card {
  display: flex;
  min-width: 0;
  min-height: 230px;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.share-danger-card-critical {
  border-color: rgba(198, 75, 75, 0.28);
  background: rgba(198, 75, 75, 0.045);
}

.share-danger-card h3 {
  margin: 0 0 8px;
  font-size: 0.96rem;
}

.share-danger-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.6;
}

.share-danger-card form {
  margin: 0;
}

.table-shell {
  margin-top: 18px;
  border-radius: 13px;
  background: var(--panel-soft);
}

th,
td {
  padding: 13px 14px;
  font-size: 0.79rem;
}

thead th {
  background: rgba(23, 32, 29, 0.035);
  font-size: 0.69rem;
  text-transform: uppercase;
}

.user-admin-card,
.share-item,
.collection-item {
  border-radius: 14px;
  background: var(--panel-soft);
}

.app-dialog::backdrop {
  background: rgba(9, 17, 14, 0.62);
  backdrop-filter: blur(3px);
}

.dialog-card {
  border-radius: 17px;
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .home-layout,
  .collections-layout,
  .viewer-layout,
  .settings-two-column {
    grid-template-columns: minmax(0, 1fr);
  }

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

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

.page-content,
.page-content > *,
.settings-layout,
.settings-content,
.settings-two-column,
.settings-two-column > *,
.collections-layout,
.collections-layout > *,
.viewer-layout,
.viewer-layout > *,
.form-split,
.form-split > * {
  min-width: 0;
}

@media (max-width: 820px) {
  .app-layout {
    display: block;
  }

  .app-sidebar {
    position: relative;
    z-index: 5;
    height: auto;
    padding: 16px;
  }

  .app-sidebar .brand-lockup {
    margin-bottom: 14px;
  }

  .side-nav {
    display: flex;
    gap: 6px;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar {
    display: none;
  }

  .side-nav-label,
  .sidebar-account,
  .sidebar-footer > .theme-switcher {
    display: none;
  }

  .side-nav a {
    flex: 0 0 auto;
    padding: 9px 12px;
    font-size: 0.78rem;
  }

  .side-nav a.is-active::before {
    display: none;
  }

  .sidebar-footer {
    position: absolute;
    top: 17px;
    right: 16px;
    display: block;
    margin: 0;
  }

  .sidebar-logout {
    width: auto;
    min-height: 36px;
  }

  .app-main {
    padding: 28px 16px 54px;
  }

  .page-header {
    align-items: flex-start;
  }

  .page-header-account {
    display: none;
  }

  .public-header,
  .public-header-actions {
    align-items: flex-start;
  }

  .public-header {
    flex-direction: column;
  }

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

  .security-block-card,
  .security-block-actions,
  .form-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .share-link-row:not(.share-link-row-compact) {
    grid-template-columns: 1fr;
  }

  .share-danger-grid {
    grid-template-columns: 1fr;
  }

  .share-filter-form {
    grid-template-columns: minmax(0, 1fr) minmax(140px, 180px);
  }

  .share-filter-form button,
  .share-filter-form .filter-reset-link {
    width: 100%;
  }

  .share-disclosure > summary {
    align-items: flex-start;
    padding: 18px;
  }

  .share-disclosure-body {
    padding: 18px;
  }

  .share-disclosure-copy small {
    max-width: 240px;
  }
}

@media (max-width: 560px) {
  .app-sidebar .brand-lockup strong,
  .app-sidebar .brand-lockup small {
    display: none;
  }

  .side-nav {
    padding-right: 64px;
  }

  .page-header h1,
  .public-title h1 {
    font-size: 2rem;
  }

  .panel {
    padding: 18px;
  }

  .share-filter-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-nav {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .settings-nav-link {
    flex: 0 0 auto;
  }

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

  .user-admin-actions .inline-form,
  .user-admin-actions button,
  .user-admin-actions select {
    width: 100%;
  }

  .stats-grid,
  .security-summary-grid,
  .security-policy-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 102px;
  }

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

  .card-title {
    min-height: auto;
  }

  .policy-field {
    min-height: 132px;
  }

  .pagination {
    flex-wrap: wrap;
  }
}
