@font-face { font-family: "MiSans"; src: url("/static/fonts/MiSans-Normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "MiSans"; src: url("/static/fonts/MiSans-Normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "MiSans"; src: url("/static/fonts/MiSans-Semibold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "MiSans"; src: url("/static/fonts/MiSans-Semibold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "MiSans"; src: url("/static/fonts/MiSans-Semibold.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }

:root {
  --bg: #f8faff; --surface: rgba(255,255,255,.88); --soft: #f4f7fc;
  --ink: #111827; --text: #354056; --muted: #8a96aa; --line: #e7ecf4;
  --blue: #2563eb; --blue-soft: #eaf2ff; --danger: #c84b55;
  --radius: 15px; --shadow: 0 16px 42px rgba(45,76,132,.07);
}
* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "MiSans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; line-height: 1.55; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: 360px; z-index: -1; pointer-events: none; background: radial-gradient(circle at 68% 0%, rgba(80,143,255,.11), transparent 38%), linear-gradient(180deg,#fff 0%,rgba(248,250,255,0) 100%); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, .button { touch-action: manipulation; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.icon { width: 16px !important; height: 16px !important; flex: 0 0 auto; color: currentColor; stroke-width: 1.8; }
.icon-sm { width: 14px !important; height: 14px !important; }
.icon-lg { width: 20px !important; height: 20px !important; }

.topbar { min-height: 92px; padding: 18px 30px; display: grid; grid-template-columns: 260px minmax(280px,620px) minmax(340px,1fr); align-items: center; gap: 28px; position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.78); border-bottom: 1px solid rgba(225,232,243,.72); backdrop-filter: blur(20px); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 760; font-size: 18px; letter-spacing: -.03em; white-space: nowrap; }
.brand b { color: var(--blue); font-size: 16px; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; }
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 8px 13px rgba(37,99,235,.18)); }
.top-search { height: 52px; padding: 0 15px; display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 11px; background: rgba(255,255,255,.72); border: 1px solid #dbe3f0; border-radius: 13px; box-shadow: 0 8px 28px rgba(43,77,135,.04); transition: .2s ease; }
.top-search:focus-within { border-color: #9dbcf5; box-shadow: 0 0 0 4px rgba(37,99,235,.07),0 12px 30px rgba(43,77,135,.05); background: #fff; }
.top-search > .icon { color: #53617a; }
.top-search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 14px; }
.top-search input::placeholder { color: #a8b1c0; }
.top-search kbd { padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; color: #a4adbb; background: var(--soft); font: 10px/1.4 inherit; }
.topbar-space { min-width: 0; }
.topnav { display: flex; justify-content: flex-end; align-items: center; gap: 9px; }
.nav-action { min-height: 40px; padding: 8px 13px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #dfe6f0; border-radius: 10px; background: rgba(255,255,255,.78); color: #40506a; font-size: 13px; font-weight: 650; }
.nav-action:hover { border-color: #b9ccef; color: var(--blue); background: #fff; }
main { min-height: calc(100vh - 92px); }

.button { min-height: 43px; padding: 9px 17px; border: 1px solid transparent; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; color: var(--text); background: #fff; font-weight: 670; font-size: 13px; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: linear-gradient(180deg,#2d72f1,#1f5ee0); box-shadow: 0 9px 22px rgba(37,99,235,.22); }
.button-primary:hover { background: linear-gradient(180deg,#2769e7,#194fc7); }
.button-dark { color: #fff; background: var(--ink); }
.button-light { border-color: var(--line); background: #fff; }
.button-danger { color: #fff; background: var(--danger); }
.button-danger-ghost { color: var(--danger); border-color: #f1d3d6; background: #fff; }
.button-small { min-height: 44px; padding: 9px 17px; }
.text-button { padding: 2px 4px; display: inline-flex; align-items: center; gap: 5px; border: 0; color: var(--blue); background: none; cursor: pointer; font-weight: 650; font-size: 12px; }
.text-button.danger { color: var(--danger); }

.app-shell { width: 100%; min-height: calc(100vh - 92px); margin: 0; padding: 26px 30px 60px; display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 24px; }
.sidebar { min-height: calc(100vh - 144px); padding: 22px 14px; display: flex; flex-direction: column; background: rgba(255,255,255,.58); border: 1px solid rgba(222,230,241,.82); border-radius: 16px; backdrop-filter: blur(14px); }
.sidebar-heading { padding: 0 10px 14px; display: flex; justify-content: space-between; align-items: center; color: #758197; font-size: 12px; font-weight: 680; }
.sidebar-heading > a { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--blue); background: #fff; font-size: 16px; }
.sidebar-group-heading { margin-top: 25px; padding-top: 18px; border-top: 1px solid var(--line); color: #9aa4b5; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-create-group > summary { list-style: none; cursor: pointer; }
.sidebar-create-group > summary::-webkit-details-marker { display: none; }
.sidebar-add-button { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--blue); background: #fff; transition: .18s ease; }
.sidebar-create-group[open] .sidebar-add-button { color: #fff; border-color: var(--blue); background: var(--blue); transform: rotate(45deg); }
.sidebar-inline-form { margin: -4px 4px 10px; padding: 10px; border: 1px solid #e2e9f3; border-radius: 9px; background: rgba(247,250,255,.88); }
.sidebar-inline-row { display: grid; grid-template-columns: minmax(0,1fr) 32px; gap: 7px; align-items: center; }
.sidebar-inline-row input[type=text] { min-width: 0; width: 100%; height: 32px; padding: 6px 9px; border: 1px solid #dfe6f0; border-radius: 7px; color: var(--ink); background: #fff; font: inherit; font-size: 11px; }
.sidebar-inline-row input[type=text]:focus { outline: 2px solid rgba(59,130,246,.16); border-color: #9fc0f5; }
.sidebar-inline-row input[type=color] { width: 32px; height: 32px; padding: 3px; border: 1px solid #dfe6f0; border-radius: 7px; background: #fff; cursor: pointer; }
.sidebar-inline-actions { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-inline-actions button { min-height: 29px; padding: 5px 9px; display: inline-flex; align-items: center; gap: 4px; border: 0; border-radius: 7px; color: #fff; background: var(--blue); cursor: pointer; font-size: 10px; font-weight: 650; }
.sidebar-inline-actions button:hover { background: #245fd0; }
.sidebar-inline-manage { width: auto !important; height: auto !important; display: inline-flex !important; margin: 0; border: 0 !important; border-radius: 0 !important; color: #8290a5 !important; background: transparent !important; font-size: 10px; text-align: left; }
.sidebar-inline-manage:hover { color: var(--blue) !important; }
.sidebar-empty { padding: 0 10px; color: #a3adbb; font-size: 11px; }
.side-nav { display: grid; gap: 4px; }
.side-nav a { min-height: 43px; padding: 9px 11px; display: flex; justify-content: space-between; align-items: center; border-radius: 9px; color: #4e5a70; font-size: 13px; transition: .16s ease; }
.side-nav a > span { display: flex; align-items: center; gap: 10px; min-width: 0; }
.side-nav a:hover { color: var(--blue); background: rgba(239,245,255,.7); }
.side-nav a.active { color: var(--blue); background: linear-gradient(90deg,#eaf2ff,#f1f6ff); font-weight: 720; }
.side-nav strong { min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 12px; color: #8792a4; background: rgba(242,245,250,.95); font-size: 10px; font-weight: 650; }
.side-nav a.active strong { color: var(--blue); background: #fff; }
.nav-symbol { width: 17px !important; height: 17px !important; color: #63708a; }
.side-nav a.active .nav-symbol { color: var(--blue); }
.side-nav.compact .color-dot { margin-left: 4px; }
.sidebar-system { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.sidebar-system .side-nav a { color: #7d889a; }
.sidebar-system .side-nav a.active { color: var(--blue); }
.color-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); flex: 0 0 auto; }
.tag-cloud { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 8px; }
.tag { padding: 4px 8px; border: 1px solid transparent; border-radius: 7px; color: #7b8799; background: #f2f5f9; font-size: 10px; }
.tag:hover, .tag.selected { color: var(--blue); border-color: #d9e6fb; background: #edf4ff; }

.library { min-width: 0; }
.library-header { min-height: 102px; padding: 12px 8px 24px; display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; }
.eyebrow { margin: 0 0 5px !important; color: var(--blue) !important; font-size: 9px !important; font-weight: 760; letter-spacing: .17em; }
.library-header h1 { margin: 0; color: var(--ink); font-size: clamp(23px,2vw,28px); line-height: 1.2; letter-spacing: -.035em; font-weight: 750; }
.page-heading h1 { margin: 0; color: var(--ink); font-size: clamp(28px,3vw,38px); line-height: 1.15; letter-spacing: -.04em; font-weight: 750; }
.library-header p, .page-heading p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.library-view-meta { padding: 7px 10px; color: #9aa4b4; font-size: 11px; }
.library-view-meta span { color: var(--blue); font-weight: 750; }
.result-meta { margin: 0 4px 12px; padding: 9px 12px; color: #7b8798; background: rgba(235,243,255,.7); border-radius: 8px; font-size: 11px; }
.result-meta a { margin-left: 6px; color: var(--blue); font-weight: 650; }
.prompt-grid { display: grid; gap: 12px; }
.prompt-card { min-width: 0; padding: 20px 22px 18px; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 18px; background: rgba(255,255,255,.74); border: 1px solid rgba(225,231,240,.88); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(56,82,126,.025); backdrop-filter: blur(10px); transition: .2s ease; }
.prompt-card-clickable { cursor: pointer; }
.prompt-card:hover { border-color: #d4e1f4; background: rgba(255,255,255,.95); box-shadow: var(--shadow); transform: translateY(-1px); }
.prompt-accent { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; color: var(--blue); background: linear-gradient(145deg,#e9f2ff,#f5f8ff); }
.prompt-accent .icon { color: var(--blue); }
.prompt-card-body { min-width: 0; }
.card-title-row { display: flex; align-items: center; gap: 8px; }
.card-title-row h2 { margin: 0; color: #162033; font-size: 17px; line-height: 1.35; letter-spacing: -.02em; font-weight: 730; }
.card-title-trigger { max-width: 100%; padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; font: inherit; letter-spacing: inherit; text-align: left; }
.card-title-trigger:hover, .card-title-trigger:focus-visible { color: var(--blue); }
.card-title-row form { margin: 0; }
.favorite-button { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: 0; color: #9aa7ba; background: transparent; cursor: pointer; line-height: 1; }
.favorite-button:hover, .favorite-button.active { color: #e2a52b; }
.favorite-button.active .lucide-star, .favorite-label .lucide-star, .modal-favorite-button.active .lucide-star { fill: currentColor; }
.card-meta { min-height: 24px; margin-top: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.card-meta > span, .category-pill, .status-pill { padding: 3px 8px; display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; color: #8490a3; background: #f2f5f9; font-size: 10px; font-weight: 560; }
.category-pill { color: #4873b8 !important; background: #edf4ff !important; }
.category-pill.muted { color: #a0a9b7 !important; background: #f4f6f9 !important; }
.favorite-label { display: inline-flex; align-items: center; gap: 4px; color: #b88824; font-size: 11px; font-weight: 700; }
.danger-soft { color: var(--danger) !important; background: #fdf0f1 !important; }
.prompt-preview { max-width: 900px; max-height: 3.2em; margin: 13px 0 0; overflow: hidden; color: #68758b; font-size: 12px; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.card-footer { margin-top: 15px; display: flex; align-items: center; gap: 20px; color: #a2acbb; font-size: 10px; }
.card-footer a { color: var(--blue); font-weight: 660; }
.card-footer a span { margin-left: 3px; transition: .15s ease; }
.card-footer a:hover span { margin-left: 7px; }
.expand-prompt-button { padding: 0; display: inline-flex; align-items: center; gap: 5px; border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 10px; font-weight: 660; }
.expand-prompt-button .icon { transition: transform .15s ease; }
.expand-prompt-button:hover .icon { transform: translate(1px,-1px); }
.inline-actions { display: flex; gap: 7px; }
.inline-actions form { margin: 0; }
.card-actions { align-self: start; }
.icon-button { min-height: 36px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid #e1e7f0; border-radius: 9px; color: #4e5c72; background: rgba(255,255,255,.8); cursor: pointer; font-size: 11px; font-weight: 650; }
.icon-button:hover { color: var(--blue); border-color: #bcd1f5; background: #fff; }
.card-tags, .detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.card-tags span, .detail-tags span { padding: 3px 7px; border-radius: 6px; color: #8490a3; background: #f2f5f9; font-size: 10px; }

.prompt-modal { position: fixed; inset: 0; z-index: 200; padding: 24px; display: grid; place-items: center; isolation: isolate; }
.prompt-modal[hidden] { display: none; }
.prompt-modal-backdrop { position: absolute; inset: 0; z-index: -1; background: rgba(226,233,244,.6); -webkit-backdrop-filter: blur(7px) brightness(.9) saturate(.86); backdrop-filter: blur(7px) brightness(.9) saturate(.86); cursor: default; will-change: opacity,background-color,backdrop-filter; }
.prompt-modal-panel { width: min(980px,calc(100vw - 48px)); height: min(84vh,850px); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(210,222,239,.92); border-radius: 18px; background: rgba(255,255,255,.96); box-shadow: 0 28px 80px rgba(38,67,115,.17),0 3px 12px rgba(51,76,118,.06); transform-origin: center 62%; transform-style: preserve-3d; backface-visibility: hidden; will-change: transform,opacity,filter,box-shadow; }
.prompt-modal-header { flex: 0 0 auto; padding: 22px 24px 18px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 22px; border-bottom: 1px solid rgba(228,234,242,.9); background: rgba(255,255,255,.86); backdrop-filter: blur(16px); }
.prompt-modal-heading { min-width: 0; }
.prompt-modal-meta { min-height: 22px; margin-bottom: 7px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.prompt-modal-meta > span { padding: 3px 8px; display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; color: #8490a3; background: #f2f5f9; font-size: 10px; font-weight: 560; }
.prompt-modal-meta .category-pill { color: #4873b8; background: #edf4ff; }
.prompt-modal-heading h2 { margin: 0; color: #152037; font-size: clamp(20px,2.2vw,27px); line-height: 1.28; letter-spacing: -.035em; font-weight: 720; overflow-wrap: anywhere; }
.prompt-modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.modal-favorite-button, .modal-edit-button { min-height: 38px; padding: 8px 11px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #e1e7f0; border-radius: 9px; color: #536077; background: rgba(255,255,255,.82); cursor: pointer; font-size: 11px; font-weight: 650; white-space: nowrap; }
.modal-favorite-button:hover, .modal-edit-button:hover { color: var(--blue); border-color: #bfd2f3; background: #fff; }
.modal-favorite-button.active { color: #b98218; border-color: #efddb5; background: #fffaf0; }
.modal-copy-button { min-height: 38px; padding: 8px 13px; box-shadow: 0 7px 18px rgba(37,99,235,.16); white-space: nowrap; }
.prompt-modal-close { width: 38px; height: 38px; padding: 0; display: grid; place-items: center; border: 1px solid #e1e7f0; border-radius: 9px; color: #778397; background: rgba(255,255,255,.82); cursor: pointer; font-size: 23px; font-weight: 400; line-height: 1; }
.prompt-modal-close:hover { color: #26344c; border-color: #cad5e5; background: #fff; }
.prompt-modal-body { flex: 1 1 auto; min-height: 0; padding: 0 24px 24px; display: flex; flex-direction: column; overflow: hidden; }
.prompt-modal-content-heading { flex: 0 0 auto; padding: 15px 2px 10px; display: flex; align-items: center; justify-content: space-between; color: #98a3b4; font-size: 10px; font-weight: 650; letter-spacing: .035em; }
.prompt-modal-content { flex: 1 1 auto; min-height: 0; margin: 0; padding: clamp(22px,3vw,34px); overflow: auto; overscroll-behavior: contain; border: 1px solid #e7ecf4; border-radius: 12px; color: #334158; background: #fbfcff; font: 13px/1.82 "MiSans","PingFang SC",sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; scrollbar-color: #cdd8e8 transparent; }
.prompt-modal-content:focus { outline: 2px solid rgba(37,99,235,.25); outline-offset: -2px; }
.prompt-modal button:focus-visible, .prompt-modal a:focus-visible { outline: 3px solid rgba(37,99,235,.2); outline-offset: 2px; }

.empty-state { min-height: 390px; padding: 60px 20px; display: grid; place-items: center; align-content: center; text-align: center; border: 1px dashed #dbe4f0; border-radius: var(--radius); background: rgba(255,255,255,.5); }
.empty-icon { width: 48px; height: 48px; margin-bottom: 13px; display: grid; place-items: center; border-radius: 13px; color: var(--blue); background: var(--blue-soft); font-size: 21px; }
.empty-state h2, .empty-state h1 { margin: 0 0 7px; letter-spacing: -.025em; }
.empty-state p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

.page-wrap { width: min(1120px,calc(100% - 40px)); margin: 0 auto; padding: 46px 0 80px; }
.detail-wrap { width: min(980px,calc(100% - 40px)); }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 23px; color: var(--muted); font-size: 12px; }
.back-link:hover { color: var(--blue); }
.detail-card, .editor-card, .manage-card { background: rgba(255,255,255,.84); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); backdrop-filter: blur(15px); }
.detail-card { padding: clamp(25px,5vw,52px); }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; }
.detail-header h1 { max-width: 720px; margin: 14px 0 5px; font-size: clamp(29px,5vw,45px); line-height: 1.16; letter-spacing: -.045em; font-weight: 760; }
.detail-time { color: var(--muted); font-size: 11px; }
.detail-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.reading-toolbar { margin-top: 30px; padding: 11px 14px; display: flex; justify-content: space-between; color: #8995a7; background: #f5f8fc; border: 1px solid var(--line); border-bottom: 0; border-radius: 11px 11px 0 0; font-size: 10px; font-weight: 680; letter-spacing: .04em; }
.prompt-content { min-height: 360px; max-height: 65vh; margin: 0; padding: clamp(20px,4vw,34px); overflow: auto; color: #354155; background: rgba(252,253,255,.9); border: 1px solid var(--line); border-radius: 0 0 11px 11px; font: 13px/1.78 "MiSans", "PingFang SC", sans-serif; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.detail-footer { padding-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }

.page-heading { margin-bottom: 29px; }
.form-wrap { width: min(960px,calc(100% - 40px)); }
.editor-card { padding: clamp(22px,4vw,40px); }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
.field { display: grid; gap: 8px; }
.field > span, .field-label { color: #334158; font-size: 12px; font-weight: 690; }
.field b { color: var(--danger); }
.field em { float: right; color: var(--muted); font-style: normal; font-weight: 500; }
.field input, .field select, .field textarea, .quick-add input[type=text], .manage-row input[type=text] { width: 100%; border: 1px solid #e0e7f0; border-radius: 9px; color: var(--text); background: #fbfcff; outline: none; transition: .15s ease; }
.field input, .field select { height: 44px; padding: 0 13px; }
.field textarea { min-height: 440px; resize: vertical; padding: 16px; font: 13px/1.7 "MiSans", "PingFang SC", sans-serif; }
.field input:focus, .field select:focus, .field textarea:focus, .quick-add input:focus, .manage-row input:focus { border-color: #9cbcf5; box-shadow: 0 0 0 4px rgba(37,99,235,.07); background: #fff; }
.field small, .field-hint { color: var(--muted); font-size: 10px; }
.tag-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-picker label { cursor: pointer; }
.tag-picker input { position: absolute; opacity: 0; pointer-events: none; }
.tag-picker span { display: block; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: #fff; font-size: 11px; }
.tag-picker input:checked + span { color: var(--blue); border-color: #c7dafb; background: #edf4ff; font-weight: 650; }
.form-actions { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }

.manage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.manage-card { padding: 25px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.quick-add { margin: 20px 0 16px; display: flex; gap: 8px; }
.quick-add input[type=text] { min-width: 0; height: 42px; padding: 0 11px; }
input[type=color] { width: 42px; min-width: 42px; height: 42px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.manage-list { border-top: 1px solid var(--line); }
.manage-row { padding: 10px 0; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #eef2f7; }
.manage-row > form:first-child { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; }
.manage-row input[type=text] { min-width: 0; height: 36px; padding: 0 9px; }
.manage-row input[type=color] { width: 35px; min-width: 35px; height: 35px; }
.manage-row span { white-space: nowrap; color: var(--muted); font-size: 10px; }
.empty-line { color: var(--muted); text-align: center; font-size: 11px; }
.data-card { margin-top: 18px; scroll-margin-top: 115px; }
.data-actions { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.data-block { padding: 20px; border: 1px solid var(--line); border-radius: 11px; background: #f8faff; }
.data-block h3 { margin: 0 0 5px; font-size: 14px; }
.data-block p { margin: 0 0 15px; color: var(--muted); font-size: 11px; }
.import-form { display: grid; gap: 10px; }
.import-form p { margin-bottom: 0; }
.radio-line { color: #5b687d; font-size: 11px; }
.error-page { margin-top: 40px; }

.toast-stack { position: fixed; top: 105px; right: 22px; z-index: 100; display: grid; gap: 8px; }
.toast { padding: 11px 15px; border-radius: 9px; color: #fff; background: #182238; box-shadow: var(--shadow); font-size: 12px; transition: .3s ease; }
.toast-error { background: var(--danger); }
.toast.hide { opacity: 0; transform: translateY(-8px); }
.copy-toast { position: fixed; left: 50%; bottom: 28px; z-index: 100; padding: 9px 15px; border-radius: 9px; color: #fff; background: #182238; opacity: 0; transform: translate(-50%,12px); pointer-events: none; transition: .2s ease; font-size: 12px; }
.copy-toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 1040px) {
  .topbar { grid-template-columns: 220px minmax(220px,1fr) auto; padding-inline: 20px; gap: 16px; }
  .nav-action { padding-inline: 10px; }
  .nav-action span { display: none; }
  .app-shell { padding-inline: 20px; grid-template-columns: 210px minmax(0,1fr); gap: 18px; }
}
@media (max-width: 760px) {
  .topbar { min-height: auto; padding: 13px 15px; grid-template-columns: 1fr auto; gap: 12px; }
  .brand { font-size: 15px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand b { display: none; }
  .top-search { height: 46px; grid-column: 1/-1; grid-row: 2; }
  .topbar-space { display: none; }
  .topnav { grid-column: 2; grid-row: 1; }
  .nav-action { display: none; }
  .button-small { min-height: 38px; padding: 7px 11px; font-size: 11px; }
  main { min-height: calc(100vh - 116px); }
  .app-shell { display: block; padding: 14px 14px 50px; }
  .sidebar { min-height: 0; padding: 8px; border-radius: 12px; overflow-x: auto; }
  .sidebar { flex-direction: row; align-items: center; }
  .sidebar-heading, .sidebar-group-heading, .sidebar-create-group, .sidebar-section-title, .side-nav.compact, .tag-cloud, .sidebar-empty { display: none; }
  .sidebar-system { margin-top: 0; padding-top: 0; border-top: 0; }
  .side-nav { display: flex; width: max-content; }
  .side-nav a { min-height: 38px; gap: 9px; }
  .library-header { min-height: 108px; padding: 24px 4px 18px; }
  .prompt-card { padding: 17px; grid-template-columns: 38px minmax(0,1fr); gap: 12px; }
  .prompt-accent { width: 38px; height: 38px; border-radius: 10px; }
  .card-actions { grid-column: 2; grid-row: 2; margin-top: 2px; }
  .prompt-preview { -webkit-line-clamp: 3; max-height: 4.9em; }
  .manage-grid, .data-actions { grid-template-columns: 1fr; }
  .detail-header { display: block; }
  .detail-actions { margin-top: 20px; }
  .prompt-content { max-height: none; }
  .prompt-modal { padding: 10px; align-items: center; }
  .prompt-modal-panel { width: calc(100vw - 20px); height: min(90dvh,850px); max-height: calc(100dvh - 20px); border-radius: 15px; }
  .prompt-modal-header { padding: 18px 18px 14px; display: block; }
  .prompt-modal-heading { padding-right: 42px; }
  .prompt-modal-actions { margin-top: 15px; justify-content: flex-start; flex-wrap: wrap; }
  .prompt-modal-close { position: absolute; top: 15px; right: 15px; }
  .prompt-modal-body { padding: 0 16px 16px; }
  .modal-copy-button { order: -1; }
}
@media (max-width: 480px) {
  .brand > span:nth-child(2) { display: none; }
  .page-wrap, .detail-wrap, .form-wrap { width: min(100% - 24px,1120px); padding-top: 24px; }
  .detail-card, .manage-card { border-radius: 13px; }
  .detail-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .detail-footer { flex-direction: column; }
  .detail-footer form, .detail-footer .button { width: 100%; }
  .field textarea { min-height: 360px; }
  .manage-card { padding: 18px; }
  .manage-row { align-items: flex-start; }
  .manage-row > form:first-child { flex-wrap: wrap; }
  .manage-row input[type=text] { flex: 1; }
  .library-view-meta { display: none; }
  .modal-favorite-button, .modal-edit-button { flex: 1; }
  .modal-copy-button { flex: 1 0 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .prompt-modal-panel, .prompt-modal-backdrop { animation: none !important; transition: none !important; }
}
