:root {
  --app-bg: #f4f0fb;
  --app-ink: #302a46;
  --app-muted: #79718b;
  --app-sidebar: #202722;
  --app-accent: #7954bf;
  --app-danger: #b8323b;
  --app-line: #e6def0;
  --app-card: #fffcff;
  --app-card-hover: #f3edfc;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--app-ink);
  background:
    linear-gradient(180deg, #f7f9f6 0%, var(--app-bg) 34rem),
    var(--app-bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

img {
  max-width: 100%;
}

.global-app-nav {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 900;
  border-bottom: 1px solid rgba(205, 220, 213, .9);
  padding: .5rem max(clamp(.75rem, 2vw, 2rem), calc((100vw - 2160px) / 2));
  background: rgba(250, 252, 250, .92);
  box-shadow: 0 .4rem 1.5rem rgba(30, 43, 36, .06);
  backdrop-filter: blur(18px);
}

.global-app-brand,
.global-app-nav nav,
.global-app-account {
  display: flex;
  align-items: center;
}

.global-app-brand {
  gap: .55rem;
  color: #213a32;
  text-decoration: none;
}

.global-app-brand > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #228b78, #145f53);
  color: #fff;
  font-size: .74rem;
  font-weight: 900;
}

.global-app-nav nav {
  gap: .25rem;
}

.global-app-nav nav a,
.global-app-account a,
.global-app-account span {
  border-radius: 10px;
  padding: .45rem .7rem;
  color: #5d6f68;
  font-size: .84rem;
  font-weight: 750;
  text-decoration: none;
}

.global-app-nav nav a:hover,
.global-app-nav nav a.active {
  background: #e5f3ee;
  color: #176b5d;
}

.global-app-account span {
  background: #f0f3f1;
}

.profile-menu {
  position: relative;
}

.profile-menu summary {
  display: flex;
  gap: .5rem;
  align-items: center;
  border-radius: 12px;
  padding: .3rem .45rem .3rem .3rem;
  background: #eef3f0;
  color: #344a42;
  cursor: pointer;
  list-style: none;
}

.profile-menu summary::-webkit-details-marker {
  display: none;
}

.profile-menu-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: #197967 !important;
  color: #fff !important;
  font-weight: 900;
}

.profile-menu-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-menu-name {
  padding: 0 !important;
  background: transparent !important;
}

.profile-menu summary i {
  color: #81908a;
  font-style: normal;
}

.profile-menu-panel {
  width: 240px;
  display: grid;
  gap: .25rem;
  position: absolute;
  top: calc(100% + .55rem);
  right: 0;
  z-index: 1000;
  border: 1px solid #d8e2dd;
  border-radius: 15px;
  padding: .55rem;
  background: #fff;
  box-shadow: 0 1rem 3rem rgba(27, 43, 36, .16);
}

.profile-menu-panel > div {
  display: grid;
  border-bottom: 1px solid #e7ece9;
  margin-bottom: .25rem;
  padding: .45rem .55rem .7rem;
}

.profile-menu-panel small {
  overflow: hidden;
  color: #7b8883;
  text-overflow: ellipsis;
}

.profile-menu-panel a,
.profile-menu-panel button {
  width: 100%;
  display: block;
  border: 0;
  border-radius: 9px;
  padding: .55rem .65rem;
  background: transparent;
  color: #3b5048;
  font-size: .82rem;
  font-weight: 750;
  text-align: left;
  text-decoration: none;
}

.profile-menu-panel a:hover,
.profile-menu-panel button:hover {
  background: #eaf5f1;
  color: #176b5d;
}

.profile-page {
  background: radial-gradient(circle at 85% 5%, rgba(223, 184, 83, .13), transparent 28rem), #eff4f1;
}

.profile-shell {
  width: min(100% - 2rem, 1120px);
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.profile-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1.1rem;
  align-items: center;
  border: 1px solid #d8e3dd;
  border-radius: 20px;
  padding: 1.35rem;
  background: linear-gradient(135deg, rgba(255,255,255,.98), rgba(246,249,244,.94));
  box-shadow: 0 1rem 3rem rgba(37, 53, 45, .08);
}

.profile-avatar-large {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 28px;
  background: linear-gradient(145deg, #278b78, #155d52);
  color: #fff;
  font-size: 2.2rem;
  font-weight: 900;
  box-shadow: 0 .7rem 1.8rem rgba(25, 99, 84, .2);
}

.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero h1 { margin: .12rem 0; font-size: clamp(1.65rem, 4vw, 2.55rem); font-weight: 900; }
.profile-hero p { margin: 0; color: #718078; }
.profile-access-badge { border-radius: 999px; padding: .45rem .7rem; background: #e4f2ed; color: #176857; font-size: .76rem; font-weight: 850; }

.profile-layout {
  display: grid;
  grid-template-columns: minmax(230px, .7fr) minmax(0, 1.6fr);
  gap: 1rem;
  margin-top: 1rem;
}

.profile-summary-card,
.profile-form-card {
  border: 1px solid #d8e3dd;
  border-radius: 18px;
  padding: 1.2rem;
  background: rgba(255,255,255,.94);
}

.profile-summary-card dl { display: grid; gap: .65rem; margin: 1rem 0; }
.profile-summary-card dl div { display: grid; gap: .1rem; border-bottom: 1px solid #edf0ee; padding-bottom: .55rem; }
.profile-summary-card dt { color: #84918b; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.profile-summary-card dd { margin: 0; color: #30473e; font-weight: 750; }
.profile-summary-card p { margin: 0; color: #75827c; font-size: .78rem; }
.profile-form-card { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.profile-form-card > div:first-child, .profile-form-card .wide, .profile-form-actions { grid-column: 1 / -1; }
.profile-form-card h2 { margin: .12rem 0 0; font-size: 1.45rem; }
.profile-form-card label { display: grid; gap: .35rem; color: #455a51; font-size: .8rem; font-weight: 800; }
.profile-form-actions { display: flex; justify-content: flex-end; gap: .5rem; border-top: 1px solid #e4eae7; padding-top: 1rem; }

@media (max-width: 720px) {
  .profile-hero { grid-template-columns: auto minmax(0,1fr); }
  .profile-access-badge { grid-column: 1 / -1; justify-self: start; }
  .profile-layout, .profile-form-card { grid-template-columns: 1fr; }
}

/* Focused notes library */
.notes-page { overflow: hidden; background: #edf2ef; }
.notes-shell { height: calc(100vh - 58px); display: grid; grid-template-columns: 230px 330px minmax(0,1fr); }
.notes-topics, .notes-list-panel, .note-editor-panel { min-width: 0; min-height: 0; }
.notes-topics { overflow-y: auto; border-right: 1px solid #d9e2dd; padding: 1rem .75rem; background: #f8faf8; }
.notes-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: .25rem .45rem 1rem; }
.notes-sidebar-head span, .notes-list-heading span { color: #85918b; font-size: .69rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.notes-sidebar-head h1 { margin: .1rem 0 0; font-size: 1.35rem; font-weight: 900; }
.notes-sidebar-head button { width: 34px; height: 34px; border: 0; border-radius: 11px; background: #197967; color: white; font-size: 1.2rem; }
.notes-topic { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: .55rem; align-items: center; border-radius: 10px; margin: .15rem 0; padding: .55rem .6rem; color: #465a52; font-size: .82rem; font-weight: 750; text-decoration: none; }
.notes-topic:hover, .notes-topic.active { background: #e3f1ec; color: #176857; }
.notes-topic i { width: 9px; height: 9px; border-radius: 3px; background: var(--topic-color,#1f7a6d); }
.notes-topic strong { color: #87938d; font-size: .7rem; }
.notes-topic-label { margin: 1.2rem .6rem .45rem; color: #98a29d; font-size: .65rem; font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }
.notes-new-topic { display: grid; grid-template-columns: 1fr 32px; gap: .3rem; margin-top: .65rem; }
.notes-new-topic input { min-width: 0; border: 1px solid #d9e2dd; border-radius: 9px; padding: .45rem .55rem; background: white; font-size: .76rem; }
.notes-new-topic button { border: 0; border-radius: 9px; background: #e3eee9; color: #176b5d; font-weight: 900; }
.notes-list-panel { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; border-right: 1px solid #d9e2dd; background: #f3f6f4; }
.notes-search { display: grid; grid-template-columns: auto 1fr; align-items: center; margin: .8rem; border: 1px solid #d9e2dd; border-radius: 11px; padding: .1rem .55rem; background: white; }
.notes-search input { min-width: 0; border: 0; padding: .55rem; outline: none; background: transparent; font-size: .8rem; }
.notes-list-heading { display: flex; justify-content: space-between; padding: .2rem 1rem .6rem; }
.notes-list { overflow-y: auto; padding: 0 .6rem .8rem; }
.note-list-card { display: grid; gap: .3rem; border: 1px solid transparent; border-radius: 13px; margin-bottom: .35rem; padding: .75rem; color: #33473f; text-decoration: none; }
.note-list-card:hover { background: rgba(255,255,255,.7); }
.note-list-card.active { border-color: #c7ded6; background: white; box-shadow: 0 .5rem 1.3rem rgba(35,55,46,.07); }
.note-list-title { overflow: hidden; font-size: .86rem; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.note-list-title i { color: #d29f21; font-style: normal; }.note-list-title em { float: right; font-size: .72rem; font-style: normal; }
.note-list-preview { display: -webkit-box; overflow: hidden; color: #718078; font-size: .72rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.note-list-card small { color: #98a19d; font-size: .64rem; }
.notes-list-empty { display: grid; gap: .2rem; padding: 2rem 1rem; color: #84908a; text-align: center; }
.notes-create-button { margin: .65rem; border: 0; border-radius: 11px; padding: .65rem; background: #197967; color: #fff; font-size: .8rem; font-weight: 850; }
.note-editor-panel { overflow-y: auto; padding: 1.2rem; background: #fff; }
.note-editor-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; border-bottom: 1px solid #e5ebe8; padding-bottom: 1rem; }
.note-editor-head span, .note-editor-head small { color: #83908a; font-size: .7rem; }.note-editor-head h2 { margin: .15rem 0; font-size: 1.6rem; font-weight: 900; }
.note-head-actions { display: flex; gap: .3rem; }.note-head-actions form { margin: 0; }.note-head-actions button { width: 36px; height: 36px; border: 1px solid #dae3df; border-radius: 10px; background: #f8faf9; color: #65766e; }.note-head-actions button.danger { color: #ac3d47; }
.note-lock-screen, .note-editor-empty { min-height: 60vh; display: grid; justify-items: center; align-content: center; gap: .55rem; color: #718078; text-align: center; }.note-lock-screen > span, .note-editor-empty > span { font-size: 3rem; }.note-lock-screen h3, .note-editor-empty h2 { margin: 0; color: #30473e; }.note-lock-screen p, .note-editor-empty p { max-width: 430px; margin: 0; }.note-lock-screen form { width: min(100%,360px); display: grid; grid-template-columns: 1fr auto; gap: .5rem; margin-top: .6rem; }
.note-editor-form { display: grid; grid-template-rows: auto auto minmax(360px,1fr) auto; min-height: calc(100vh - 180px); }
.note-title-row { display: grid; grid-template-columns: minmax(0,1fr) 190px; gap: .6rem; padding: 1rem 0 .7rem; }.note-title-row input, .note-title-row select { border: 1px solid #dce5e0; border-radius: 10px; padding: .6rem .7rem; background: #f9fbfa; }
.note-format-toolbar { display: flex; flex-wrap: wrap; gap: .25rem; border: 1px solid #dfe7e3; border-radius: 10px 10px 0 0; padding: .35rem; background: #f5f8f6; }.note-format-toolbar button { min-width: 34px; border: 0; border-radius: 7px; padding: .35rem .5rem; background: transparent; color: #4a5d55; }.note-format-toolbar button:hover { background: #e2eee9; }
.note-main-text { width: 100%; min-height: 360px; resize: vertical; border: 1px solid #dfe7e3; border-top: 0; border-radius: 0 0 10px 10px; padding: 1.2rem; outline: none; color: #263a32; background: #fff; font: 16px/1.75 Georgia, "Times New Roman", serif; }
.note-main-text:focus { box-shadow: inset 0 0 0 2px rgba(31,122,109,.12); }
.note-editor-footer { display: grid; grid-template-columns: minmax(130px,1fr) auto auto minmax(150px,.7fr) minmax(150px,.7fr) auto; gap: .5rem; align-items: center; padding-top: .75rem; }.note-editor-footer > input { min-width: 0; border: 1px solid #dae3df; border-radius: 9px; padding: .5rem .6rem; font-size: .75rem; }.note-editor-footer label { color: #61736b; font-size: .72rem; white-space: nowrap; }
.new-note-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }.new-note-form label { display: grid; gap: .35rem; color: #465950; font-size: .8rem; font-weight: 800; }.new-note-form .wide, .new-note-form .profile-form-actions { grid-column: 1/-1; }.new-note-passwords { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; border: 1px solid #e1e7e4; border-radius: 12px; padding: .85rem; background: #f8faf9; }
@media (max-width: 980px) { .notes-shell { grid-template-columns: 200px 280px minmax(0,1fr); }.note-editor-footer { grid-template-columns: 1fr 1fr; }.note-editor-footer .btn { grid-column: 1/-1; }.note-title-row { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .notes-page { overflow: auto; }.notes-shell { height: auto; min-height: calc(100vh - 58px); grid-template-columns: 1fr; }.notes-topics { display: flex; gap: .35rem; overflow-x: auto; border-right: 0; border-bottom: 1px solid #d9e2dd; padding: .55rem; }.notes-sidebar-head, .notes-topic-label, .notes-new-topic { display: none; }.notes-topic { flex: 0 0 auto; margin: 0; }.notes-list-panel { min-height: 320px; border-right: 0; border-bottom: 1px solid #d9e2dd; }.note-editor-panel { padding: .85rem; }.new-note-form, .new-note-passwords { grid-template-columns: 1fr; }.note-lock-screen form { grid-template-columns: 1fr; } }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  padding: 1.25rem;
  color: #f8f3e7;
  background:
    radial-gradient(circle at 50% -15%, rgba(218, 165, 32, .13), transparent 34rem),
    radial-gradient(circle at 0 100%, rgba(218, 165, 32, .06), transparent 28rem),
    linear-gradient(145deg, #050505 0%, #101010 58%, #080808 100%);
}

.login-shell { width: min(100%, 430px); }

.login-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(218, 165, 32, .86);
  border-radius: 18px;
  padding: clamp(1.6rem, 5vw, 2.25rem);
  background: linear-gradient(145deg, rgba(31, 26, 13, .98), rgba(13, 13, 13, .99));
  box-shadow: 0 1.8rem 5rem rgba(0, 0, 0, .6), 0 0 35px rgba(218, 165, 32, .18);
}

.login-card::before { content: ""; height: 3px; position: absolute; inset: 0 0 auto; background: linear-gradient(90deg, transparent, #ffd700, transparent); }
.login-header { text-align: center; }
.login-avatar { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto .9rem; border: 1px solid rgba(255,215,0,.48); border-radius: 50%; color: #ffd700; background: rgba(218,165,32,.08); box-shadow: 0 0 24px rgba(218,165,32,.18); }
.login-avatar svg { width: 34px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.6; }
.login-header .login-eyebrow { margin: 0 0 .35rem; color: #daa520; font-size: .68rem; font-weight: 800; letter-spacing: .22em; }
.login-header h1 { margin: 0; color: #ffd700; font-size: clamp(1.55rem,5vw,1.9rem); font-weight: 750; text-shadow: 0 0 18px rgba(218,165,32,.3); }
.login-header > p:last-child { margin: .45rem 0 1.55rem; color: #b8a978; font-size: .88rem; }
.login-alert, .login-notice { border: 1px solid; border-radius: 9px; margin-bottom: 1rem; padding: .65rem .75rem; font-size: .8rem; }
.login-alert { border-color: rgba(220,78,78,.6); color: #ffb8b8; background: rgba(130,25,25,.22); }
.login-notice { border-color: rgba(218,165,32,.35); color: #dbc985; background: rgba(218,165,32,.07); }
.login-form { display: grid; gap: 1rem; }
.login-field { display: grid; gap: .4rem; }
.login-field label { color: #daa520; font-size: .8rem; font-weight: 650; }
.login-field input { width: 100%; border: 1px solid #9d781c; border-radius: 9px; padding: .72rem .8rem; outline: 0; color: #fff; background: rgba(26,21,9,.8); transition: .18s ease; }
.login-field input::placeholder { color: #776c51; }
.login-field input:focus { border-color: #ffd700; background: #1a1509; box-shadow: 0 0 0 .2rem rgba(218,165,32,.18); }
.login-password-wrap { position: relative; }
.login-password-wrap input { padding-right: 3rem; }
.login-password-toggle { width: 42px; height: 100%; display: grid; place-items: center; position: absolute; top: 0; right: 0; border: 0; padding: 0; color: #c39a2c; background: transparent; cursor: pointer; }
.login-password-toggle:hover, .login-password-toggle:focus-visible { color: #ffd700; }
.login-password-toggle svg { width: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.login-password-toggle .eye-closed, .login-password-toggle[aria-pressed="true"] .eye-open { display: none; }
.login-password-toggle[aria-pressed="true"] .eye-closed { display: block; }
.login-submit { border: 0; border-radius: 9px; margin-top: .25rem; padding: .76rem 1rem; color: #171000; background: linear-gradient(135deg,#daa520,#ffd700); box-shadow: 0 .55rem 1.4rem rgba(218,165,32,.18); font-weight: 800; cursor: pointer; transition: .18s ease; }
.login-submit:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 .75rem 1.7rem rgba(218,165,32,.27); }
.login-submit:active { transform: translateY(0); }
.login-submit-link { display: block; color: #171000; text-align: center; text-decoration: none; }
.login-submit-link:hover { color: #171000; }
.login-options { display: flex; justify-content: space-between; gap: 1rem; align-items: center; color: #a79870; font-size: .76rem; }
.login-options a, .login-signup a { color: #e3b72e; text-decoration: none; }
.login-options a:hover, .login-signup a:hover { color: #ffd700; text-decoration: underline; }
.login-check { display: inline-flex; gap: .45rem; align-items: center; cursor: pointer; }
.login-check input { width: 1rem; height: 1rem; margin: 0; accent-color: #daa520; }
.login-signup { margin: 1.1rem 0 0; color: #8e8262; font-size: .78rem; text-align: center; }
.login-help { color: #8e8262; font-size: .69rem; line-height: 1.4; }
.login-help ul { margin: .25rem 0 0; padding-left: 1.15rem; }
.login-error { color: #ff9e9e; font-size: .72rem; }
.login-footer { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: center; margin-top: 1.5rem; color: #746744; }
.login-footer span { height: 1px; background: linear-gradient(90deg,transparent,rgba(218,165,32,.45)); }
.login-footer span:last-child { transform: scaleX(-1); }
.login-footer p { margin: 0; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }

.todo-page {
  background:
    linear-gradient(135deg, rgba(232, 195, 99, .16), transparent 30rem),
    linear-gradient(180deg, #f9f4ee 0%, #edf3f0 100%);
}

.todo-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  width: min(100%, 1380px);
  margin: 0 auto;
  padding: 1.25rem;
}

.todo-sidebar,
.todo-workspace {
  border: 1px solid rgba(220, 226, 218, .86);
  background: rgba(255, 253, 250, .88);
  box-shadow: 0 1rem 2.8rem rgba(44, 39, 29, .09);
}

.todo-sidebar {
  display: grid;
  align-content: start;
  gap: 1rem;
  border-radius: .85rem 0 0 .85rem;
  padding: 1rem;
}

.todo-workspace {
  min-width: 0;
  border-left: 0;
  border-radius: 0 .85rem .85rem 0;
  padding: 2rem;
}

.todo-user {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.todo-user strong,
.todo-user span {
  display: block;
}

.todo-user span,
.todo-sidebar-section p,
.todo-meta,
.todo-empty p {
  color: var(--app-muted);
}

.todo-add-button {
  min-height: 40px;
  border: 0;
  border-radius: .65rem;
  padding: .55rem .75rem;
  background: #e64e45;
  color: #fff;
  font-weight: 800;
  text-align: left;
}

.todo-nav,
.todo-project-list,
.todo-sidebar-actions {
  display: grid;
  gap: .3rem;
}

.todo-nav a,
.todo-project-list a {
  min-width: 0;
  min-height: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .5rem;
  border-radius: .55rem;
  padding: .35rem .55rem;
  color: #33413a;
  font-weight: 700;
  text-decoration: none;
}

.todo-nav a:hover,
.todo-nav a.active,
.todo-project-list a:hover,
.todo-project-list a.active {
  background: #fff0e8;
  color: #b8453f;
}

.todo-nav strong {
  color: var(--app-muted);
  font-size: .8rem;
}

.todo-sidebar-section h2 {
  margin: 0 0 .45rem;
  color: #52625a;
  font-size: .82rem;
  font-weight: 900;
}

.todo-project-list a {
  grid-template-columns: 10px minmax(0, 1fr) auto;
}

.todo-project-list strong {
  color: var(--app-muted);
  font-size: .76rem;
}

.todo-project-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--project-color, var(--app-accent));
}

.todo-project-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: .35rem;
  margin-top: .6rem;
}

.todo-project-form input {
  min-height: 34px;
}

.todo-project-form button {
  border: 0;
  border-radius: .55rem;
  background: #e7f1ed;
  color: #1f6f63;
  font-weight: 900;
}

.todo-sidebar-actions {
  margin-top: 1rem;
}

.todo-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 380px);
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.todo-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  font-weight: 850;
}

.todo-dashboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr)) minmax(190px, 1.35fr);
  gap: .65rem;
  margin-bottom: 1.25rem;
}

.todo-stat,
.todo-progress {
  min-height: 82px;
  border: 1px solid #e3e5df;
  border-radius: .85rem;
  padding: .75rem .85rem;
  background: #fff;
  text-decoration: none;
}

.todo-stat strong,
.todo-progress strong {
  display: block;
  color: #26342e;
  font-size: 1.55rem;
  line-height: 1.1;
}

.todo-stat span,
.todo-progress span {
  color: var(--app-muted);
  font-size: .83rem;
  font-weight: 700;
}

.todo-stat:hover {
  border-color: #c8ddd5;
  background: #f5faf8;
}

.todo-stat-danger strong,
.todo-danger-link strong {
  color: var(--app-danger);
}

.todo-progress-track {
  height: 7px;
  margin-top: .75rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ece8;
}

.todo-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--app-accent);
}

.todo-quick-add {
  margin-bottom: 1.25rem;
  border: 1px solid #d8e5df;
  border-radius: .85rem;
  padding: 1rem;
  background: #f6fbf8;
}

.todo-panel-heading {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .75rem;
  align-items: baseline;
  margin-bottom: .7rem;
}

.todo-panel-heading span {
  color: var(--app-muted);
  font-size: .86rem;
}

.todo-add-grid {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) repeat(3, minmax(150px, .72fr));
  gap: .6rem;
  align-items: stretch;
}

.todo-title-input,
.todo-add-grid textarea {
  grid-column: 1 / -1;
}

.todo-pin {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid #cfd8d2;
  border-radius: .55rem;
  padding: .45rem .65rem;
  background: #fff;
  color: #415048;
  font-weight: 700;
}

.todo-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: end;
  border-bottom: 1px solid var(--app-line);
  padding: 0 0 1rem;
  margin-bottom: .35rem;
}

.todo-filters label {
  min-width: 160px;
  color: var(--app-muted);
  font-size: .78rem;
  font-weight: 800;
}

.todo-filters select {
  margin-top: .25rem;
  font-size: .92rem;
}

.todo-list {
  display: grid;
  gap: .65rem;
}

.todo-note-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .7rem;
}

.todo-note-category {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: .35rem .6rem;
  align-items: center;
  min-height: 84px;
  border: 1px solid #dde5df;
  border-radius: .8rem;
  padding: .85rem;
  background: #fff;
  color: #26342e;
  text-decoration: none;
}

.todo-note-category:hover {
  border-color: #bdd8cf;
  background: #f5faf8;
}

.todo-note-category strong {
  font-size: 1rem;
}

.todo-note-category > span:last-child {
  grid-column: 2;
  color: var(--app-muted);
  font-size: .82rem;
  font-weight: 700;
}

.todo-project-dot-muted {
  background: #b6c1bc;
}

.todo-note-back {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem 1rem;
  align-items: center;
  margin-bottom: .8rem;
  color: var(--app-muted);
  font-size: .86rem;
}

.todo-note-back a {
  color: #277366;
  font-weight: 800;
  text-decoration: none;
}

.todo-note-browser {
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(280px, 1fr);
  gap: .85rem;
  align-items: start;
}

.todo-note-titles {
  display: grid;
  gap: .35rem;
}

.todo-note-titles > a {
  border: 1px solid #e2e7e3;
  border-radius: .65rem;
  padding: .72rem .8rem;
  background: #fff;
  color: #27352f;
  font-weight: 750;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.todo-note-titles > a:hover,
.todo-note-titles > a.active {
  border-color: #bad6cc;
  background: #ecf6f2;
  color: #1f665c;
}

.todo-note-detail,
.todo-note-prompt {
  border: 1px solid #dde5df;
  border-radius: .8rem;
  padding: 1rem;
  background: #fff;
}

.todo-note-detail-heading {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.todo-note-detail-heading h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 850;
}

.todo-note-detail-heading span {
  border-radius: 999px;
  padding: .12rem .45rem;
  background: #fff5df;
  color: #a26200;
  font-size: .76rem;
  font-weight: 800;
}

.todo-note-detail > p {
  margin: .75rem 0 0;
  color: #3e4b45;
}

.todo-note-actions {
  display: flex;
  gap: .55rem;
  margin-top: 1rem;
}

.todo-note-actions form {
  margin: 0;
}

.todo-note-prompt {
  color: var(--app-muted);
  text-align: center;
}

.todo-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: .65rem;
  align-items: start;
  border: 1px solid rgba(220, 226, 218, .95);
  border-left: 4px solid #d6dfdb;
  border-radius: .7rem;
  padding: .8rem .7rem;
  background: rgba(255, 255, 255, .76);
}

.todo-item.priority-high {
  border-left-color: #e7a537;
}

.todo-item.priority-urgent,
.todo-item.overdue {
  border-left-color: #d8514e;
}

.todo-item.overdue {
  background: #fffaf8;
}

.todo-check-form,
.todo-item-actions form {
  margin: 0;
}

.todo-check {
  width: 22px;
  height: 22px;
  border: 2px solid #aeb9b2;
  border-radius: 999px;
  background: transparent;
}

.todo-item.done .todo-check {
  border-color: #1f7a6d;
  background: #1f7a6d;
  box-shadow: inset 0 0 0 4px #fff;
}

.todo-item.done .todo-item-body {
  opacity: .62;
}

.todo-item.done h2 {
  text-decoration: line-through;
}

.todo-item-line {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
}

.todo-item h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 800;
}

.todo-item p {
  margin: .35rem 0 0;
  color: #3e4b45;
}

.todo-kind,
.todo-meta span,
.todo-priority {
  border-radius: 999px;
  padding: .12rem .45rem;
  background: #e8f1ed;
  color: #1f665c;
  font-size: .76rem;
  font-weight: 800;
}

.todo-item.priority-high .todo-priority {
  background: #fff0d6;
  color: #a26200;
}

.todo-item.priority-urgent .todo-priority,
.todo-item.overdue .todo-deadline {
  background: #fae5e3;
  color: #ad3438;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .45rem;
}

.todo-item-actions {
  display: flex;
  gap: .15rem;
}

.todo-action,
.todo-delete {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: var(--app-danger);
  font-size: 1.35rem;
  line-height: 1;
}

.todo-action {
  color: #a7afa9;
  font-size: 1.15rem;
}

.todo-action.active,
.todo-action:hover {
  color: #d59624;
  background: #fff5df;
}

.todo-delete:hover,
.todo-delete:focus-visible {
  background: #f9e9ea;
}

.todo-edit {
  margin-top: .55rem;
}

.todo-edit summary {
  width: fit-content;
  cursor: pointer;
  color: #277366;
  font-size: .8rem;
  font-weight: 800;
}

.todo-edit-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(2, minmax(130px, .55fr));
  gap: .5rem;
  border-radius: .65rem;
  margin-top: .55rem;
  padding: .65rem;
  background: #f3f7f5;
}

.todo-edit-title,
.todo-edit-body {
  grid-column: 1 / -1;
}

.todo-empty {
  border: 1px dashed #aeb9b2;
  border-radius: .8rem;
  padding: 2rem;
  background: rgba(255, 255, 255, .54);
  text-align: center;
}

.todo-page {
  background: #fff;
  color: #1f1f1f;
}

.todo-page .brand-mark {
  display: none;
}

.todo-shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  grid-template-columns: 280px minmax(0, 1fr);
  margin: 0;
  padding: 0;
  background: #fff;
}

.todo-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  gap: .65rem;
  border: 0;
  border-radius: 0;
  padding: 1rem .75rem;
  background: #fbfaf8;
  box-shadow: none;
}

.todo-workspace {
  position: relative;
  border: 0;
  border-radius: 0;
  padding: 4.35rem 2rem 4rem;
  background: #fff;
  box-shadow: none;
}

.todo-workspace > .todo-header,
.todo-workspace > .todo-quick-add,
.todo-workspace > .todo-filters,
.todo-workspace > .todo-list,
.todo-workspace > .todo-note-categories,
.todo-workspace > .todo-note-back,
.todo-workspace > .todo-note-browser {
  width: min(100%, 800px);
  margin-left: auto;
  margin-right: auto;
}

.todo-topbar {
  position: absolute;
  top: 1rem;
  right: 1.1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  color: #555;
  font-size: .88rem;
}

.todo-user {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  display: grid;
  min-height: 32px;
  gap: .45rem;
  align-items: center;
  margin-bottom: 1.35rem;
  color: #202020;
}

.todo-avatar {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #4568d4;
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
}

.todo-user strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .86rem;
  font-weight: 700;
}

.todo-user-chevron,
.todo-user-tools {
  color: #777;
  font-size: .9rem;
}

.todo-add-button {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 34px;
  margin-bottom: .35rem;
  border-radius: .45rem;
  padding: .3rem .4rem;
  background: transparent;
  color: #dc4c3e;
  font-size: .9rem;
  font-weight: 700;
}

.todo-add-button span,
.todo-inline-add span {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #dc4c3e;
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 400;
}

.todo-add-button:hover {
  background: #fff1ed;
}

.todo-nav,
.todo-project-list {
  gap: .1rem;
}

.todo-nav a,
.todo-project-list a {
  min-height: 34px;
  border-radius: .35rem;
  padding: .25rem .55rem;
  color: #202020;
  font-size: .9rem;
  font-weight: 500;
}

.todo-nav a > span,
.todo-project-list a > span:not(.todo-project-hash) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-nav a span:first-child {
  display: flex;
  gap: .55rem;
  align-items: center;
}

.todo-nav i {
  width: 18px;
  color: #777;
  font-style: normal;
  font-size: .82rem;
  text-align: center;
}

.todo-nav a:hover,
.todo-nav a.active,
.todo-project-list a:hover,
.todo-project-list a.active {
  background: #ffefe8;
  color: #dc4c3e;
}

.todo-nav a.active i {
  color: #dc4c3e;
}

.todo-nav strong,
.todo-project-list strong {
  color: #9b9b9b;
  font-size: .78rem;
  font-weight: 500;
}

.todo-sidebar-section {
  margin-top: 1.6rem;
}

.todo-sidebar-section h2 {
  margin: 0 0 .55rem;
  padding: 0 .55rem;
  color: #5f5f5f;
  font-size: .9rem;
  font-weight: 650;
  text-transform: none;
}

.todo-project-list a {
  grid-template-columns: 18px minmax(0, 1fr) auto;
}

.todo-project-hash {
  color: #888;
  font-size: 1rem;
}

.todo-project-form {
  grid-template-columns: minmax(0, 1fr) 30px;
  padding: .25rem .45rem;
}

.todo-project-form input {
  min-height: 30px;
  border: 0;
  background: transparent;
  font-size: .88rem;
}

.todo-project-form button {
  border-radius: .35rem;
  background: transparent;
  color: #777;
}

.todo-sidebar-actions {
  margin-top: auto;
}

.todo-sidebar-actions .btn {
  border: 0;
  color: #555;
  background: transparent;
  text-align: left;
}

.todo-header {
  display: block;
  margin-bottom: 1.25rem;
}

.todo-header h1 {
  margin: 0;
  color: #111;
  font-size: 1.65rem;
  line-height: 1.25;
  font-weight: 750;
}

.todo-search {
  margin-top: .9rem;
}

.todo-search .form-control {
  max-width: 360px;
  min-height: 34px;
  border-color: #eee;
  border-radius: .45rem;
  font-size: .9rem;
}

.todo-dashboard {
  display: none;
}

.todo-quick-add {
  border: 1px solid #eee;
  border-radius: .5rem;
  margin-bottom: 1rem;
  padding: .75rem;
  background: #fff;
}

.todo-panel-heading {
  display: none;
}

.todo-add-grid {
  grid-template-columns: minmax(0, 1fr) repeat(3, minmax(120px, .45fr));
  gap: .45rem;
}

.todo-add-grid .form-control,
.todo-add-grid .form-select {
  min-height: 34px;
  border-color: #e6e6e6;
  border-radius: .45rem;
  font-size: .88rem;
}

.todo-title-input,
.todo-add-grid textarea {
  grid-column: 1 / -1;
}

.todo-pin {
  min-height: 34px;
  border-color: #e6e6e6;
  border-radius: .45rem;
  padding: .35rem .55rem;
  font-size: .88rem;
  font-weight: 500;
}

.todo-add-grid .btn-success {
  border-color: #dc4c3e;
  background: #dc4c3e;
}

.todo-filters {
  gap: .5rem;
  align-items: center;
  border: 0;
  padding: 0;
  margin-bottom: .75rem;
  color: #777;
}

.todo-filters label {
  min-width: 130px;
  color: #777;
  font-size: .72rem;
  font-weight: 500;
}

.todo-filters .form-select,
.todo-filters .btn {
  min-height: 30px;
  border-color: #ededed;
  border-radius: .4rem;
  font-size: .82rem;
}

.todo-list {
  gap: 0;
}

.todo-item {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: .3rem;
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid #eee;
  border-left: 0;
  border-radius: 0;
  padding: .55rem 0;
  background: transparent;
}

.todo-item.priority-high,
.todo-item.priority-urgent,
.todo-item.overdue {
  border-left: 0;
}

.todo-item.overdue {
  background: transparent;
}

.todo-check {
  width: 18px;
  height: 18px;
  margin-top: .05rem;
  border: 1px solid #b8b8b8;
}

.todo-item.done .todo-check {
  border-color: #dc4c3e;
  background: #dc4c3e;
  box-shadow: inset 0 0 0 3px #fff;
}

.todo-item-line {
  gap: .4rem;
}

.todo-item h2 {
  color: #202020;
  font-size: .88rem;
  line-height: 1.35;
  font-weight: 500;
}

.todo-item p {
  margin-top: .25rem;
  color: #686868;
  font-size: .85rem;
}

.todo-kind,
.todo-priority {
  display: none;
}

.todo-meta {
  gap: .25rem;
  margin-top: .28rem;
}

.todo-meta span {
  border: 0;
  border-radius: .25rem;
  padding: 0;
  background: transparent;
  color: #8a8a8a;
  font-size: .76rem;
  font-weight: 400;
}

.todo-item.overdue .todo-deadline {
  background: transparent;
  color: #dc4c3e;
}

.todo-item-actions {
  opacity: 0;
  transition: opacity .12s ease;
}

.todo-item:hover .todo-item-actions,
.todo-item:focus-within .todo-item-actions {
  opacity: 1;
}

.todo-action,
.todo-delete {
  width: 26px;
  height: 26px;
  border-radius: .35rem;
  color: #8a8a8a;
  font-size: .95rem;
}

.todo-delete {
  color: #dc4c3e;
}

.todo-action.active,
.todo-action:hover {
  color: #d59624;
  background: #fff4dc;
}

.todo-edit summary {
  color: #8a8a8a;
  font-size: .76rem;
  font-weight: 500;
}

.todo-edit-grid {
  border: 1px solid #eee;
  border-radius: .5rem;
  background: #fafafa;
}

.todo-inline-add {
  display: flex;
  gap: .55rem;
  align-items: center;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-bottom: 1px solid #eee;
  padding: .55rem 0;
  background: transparent;
  color: #777;
  text-align: left;
  font-size: .88rem;
}

.todo-inline-add span {
  width: 18px;
  height: 18px;
  background: transparent;
  color: #dc4c3e;
  font-size: 1.15rem;
}

.todo-inline-add:hover {
  color: #dc4c3e;
}

.todo-empty {
  border: 0;
  border-bottom: 1px solid #eee;
  border-radius: 0;
  padding: 1.5rem 0;
  background: transparent;
  color: #777;
}

.app-shell {
  min-height: calc(100vh - 58px);
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 58px;
  height: calc(100vh - 58px);
  overflow: auto;
  color: #f8f4eb;
  background:
    linear-gradient(180deg, #26322c 0%, var(--app-sidebar) 100%);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: .5rem;
  background: #e8c363;
  color: #202321;
  font-weight: 800;
}

.workspace {
  min-width: 0;
  padding: 1.5rem;
}

.workspace-header {
  border: 1px solid rgba(220, 226, 218, .85);
  border-radius: .85rem;
  padding: 1rem;
  background: rgba(255, 253, 250, .78);
  box-shadow: 0 .75rem 2rem rgba(38, 43, 40, .06);
}

.toolbar {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .5rem;
}

.path-heading {
  overflow-wrap: anywhere;
}

.tree {
  display: grid;
  gap: .18rem;
  padding-right: .45rem;
}

.tree-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: .2rem;
  align-items: center;
}

.tree button {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: .45rem;
  border: 0;
  border-radius: .55rem;
  padding: .35rem .5rem;
  color: #f8f4eb;
  background: transparent;
  text-align: left;
}

.tree-folder {
  min-width: 0;
  display: grid !important;
  grid-template-columns: 20px 22px minmax(0, 1fr) auto;
  padding-left: calc(.42rem + (var(--tree-depth, 0) * .82rem)) !important;
}

.tree-folder:hover,
.tree-folder.active,
.tree-folder.drag-over,
.tree-toggle:hover:not(:disabled),
.tree-toggle.expanded:hover,
.tree .add-folder:hover,
.tree .add-folder:focus-visible {
  background: rgba(255, 255, 255, .08);
}

.tree-folder.active {
  background: rgba(232, 195, 99, .18);
  color: #fff;
  box-shadow: inset 3px 0 0 #e8c363;
}

.tree-toggle {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: .38rem;
  color: #b9cbc2;
  font-size: 1.05rem;
  line-height: 1;
  transition: transform .15s ease;
}

.tree-toggle:empty {
  opacity: .28;
}

.tree-toggle.expanded {
  transform: rotate(90deg);
}

.tree-folder-icon,
.tree-root-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: .38rem;
  background: rgba(232, 195, 99, .14);
  color: #e8c363;
  font-size: .8rem;
  font-weight: 900;
}

.tree-folder-icon::before {
  content: "";
  width: .9rem;
  height: .68rem;
  display: block;
  border-radius: .16rem;
  background: currentColor;
  clip-path: polygon(0 24%, 38% 24%, 48% 0, 100% 0, 100% 100%, 0 100%);
}

.tree-folder-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.tree-count {
  margin-left: auto;
  min-width: 1.35rem;
  border-radius: 999px;
  padding: .08rem .35rem;
  background: rgba(255, 255, 255, .11);
  color: #d7eadf;
  text-align: center;
  font-size: .72rem;
  font-weight: 800;
}

.tree .add-folder {
  justify-content: center;
  padding: .25rem;
  color: #d7eadf;
  font-weight: 800;
}

.tree-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
}

.tree-tools .btn {
  min-width: 0;
  font-weight: 700;
}

.drop-zone {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px dashed #9aa89f;
  background: rgba(255, 253, 250, .72);
  color: #33413a;
}

.drop-zone.drag-over {
  border-color: var(--app-accent);
  background: #e8f3ef;
}

.drop-zone-actions {
  flex: 0 0 auto;
}

.upload-preview-panel {
  border: 1px solid rgba(220, 226, 218, .9);
  background: rgba(255, 253, 250, .82);
  box-shadow: 0 .65rem 1.8rem rgba(38, 43, 40, .06);
}

.upload-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.upload-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .65rem;
}

.upload-preview-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: .65rem;
  background: #fff;
  box-shadow: 0 .45rem 1rem rgba(44, 39, 29, .07);
}

.upload-preview-thumb {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #252b28;
}

.upload-preview-thumb img,
.upload-preview-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-preview-name {
  min-height: 2.7rem;
  display: -webkit-box;
  overflow: hidden;
  padding: .45rem .5rem;
  color: #2d3832;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.site-import {
  border: 1px solid rgba(220, 226, 218, .9);
  background: rgba(255, 253, 250, .75);
  box-shadow: 0 .65rem 1.8rem rgba(38, 43, 40, .06);
}

.site-import-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: end;
}

.site-import-form .btn {
  min-height: 38px;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 1.25rem;
  align-items: start;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 360px));
  justify-content: start;
  gap: 1.15rem;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: .85rem;
}

.folder-card {
  width: 100%;
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .45rem;
  align-items: center;
  border: 1px solid var(--app-line);
  border-radius: .7rem;
  padding: .45rem;
  background: var(--app-card);
  box-shadow: 0 .5rem 1.2rem rgba(38, 43, 40, .06);
  color: var(--app-ink);
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.folder-card:hover,
.folder-card.drag-over,
.folder-card.active {
  border-color: rgba(31, 122, 109, .45);
  background: var(--app-card-hover);
  transform: translateY(-1px);
  box-shadow: 0 .7rem 1.6rem rgba(38, 43, 40, .1);
}

.folder-open {
  min-width: 0;
  min-height: 70px;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: .8rem;
  align-items: center;
  border: 0;
  border-radius: .55rem;
  padding: .4rem;
  color: inherit;
  background: transparent;
  text-align: left;
}

.card-actions,
.media-actions {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: .5rem;
  color: #415048;
  background: transparent;
  font-size: 1.25rem;
  line-height: 1;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: rgba(31, 122, 109, .32);
  background: #e7f1ed;
}

.icon-button.danger {
  color: var(--app-danger);
}

.icon-button.danger:hover,
.icon-button.danger:focus-visible {
  border-color: rgba(184, 50, 59, .28);
  background: #f9e9ea;
}

.folder-icon {
  width: 52px;
  height: 42px;
  position: relative;
  border-radius: .45rem;
  background: linear-gradient(180deg, #f3c85f 0%, #dca93a 100%);
  box-shadow: inset 0 -8px 16px rgba(115, 79, 15, .16);
}

.folder-icon::before {
  content: "";
  position: absolute;
  left: 5px;
  top: -7px;
  width: 24px;
  height: 12px;
  border-radius: .35rem .35rem 0 0;
  background: #e8bd4f;
}

.folder-cover {
  width: 58px;
  height: 58px;
  display: block;
  overflow: hidden;
  border-radius: .65rem;
  background: #252b28;
  box-shadow: 0 .35rem .9rem rgba(38, 43, 40, .18);
}

.folder-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.folder-title {
  display: block;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-weight: 700;
  line-height: 1.2;
}

.folder-path {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--app-muted);
  font-size: .82rem;
}

.media-card {
  position: relative;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: .85rem;
  background: #171d1a;
  box-shadow: 0 .85rem 2rem rgba(31, 36, 33, .11);
  text-align: left;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.media-main {
  position: relative;
  width: 100%;
  display: block;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.media-actions {
  position: absolute;
  top: .65rem;
  right: .65rem;
  padding: .25rem;
  border-radius: .65rem;
  background: rgba(255, 253, 250, .92);
  box-shadow: 0 .5rem 1.2rem rgba(20, 24, 22, .22);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.media-card:hover .media-actions,
.media-card:focus-within .media-actions {
  opacity: 1;
  pointer-events: auto;
}

.media-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: .45rem;
  padding: 3.6rem .85rem .85rem;
  color: #fffdf8;
  background: linear-gradient(180deg, rgba(18, 23, 20, 0) 0%, rgba(18, 23, 20, .66) 45%, rgba(18, 23, 20, .92) 100%);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

.media-card:hover {
  border-color: rgba(31, 122, 109, .42);
  transform: translateY(-2px);
  box-shadow: 0 1.1rem 2.6rem rgba(44, 39, 29, .16);
}

.media-card.active {
  outline: 3px solid rgba(31, 122, 109, .35);
}

.media-card-featured {
  grid-column: 1 / -1;
  width: min(100%, 560px);
}

.media-card-featured .thumb {
  aspect-ratio: 4 / 5;
}

.cover-badge {
  width: max-content;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 999px;
  padding: .2rem .65rem;
  background: rgba(31, 122, 109, .82);
  color: #fffdf8;
  font-size: .78rem;
  font-weight: 800;
  text-shadow: none;
  box-shadow: 0 .35rem .9rem rgba(0, 0, 0, .2);
}

.thumb {
  width: 100%;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #252b28;
  color: #f8f4eb;
}

.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .22s ease, filter .22s ease;
}

.media-card:hover .thumb img,
.media-card:hover .thumb video,
.media-card:focus-within .thumb img,
.media-card:focus-within .thumb video {
  filter: saturate(1.05) contrast(1.03);
  transform: scale(1.025);
}

.media-name {
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.2;
  min-height: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}

.tag-pill {
  border-radius: 999px;
  padding: .12rem .5rem;
  background: rgba(239, 248, 244, .88);
  color: #1f5d53;
  font-size: .75rem;
  text-shadow: none;
}

.inspector {
  position: sticky;
  top: 1.5rem;
  overflow: hidden;
  border: 1px solid rgba(220, 226, 218, .9);
  background: #fffdf8;
  box-shadow: 0 1rem 2.6rem rgba(44, 39, 29, .13);
}

.load-more {
  grid-column: 1 / -1;
  min-height: 96px;
  border: 1px dashed #aeb9b2;
  border-radius: .7rem;
  background: rgba(255, 253, 250, .7);
  color: #365047;
  font-weight: 700;
}

.load-more:hover:not(:disabled) {
  border-color: rgba(31, 122, 109, .5);
  background: #eef7f3;
}

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

.action-grid .btn {
  min-width: 0;
  white-space: normal;
}

.preview {
  background: #252b28;
}

.folder-preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  background: #252b28;
}

.folder-preview .folder-icon {
  transform: scale(1.8);
}

.preview img,
.preview video {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
}

.file-path {
  overflow-wrap: anywhere;
}

.viewer-modal {
  color: #f8f4eb;
  background: #101412;
}

.viewer-counter {
  color: #aebbb4;
}

.viewer-body {
  position: relative;
  min-height: 0;
  padding: 1rem;
}

.viewer-stage {
  width: 100%;
  min-height: calc(100vh - 112px);
  display: grid;
  place-items: center;
}

.viewer-stage img,
.viewer-stage video {
  max-width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .45);
}

.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  color: #f8f4eb;
  background: rgba(16, 20, 18, .62);
  box-shadow: 0 .75rem 2rem rgba(0, 0, 0, .28);
  font-size: 2.3rem;
  line-height: 1;
  backdrop-filter: blur(10px);
  transform: translateY(-50%);
}

.viewer-nav span {
  transform: translateY(-2px);
}

.viewer-nav:hover:not(:disabled),
.viewer-nav:focus-visible:not(:disabled) {
  background: rgba(31, 122, 109, .78);
  border-color: rgba(255, 255, 255, .34);
}

.viewer-nav:disabled {
  opacity: .25;
  cursor: default;
}

.viewer-prev {
  left: 1.25rem;
}

.viewer-next {
  right: 1.25rem;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .content-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(260px, 340px));
  }
}

@media (max-width: 992px) {
  .todo-shell {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .todo-sidebar,
  .todo-workspace {
    border-radius: 0;
  }

  .todo-sidebar {
    position: static;
    height: auto;
    max-height: none;
  }

  .todo-workspace {
    border-left: 0;
    padding: 4rem 1rem 2rem;
  }

  .todo-header,
  .todo-add-grid {
    grid-template-columns: 1fr;
  }

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

  .todo-progress {
    grid-column: 1 / -1;
  }

  .todo-edit-grid {
    grid-template-columns: 1fr;
  }

  .todo-item {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .todo-note-browser {
    grid-template-columns: 1fr;
  }

  .todo-item-actions {
    grid-column: 2;
    opacity: 1;
  }

  .todo-topbar {
    right: 1rem;
    font-size: .8rem;
  }

  .todo-workspace > .todo-header,
  .todo-workspace > .todo-quick-add,
  .todo-workspace > .todo-filters,
  .todo-workspace > .todo-list,
  .todo-workspace > .todo-note-categories,
  .todo-workspace > .todo-note-back,
  .todo-workspace > .todo-note-browser {
    width: 100%;
  }

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

  .sidebar {
    position: relative;
    height: auto;
    max-height: 38vh;
  }

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

  .inspector {
    position: static;
  }

  .workspace {
    padding: 1.25rem;
  }

  .toolbar {
    width: 100%;
  }

  .media-actions {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 576px) {
  .login-card {
    padding: 1.25rem;
  }

  .workspace {
    padding: .85rem;
  }

  .sidebar {
    max-height: 44vh;
  }

  .sidebar .d-flex {
    gap: .75rem !important;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .drop-zone {
    min-height: 92px;
    display: grid;
    align-items: flex-start;
  }

  .drop-zone-actions,
  .drop-zone-actions .btn {
    width: 100%;
  }

  .upload-preview-head {
    display: grid;
  }

  .upload-preview-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

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

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .7rem;
  }

  .media-card {
    border-radius: .7rem;
  }

  .media-card-featured {
    width: 100%;
  }

  .media-card-featured .thumb {
    aspect-ratio: 3 / 4;
  }

  .media-body {
    padding: 2.8rem .65rem .65rem;
  }

  .media-name {
    font-size: .9rem;
  }

  .tag-list {
    gap: .25rem;
  }

  .tag-pill {
    padding: .08rem .42rem;
    font-size: .68rem;
  }

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

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

  .content-grid {
    gap: .85rem;
  }

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

  .viewer-body {
    padding: .5rem;
  }

  .viewer-stage {
    min-height: calc(100vh - 94px);
  }

  .viewer-stage img,
  .viewer-stage video {
    max-height: calc(100vh - 92px);
  }

  .viewer-nav {
    width: 42px;
    height: 42px;
    font-size: 2rem;
  }

  .viewer-prev {
    left: .5rem;
  }

  .viewer-next {
    right: .5rem;
  }
}

@media (max-width: 380px) {
  .gallery {
    grid-template-columns: 1fr;
  }
}

.catalog-shell {
  width: min(calc(100% - clamp(1rem, 3vw, 4rem)), 2160px);
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.catalog-shell.narrow {
  width: min(100% - 2rem, 860px);
}

.catalog-header,
.title-hero,
.catalog-tools,
.catalog-form-panel,
.character-board,
.character-profile,
.character-editor {
  border: 1px solid rgba(220, 226, 218, .9);
  border-radius: .85rem;
  background: rgba(255, 253, 250, .82);
  box-shadow: 0 .9rem 2.4rem rgba(38, 43, 40, .08);
}

.catalog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.catalog-hero {
  min-height: 92px;
  background:
    linear-gradient(135deg, rgba(31, 122, 109, .09), rgba(232, 195, 99, .13)),
    rgba(255, 253, 250, .9);
}

.catalog-hero-copy {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .85rem;
}

.catalog-hero-copy .brand-mark {
  margin: 0;
}

.catalog-summary {
  margin-left: auto;
  min-width: 92px;
  border: 1px solid rgba(220, 226, 218, .9);
  border-radius: .75rem;
  padding: .45rem .7rem;
  background: rgba(255, 255, 255, .58);
  text-align: center;
}

.catalog-summary strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
}

.catalog-summary span {
  color: var(--app-muted);
  font-size: .78rem;
  font-weight: 700;
}

.catalog-intro {
  display: none;
}

.catalog-header h1,
.title-hero h1,
.character-profile h1 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0;
}

.catalog-header h1 {
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  line-height: 1;
}

.catalog-header p,
.title-hero p,
.character-profile p {
  margin: .35rem 0 0;
  color: var(--app-muted);
}

.catalog-nav,
.detail-nav,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}

.catalog-nav form {
  margin: 0;
}

.catalog-nav .btn {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.detail-nav {
  margin-bottom: 1rem;
}

.detail-nav a {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(31, 122, 109, .16);
  border-radius: .55rem;
  padding: .35rem .65rem;
  background: rgba(255, 253, 250, .72);
  color: #286b60;
  font-weight: 700;
  text-decoration: none;
}

.detail-nav a:hover,
.detail-nav a:focus-visible {
  border-color: rgba(31, 122, 109, .35);
  background: #e8f4ef;
  color: #174d44;
}

.catalog-tools {
  padding: .7rem;
  margin-bottom: 1rem;
  position: sticky;
  top: .75rem;
  z-index: 3;
  backdrop-filter: blur(12px);
}

.catalog-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px auto auto;
  gap: .6rem;
}

.catalog-search .form-control,
.catalog-search .form-select,
.catalog-search .btn {
  min-height: 42px;
  border-radius: .65rem;
}

.title-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.1rem;
}

.title-card,
.character-card {
  min-width: 0;
  display: grid;
  gap: 0;
  border: 1px solid var(--app-line);
  border-radius: .8rem;
  background: #fff;
  color: var(--app-ink);
  text-decoration: none;
  overflow: hidden;
  box-shadow: 0 .75rem 2rem rgba(44, 39, 29, .08);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.title-card-link {
  min-width: 0;
  display: grid;
  color: inherit;
  text-decoration: none;
}

.title-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  padding: 0 .85rem .85rem;
}

.title-card-actions form,
.title-card-actions .title-action {
  min-width: 0;
}

.title-card-actions form,
.title-card-actions button {
  width: 100%;
}

.title-card-actions .title-action-open {
  grid-column: 1 / -1;
  justify-content: center;
}

.title-action {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(31, 122, 109, .24);
  border-radius: .55rem;
  padding: .35rem .62rem;
  background: #f8fbf9;
  color: #275f56;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-decoration: none;
}

.title-action:hover,
.title-action:focus-visible {
  border-color: rgba(31, 122, 109, .45);
  background: #e8f4ef;
  color: #174d44;
}

.title-action-open {
  border-color: rgba(31, 122, 109, .3);
  background: #1f7a6d;
  color: #fff;
}

.title-action-open:hover,
.title-action-open:focus-visible {
  background: #176459;
  color: #fff;
}

.title-action-danger {
  border-color: rgba(184, 50, 59, .24);
  background: #fff8f8;
  color: #b8323b;
}

.title-action-danger:hover,
.title-action-danger:focus-visible {
  border-color: rgba(184, 50, 59, .5);
  background: #b8323b;
  color: #fff;
}

.title-card:hover,
.character-card:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 122, 109, .4);
  box-shadow: 0 .85rem 1.8rem rgba(44, 39, 29, .12);
}

.title-poster {
  position: relative;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, .08), transparent 6rem),
    linear-gradient(145deg, #1d2823, #33483f);
  color: #f8f4eb;
  font-weight: 800;
}

.title-poster::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .58));
  pointer-events: none;
}

.poster-placeholder {
  width: min(76%, 150px);
  min-height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: .8rem;
  padding: .75rem;
  background: rgba(255, 255, 255, .05);
  color: rgba(248, 244, 235, .86);
  text-align: center;
  text-decoration: none;
}

.adult-poster img {
  filter: blur(18px) brightness(.52);
  transform: scale(1.12);
}

.adult-poster-mask {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: .5rem;
  padding: 1rem;
  background:
    radial-gradient(circle at 50% 40%, rgba(184, 50, 59, .28), transparent 9rem),
    linear-gradient(145deg, #191b1a, #383a37);
  color: #fff;
  text-align: center;
}

.adult-poster-mask strong {
  border: 2px solid rgba(255, 255, 255, .78);
  border-radius: .55rem;
  padding: .32rem .62rem;
  font-size: 1.35rem;
  line-height: 1;
}

.adult-poster-mask small {
  color: rgba(255, 255, 255, .8);
}

.adult-badge {
  position: absolute;
  top: .65rem;
  right: .65rem;
  z-index: 2;
  border-radius: .4rem;
  padding: .2rem .45rem;
  background: #b8323b;
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
}

.title-poster img,
.title-hero-poster img,
.character-portrait img,
.character-large-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.title-card-body {
  min-width: 0;
  display: grid;
  gap: .35rem;
  padding: .9rem .95rem .8rem;
}

.title-card-body strong,
.character-card strong {
  color: var(--app-ink);
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.2;
}

.title-card-body small,
.character-card small,
.title-meta {
  color: var(--app-muted);
  text-decoration: none;
}

.title-kind {
  width: fit-content;
  border-radius: 999px;
  padding: .18rem .55rem;
  background: #dfeee8;
  color: #1e6459;
  font-size: .78rem;
  font-weight: 800;
}

.overlay-kind {
  position: absolute;
  left: .65rem;
  bottom: .65rem;
  z-index: 2;
  background: rgba(255, 253, 250, .9);
  color: #1e6459;
}

.title-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  font-size: .82rem;
}

.title-meta span {
  border-radius: 999px;
  padding: .12rem .45rem;
  background: #edf4f0;
  color: #4f625a;
}

.catalog-form-panel {
  padding: 1rem;
}

.character-create-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
  position: sticky;
  top: 1rem;
  overflow: hidden;
  padding: 0;
  background:
    radial-gradient(circle at 100% 0, rgba(31, 122, 109, .12), transparent 18rem),
    rgba(255, 253, 250, .96);
}

.title-create-panel {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.title-create-panel p {
  color: var(--app-muted);
}

.compact-title-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
}

.compact-title-form p {
  margin: 0;
}

.compact-title-form p:nth-of-type(5),
.compact-title-form button {
  grid-column: 1 / -1;
}

.catalog-form-panel.wide {
  padding: 1.25rem;
}

.stack-form p {
  margin-bottom: .8rem;
}

.stack-form label {
  display: block;
  margin-bottom: .25rem;
  color: #415048;
  font-weight: 700;
}

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  border: 1px solid #cfd8d2;
  border-radius: .55rem;
  padding: .55rem .65rem;
  background: #fff;
}

.stack-form input[type="checkbox"] {
  width: auto;
  margin-right: .4rem;
}

.character-create-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.1rem 0;
}

.character-create-heading h2 {
  margin: .12rem 0 .35rem;
}

.character-create-heading p {
  max-width: 34rem;
  margin: 0;
  color: var(--app-muted);
  font-size: .88rem;
}

.character-create-eyebrow {
  color: #1f7a6d;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.character-form-progress {
  --progress: 0deg;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 55%, transparent 57%),
    conic-gradient(#1f7a6d var(--progress), #dfe8e3 0);
  color: #245e55;
  font-size: .72rem;
  font-weight: 900;
}

.character-create-preview {
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: .8rem;
  align-items: center;
  margin: 0 1.1rem;
  border: 1px solid rgba(31, 122, 109, .18);
  border-radius: .85rem;
  padding: .7rem;
  background: linear-gradient(135deg, #edf7f3, #fffaf2);
}

.character-create-avatar {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: .75rem;
  background: linear-gradient(145deg, #1d2823, #3c5d50);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 900;
}

.character-create-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-create-preview strong,
.character-create-preview small {
  display: block;
  overflow-wrap: anywhere;
}

.character-create-preview small {
  margin-top: .18rem;
  color: var(--app-muted);
}

.character-create-form {
  display: grid;
  gap: .75rem;
  padding: 0 1.1rem 1.1rem;
}

.character-form-section,
.character-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
}

.character-form-primary {
  border-top: 1px solid rgba(220, 226, 218, .85);
  padding-top: .9rem;
}

.character-field {
  min-width: 0;
  position: relative;
}

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

.character-field label {
  display: block;
  margin-bottom: .3rem;
  color: #354a41;
  font-size: .8rem;
  font-weight: 850;
}

.character-field label span {
  color: #b8323b;
}

.character-field input,
.character-field select,
.character-field textarea {
  min-height: 42px;
  border-color: #cad6cf;
  border-radius: .65rem;
  background: rgba(255, 255, 255, .94);
  font-size: .9rem;
}

.character-field textarea {
  min-height: 92px;
  resize: vertical;
}

.character-field input:focus,
.character-field select:focus,
.character-field textarea:focus {
  border-color: #3e978a;
  box-shadow: 0 0 0 .2rem rgba(31, 122, 109, .12);
}

.character-field > small {
  display: block;
  margin-top: .25rem;
  color: var(--app-muted);
  font-size: .74rem;
}

.character-field .errorlist,
.character-form-alert .errorlist {
  margin: .3rem 0 0;
  padding: 0;
  color: #a92f38;
  font-size: .78rem;
  font-weight: 800;
  list-style: none;
}

.character-field.has-error input,
.character-field.has-error select,
.character-field.has-error textarea {
  border-color: #c8565e;
  background: #fff8f8;
}

.character-form-alert {
  border: 1px solid rgba(184, 50, 59, .22);
  border-radius: .65rem;
  padding: .65rem .75rem;
  background: #fff4f4;
}

.character-form-group {
  overflow: hidden;
  border: 1px solid rgba(210, 220, 214, .92);
  border-radius: .75rem;
  background: rgba(255, 255, 255, .62);
}

.character-form-group summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  align-items: center;
  padding: .65rem .8rem;
  cursor: pointer;
  list-style: none;
}

.character-form-group summary::-webkit-details-marker {
  display: none;
}

.character-form-group summary::before {
  content: "+";
  grid-column: 2;
  grid-row: 1;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e6f1ed;
  color: #1f7a6d;
  font-weight: 900;
}

.character-form-group[open] summary::before {
  content: "−";
}

.character-form-group summary > span:first-child {
  grid-column: 1;
  grid-row: 1;
}

.character-form-group summary strong,
.character-form-group summary small {
  display: block;
}

.character-form-group summary strong {
  color: #2b4037;
  font-size: .88rem;
}

.character-form-group summary small {
  margin-top: .12rem;
  color: var(--app-muted);
  font-size: .74rem;
}

.character-group-status {
  grid-column: 1;
  grid-row: 2;
  color: #497068;
  font-size: .7rem;
  font-weight: 800;
}

.character-form-group .character-form-grid {
  border-top: 1px solid rgba(220, 226, 218, .8);
  padding: .8rem;
  background: #f8fbf9;
}

.character-form-textareas .character-field {
  grid-column: 1 / -1;
}

.character-counter {
  position: absolute;
  right: .55rem;
  bottom: .35rem;
  border-radius: 999px;
  padding: .05rem .35rem;
  background: rgba(238, 243, 240, .9);
  color: #75827b;
  font-size: .65rem;
}

.character-gallery-toggle {
  grid-column: 1 / -1;
  display: flex;
  align-items: start;
  gap: .65rem;
  border: 1px solid rgba(31, 122, 109, .18);
  border-radius: .65rem;
  padding: .65rem;
  background: #edf7f3;
  cursor: pointer;
}

.character-gallery-toggle input {
  flex: 0 0 auto;
  margin-top: .15rem;
}

.character-gallery-toggle strong,
.character-gallery-toggle small {
  display: block;
}

.character-gallery-toggle strong {
  color: #285d53;
  font-size: .83rem;
}

.character-gallery-toggle small {
  margin-top: .1rem;
  color: var(--app-muted);
  font-size: .72rem;
}

.character-form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .55rem;
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding-top: .2rem;
  background: rgba(255, 253, 250, .94);
}

.character-form-actions .btn {
  min-height: 48px;
  border-radius: .7rem;
  font-weight: 850;
}

.character-form-actions .btn-success span,
.character-form-actions .btn-success small {
  display: block;
}

.character-form-actions .btn-success small {
  opacity: .75;
  font-size: .68rem;
  font-weight: 600;
}

.character-draft-clear {
  border: 1px solid #d5ded9;
  background: #fff;
  color: #5c6c64;
}

.empty-panel {
  grid-column: 1 / -1;
  border: 1px dashed #aeb9b2;
  border-radius: .8rem;
  padding: 2rem;
  color: var(--app-muted);
  background: rgba(255, 253, 250, .7);
  text-align: center;
}

.title-hero {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1.4rem;
  align-items: stretch;
  padding: 1.25rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.title-hero-poster {
  position: relative;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: .8rem;
  background: #202722;
  color: #f8f4eb;
  font-weight: 800;
}

.title-hero-poster.adult-locked {
  background: #191b1a;
}

.detail-mask {
  gap: .75rem;
}

.adult-inline-badge {
  display: inline-block;
  margin-left: .35rem;
  border-radius: .4rem;
  padding: .18rem .5rem;
  background: #b8323b;
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
}

.title-hero-content {
  min-width: 0;
  display: grid;
  align-content: end;
  gap: .85rem;
  padding: .6rem 0;
}

.title-heading {
  min-width: 0;
}

.title-heading h1 {
  overflow-wrap: anywhere;
}

.title-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.title-stats span {
  min-width: 128px;
  border: 1px solid rgba(220, 226, 218, .9);
  border-radius: .75rem;
  padding: .55rem .7rem;
  background: rgba(248, 251, 247, .86);
  color: var(--app-muted);
  font-size: .84rem;
}

.title-stats strong {
  display: block;
  color: var(--app-ink);
  font-size: 1.05rem;
}

.title-description {
  max-width: 760px;
  border-left: 3px solid rgba(31, 122, 109, .28);
  padding-left: .8rem;
}

.title-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.title-gallery-link {
  width: fit-content;
  color: #1f7a6d;
  font-weight: 800;
  text-decoration: none;
}

.title-gallery-link:hover,
.title-gallery-link:focus-visible {
  color: #164e46;
  text-decoration: underline;
}

.character-board {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
}

.character-board-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: .75rem;
  align-items: center;
}

.character-board-head h2,
.character-board > h2,
.character-create-panel > h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.1;
}

.gender-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.gender-columns > section {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: .7rem;
  border: 1px solid rgba(220, 226, 218, .9);
  border-radius: .8rem;
  padding: .85rem;
  background:
    linear-gradient(180deg, rgba(248, 251, 247, .92), rgba(255, 253, 250, .96));
}

.gender-columns h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin: 0;
  padding-bottom: .55rem;
  border-bottom: 1px solid rgba(220, 226, 218, .8);
  font-size: 1rem;
  font-weight: 800;
  color: #213b35;
}

.gender-columns h3 span {
  min-width: 1.75rem;
  border-radius: 999px;
  padding: .16rem .5rem;
  background: #dfeee8;
  color: #1e6459;
  text-align: center;
  font-size: .8rem;
}

.character-list {
  display: grid;
  gap: .65rem;
}

.character-list > p {
  margin: 0;
  border: 1px dashed rgba(128, 142, 134, .35);
  border-radius: .7rem;
  padding: .85rem;
  background: rgba(255, 255, 255, .54);
  text-align: center;
}

.character-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .45rem;
  padding: .5rem;
  border-radius: .75rem;
}

.character-card-link {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: .7rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.character-portrait,
.character-large-portrait {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #202722;
  color: #f8f4eb;
  font-weight: 800;
}

.cover-upload-panel {
  position: absolute;
  left: .65rem;
  right: .65rem;
  bottom: .65rem;
  display: grid;
  gap: .35rem;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: .7rem;
  padding: .55rem;
  background: rgba(16, 20, 18, .72);
  color: #f8f4eb;
  backdrop-filter: blur(10px);
}

.cover-upload-panel label {
  margin: 0;
  font-size: .78rem;
  font-weight: 800;
}

.cover-upload-panel input[type="file"] {
  width: 100%;
  color: #dfe7e2;
  font-size: .78rem;
}

.character-portrait {
  width: 58px;
  height: 58px;
  border-radius: .65rem;
}

.character-card-body {
  min-width: 0;
  display: grid;
  gap: .15rem;
}

.character-delete {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(176, 70, 70, .22);
  border-radius: .65rem;
  background: rgba(255, 246, 246, .92);
  color: #9c2f2f;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 800;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.character-delete:hover,
.character-delete:focus-visible {
  border-color: rgba(176, 70, 70, .48);
  background: #b04646;
  color: #fff;
  transform: translateY(-1px);
}

.character-detail-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.character-page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(208, 218, 212, .9);
  padding: .25rem .2rem 1rem;
}

.character-page-heading h1 {
  margin: .15rem 0 0;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: 1;
}

.character-page-heading p {
  margin: .35rem 0 0;
  color: var(--app-muted);
}

.character-page-eyebrow {
  color: #1f7a6d;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.character-save-state {
  flex: 0 0 auto;
  border: 1px solid #d4e0da;
  border-radius: 999px;
  padding: .4rem .7rem;
  background: #f7faf8;
  color: #5d6e66;
  font-size: .76rem;
  font-weight: 800;
}

.character-save-state::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: .4rem;
  border-radius: 50%;
  background: #3f9a76;
}

.character-save-state.is-dirty {
  border-color: #ead39b;
  background: #fff8e8;
  color: #806226;
}

.character-save-state.is-dirty::before {
  background: #d89d25;
}

.character-profile,
.character-editor {
  padding: 1rem;
}

.character-profile {
  position: sticky;
  top: 1rem;
}

.character-large-portrait {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: .8rem;
  margin-bottom: 1rem;
  font-size: 4rem;
}

.character-studio {
  grid-template-columns: minmax(290px, 350px) minmax(0, 1fr);
}

.character-studio-profile {
  overflow: hidden;
  padding: .7rem;
}

.character-studio-profile .character-large-portrait {
  margin: 0;
  border-radius: .7rem;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, .12), transparent 8rem),
    linear-gradient(145deg, #17201c, #375247);
}

.character-portrait-upload {
  position: absolute;
  inset: auto .65rem .65rem;
  display: grid;
  gap: .4rem;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: .7rem;
  padding: .6rem;
  background: rgba(15, 20, 18, .76);
  color: #fff;
  backdrop-filter: blur(12px);
  transform: translateY(calc(100% - 42px));
  transition: transform .18s ease;
}

.character-large-portrait:hover .character-portrait-upload,
.character-portrait-upload:focus-within {
  transform: translateY(0);
}

.character-portrait-upload label {
  cursor: pointer;
}

.character-portrait-upload strong,
.character-portrait-upload small {
  display: block;
}

.character-portrait-upload small {
  color: rgba(255, 255, 255, .7);
  font-size: .7rem;
}

.character-portrait-upload input {
  width: 100%;
  color: #eaf0ec;
  font-size: .74rem;
}

.character-profile-identity {
  padding: 1rem .35rem .35rem;
}

.character-profile-identity h2 {
  margin: .5rem 0 .1rem;
  overflow-wrap: anywhere;
  font-size: 1.55rem;
  font-weight: 900;
}

.character-profile-identity p {
  margin: 0;
}

.character-race-chip {
  display: inline-flex;
  margin-top: .6rem;
  border-radius: 999px;
  padding: .25rem .55rem;
  background: #f1e9d7;
  color: #715b2c;
  font-size: .75rem;
  font-weight: 800;
}

.character-race-chip.muted {
  background: #edf1ef;
  color: #77827c;
}

.character-live-facts {
  padding: 0 .35rem;
}

.character-profile-actions {
  display: grid;
  gap: .5rem;
  padding: .4rem .35rem .35rem;
}

.character-profile-actions form,
.character-profile-actions .btn {
  width: 100%;
}

.character-profile-actions .btn {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: .7rem;
  font-weight: 850;
}

.character-profile-actions .btn small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  opacity: .7;
  font-size: .64rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-studio-editor {
  overflow: hidden;
  padding: 0;
}

.character-studio-editor > .character-readonly {
  padding: 0 1.2rem 1.2rem;
}

.character-editor-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem;
  background:
    radial-gradient(circle at 100% 0, rgba(31, 122, 109, .12), transparent 18rem),
    linear-gradient(135deg, rgba(249, 252, 250, .98), rgba(255, 251, 242, .82));
}

.character-editor-heading h2 {
  margin: .15rem 0 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 900;
}

.character-editor-heading p {
  margin: .3rem 0 0;
  color: var(--app-muted);
  font-size: .84rem;
}

.character-editor-progress {
  --progress: 0deg;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 55%, transparent 57%),
    conic-gradient(#1f7a6d var(--progress), #dfe8e3 0);
  color: #245e55;
  font-size: .74rem;
  font-weight: 900;
}

.character-editor-form {
  display: grid;
  gap: .8rem;
  padding: 1rem 1.2rem 1.2rem;
}

.character-editor-section {
  overflow: hidden;
  border: 1px solid rgba(213, 222, 216, .95);
  border-radius: .8rem;
  background: #fbfcfa;
}

section.character-editor-section {
  padding-bottom: .9rem;
}

.character-editor-section-head {
  min-height: 68px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 26px;
  gap: .7rem;
  align-items: center;
  margin: 0;
  padding: .7rem .85rem;
  list-style: none;
}

details .character-editor-section-head {
  cursor: pointer;
}

.character-editor-section-head::-webkit-details-marker {
  display: none;
}

.character-editor-section-head > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: .65rem;
  background: #dfeee8;
  color: #1f6c60;
  font-size: .72rem;
  font-weight: 900;
}

.character-editor-section-head h3 {
  margin: 0;
  color: #2a3d35;
  font-size: .95rem;
  font-weight: 900;
}

.character-editor-section-head p {
  margin: .12rem 0 0;
  color: var(--app-muted);
  font-size: .74rem;
}

.character-editor-section-head > small {
  color: #527068;
  font-size: .7rem;
  font-weight: 800;
}

details .character-editor-section-head::after {
  content: "+";
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef3f0;
  color: #477267;
  font-weight: 900;
}

details[open] .character-editor-section-head::after {
  content: "−";
}

.character-editor-section > .character-form-grid {
  margin: 0 .85rem;
  border-top: 1px solid rgba(220, 226, 218, .8);
  padding-top: .8rem;
}

.character-editor-technical {
  background: #f7f8f6;
}

.character-editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  position: sticky;
  bottom: .5rem;
  z-index: 2;
  border: 1px solid rgba(204, 216, 209, .94);
  border-radius: .8rem;
  padding: .65rem;
  background: rgba(255, 253, 250, .94);
  box-shadow: 0 .65rem 1.5rem rgba(38, 43, 40, .1);
  backdrop-filter: blur(12px);
}

.character-editor-actions > span {
  color: var(--app-muted);
  font-size: .76rem;
  font-weight: 750;
}

.character-editor-form.is-dirty .character-editor-actions > span {
  color: #8a6420;
}

.character-editor-actions > div {
  display: flex;
  gap: .5rem;
}

.character-editor-actions .btn {
  min-height: 42px;
  border-radius: .65rem;
  font-weight: 800;
}

.character-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin: 1rem 0;
}

.character-facts div {
  min-width: 0;
  border: 1px solid var(--app-line);
  border-radius: .6rem;
  padding: .45rem .55rem;
  background: #f8faf7;
}

.character-facts dt {
  color: var(--app-muted);
  font-size: .76rem;
  font-weight: 700;
}

.character-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.character-readonly {
  display: grid;
  gap: .75rem;
  margin: 0;
}

.character-readonly div {
  min-width: 0;
  border: 1px solid var(--app-line);
  border-radius: .7rem;
  padding: .75rem .85rem;
  background: #f8faf7;
}

.character-readonly dt {
  color: var(--app-muted);
  font-size: .8rem;
  font-weight: 800;
}

.character-readonly dd {
  margin: .2rem 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

@media (max-width: 1040px) {
  .character-detail-grid {
    grid-template-columns: 1fr;
  }

  .character-profile {
    position: static;
  }

  .character-create-panel {
    position: static;
  }

  .character-studio-profile {
    display: grid;
    grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
    gap: .35rem 1rem;
  }

  .character-studio-profile .character-large-portrait {
    grid-row: 1 / span 4;
  }

  .character-profile-identity {
    align-self: end;
  }

  .character-live-facts {
    align-self: start;
  }
}

@media (max-width: 780px) {
  .catalog-header,
  .title-hero {
    grid-template-columns: 1fr;
  }

  .catalog-header {
    display: grid;
    align-items: start;
  }

  .catalog-summary {
    margin-left: 0;
    width: fit-content;
  }

  .catalog-nav {
    width: 100%;
  }

  .catalog-search,
  .character-board-head,
  .title-create-panel,
  .compact-title-form,
  .gender-columns {
    grid-template-columns: 1fr;
  }

  .character-create-heading {
    padding: .9rem .9rem 0;
  }

  .character-create-preview {
    margin: 0 .9rem;
  }

  .character-create-form {
    padding: 0 .9rem .9rem;
  }

  .title-hero-poster {
    width: min(100%, 260px);
  }

  .title-hero-content {
    padding: 0;
  }

  .catalog-tools {
    position: static;
  }

  .character-page-heading {
    align-items: start;
  }

  .character-save-state {
    max-width: 150px;
  }

  .title-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
  }
}

/* Animated, non-blocking character guide on a title page. */
.title-character-guide {
  position: fixed;
  right: clamp(14px, 2.4vw, 38px);
  bottom: 18px;
  z-index: 720;
  display: flex;
  align-items: end;
  gap: 10px;
  max-width: min(520px, calc(100vw - 28px));
  opacity: 0;
  transform: translateY(24px) scale(.97);
  pointer-events: none;
  transition: opacity .35s ease, transform .45s cubic-bezier(.2,.8,.2,1);
}

.title-character-guide.is-ready { opacity: 1; transform: none; }
.title-character-guide.is-hidden { display: none; }
.title-character-guide-portrait {
  width: 108px;
  height: 148px;
  flex: 0 0 auto;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 3px solid rgba(255,255,255,.9);
  border-radius: 48% 48% 18px 18px;
  color: #fff;
  background: linear-gradient(145deg, #177c6c, #083f38);
  box-shadow: 0 18px 40px rgba(12,51,45,.25);
  animation: character-guide-float 3.4s ease-in-out infinite;
}
.title-character-guide-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.title-character-guide-portrait span { font-size: 2.4rem; font-weight: 900; }
.title-character-guide-bubble {
  position: relative;
  width: min(370px, calc(100vw - 145px));
  padding: 15px 42px 15px 16px;
  border: 1px solid #cfe2dc;
  border-radius: 18px 18px 4px 18px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 18px 48px rgba(12,51,45,.2);
  pointer-events: auto;
}
.title-character-guide-bubble small { display: block; color: #177c6c; font-weight: 800; }
.title-character-guide-bubble strong { display: block; margin-top: 2px; font-size: 1.05rem; }
.title-character-guide-bubble p { margin: 3px 0 10px; color: #60706c; font-size: .84rem; }
.title-character-guide-bubble nav { display: flex; flex-wrap: wrap; gap: 6px; }
.title-character-guide-bubble nav a {
  padding: 6px 9px; border: 1px solid #cfe2dc; border-radius: 999px;
  color: #176d60; background: #f1f8f6; font-size: .76rem; font-weight: 800; text-decoration: none;
}
.title-character-guide-bubble nav a:hover { color: #fff; background: #177c6c; border-color: #177c6c; }
.title-character-guide-close {
  position: absolute; top: 8px; right: 9px; width: 27px; height: 27px; border: 0;
  border-radius: 50%; color: #51635f; background: #edf4f2; font-size: 1.15rem; line-height: 1; cursor: pointer;
}
.title-character-guide-restore {
  position: fixed; right: 18px; bottom: 18px; z-index: 719; display: none; width: 42px; height: 42px;
  border: 0; border-radius: 50%; color: #fff; background: #177c6c; box-shadow: 0 8px 24px rgba(12,51,45,.25);
  font-size: 1.15rem; font-weight: 900;
}
.title-character-guide-restore.is-visible { display: block; }
#characterFacts:target, #characterAppearance:target, #characterEditorForm:target {
  scroll-margin-top: 90px; outline: 3px solid rgba(23,124,108,.28); outline-offset: 7px;
  animation: character-guide-target 1.2s ease;
}
@keyframes character-guide-float { 50% { transform: translateY(-7px) rotate(.7deg); } }
@keyframes character-guide-target { 0%, 55% { outline-color: rgba(23,124,108,.72); } }
@media (max-width: 680px) {
  .title-character-guide { left: 10px; right: 10px; bottom: 10px; gap: 7px; }
  .title-character-guide-portrait { width: 70px; height: 94px; }
  .title-character-guide-bubble { width: calc(100vw - 97px); padding: 11px 34px 11px 12px; border-radius: 15px 15px 4px 15px; }
  .title-character-guide-bubble p { display: none; }
  .title-character-guide-bubble nav { margin-top: 7px; max-height: 70px; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .title-character-guide, .title-character-guide-portrait, #characterFacts:target, #characterAppearance:target, #characterEditorForm:target {
    animation: none; transition: none;
  }
}

.video-library-shell { width: min(1760px, calc(100% - 32px)); margin: 22px auto 60px; }
.video-folder-breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 1.2rem 0; overflow-wrap: anywhere; }
.video-folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 1rem; margin: 1.2rem 0; }
.video-folder-card { display: flex; align-items: center; gap: .8rem; min-width: 0; padding: 1.1rem; border: 1px solid var(--app-line); border-radius: 1rem; background: #fff; color: inherit; text-decoration: none; }
.video-folder-card strong { flex: 1; overflow-wrap: anywhere; }
.video-folder-card > span:first-child { font-size: 2rem; }
.video-folder-card:hover { border-color: currentColor; }
.video-library-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px; border: 1px solid #d9e4de; border-radius: 20px; background: linear-gradient(135deg,#eef7f3,#fff8e8); }
.video-library-hero h1 { margin: 2px 0; font-weight: 900; }
.video-library-hero p { margin: 0; color: #65736d; }
.video-library-hero > strong { min-width: 92px; padding: 12px; border-radius: 14px; background: #fff; text-align: center; font-size: 1.5rem; }
.video-library-hero > strong small { display: block; color: #6b7872; font-size: .7rem; }
.video-upload-panel { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; margin: 16px 0; padding: 16px; border: 1px dashed #8eb9aa; border-radius: 16px; background: #f5fbf8; }
.video-upload-panel label { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; cursor: pointer; }
.video-upload-panel label > span { grid-row: 1 / 3; font-size: 1.8rem; color: #177c6c; }
.video-upload-panel label small { color: #65736d; }
.video-upload-panel input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.video-upload-panel p { grid-column: 1 / -1; margin: 0; color: #7a6652; font-size: .78rem; }
.video-library-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(360px,1fr)); gap: 16px; }
.video-library-card { overflow: hidden; border: 1px solid #d9e4de; border-radius: 16px; background: #fff; box-shadow: 0 10px 28px rgba(24,52,42,.08); }
.video-library-card video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #101312; object-fit: contain; }
.video-library-card > div { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.video-library-card strong { overflow-wrap: anywhere; }
.video-library-card small { flex: 0 0 auto; color: #718079; }
@media (max-width: 650px) {
  .video-library-shell { width: min(100% - 18px,1760px); margin-top: 10px; }
  .video-library-hero { align-items: flex-start; padding: 16px; }
  .video-library-grid { grid-template-columns: 1fr; }
  .video-upload-panel { grid-template-columns: 1fr; }
}

/* Shared creation dialogs */
body.app-modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

.app-modal {
  width: min(760px, calc(100vw - 24px));
  max-width: none;
  height: min(860px, calc(100dvh - 24px));
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: inherit;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(9, 22, 17, .35);
}

.app-modal.app-modal-wide {
  width: min(1040px, calc(100vw - 24px));
}

.app-modal::backdrop {
  background: rgba(8, 17, 14, .72);
  backdrop-filter: blur(5px);
}

.app-modal-card {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f8faf8;
}

.app-modal-header {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 18px 22px;
  border-bottom: 1px solid #dce7e0;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 24px rgba(18, 49, 37, .06);
}

.app-modal-header h2,
.app-modal-header p {
  margin: 0;
}

.app-modal-header small {
  display: block;
  color: #198754;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.app-modal-top-actions {
  display: flex;
  align-items: center;
  gap: .55rem;
  flex: 0 0 auto;
}

.app-modal-close {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #edf2ef;
  color: #30423a;
  font-size: 1.6rem;
  line-height: 1;
}

.app-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px;
  scrollbar-gutter: stable;
}

.detail-nav-button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

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

/* The photo chooser behaves as a full modal even on its dedicated URL. */
.character-upload-page {
  height: 100dvh;
  overflow: hidden;
}

.character-upload-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(8, 17, 14, .7);
  backdrop-filter: blur(5px);
}

.character-upload-shell {
  position: relative;
  z-index: 2;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding: 12px;
}

.character-upload-shell > .detail-nav {
  display: none;
}

.character-upload-card {
  width: min(1050px, 100%);
  height: min(900px, calc(100dvh - 24px));
  max-height: calc(100dvh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.character-upload-modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.character-upload-head-actions {
  display: flex;
  gap: .55rem;
  flex: 0 0 auto;
}

.character-upload-card > form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 28px;
}

.character-upload-preview {
  max-height: none;
  overflow: visible;
}

@media (max-width: 640px) {
  .app-modal {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .app-modal-header,
  .character-upload-modal-head {
    align-items: flex-start;
    padding: 12px;
  }

  .app-modal-header p,
  .character-upload-modal-head p,
  .app-modal-top-actions .btn.btn-outline-secondary {
    display: none;
  }

  .app-modal-body {
    padding: 14px;
  }

  .character-upload-card {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }

  .character-upload-head-actions .btn {
    white-space: nowrap;
  }
}

/* Media library refresh */
.workspace {
  background:
    radial-gradient(circle at 92% 0, rgba(55, 153, 114, .09), transparent 26rem),
    linear-gradient(180deg, #f7faf8 0, #edf2ef 42rem);
}

.workspace-header {
  position: sticky;
  top: 12px;
  z-index: 20;
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
}

.workspace .toolbar {
  width: min(620px, 100%);
  grid-template-columns: auto auto minmax(190px, 1fr);
}

.media-command-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .8rem;
  padding: .55rem;
  border: 1px solid rgba(220, 226, 218, .9);
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
}

.media-type-filters {
  display: flex;
  gap: .3rem;
}

.media-type-filters button {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  padding: .45rem .85rem;
  background: transparent;
  color: #617168;
  font-weight: 750;
}

.media-type-filters button:hover,
.media-type-filters button.active {
  background: #def0e7;
  color: #14643f;
}

.media-sort {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #738078;
  font-size: .82rem;
  font-weight: 700;
}

.media-sort select {
  width: auto;
  min-width: 165px;
  border-color: transparent;
  background-color: transparent;
  font-weight: 700;
}

.drop-zone {
  overflow: hidden;
  position: relative;
  border: 1px solid #b8d6c7;
  border-radius: 18px !important;
  background:
    linear-gradient(135deg, rgba(224, 243, 234, .9), rgba(250, 252, 250, .94));
}

.drop-zone > div:first-child {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.drop-zone small {
  display: block;
  margin-top: .18rem;
  color: #708078;
}

.media-upload-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 14px;
  background: #198754;
  color: white;
  font-size: 1.45rem;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(25, 135, 84, .2);
}

.folder-card,
.media-card {
  border-radius: 16px;
}

.folder-card {
  min-height: 96px;
  border-color: rgba(208, 222, 214, .92);
  box-shadow: 0 8px 24px rgba(31, 56, 44, .07);
}

.media-card {
  box-shadow: 0 12px 30px rgba(27, 47, 37, .12);
}

.media-file-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.media-file-meta small {
  padding: .14rem .42rem;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(10, 17, 13, .34);
  color: rgba(255, 255, 255, .86);
  font-size: .68rem;
  text-shadow: none;
}

.media-mobile-folders,
.media-sidebar-close,
.media-sidebar-backdrop {
  display: none;
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1052;
    width: min(360px, 88vw);
    height: 100dvh;
    max-height: none;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 18px 0 48px rgba(7, 18, 13, .32);
  }

  .media-sidebar-open {
    overflow: hidden;
  }

  .media-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .media-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1051;
    width: 100%;
    border: 0;
    background: rgba(7, 18, 13, .58);
  }

  .media-sidebar-open .media-sidebar-backdrop {
    display: block;
  }

  .media-sidebar-close {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    margin-left: auto;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: white;
    font-size: 1.45rem;
  }

  .media-mobile-folders {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    margin-bottom: .7rem;
    border: 1px solid #cfe0d7;
    border-radius: 10px;
    padding: .5rem .75rem;
    background: white;
    color: #195f40;
    font-weight: 750;
  }
}

@media (max-width: 700px) {
  .workspace-header {
    position: static;
  }

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

  .workspace .toolbar #search {
    grid-column: 1 / -1;
  }

  .media-command-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .media-type-filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .media-sort {
    justify-content: space-between;
  }

  .drop-zone > div:first-child {
    align-items: flex-start;
  }

  .media-file-meta small:last-child {
    display: none;
  }
}

/* Catalog metadata, Shikimori-style filters and tool downloads */
.catalog-search-top {
  position: sticky;
  top: .65rem;
  z-index: 10;
  margin-bottom: 1rem;
  padding: .7rem;
  border: 1px solid rgba(213, 224, 217, .9);
  border-radius: 14px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 10px 28px rgba(28, 49, 39, .08);
  backdrop-filter: blur(12px);
}

.catalog-browser {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.catalog-browser.has-open-filters {
  grid-template-columns: clamp(230px, 14vw, 280px) minmax(0, 1fr);
}

.catalog-filters[hidden] {
  display: none;
}

.catalog-filter-toggle {
  white-space: nowrap;
}

.catalog-filters {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid #dbe4de;
  border-radius: 14px;
  padding: .75rem;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 10px 25px rgba(31, 52, 42, .07);
  scrollbar-width: thin;
}

.catalog-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .7rem;
}

.catalog-filter-heading strong,
.catalog-filter-heading small {
  display: block;
}

.catalog-filter-heading strong {
  font-size: 1.05rem;
}

.catalog-filter-heading small {
  color: #7a8780;
}

.catalog-filter-heading a {
  color: #a24747;
  font-size: .78rem;
  font-weight: 700;
}

.catalog-sort {
  display: grid;
  gap: .3rem;
  margin-bottom: .7rem;
  color: #617169;
  font-size: .78rem;
  font-weight: 800;
}

.catalog-filters details {
  border-top: 1px solid #e3e9e5;
  padding: .65rem 0;
}

.catalog-filters summary {
  cursor: pointer;
  color: #1f332a;
  font-size: .86rem;
  font-weight: 850;
  text-transform: uppercase;
  list-style-position: outside;
}

.catalog-filter-list {
  display: grid;
  gap: .3rem;
  padding: .6rem .15rem 0;
}

.catalog-filter-scroll {
  max-height: 190px;
  overflow-y: auto;
}

.catalog-filter-list label {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 26px;
  cursor: pointer;
  color: #4e5e56;
  font-size: .82rem;
}

.catalog-filter-list input {
  width: 16px;
  height: 16px;
  accent-color: #198754;
}

.catalog-results {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.title-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
}

.title-card-tags i {
  border-radius: 999px;
  padding: .15rem .45rem;
  background: #edf5f0;
  color: #39705a;
  font-size: .68rem;
  font-style: normal;
  font-weight: 700;
}

.title-card-characters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .3rem;
  padding: 0 .85rem .8rem;
}

.title-card-characters a {
  min-width: 0;
  color: #42534a;
  text-decoration: none;
  text-align: center;
}

.title-card-characters img,
.title-card-characters a > span {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 9px;
  background: #dcebe3;
  object-fit: cover;
  color: #1b6545;
  font-weight: 900;
}

.title-card-characters small {
  display: block;
  margin-top: .22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .62rem;
}

.title-hero {
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  align-items: start;
}

.title-hero-poster {
  width: 100%;
  max-width: 220px;
  min-height: 0;
  align-self: start;
}

.title-hero-poster img {
  position: absolute;
  inset: 0;
}

.title-hero-content {
  align-content: start;
}

.title-cover-change {
  position: absolute;
  left: .65rem;
  right: .65rem;
  bottom: .65rem;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 9px;
  background: rgba(11, 22, 17, .78);
  color: white;
  font-weight: 800;
  backdrop-filter: blur(9px);
}

.title-cover-drop-overlay {
  display: grid;
  place-items: center;
  align-content: center;
  position: absolute;
  inset: .55rem;
  z-index: 6;
  border: 2px dashed rgba(255,255,255,.82);
  border-radius: .75rem;
  padding: 1rem;
  background: rgba(16, 74, 63, .86);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: scale(.97);
  transition: opacity .16s ease, transform .16s ease;
  backdrop-filter: blur(7px);
}

.title-cover-drop-overlay strong,
.title-cover-drop-overlay small { display: block; }
.title-cover-drop-overlay small { color: rgba(255,255,255,.78); font-size: .72rem; }
.title-hero-poster.is-cover-dragging .title-cover-drop-overlay { opacity: 1; transform: scale(1); }
.title-hero-poster.is-cover-uploading::after { content: "Загрузка обложки…"; display: grid; place-items: center; position: absolute; inset: 0; z-index: 8; background: rgba(20,31,26,.82); color: white; font-size: .85rem; font-weight: 850; }

.title-catalog-facts {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0;
}

.title-catalog-facts div {
  min-width: 110px;
  padding: .48rem .65rem;
  border-radius: 10px;
  background: #f0f5f2;
}

.title-catalog-facts dt {
  color: #78867f;
  font-size: .68rem;
  text-transform: uppercase;
}

.title-catalog-facts dd {
  margin: 0;
  color: #263a30;
  font-size: .84rem;
  font-weight: 800;
}

.title-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.title-detail-tags span {
  border: 1px solid #c9ded3;
  border-radius: 999px;
  padding: .24rem .6rem;
  background: #edf7f1;
  color: #246548;
  font-size: .75rem;
  font-weight: 750;
}

.title-detail-tags span.theme {
  border-color: #e5d7ad;
  background: #fbf5e6;
  color: #715b20;
}

.title-cover-form {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.title-cover-form > label {
  font-weight: 800;
}

.title-cover-preview {
  width: min(300px, 100%);
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin: auto;
  border: 2px dashed #bfd3c8;
  border-radius: 16px;
  background: #edf3ef;
  color: #74827a;
}

.title-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.title-check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .35rem;
  max-height: 220px;
  overflow-y: auto;
  margin: .35rem 0 0;
  padding: .65rem;
  border: 1px solid #dce5df;
  border-radius: 10px;
  list-style: none;
}

.title-check-list label {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
}

.title-check-list input {
  width: 16px;
  height: 16px;
  accent-color: #198754;
}

.tool-download-page {
  background:
    radial-gradient(circle at 85% 10%, rgba(232, 195, 99, .18), transparent 25rem),
    linear-gradient(150deg, #f7faf8, #e9f0ec);
}

.tool-download-shell {
  width: min(1100px, calc(100% - 2rem));
  margin: auto;
  padding: 1rem 0 3rem;
}

.tool-download-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: clamp(1.2rem, 3vw, 2.2rem);
  border: 1px solid #d8e4dd;
  border-radius: 20px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 18px 45px rgba(30, 55, 43, .09);
}

.tool-download-hero h1 {
  margin: .25rem 0;
  font-size: clamp(1.7rem, 4vw, 3.2rem);
}

.tool-download-hero p {
  max-width: 780px;
  margin: 0;
  color: #62726a;
}

.tool-download-icon {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: #198754;
  color: white;
  font-size: 2.4rem;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(25, 135, 84, .22);
}

.tool-download-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.tool-download-card {
  position: relative;
  min-height: 190px;
  padding: 1.25rem;
  border: 1px solid #d8e4dd;
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 12px 30px rgba(30, 55, 43, .07);
}

.tool-download-card > span {
  color: #198754;
  font-weight: 900;
}

.tool-download-card h2 {
  margin: .45rem 0;
}

.tool-download-card p {
  color: #64736b;
}

.tool-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.tool-download-status {
  min-height: 22px;
  margin-top: .7rem;
  color: #276348;
  font-weight: 700;
}

.tool-advanced-download {
  display: inline-block;
  margin-top: .65rem;
  color: #69786f;
  font-size: .78rem;
}

.tool-download-note {
  margin-top: 1rem;
  padding: 1rem 1.2rem;
  border: 1px solid #ead9a9;
  border-radius: 14px;
  background: #fff8e5;
  color: #66551f;
}

.tool-download-note p {
  margin: .25rem 0 0;
}

@media (max-width: 900px) {
  .catalog-browser,
  .catalog-browser.has-open-filters {
    grid-template-columns: 1fr;
  }

  .catalog-filters {
    position: static;
    max-height: none;
  }

  .catalog-filters details:not([open]) {
    padding-bottom: .65rem;
  }
}

@media (max-width: 650px) {
  .catalog-search-top,
  .tool-download-grid,
  .tool-download-hero {
    grid-template-columns: 1fr;
  }

  .catalog-search-top {
    position: static;
  }

  .title-hero {
    grid-template-columns: 1fr;
  }

  .title-hero-poster {
    width: min(250px, 100%);
    max-width: none;
    margin: auto;
  }

  .tool-download-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }
}

.character-portrait-drop-hint {
  position: absolute;
  inset: 12px;
  z-index: 8;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 1rem;
  border: 3px dashed rgba(255, 255, 255, .9);
  border-radius: 18px;
  background: rgba(10, 92, 58, .88);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: scale(.97);
  transition: opacity .16s ease, transform .16s ease;
}

.character-portrait-drop-hint small {
  display: block;
  margin-top: .35rem;
  color: rgba(255, 255, 255, .82);
}

.character-large-portrait.is-portrait-dragging .character-portrait-drop-hint {
  opacity: 1;
  transform: scale(1);
}

.character-upload-folder {
  display: grid;
  gap: .8rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid #cfe0d6;
  border-radius: 16px;
  background: #f2f8f4;
}

.character-upload-folder > div:first-child {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.character-upload-folder > div:first-child > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: #198754;
  color: #fff;
  font-size: 1.4rem;
}

.character-upload-folder small,
.character-upload-folder strong {
  display: block;
}

.character-upload-folder-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .65rem;
}

.character-folder-created {
  margin: 0 1.5rem 1rem;
  padding: .75rem 1rem;
  border-radius: 12px;
  background: #dff3e6;
  color: #0f633c;
  font-weight: 700;
}

.media-breadcrumbs {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 38px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.media-breadcrumbs button,
.media-breadcrumbs strong {
  border: 0;
  padding: 0;
  background: none;
  color: #183d2c;
  font-size: clamp(1rem, 1.7vw, 1.45rem);
  font-weight: 750;
}

.media-breadcrumbs button:hover {
  color: #198754;
}

.media-folder-summary {
  display: flex;
  gap: .8rem;
  color: #718078;
  font-size: .82rem;
}

.media-compact-view .gallery {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

.media-compact-view .media-card .thumb {
  aspect-ratio: 1;
}

.media-compact-view .media-card .media-body {
  padding: .55rem;
}

.media-compact-view .media-card .tag-list {
  display: none;
}

@media (max-width: 640px) {
  .character-upload-folder-controls {
    grid-template-columns: 1fr;
  }

  .media-view-toggle {
    display: none;
  }
}

@media (max-width: 420px) {
  .title-grid {
    grid-template-columns: 1fr;
  }

  .title-card-actions,
  .character-facts,
  .character-form-section,
  .character-form-grid {
    grid-template-columns: 1fr;
  }

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

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

  .character-page-heading {
    display: grid;
  }

  .character-save-state {
    max-width: none;
    width: fit-content;
  }

  .character-studio-profile {
    display: block;
  }

  .character-editor-heading,
  .character-editor-actions {
    align-items: start;
  }

  .character-editor-actions {
    display: grid;
  }

  .character-editor-actions > div {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Character directory: title preview -> full cast -> character profile */
.title-character-preview,
.characters-directory-hero,
.characters-directory-tools,
.directory-add-panel {
  border: 1px solid rgba(220, 226, 218, .9);
  border-radius: .85rem;
  background: rgba(255, 253, 250, .9);
  box-shadow: 0 .9rem 2.4rem rgba(38, 43, 40, .08);
}

.title-character-preview {
  padding: 1.1rem;
}

.title-character-preview-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
}

.title-character-preview-head h2 {
  margin: .15rem 0 0;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 900;
}

.title-character-preview-head > a {
  color: #1f6f63;
  font-size: .85rem;
  font-weight: 850;
  text-decoration: none;
}

.title-character-preview-head > a span {
  display: inline-grid;
  min-width: 1.7rem;
  place-items: center;
  margin-left: .2rem;
  border-radius: 999px;
  padding: .1rem .4rem;
  background: #e2efea;
}

.title-character-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: .65rem;
}

.title-character-tile {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: .2rem;
  color: var(--app-ink);
  text-decoration: none;
}

.title-character-tile-image {
  position: relative;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: .25rem;
  border-radius: .65rem;
  background: linear-gradient(145deg, #1c2822, #426052);
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
}

.title-character-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .22s ease;
}

.title-character-tile:hover .title-character-tile-image img {
  transform: scale(1.04);
}

.title-character-tile-image small {
  position: absolute;
  inset: auto .35rem .35rem;
  overflow: hidden;
  border-radius: .35rem;
  padding: .2rem .35rem;
  background: rgba(18, 24, 21, .76);
  color: #fff;
  font-size: .58rem;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(7px);
}

.title-character-tile > strong,
.title-character-tile > span,
.title-character-tile > em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-character-tile > strong {
  font-size: .8rem;
}

.title-character-tile > span,
.title-character-tile > em {
  color: var(--app-muted);
  font-size: .68rem;
  font-style: normal;
}

.title-characters-empty,
.characters-filter-empty {
  display: grid;
  justify-items: center;
  gap: .35rem;
  border: 1px dashed #b8c4bd;
  border-radius: .8rem;
  padding: 2rem;
  color: var(--app-muted);
  text-align: center;
}

.title-characters-empty strong,
.characters-filter-empty strong {
  color: #31463d;
  font-size: 1.05rem;
}

.title-characters-empty p,
.characters-filter-empty p {
  margin: 0;
}

.characters-directory-hero {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: .9rem 1rem;
  background:
    radial-gradient(circle at 85% 10%, rgba(31, 122, 109, .13), transparent 20rem),
    rgba(255, 253, 250, .94);
}

.characters-directory-poster {
  width: 84px;
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: .65rem;
  background: #202722;
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  text-align: center;
}

.characters-directory-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.characters-directory-hero h1 {
  margin: .15rem 0 0;
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  font-weight: 900;
  line-height: 1;
}

.characters-directory-hero p,
.characters-directory-hero small {
  display: block;
  margin: .3rem 0 0;
  color: var(--app-muted);
}

.characters-directory-count {
  min-width: 86px;
  border-left: 1px solid var(--app-line);
  padding-left: 1rem;
  text-align: center;
}

.characters-directory-count strong,
.characters-directory-count span {
  display: block;
}

.characters-directory-count strong {
  font-size: 2rem;
  line-height: 1;
}

.characters-directory-count span {
  margin-top: .2rem;
  color: var(--app-muted);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.characters-directory-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: .7rem;
  align-items: center;
  position: sticky;
  top: .5rem;
  z-index: 4;
  margin-bottom: 1rem;
  padding: .65rem;
  backdrop-filter: blur(12px);
}

.character-gender-tabs,
.character-faction-tabs {
  display: flex;
  gap: .45rem;
  margin: .75rem 0;
  border: 1px solid rgba(214, 224, 218, .9);
  border-radius: 14px;
  padding: .42rem;
  background: rgba(255, 253, 250, .9);
}

.character-gender-tabs button,
.character-faction-tabs button {
  display: flex;
  gap: .4rem;
  align-items: center;
  border: 0;
  border-radius: 10px;
  padding: .55rem .8rem;
  background: transparent;
  color: #60716a;
  font-size: .8rem;
  font-weight: 800;
}

.character-gender-tabs button.active,
.character-faction-tabs button.active {
  background: #1f7a6d;
  color: #fff;
  box-shadow: 0 .35rem .9rem rgba(31, 122, 109, .2);
}

.character-gender-tabs button i { font-size: 1.05rem; font-style: normal; }
.character-gender-tabs button span, .character-faction-tabs button span { border-radius: 999px; padding: .08rem .38rem; background: rgba(120,140,132,.12); font-size: .68rem; }
.character-gender-tabs button.active span, .character-faction-tabs button.active span { background: rgba(255,255,255,.18); }
.character-faction-tabs > span { align-self: center; padding: 0 .45rem; color: #66766f; font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }

.character-bulk-editor {
  display: grid;
  grid-template-columns: auto auto minmax(145px,.8fr) minmax(190px,1fr) minmax(170px,1fr) minmax(170px,1fr) auto;
  gap: .5rem;
  align-items: center;
  position: sticky;
  top: 66px;
  z-index: 25;
  margin-bottom: .8rem;
  border: 1px solid #cfe0d8;
  border-radius: 14px;
  padding: .58rem .65rem;
  background: rgba(255,255,255,.95);
  box-shadow: 0 .6rem 1.8rem rgba(35,52,44,.1);
  backdrop-filter: blur(14px);
}

.character-bulk-editor > strong { border-radius: 999px; padding: .3rem .5rem; background: #e7f3ee; color: #176857; font-size: .7rem; white-space: nowrap; }
.character-bulk-editor .form-select, .character-bulk-editor input { min-width: 0; font-size: .74rem; }
.character-bulk-text { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .35rem; align-items: center; margin: 0; }
.character-bulk-text > input:last-child { width: 100%; border: 1px solid #d8e2dd; border-radius: 8px; padding: .45rem .5rem; }
.character-bulk-text input[type="checkbox"] { accent-color: #197967; }

.directory-character-card { position: relative; }
.directory-character-card.is-selected { border-color: #2a9c87; box-shadow: 0 0 0 3px rgba(42,156,135,.2), 0 .9rem 2.4rem rgba(38,43,40,.09); }
.directory-character-selector { width: 32px; height: 32px; display: grid; place-items: center; position: absolute; left: .45rem; top: .45rem; z-index: 4; border-radius: 50%; background: rgba(255,255,255,.94); box-shadow: 0 .2rem .7rem rgba(27,43,36,.15); cursor: pointer; }
.directory-character-selector input { position: absolute; opacity: 0; }
.directory-character-selector span { width: 21px; height: 21px; display: grid; place-items: center; border: 2px solid #9aaba4; border-radius: 50%; color: transparent; font-size: .68rem; font-weight: 900; }
.directory-character-selector input:checked + span { border-color: #197967; background: #197967; color: white; }

.characters-search {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  border: 1px solid #cbd7d0;
  border-radius: .65rem;
  background: #fff;
}

.characters-search > span {
  color: #567068;
  font-size: 1.25rem;
  text-align: center;
}

.characters-search input {
  min-width: 0;
  min-height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
}

.characters-filters {
  display: flex;
  gap: .35rem;
}

.characters-filters button {
  min-height: 38px;
  border: 1px solid #d5ded9;
  border-radius: .6rem;
  padding: .35rem .6rem;
  background: #fff;
  color: #52635a;
  font-size: .75rem;
  font-weight: 800;
}

.characters-filters button span {
  margin-left: .15rem;
  opacity: .65;
}

.characters-filters button.active,
.characters-filters button:hover {
  border-color: #1f7a6d;
  background: #1f7a6d;
  color: #fff;
}

.characters-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.character-gender-group-heading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: 1.25rem;
  padding: .85rem 1rem;
  border-bottom: 2px solid var(--app-line);
  border-radius: .75rem .75rem 0 0;
  background: var(--app-surface, #fff);
}

.character-gender-group-heading:first-child { margin-top: 0; }
.character-gender-group-heading[hidden] { display: none; }
.directory-character-card[hidden] { display: none; }
.character-gender-group-heading h2 { margin: 0; font-size: 1.2rem; font-weight: 800; }
.character-gender-group-heading > span { padding: .2rem .6rem; border-radius: 999px; background: var(--app-line); font-weight: 700; }

.directory-character-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: .8rem;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--app-line);
  border-radius: .8rem;
  padding: .55rem;
  background: #fff;
  box-shadow: 0 .5rem 1.5rem rgba(38, 43, 40, .06);
  transition: transform .15s ease, border-color .15s ease;
}

.directory-character-card:hover {
  border-color: rgba(31, 122, 109, .4);
  transform: translateY(-2px);
}

.directory-character-image {
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: .6rem;
  background: linear-gradient(145deg, #1b2621, #405b50);
  color: #fff;
  font-size: 2.4rem;
  font-weight: 900;
  text-decoration: none;
}

.directory-character-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.directory-character-body {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: .2rem;
  padding: .25rem 0;
}

.directory-character-kind {
  width: fit-content;
  border-radius: 999px;
  padding: .16rem .45rem;
  background: #e2f0ea;
  color: #24695e;
  font-size: .65rem;
  font-weight: 850;
}

.directory-character-body h2 {
  margin: .18rem 0 0;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
  font-weight: 900;
}

.directory-character-body h2 a {
  color: inherit;
  text-decoration: none;
}

.directory-character-body > p {
  margin: 0;
  overflow: hidden;
  color: var(--app-muted);
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-character-body dl {
  display: grid;
  gap: .12rem;
  margin: .3rem 0;
}

.directory-character-body dl div {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: .35rem;
  font-size: .7rem;
}

.directory-character-body dt {
  color: var(--app-muted);
  font-weight: 650;
}

.directory-character-body dd {
  margin: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-character-open {
  margin-top: auto;
  color: #1f7568;
  font-size: .72rem;
  font-weight: 850;
  text-decoration: none;
}

.directory-character-card .character-delete {
  width: 1.9rem;
  height: 1.9rem;
}

.characters-filter-empty {
  grid-column: 1 / -1;
}

.directory-add-panel {
  margin-top: 1rem;
  overflow: hidden;
}

.directory-add-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, #f2f8f5, #fffaf0);
}

.directory-add-heading h2 {
  margin: .15rem 0 0;
  font-size: 1.4rem;
  font-weight: 900;
}

.directory-add-heading p {
  margin: .25rem 0 0;
  color: var(--app-muted);
  font-size: .8rem;
}

.directory-add-heading button {
  flex: 0 0 auto;
  border: 1px solid rgba(31, 122, 109, .3);
  border-radius: .6rem;
  padding: .45rem .7rem;
  background: #fff;
  color: #24695e;
  font-size: .78rem;
  font-weight: 850;
}

.directory-character-form {
  display: grid;
  gap: .8rem;
  max-height: 2200px;
  overflow: hidden;
  border-top: 1px solid var(--app-line);
  padding: 1rem 1.1rem 1.1rem;
  opacity: 1;
  transition: max-height .3s ease, padding .3s ease, opacity .2s ease;
}

.detail-nav-button-secondary {
  background: rgba(255, 255, 255, .82);
  color: #17675e;
}

.character-import-result {
  margin: 14px 0;
  padding: 13px 16px;
  border: 1px solid #9bd7c3;
  border-radius: 14px;
  background: #eaf9f3;
  color: #165f50;
}

.character-folder-import-form {
  display: grid;
  gap: 18px;
}

.character-folder-dropzone {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 28px 18px;
  border: 2px dashed #8fc9bc;
  border-radius: 18px;
  background: #f4fbf9;
  color: #245f56;
  text-align: center;
  cursor: pointer;
  transition: .2s ease;
}

.character-folder-dropzone:hover,
.character-folder-dropzone.is-dragging {
  border-color: #168a77;
  background: #e6f8f3;
  transform: translateY(-2px);
}

.character-folder-dropzone-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  background: #197d6c;
  color: white;
  font-size: 1.6rem;
}

.character-folder-dropzone small {
  color: #67827d;
}

.character-folder-dropzone em {
  margin-top: 4px;
  color: #167565;
  font-size: .85rem;
  font-style: normal;
  font-weight: 750;
}

.character-folder-example {
  padding: 18px;
  border: 1px solid #dce8e5;
  border-radius: 16px;
  background: linear-gradient(135deg, #f5fbf9, #f8f7ff);
}

.character-folder-example strong,
.character-folder-example code {
  display: block;
}

.character-folder-example code {
  margin-top: 10px;
  color: #24423e;
  line-height: 1.8;
  white-space: normal;
}

.character-folder-example code span {
  color: #7d8d89;
}

.character-folder-import-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.character-folder-import-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff8e7;
  color: #6d5622;
  font-size: .9rem;
}

@media (max-width: 680px) {
  .character-folder-import-options {
    grid-template-columns: 1fr;
  }
}

.directory-character-form.is-collapsed {
  max-height: 0;
  border-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}

.directory-form-preview {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: .75rem;
  align-items: center;
  border: 1px solid #d9e5df;
  border-radius: .75rem;
  padding: .6rem;
  background: #f4faf7;
}

.directory-form-preview > span {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: .65rem;
  background: #263a31;
  color: #fff;
  font-size: 1.7rem;
  font-weight: 900;
}

.directory-form-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.directory-form-preview strong,
.directory-form-preview small {
  display: block;
}

.directory-form-preview small {
  margin-top: .15rem;
  color: var(--app-muted);
}

.directory-form-details {
  border: 1px solid var(--app-line);
  border-radius: .7rem;
  background: #fafbf9;
}

.directory-form-details summary {
  display: flex;
  justify-content: space-between;
  gap: .7rem;
  padding: .7rem .8rem;
  color: #34483f;
  font-size: .82rem;
  font-weight: 850;
  cursor: pointer;
}

.directory-form-details summary span {
  color: var(--app-muted);
  font-size: .7rem;
  font-weight: 700;
}

.directory-form-details .character-form-grid {
  border-top: 1px solid var(--app-line);
  padding: .8rem;
}

.directory-create-submit {
  min-height: 48px;
  border-radius: .7rem;
  font-weight: 900;
}

.character-original-name {
  color: #536b62 !important;
  font-size: .9rem;
}

.character-importance-chip {
  display: inline-flex;
  margin-left: .25rem;
  border-radius: 999px;
  padding: .18rem .5rem;
  background: #f0e7d2;
  color: #745d29;
  font-size: .7rem;
  font-weight: 850;
}

.character-profile-identity > small {
  display: block;
  margin: .15rem 0;
  color: var(--app-muted);
}

@media (max-width: 1100px) {
  .title-character-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .characters-directory-tools {
    grid-template-columns: 1fr;
  }

  .characters-filters {
    overflow-x: auto;
    padding-bottom: .15rem;
  }

  .characters-filters button {
    flex: 0 0 auto;
  }
}

@media (max-width: 780px) {
  .characters-directory {
    grid-template-columns: 1fr;
  }

  .characters-directory-tools {
    position: static;
  }
}

@media (max-width: 520px) {
  .title-character-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .title-character-preview-head,
  .directory-add-heading {
    align-items: start;
  }

  .characters-directory-hero {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .characters-directory-poster {
    width: 68px;
  }

  .characters-directory-count {
    grid-column: 1 / -1;
    border-top: 1px solid var(--app-line);
    border-left: 0;
    padding-top: .6rem;
    padding-left: 0;
  }

  .characters-directory-count strong,
  .characters-directory-count span {
    display: inline;
  }

  .directory-character-card {
    grid-template-columns: 88px minmax(0, 1fr) auto;
  }

  .directory-add-heading {
    display: grid;
  }
}

/* Standalone character gallery and dedicated upload flow */
.character-gallery-page,
.character-upload-page {
  background:
    radial-gradient(circle at 8% 4%, rgba(31, 122, 109, .11), transparent 28rem),
    linear-gradient(180deg, #f7f9f6, #eaf0ec);
}

.character-gallery-shell {
  width: min(calc(100% - clamp(1rem, 3vw, 4rem)), 2160px);
  margin: 0 auto;
  padding: 1rem 0 4rem;
}

.character-gallery-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1rem;
  align-items: center;
  border: 1px solid rgba(214, 224, 218, .94);
  border-radius: 1rem;
  padding: 1.15rem 1.25rem;
  background:
    radial-gradient(circle at 88% 8%, rgba(234, 194, 93, .18), transparent 18rem),
    rgba(255, 253, 250, .94);
  box-shadow: 0 1rem 2.8rem rgba(38, 43, 40, .08);
}

.character-gallery-hero h1 {
  margin: .18rem 0 0;
  font-size: clamp(1.6rem, 4vw, 2.7rem);
  font-weight: 900;
  letter-spacing: -.03em;
}

.character-gallery-hero p {
  margin: .3rem 0 0;
  color: var(--app-muted);
}

.character-gallery-stats {
  display: flex;
  gap: .45rem;
}

.character-gallery-stats span {
  min-width: 70px;
  border: 1px solid #dce4df;
  border-radius: .7rem;
  padding: .45rem .6rem;
  background: rgba(255, 255, 255, .75);
  color: var(--app-muted);
  font-size: .68rem;
  font-weight: 750;
  text-align: center;
}

.character-gallery-stats strong {
  display: block;
  color: #2b4037;
  font-size: 1.1rem;
}

.character-gallery-hero > .btn {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: .7rem;
  font-weight: 850;
}

.character-gallery-hero-actions {
  display: flex;
  gap: .5rem;
}

.character-gallery-hero-actions .btn {
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: .7rem;
  font-weight: 800;
}

.character-gallery-notice {
  margin: .8rem 0;
  border: 1px solid;
  border-radius: .75rem;
  padding: .7rem .85rem;
  font-size: .86rem;
}

.character-gallery-notice.success {
  border-color: #a9d8c9;
  background: #ebf8f3;
  color: #176653;
}

.character-gallery-notice.error {
  border-color: #e4b3b8;
  background: #fff0f1;
  color: #92333d;
}

.character-gallery-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  margin: .85rem 0;
  border: 1px solid rgba(214, 224, 218, .86);
  border-radius: .7rem;
  padding: .55rem .7rem;
  background: rgba(255, 253, 250, .78);
  font-size: .78rem;
}

.character-gallery-breadcrumbs a {
  color: #286b60;
  font-weight: 800;
  text-decoration: none;
}

.character-gallery-breadcrumbs span {
  color: #94a099;
}

.character-gallery-folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .7rem;
  margin-bottom: 1rem;
}

.character-gallery-folder {
  min-width: 0;
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: .15rem .7rem;
  align-items: center;
  overflow: hidden;
  border: 1px solid #d9e2dd;
  border-radius: .8rem;
  padding: .5rem;
  background: #fff;
  color: #2d4138;
  text-decoration: none;
  box-shadow: 0 .45rem 1.2rem rgba(38, 43, 40, .06);
  transition: transform .15s ease, border-color .15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(31, 122, 109, .16);
  -webkit-user-select: none;
  user-select: none;
}

.character-gallery-folder-card {
  min-width: 0;
  position: relative;
}

.character-gallery-folder-card .character-gallery-folder {
  height: 100%;
}

.character-gallery-manage {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  position: absolute;
  top: .42rem;
  right: .42rem;
  z-index: 3;
  border: 1px solid rgba(31, 58, 49, .12);
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #285d53;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 .25rem .7rem rgba(21, 38, 31, .12);
}

.character-gallery-manage:hover {
  background: #e4f4ef;
}

.character-gallery-folder:hover {
  border-color: rgba(31, 122, 109, .42);
  color: #1e5e53;
  transform: translateY(-2px);
}

.character-gallery-folder > span {
  grid-row: 1 / span 2;
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: .6rem;
  background: linear-gradient(145deg, #d9a83c, #efc96d);
}

.character-gallery-folder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.character-gallery-folder i {
  width: 34px;
  height: 25px;
  position: relative;
  border-radius: .25rem;
  background: #fff1c6;
  pointer-events: none;
}

.character-gallery-folder i::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -6px;
  width: 15px;
  height: 8px;
  border-radius: .2rem .2rem 0 0;
  background: #fff1c6;
}

.character-gallery-folder strong,
.character-gallery-folder small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-gallery-folder small {
  color: var(--app-muted);
  font-size: .68rem;
}

.character-masonry {
  column-count: 5;
  column-gap: .75rem;
}

.character-gallery-bulkbar {
  display: flex;
  gap: .65rem;
  align-items: center;
  position: sticky;
  top: 66px;
  z-index: 20;
  margin: 0 0 .85rem;
  border: 1px solid #d5e2dc;
  border-radius: 14px;
  padding: .6rem .7rem;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 .55rem 1.6rem rgba(31, 48, 40, .09);
  backdrop-filter: blur(14px);
}

.bulk-select-all,
.character-gallery-bulkbar > label:not(.bulk-select-all) {
  display: flex;
  gap: .4rem;
  align-items: center;
  margin: 0;
  color: #4c6158;
  font-size: .76rem;
  font-weight: 800;
}

.bulk-select-all input {
  width: 17px;
  height: 17px;
  accent-color: #197967;
}

.character-gallery-bulkbar > strong {
  border-radius: 999px;
  padding: .3rem .55rem;
  background: #e8f3ef;
  color: #176857;
  font-size: .72rem;
}

.bulkbar-spacer { flex: 1; }
.character-gallery-bulkbar select { width: min(36vw, 280px); font-size: .78rem; }
.character-gallery-bulkbar .btn { white-space: nowrap; }

.character-masonry-card {
  width: 100%;
  display: block;
  position: relative;
  overflow: hidden;
  break-inside: avoid;
  margin: 0 0 .75rem;
  border: 0;
  border-radius: .85rem;
  padding: 0;
  background: #24312b;
  color: #fff;
  cursor: zoom-in;
  box-shadow: 0 .7rem 1.7rem rgba(34, 40, 36, .13);
}

.character-masonry-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: .75rem;
  border-radius: .9rem;
  transition: box-shadow .16s ease, transform .16s ease;
}

.character-masonry-item.is-selected {
  box-shadow: 0 0 0 4px #2a9c87, 0 .7rem 1.7rem rgba(34, 40, 36, .16);
  transform: translateY(-2px);
}

.character-gallery-selector {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  position: absolute;
  top: .42rem;
  left: .42rem;
  z-index: 4;
  margin: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 .25rem .7rem rgba(21, 38, 31, .16);
  cursor: pointer;
}

.character-gallery-selector input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.character-gallery-selector span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 2px solid #9baba4;
  border-radius: 50%;
  color: transparent;
  font-size: .72rem;
  font-weight: 900;
}

.character-gallery-selector input:checked + span {
  border-color: #197967;
  background: #197967;
  color: #fff;
}

.character-masonry-item .character-masonry-card {
  margin-bottom: 0;
}

.character-gallery-manage.file-manage {
  opacity: 0;
  transition: opacity .16s ease;
}

.character-masonry-item:hover .file-manage,
.character-gallery-manage.file-manage:focus-visible {
  opacity: 1;
}

.gallery-manager-form {
  display: grid;
  gap: .85rem;
}

.gallery-manager-form label,
.gallery-manager-form label > span {
  display: grid;
  gap: .35rem;
  color: #43564f;
  font-size: .82rem;
  font-weight: 800;
}

.gallery-manager-buttons {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}

.gallery-manager-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: .6rem;
  align-items: center;
  color: #87938e;
  font-size: .74rem;
}

.gallery-manager-divider::before,
.gallery-manager-divider::after {
  content: "";
  height: 1px;
  background: #e0e6e2;
}

@media (max-width: 720px) {
  .global-app-nav {
    grid-template-columns: auto minmax(0, 1fr);
    gap: .5rem;
    overflow-x: auto;
  }

  .global-app-brand strong,
  .global-app-account {
    display: none;
  }

  .global-app-nav nav {
    justify-content: flex-end;
  }

  .global-app-nav nav a {
    white-space: nowrap;
  }

  .character-gallery-hero-actions {
    width: 100%;
    grid-column: 1 / -1;
  }

  .character-gallery-hero-actions .btn {
    flex: 1;
  }

  .character-gallery-manage.file-manage {
    opacity: 1;
  }

  .character-gallery-bulkbar {
    display: grid;
    grid-template-columns: auto 1fr;
    top: 62px;
  }

  .bulkbar-spacer { display: none; }
  .character-gallery-bulkbar > label:not(.bulk-select-all),
  .character-gallery-bulkbar .btn { grid-column: 1 / -1; }
  .character-gallery-bulkbar > label:not(.bulk-select-all) { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .character-gallery-bulkbar select { width: 100%; }
}

@media (max-width: 1100px) {
  .character-bulk-editor { grid-template-columns: auto auto repeat(2,minmax(150px,1fr)); }
  .character-bulk-editor .btn { grid-column: -2 / -1; }
}

@media (max-width: 640px) {
  .character-gender-tabs, .character-faction-tabs { overflow-x: auto; }
  .character-gender-tabs button, .character-faction-tabs button { flex: 0 0 auto; }
  .character-bulk-editor { grid-template-columns: 1fr 1fr; top: 62px; }
  .character-bulk-editor .form-select, .character-bulk-text, .character-bulk-editor .btn { grid-column: 1 / -1; }
}

.character-masonry-card img,
.character-masonry-card video {
  width: 100%;
  height: auto;
  display: block;
  transition: transform .22s ease, filter .22s ease;
}

.character-masonry-card:hover img,
.character-masonry-card:hover video {
  filter: brightness(.84);
  transform: scale(1.025);
}

.character-masonry-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 2rem .65rem .55rem;
  background: linear-gradient(transparent, rgba(10, 14, 12, .78));
  font-size: .7rem;
  font-weight: 750;
  opacity: 0;
  text-align: left;
  transition: opacity .18s ease;
}

.character-masonry-card:hover .character-masonry-caption {
  opacity: 1;
}

.character-video-badge {
  position: absolute;
  top: .5rem;
  right: .5rem;
  border-radius: 999px;
  padding: .2rem .45rem;
  background: rgba(11, 15, 13, .72);
  font-size: .65rem;
  font-weight: 850;
}

.character-gallery-empty {
  display: grid;
  justify-items: center;
  gap: .45rem;
  border: 1px dashed #aebcb4;
  border-radius: 1rem;
  padding: 3rem 1rem;
  background: rgba(255, 253, 250, .7);
  color: var(--app-muted);
  text-align: center;
}

.character-gallery-empty > span {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e3eee9;
  color: #287064;
  font-size: 1.8rem;
}

.character-gallery-empty h2 {
  margin: .25rem 0 0;
  color: #2e4239;
  font-size: 1.2rem;
}

.character-gallery-empty p {
  max-width: 440px;
  margin: 0 0 .45rem;
}

.character-gallery-viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  background: rgba(8, 11, 9, .97);
  color: #fff;
}

.character-gallery-viewer::backdrop {
  background: rgba(0, 0, 0, .82);
}

.character-gallery-viewer-head {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  z-index: 2;
  padding: .65rem 1rem;
  background: rgba(12, 16, 14, .86);
}

.character-gallery-viewer-head strong,
.character-gallery-viewer-head span {
  display: block;
}

.character-gallery-viewer-head span {
  color: rgba(255, 255, 255, .62);
  font-size: .72rem;
}

.character-gallery-viewer-head button {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 1.7rem;
}

.character-gallery-viewer-stage {
  height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 1rem 5rem;
}

.character-gallery-viewer-stage img,
.character-gallery-viewer-stage video {
  max-width: 100%;
  max-height: calc(100vh - 92px);
  border-radius: .5rem;
  object-fit: contain;
}

.character-gallery-viewer-nav {
  width: 48px;
  height: 64px;
  position: fixed;
  top: calc(50% - 32px);
  z-index: 3;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: .7rem;
  background: rgba(20, 26, 23, .7);
  color: #fff;
  font-size: 2.2rem;
}

.character-gallery-viewer-nav.previous {
  left: 1rem;
}

.character-gallery-viewer-nav.next {
  right: 1rem;
}

.character-upload-success {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: .7rem;
  align-items: center;
  margin-bottom: 1rem;
  border: 1px solid #badaca;
  border-radius: .8rem;
  padding: .65rem .8rem;
  background: #effaf5;
}

.character-upload-success > span {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #1f7a6d;
  color: #fff;
  font-weight: 900;
}

.character-upload-success strong,
.character-upload-success small {
  display: block;
}

.character-upload-success small {
  color: var(--app-muted);
}

.character-upload-success a {
  color: #17685c;
  font-size: .78rem;
  font-weight: 850;
  text-decoration: none;
}

.character-upload-shell {
  width: min(100% - 2rem, 880px);
  margin: 0 auto;
  padding: 1rem 0 4rem;
}

.character-upload-card {
  overflow: hidden;
  border: 1px solid rgba(214, 224, 218, .94);
  border-radius: 1rem;
  background: rgba(255, 253, 250, .96);
  box-shadow: 0 1rem 3rem rgba(38, 43, 40, .1);
}

.character-upload-card > header {
  padding: 1.3rem 1.4rem;
  background:
    radial-gradient(circle at 90% 5%, rgba(31, 122, 109, .13), transparent 18rem),
    linear-gradient(135deg, #f8fbf9, #fff9ed);
}

.character-upload-card h1 {
  margin: .18rem 0 0;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 900;
}

.character-upload-card header p {
  margin: .25rem 0 0;
  color: var(--app-muted);
}

.character-upload-card > .character-form-alert,
.character-upload-card > form {
  margin: 1rem 1.4rem 1.4rem;
}

.character-upload-drop {
  min-height: 230px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: .35rem;
  border: 2px dashed #a8beb3;
  border-radius: .85rem;
  padding: 1.5rem;
  background: #f5faf7;
  color: #345047;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}

.character-upload-sources {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
  margin-bottom: .8rem;
}

.character-upload-source {
  min-height: 132px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: .15rem .65rem;
  align-content: center;
  align-items: center;
  border: 1px solid #cddbd4;
  border-radius: .8rem;
  padding: .8rem;
  background: #fafcfb;
  color: #314a40;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.character-upload-source:hover,
.character-upload-source:active {
  border-color: #1f7a6d;
  background: #edf7f3;
  transform: translateY(-1px);
}

.character-upload-source.primary {
  border-color: rgba(31, 122, 109, .35);
  background: #f1f8f5;
}

.character-upload-source > span {
  grid-row: 1 / span 2;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: .65rem;
  background: #dcece5;
  color: #1f7063;
  font-size: 1.3rem;
}

.character-upload-source strong,
.character-upload-source small {
  display: block;
}

.character-upload-source small {
  color: var(--app-muted);
  font-size: .7rem;
}

.character-upload-source input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.character-upload-device-note {
  margin: .65rem 0 0;
  border-left: 3px solid #d4b45e;
  padding: .35rem 0 .35rem .65rem;
  color: var(--app-muted);
  font-size: .74rem;
}

.character-upload-drop:hover,
.character-upload-drop.is-dragging {
  border-color: #1f7a6d;
  background: #eaf6f1;
}

.character-upload-drop > span {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: .25rem;
  border-radius: 50%;
  background: #1f7a6d;
  color: #fff;
  font-size: 2rem;
}

.character-upload-drop small {
  color: var(--app-muted);
}

.character-upload-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.character-upload-preview {
  margin-top: 1rem;
  border: 1px solid var(--app-line);
  border-radius: .8rem;
  padding: .75rem;
  background: #fafbf9;
}

.character-upload-preview > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  margin-bottom: .7rem;
}

.character-upload-preview button {
  border: 0;
  background: transparent;
  color: #a23940;
  font-size: .75rem;
  font-weight: 850;
}

.character-upload-preview section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .55rem;
}

.character-upload-preview article {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #dde4df;
  border-radius: .65rem;
  background: #fff;
}

.character-upload-preview img {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
}

.character-upload-preview small {
  display: block;
  overflow: hidden;
  padding: .35rem .45rem;
  color: var(--app-muted);
  font-size: .65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-upload-actions {
  display: flex;
  justify-content: end;
  gap: .55rem;
  margin-top: 1rem;
}

.character-upload-actions .btn {
  min-height: 44px;
  border-radius: .65rem;
  font-weight: 850;
}

@media (max-width: 1200px) {
  .character-masonry {
    column-count: 4;
  }
}

@media (max-width: 900px) {
  .character-masonry {
    column-count: 3;
  }

  .character-gallery-hero {
    grid-template-columns: 1fr auto;
  }

  .character-gallery-stats {
    grid-column: 1;
    grid-row: 2;
  }

  .character-gallery-hero > .btn {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 620px) {
  .character-masonry {
    column-count: 2;
    column-gap: .5rem;
  }

  .character-masonry-card {
    margin-bottom: .5rem;
  }

  .character-gallery-hero {
    grid-template-columns: 1fr;
  }

  .character-gallery-stats,
  .character-gallery-hero > .btn {
    grid-column: auto;
    grid-row: auto;
  }

  .character-gallery-stats {
    overflow-x: auto;
  }

  .character-gallery-stats span {
    flex: 1 0 70px;
  }

  .character-gallery-viewer-stage {
    padding: .5rem 3.4rem;
  }

  .character-gallery-viewer-nav.previous {
    left: .35rem;
  }

  .character-gallery-viewer-nav.next {
    right: .35rem;
  }

  .character-upload-success {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .character-upload-success a {
    grid-column: 1 / -1;
  }

  .character-upload-card > header {
    padding: 1rem;
  }

  .character-upload-card > .character-form-alert,
  .character-upload-card > form {
    margin: .8rem 1rem 1rem;
  }

  .character-upload-actions {
    display: grid;
  }

  .character-upload-sources {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1600px) {
  .character-masonry { column-count: 6; }
  .title-character-strip { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}

@media (min-width: 1900px) {
  .characters-directory { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .character-masonry { column-count: 7; }
  .title-character-strip { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

@media (hover: none) and (pointer: coarse) {
  .character-gallery-folder:hover {
    transform: none;
  }

  .character-gallery-folder:active {
    border-color: #1f7a6d;
    background: #edf7f3;
    transform: scale(.985);
  }

  .character-masonry-caption {
    opacity: 1;
  }
}

.documents-page,
.document-reader-page {
  background:
    radial-gradient(circle at 12% 8%, rgba(31, 122, 109, .1), transparent 28rem),
    linear-gradient(180deg, #f7f9f6 0%, var(--app-bg) 100%);
}

.documents-shell {
  width: min(calc(100% - clamp(1rem, 3vw, 4rem)), 1800px);
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.documents-header,
.document-upload-panel,
.document-list-panel,
.reader-header,
.reader-content {
  border: 1px solid rgba(220, 226, 218, .9);
  border-radius: .85rem;
  background: rgba(255, 253, 250, .9);
  box-shadow: 0 .9rem 2.4rem rgba(38, 43, 40, .08);
}

.documents-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  padding: 1rem;
  margin-bottom: 1rem;
}

.documents-header h1,
.document-upload-panel h2,
.document-list-panel h2,
.reader-header h1 {
  margin: 0;
  font-weight: 800;
}

.documents-header p,
.document-upload-panel p,
.document-list-head p,
.reader-header p {
  margin: .35rem 0 0;
  color: var(--app-muted);
}

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

.document-upload-panel,
.document-list-panel {
  padding: 1rem;
}

.document-upload-panel {
  position: sticky;
  top: 1rem;
}

.document-upload-panel .stack-form {
  margin-top: 1.1rem;
}

.document-format-note {
  border-left: 3px solid rgba(31, 122, 109, .28);
  padding-left: .65rem;
  font-size: .86rem;
}

.document-list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 285px);
  gap: .75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.document-list {
  display: grid;
  gap: .65rem;
}

.document-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: .55rem;
  align-items: center;
  border: 1px solid var(--app-line);
  border-radius: .75rem;
  padding: .5rem;
  background: #fff;
}

.document-card a {
  min-width: 0;
  display: grid;
  gap: .22rem;
  border-radius: .5rem;
  padding: .35rem .45rem;
  color: inherit;
  text-decoration: none;
}

.document-card a:hover {
  background: #f0f7f4;
}

.document-card strong {
  overflow-wrap: anywhere;
}

.document-card small,
.document-card span,
.document-card time {
  color: var(--app-muted);
}

.document-card span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.document-card time {
  font-size: .78rem;
  font-weight: 700;
}

.document-card form {
  margin: 0;
}

.document-card button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(184, 50, 59, .2);
  border-radius: .55rem;
  background: #fff8f8;
  color: var(--app-danger);
  font-size: 1.3rem;
}

.document-empty {
  border: 1px dashed #aeb9b2;
  border-radius: .75rem;
  padding: 2rem 1rem;
  color: var(--app-muted);
  text-align: center;
}

.reader-shell {
  width: min(100% - 2rem, 920px);
  margin: 0 auto;
  padding: 1rem 0 4rem;
}

.reader-nav {
  justify-content: space-between;
}

.reader-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.reader-content {
  padding: clamp(1.25rem, 5vw, 3.25rem);
  color: #272b28;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.04rem, 1vw + .8rem, 1.18rem);
  line-height: 1.78;
}

.reader-content p {
  margin: 0 0 1.25em;
  overflow-wrap: anywhere;
}

.reader-content p:last-child {
  margin-bottom: 0;
}

@media (max-width: 780px) {
  .documents-header,
  .reader-header {
    display: grid;
  }

  .document-layout,
  .document-list-head {
    grid-template-columns: 1fr;
  }

  .document-upload-panel {
    position: static;
  }
}

/* Sakura theme: shared navigation and collection surfaces. */
body {
  background: radial-gradient(ellipse at 8% 0%, #fce5ef 0, transparent 38rem),
    radial-gradient(ellipse at 95% 15%, #e7e1ff 0, transparent 42rem), var(--app-bg);
}
.global-app-nav { border-color: var(--app-line); background: rgba(255,252,255,.94); box-shadow: 0 4px 24px #5b387a09; }
.global-app-brand { color: #413456; }
.global-app-brand > span, .profile-menu-avatar { background: linear-gradient(135deg, #9b6bd3, #da79a0) !important; }
.global-app-nav nav a { color: #7b718a; }
.global-app-nav nav a:hover, .global-app-nav nav a.active { color: #7043ad; background: #efe6fa; }
.profile-menu summary, .global-app-account span { background: #f3edf8; color: #59476e; }
.profile-menu-panel { border-color: var(--app-line); }
.profile-menu-panel a:hover, .profile-menu-panel button:hover { background: #f3edfc; color: #7043ad; }
.btn-success { --bs-btn-bg: #7954bf; --bs-btn-border-color: #7954bf; --bs-btn-hover-bg: #6540a7; --bs-btn-hover-border-color: #6540a7; --bs-btn-active-bg: #583592; --bs-btn-active-border-color: #583592; }
.form-control:focus, .form-select:focus { border-color: #af8bd6; box-shadow: 0 0 0 .2rem #9c70c822; }
:focus-visible { outline: 3px solid #a477d3; outline-offset: 3px; }
.catalog-shell { max-width: 1680px; padding-top: 1.6rem; }
.catalog-hero { position: relative; overflow: hidden; min-height: 190px; padding: 2rem; border-color: #e6d8ef; border-radius: 24px;
  background: radial-gradient(circle at 78% 0%, #e0d5fcaa, transparent 45%), linear-gradient(115deg, #fff9fc, #f4eafd 65%, #fce5ee);
  box-shadow: 0 12px 36px #71418b08; }
.catalog-hero::after { content: "✦"; position: absolute; right: 20%; top: -55px; font-size: 230px; line-height: 1; color: #b797d51c; pointer-events: none; }
.catalog-hero-copy, .catalog-summary, .catalog-nav { position: relative; z-index: 1; }
.catalog-hero-copy .brand-mark { width: 60px; height: 60px; border-radius: 19px; background: #fff8fd; color: #a064b2; border: 1px solid #ebd9f1; font-size: 1.6rem; box-shadow: 0 6px 18px #925fa511; }
.catalog-eyebrow { display: block; margin-bottom: .65rem; color: #a16aaf; font-size: .68rem; font-weight: 800; letter-spacing: .19em; }
.catalog-header h1 { font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -.04em; color: #483259; }
.catalog-header p { max-width: 540px; margin-top: .7rem; color: #89738f; font-size: .9rem; }
.catalog-summary { border-color: #e8dbee; border-radius: 16px; padding: .9rem 1.2rem; background: #ffffff80; }
.catalog-summary strong { color: #8454b0; font-size: 1.8rem; }
.catalog-summary span { font-size: .7rem; }
.catalog-search-top { border-color: var(--app-line); border-radius: 18px; background: #ffffffd9; box-shadow: 0 8px 26px #57387006; padding: .85rem; }
.catalog-search input { background: #fcfaff; border-color: #e7dfef; }
.catalog-filters { border-color: var(--app-line); background: #fffcff; }
.title-grid { gap: 1.3rem; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.title-card { align-content: start; grid-template-rows: auto 1fr auto; border-color: #e8e0ee; border-radius: 18px; box-shadow: 0 6px 22px #583c7308; }
.title-card:hover { border-color: #c6a5de; box-shadow: 0 14px 32px #7954bf19; transform: translateY(-5px); }
.title-poster { background: radial-gradient(circle at 30% 20%, #b48ac3, transparent 65%), linear-gradient(145deg, #6b508c, #b18bb4); }
.title-card-body > strong { font-weight: 750; line-height: 1.4; }
.title-meta > span, .title-kind { background: #f1eaf8; color: #7b5c95; }
.title-card-tags i { background: #faf0f6; color: #a16d8d; }
.title-card-characters a > span { background: #eee4f6; color: #8760a3; }
.title-card-actions { align-self: end; padding-top: .65rem; }
.title-action { border-color: #e1d5ee; background: #fcf9ff; color: #7c5a9b; font-weight: 650; border-radius: 9px; }
.title-action:hover, .title-action:focus-visible { border-color: #b695d1; background: #f1e8fa; color: #63418b; }
.title-action-open { background: #8861b5; border-color: #8861b5; color: white; min-height: 39px; }
.title-action-open:hover, .title-action-open:focus-visible { background: #70499f; color: white; }
.title-action-danger { color: #b55977; background: #fff9fb; border-color: #f0dae3; }
.title-action-danger:hover { color: white; background: #b55977; }
.empty-panel { grid-column: 1 / -1; border: 1px dashed #d8c2e7; background: #fffbff; border-radius: 18px; padding: 3rem 1rem; text-align: center; color: #89738f; }
@media (max-width: 720px) {
  .global-app-nav { gap: .5rem; }
  .global-app-nav nav { overflow-x: auto; scrollbar-width: thin; }
  .global-app-nav nav a { white-space: nowrap; }
  .catalog-hero { padding: 1.3rem; min-height: 160px; gap: 1rem; }
  .catalog-hero-copy .brand-mark { display: none; }
  .catalog-hero::after { right: -20px; }
  .catalog-summary { margin-left: 0; }
  .catalog-header p { font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) {
  .title-card, .character-card { transition: none; }
  .title-card:hover, .character-card:hover { transform: none; }
}
