:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px; line-height: 1.55;
  --ink: #342942; --muted: #746681; --accent: #7653b2; --accent-dark: #604097;
  --line: #eee6f1; --paper: #fffdfd; --shadow: 0 10px 32px #5a396b0b;
  background: #f8f5fa; color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 330px; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid #8154c6; outline-offset: 3px;
}
svg { flex-shrink: 0; }
h1, h2, p { margin: 0; }
h2 { font-size: 19px; line-height: 1.4; font-weight: 700; letter-spacing: -.02em; }
.sr-only, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link:focus { position: fixed; z-index: 5; top: 10px; left: 10px; padding: 8px 12px; background: white; border-radius: 8px; }

#shell { min-height: 100vh; display: grid; grid-template-columns: 223px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 2; display: flex; flex-direction: column;
  padding: 30px 18px 19px; border-right: 1px solid #eee7f2; background: #fffdfd;
}
.brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 48px; }
.brand strong { display: block; font-size: 20px; letter-spacing: .035em; line-height: 1.3; }
.brand small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.nav-kicker { color: #82738d; font-size: 11px; font-weight: 650; letter-spacing: .14em; margin: 0 12px 12px; }
#nav { display: grid; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 47px; padding: 9px 12px; border-radius: 12px; color: #635671; font-weight: 550; }
.nav-item:hover { background: #f8f3fa; }
.nav-item.active { color: var(--accent-dark); background: #eee6fa; font-weight: 700; }
.nav-item.active::after { content: ""; width: 6px; height: 6px; margin-left: auto; border-radius: 50%; background: #9d7acd; }
.side-footer { margin-top: auto; display: flex; align-items: flex-start; gap: 10px; padding: 13px 11px; border-radius: 13px; background: #f7f4fa; color: #665672; }
.side-footer .local-spark { margin-top: 7px; }
.side-footer strong { font-size: 12px; font-weight: 650; display: block; }
.side-footer small { font-size: 10.5px; color: var(--muted); }
.local-spark { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #6d9b85; box-shadow: 0 0 0 3px #e4f0e9; }
.workspace {
  min-width: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(ellipse at 63% -20%, #fff7ef 0, transparent 50%),
    radial-gradient(ellipse at 100% 29%, #efebf8 0, transparent 52%), #f9f6fa;
}
.topbar {
  min-height: 70px; display: flex; align-items: center; justify-content: space-between;
  padding: 12px clamp(25px, 3.2vw, 54px); border-bottom: 1px solid #eee7ee;
  font-size: 12px; color: #746780; background: #ffffff70;
}
.crumb span { margin: 0 9px; color: #a191ab; }
.top-right { display: flex; align-items: center; gap: 15px; }
.local-pill { display: flex; align-items: center; gap: 8px; border: 1px solid #e8e0eb; border-radius: 999px; background: #fffdfde8; padding: 5px 10px; color: #5f5769; }
.local-pill:hover { border-color: #c7b6df; }
#content { width: 100%; max-width: 1460px; padding: 31px clamp(25px, 3.2vw, 54px) 26px; margin: 0 auto; flex: 1; outline: none; }
.page-footer { display: flex; justify-content: space-between; gap: 15px; padding: 10px clamp(25px, 3.2vw, 54px) 19px; color: #84788d; font-size: 11px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { font-size: clamp(32px, 3.45vw, 50px); line-height: 1.28; font-weight: 740; letter-spacing: -.056em; margin: 7px 0 9px; }
.page-heading p { font-size: 14px; color: var(--muted); }
.eyebrow { color: #8062a8; display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .13em; }
.today-pill { flex: none; display: flex; align-items: center; gap: 11px; min-width: 130px; background: #fffdfded; border: 1px solid #eee5f0; border-radius: 16px; padding: 10px 13px; box-shadow: var(--shadow); }
.today-icon, .settings-icon { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: #f2eafb; color: var(--accent); }
.today-pill small { display: block; color: var(--muted); font-size: 11px; }
.today-pill strong { font-size: 21px; font-weight: 750; line-height: 1.15; }
.today-pill strong span { font-size: 12px; font-weight: 500; }
.panel { border: 1px solid var(--line); background: #fffdfdf2; border-radius: 22px; box-shadow: var(--shadow); min-width: 0; }
.panel-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.panel-title p { color: var(--muted); font-size: 12px; margin-top: 4px; }

.button, .icon-button, .text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 10px; line-height: 1.3;
  padding: 9px 13px; min-height: 37px; color: var(--ink); background: #f1edf6;
  font-weight: 650; font-size: 12px; white-space: nowrap; transition: background .16s, border-color .16s;
}
.button:hover, .icon-button:hover { background: #eae0f5; }
.button.compact { min-height: 33px; padding: 6px 10px; }
.button.primary { background: #7855b3; color: white; box-shadow: 0 3px 8px #7653b224; }
.button.primary:hover { background: #654299; }
.button.subtle, .icon-button { border-color: #ebe2f0; background: #fbf7fc; color: #69557e; }
.button.subtle:hover, .icon-button:hover { background: #f0e8f7; }
.button.danger { background: #a44662; color: white; }
.button.danger:hover { background: #8b3350; }
.button.danger-quiet { color: #973b59; background: #fbf0f3; }
.button.danger-quiet:hover { background: #f8e0e8; }
.button.active { background: #eae0f7; color: var(--accent-dark); border-color: #dbcaef; }
.icon-button { min-width: 34px; min-height: 34px; padding: 7px; }
.text-button { background: transparent; color: var(--accent-dark); min-height: 30px; padding: 4px 6px; }
.text-button:hover { background: #f5effa; }
.segment { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid #efe8f2; background: #f6f1f7; border-radius: 11px; }
.segment button { border: 0; padding: 6px 10px; min-height: 29px; background: transparent; border-radius: 8px; font-size: 12px; color: #756582; }
.segment button.active { color: var(--accent-dark); background: white; box-shadow: 0 1px 5px #65417914; font-weight: 700; }
.segment button:hover:not(.active) { background: #f0e7f4; }
.badge { display: inline-flex; align-items: center; gap: 5px; color: #6e568a; background: #f2e9fa; border: 1px solid #ebdff3; padding: 5px 9px; border-radius: 999px; white-space: nowrap; font-size: 11px; font-weight: 650; }
.badge.ready { color: #426a54; background: #edf7ef; border-color: #dceee2; }
.setup-badge:hover { background: #e8dcf5; }

.bag-grid { display: grid; grid-template-columns: minmax(0, 1.38fr) minmax(340px, 1fr); gap: 17px; }
.drop-zone {
  position: relative; min-height: 414px; display: grid; grid-template-rows: auto 1fr auto;
  padding: 18px 19px 20px; isolation: isolate; overflow: hidden;
  background: radial-gradient(ellipse at 25% 40%, #fff6e8 0, #fff6e83a 44%, transparent 62%),
    linear-gradient(142deg, #f9e9e8 0, #efdef6 55%, #e6e5fa 100%);
  border: 1px solid #fff; border-radius: 24px; box-shadow: 0 10px 30px #81619c19;
  transition: box-shadow .2s, border-color .2s;
}
.drop-zone::after { position: absolute; inset: 9px; z-index: -1; content: ""; pointer-events: none; border-radius: 18px; border: 1px solid #ffffff76; }
.drop-zone.dragging { border-color: #b99cdb; }
.drop-zone.drag-over { box-shadow: 0 0 0 3px #ac84d1, 0 16px 32px #875fba35; }
.drop-zone.drag-over .bag-art { transform: translateY(-3px) scale(1.045); }
.drop-zone.just-added .bag-art { animation: bag-pulse .62s ease; }
@keyframes bag-pulse { 40% { transform: translateY(-5px) scale(1.035); } }
.drop-token { pointer-events: none; position: absolute; left: calc(50% - 29px); top: 24%; width: 58px; animation: token-drop .53s ease-in both; }
.drop-token svg { width: 100%; }
@keyframes token-drop {
  from { transform: translateY(-35px) scale(.92); opacity: 0; }
  22% { opacity: 1; }
  70% { opacity: 1; }
  to { transform: translateY(105px) scale(.35); opacity: 0; }
}
.zone-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; z-index: 1; }
.zone-label { background: #fff8f8bb; padding: 5px 10px; border: 1px solid #fff; border-radius: 99px; font-size: 11px; color: #735f85; font-weight: 650; }
.zone-label span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #b68dcf; vertical-align: 2px; margin-right: 3px; }
.zone-index { color: #79628e; font-size: 10px; letter-spacing: .13em; }
.bag-stage { display: grid; place-items: center; min-height: 0; }
.bag-art { width: min(100%, 435px); max-height: 314px; overflow: visible; transition: transform .24s ease; }
.float-left { animation: hover-mood 6s ease-in-out infinite; }
.float-right { animation: hover-mood 7s ease-in-out -2s infinite; }
@keyframes hover-mood { 50% { transform: translateY(-6px); } }
.zone-bottom { text-align: center; padding: 5px 0 1px; }
.zone-bottom strong { font-size: 16px; color: #624a80; }
.zone-bottom p { font-size: 11.5px; color: #6d5a80; margin-top: 4px; }
.palette-panel { padding: 18px; }
.palette-spark { color: #a07ac7; padding: 6px; border-radius: 9px; background: #f6effb; display: grid; place-items: center; }
.palette-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 12px; }
.mood-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mood-wrap { position: relative; min-width: 0; }
.mood-tile {
  min-width: 0; width: 100%; min-height: 82px; display: grid; grid-template-rows: 1fr auto; place-items: center;
  padding: 4px 3px 6px; border: 1px solid #f0eaf2; border-radius: 12px;
  background: linear-gradient(160deg, #fff, var(--tint)); color: #51405c; font-size: 11.5px; font-weight: 600;
  user-select: none; cursor: grab; transition: transform .15s, border .15s, box-shadow .15s;
}
.mood-tile:hover { border-color: #d4c1e9; transform: translateY(-2px); box-shadow: 0 5px 14px #73589512; }
.mood-tile:active { cursor: grabbing; transform: translateY(0); }
.mood-tile .character { width: min(100%, 65px); height: 54px; pointer-events: none; }
.mood-tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.shape-delete { position: absolute; top: 3px; right: 3px; z-index: 1; border-radius: 99px; min-height: 21px; min-width: 21px; padding: 2px; opacity: 0; }
.shape-delete svg { width: 13px; height: 13px; }
.mood-wrap:hover .shape-delete, .shape-delete:focus-visible { opacity: 1; }
.library-empty { display: grid; justify-items: center; text-align: center; gap: 9px; padding: 30px 14px; border-radius: 15px; border: 1px dashed #ded0e9; color: #655372; }
.library-empty p { font-size: 12px; color: var(--muted); }
.library-empty .button { margin-top: 5px; }
.history-panel { margin-top: 17px; padding: 18px 20px; }
.empty-records { min-height: 87px; margin-top: 12px; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 14px; border: 1px dashed #eadfee; background: #fbf8fc; padding: 13px; color: var(--muted); font-size: 12px; }
.empty-icon { display: grid; place-items: center; flex: none; width: 39px; height: 39px; border-radius: 13px; background: #f0e8f8; color: #9272b4; }
.record-list { display: grid; gap: 6px; margin-top: 12px; }
.record-row { display: flex; text-align: left; align-items: center; gap: 10px; width: 100%; padding: 7px 9px; border-radius: 11px; border: 1px solid #f3edf3; background: #fdfbfe; color: var(--ink); }
.record-row:hover { background: #f7f1fb; border-color: #e8daef; }
.record-art { display: grid; place-items: center; flex: none; width: 43px; height: 43px; border-radius: 10px; background: var(--tint); }
.record-art .character { width: 39px; height: 37px; }
.record-copy { flex: 1; display: grid; min-width: 0; }
.record-copy strong { font-weight: 700; font-size: 13px; }
.record-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.record-row time { white-space: nowrap; font-size: 11px; color: var(--muted); }
.record-row > svg { color: #8e779f; }

.period-switch { padding: 4px; }
.period-switch button { min-width: 63px; min-height: 32px; }
.atlas-note { background: linear-gradient(110deg, #efe7fa, #fff2ed); border: 1px solid #fff; display: flex; align-items: center; gap: 12px; border-radius: 17px; padding: 15px 17px; margin-bottom: 16px; }
.atlas-note h2 { font-size: 15px; }
.atlas-note p { font-size: 12px; color: #6b5c76; margin-top: 3px; }
.atlas-note > div { flex: 1; }
.atlas-note-icon { display: grid; place-items: center; flex: none; width: 41px; height: 41px; border-radius: 13px; color: #8c68af; background: #fff8ffb8; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; }
.chart-panel { min-height: 280px; padding: 18px 17px; }
.donut-layout { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(100px, .85fr); gap: 9px; align-items: center; margin-top: 12px; }
.donut { width: 100%; max-width: 220px; justify-self: center; }
.donut-total, .donut-unit { text-anchor: middle; fill: #584467; pointer-events: none; }
.donut-total { font-weight: 750; font-size: 27px; }
.donut-unit { font-size: 10px; fill: var(--muted); }
.donut-segment { cursor: pointer; }
.donut-segment:hover { filter: brightness(1.04); stroke-width: 26px; }
.donut-segment.dimmed { opacity: .35; }
.legend { display: grid; gap: 4px; max-height: 210px; overflow: auto; }
.legend-row { background: #faf7fc; color: var(--ink); text-align: left; border: 1px solid transparent; border-radius: 8px; padding: 4px 7px; min-width: 0; display: grid; align-items: center; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; font-size: 11px; }
.legend-row:hover, .legend-row.selected { background: #f0e7f8; border-color: #e9dcf2; }
.legend-row small { display: block; font-size: 9px; color: var(--muted); }
.legend-row span:nth-child(2) { overflow-wrap: anywhere; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.line-chart { width: 100%; margin-top: 13px; overflow: visible; }
.chart-gridline { stroke: #ede6f1; stroke-width: 1; }
.axis-label { fill: #746480; font-size: 10px; }
.trend-line { fill: none; stroke: #a384ce; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.point-hit { fill: transparent; }
.point-dot { fill: #a384ce; stroke: white; stroke-width: 1.8; }
.chart-point { cursor: pointer; }
.chart-point:hover .point-dot, .chart-point.selected .point-dot { fill: #7653b2; r: 7; }
.chart-caption { color: var(--muted); font-size: 11px; margin-top: 6px; }
.chart-empty { min-height: 181px; display: grid; align-content: center; justify-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.empty-donut { width: 84px; height: 84px; border: 12px solid #f0e6f6; border-top-color: #dfccee; border-radius: 50%; }
.empty-line { width: min(230px, 75%); height: 84px; display: flex; flex-direction: column; justify-content: space-between; padding: 6px; border-left: 1px solid #e9e0ef; }
.empty-line i { display: block; width: 100%; border-top: 1px dashed #e9e0ef; }
.empty-link { display: flex; justify-content: center; margin-top: 18px; }

.chat-panel { display: grid; grid-template-rows: auto minmax(220px, 1fr) auto; overflow: hidden; min-height: 512px; height: min(660px, calc(100vh - 250px)); }
.chat-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 17px; border-bottom: 1px solid #f0e8f2; background: #fffcff; }
.chat-identity { display: flex; align-items: center; gap: 10px; }
.chat-identity strong { display: block; font-size: 15px; }
.chat-identity small { display: block; color: var(--muted); font-size: 11px; }
.message-stream { overflow: auto; padding: 18px 21px; display: flex; flex-direction: column; gap: 15px; background: linear-gradient(155deg, #fcf8ff, #fffdfa 70%); }
.message { display: flex; align-items: flex-start; gap: 8px; }
.message.outgoing { justify-content: flex-end; }
.message-body { max-width: min(76%, 630px); min-width: 0; }
.outgoing .message-body { text-align: right; }
.message-meta { display: flex; gap: 7px; align-items: center; color: #695577; font-size: 11px; margin-bottom: 3px; }
.outgoing .message-meta { justify-content: flex-end; }
.message-meta time { color: #84768e; font-size: 10px; }
.bubble { display: inline-block; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; color: #493854; padding: 9px 12px; background: #f2eafa; border: 1px solid #ede0f4; border-radius: 3px 14px 14px 14px; font-size: 13px; }
.outgoing .bubble { background: #e7dcf6; border-color: #e1d2f0; border-radius: 14px 3px 14px 14px; }
.bubble.safety-bubble { background: #fff1ee; border-color: #f4ded7; }
.message-body > a { display: flex; width: fit-content; margin-top: 5px; }
.reference-meta { font-size: 10px; color: var(--muted); margin-top: 3px; }
.message-retry { display: flex; justify-content: flex-end; gap: 5px; align-items: center; color: #8d4b62; font-size: 11px; }
.thinking { display: flex; gap: 5px; align-items: center; font-size: 11px; color: var(--muted); }
.thinking span { width: 5px; height: 5px; border-radius: 50%; background: #b48ad2; animation: hover-mood 1.2s ease-in-out infinite; }
.thinking span:nth-child(2) { animation-delay: .12s; }
.thinking span:nth-child(3) { animation-delay: .24s; }
.composer { padding: 11px 16px 12px; border-top: 1px solid #f0e8f2; background: #fffdfd; }
.composer textarea { display: block; min-height: 52px; max-height: 130px; }
.composer-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.composer-note, .chat-setup-note, .selected-references { font-size: 11px; color: var(--muted); }
.composer-note { margin-top: 5px; }
.chat-setup-note { padding: 4px 8px; margin-bottom: 5px; background: #f8effa; border-radius: 7px; }
.selected-references { display: flex; align-items: center; gap: 5px; }

.urgent-card { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; margin-bottom: 16px; border-radius: 17px; border: 1px solid #f2ddd5; background: #fff4ef; color: #744b4f; }
.urgent-icon { display: grid; place-items: center; flex: none; width: 41px; height: 41px; border-radius: 12px; background: #f9e3df; color: #a66b75; }
.urgent-card h2 { font-size: 16px; }
.urgent-card p { margin: 4px 0 9px; font-size: 13px; }
.support-grid, .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.support-card, .settings-card { padding: 19px; }
.support-icon { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 13px; border-radius: 15px; }
.support-icon.lavender { background: #f0e7fa; color: #906cbd; }
.support-icon.mint { background: #e8f4ec; color: #658e76; }
.support-card h2 { margin-top: 3px; }
.support-card ol { padding-left: 20px; margin: 10px 0 13px; color: var(--muted); font-size: 13px; }
.support-card li { margin: 7px 0; }
.saved-contact { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 8px; border-radius: 9px; background: #f7f1f9; color: #594466; font-size: 12px; }
.saved-contact span { min-width: 0; overflow-wrap: anywhere; }
.contacts-card { grid-column: 1 / -1; }
.contacts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.settings-form { display: grid; gap: 11px; margin-top: 14px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span, .tag-field legend { font-size: 12px; font-weight: 700; }
.field small, .tag-field small, .field-hint { color: var(--muted); font-size: 11px; font-weight: 400; }
.field > span small, .tag-field legend small { margin-left: 4px; }
textarea, input:not([type="checkbox"]):not([type="range"]):not([type="color"]), select {
  width: 100%; min-width: 0; border: 1px solid #e9dfee; border-radius: 9px; padding: 8px 9px;
  background: #fcfaff; color: var(--ink); font-size: 13px;
}
textarea { resize: vertical; }
textarea::placeholder, input::placeholder { color: #8c7d95; }
input[type="checkbox"], input[type="range"] { accent-color: var(--accent); }
.form-actions { display: flex; align-items: center; gap: 8px; }
.path-box { display: flex; align-items: center; gap: 8px; padding: 7px 8px; margin-top: 14px; border-radius: 10px; background: #f7f2fa; color: #6d5287; }
.path-box code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.path-box .icon-button { min-width: 29px; min-height: 29px; padding: 4px; }
.setting-row { padding: 12px 0; border-bottom: 1px solid #f2ebf3; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting-row:last-child { border: 0; padding-bottom: 0; }
.setting-row strong { font-size: 13px; }
.setting-row p { color: var(--muted); font-size: 11px; margin-top: 3px; }
.switch { position: relative; flex: none; width: 41px; height: 24px; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #d8cde0; transition: background .18s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: white; transition: transform .18s; }
.switch input:checked + span { background: #815db9; }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

dialog { width: min(490px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 20px; border: 1px solid #eee4f1; border-radius: 19px; background: #fffdfd; color: var(--ink); box-shadow: 0 20px 65px #50316a3b; }
dialog.wide { width: min(710px, calc(100% - 28px)); }
dialog::backdrop { background: #4d355951; backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.dialog-header h2 { font-size: 20px; }
.dialog-header p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.dialog-status:not(:empty) { margin-bottom: 12px; }
.dialog-status .toast { box-shadow: none; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 15px; }
.dialog-actions.split { justify-content: space-between; }
.record-preview { display: flex; gap: 10px; align-items: center; margin-bottom: 13px; }
.record-preview .record-art { width: 54px; height: 54px; }
.record-preview .record-art .character { width: 51px; height: 48px; }
.record-preview strong, .record-preview small { display: block; }
.record-preview small { color: var(--muted); font-size: 11px; }
.tag-field { border: 0; padding: 0; margin: 11px 0 0; min-width: 0; }
.tag-field legend { padding: 0; margin-bottom: 6px; }
.tags, .shape-options { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { position: relative; }
.tag input { position: absolute; opacity: 0; margin: 0; }
.tag span { display: inline-block; border: 1px solid #ecdfef; border-radius: 99px; padding: 4px 9px; background: #faf6fc; color: #71607e; font-size: 12px; cursor: pointer; }
.tag input:checked + span { color: var(--accent-dark); background: #eee3f8; border-color: #d7c0ec; }
.tag input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.editor-layout { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(215px, 1.15fr); gap: 15px; }
.shape-canvas { display: grid; place-items: center; border: 1px solid #ebdfef; border-radius: 12px; background-color: #fbf7fc; background-image: radial-gradient(#e5d8ed 1px, transparent 1px); background-size: 11px 11px; }
#shape-canvas { display: block; width: 100%; height: auto; max-height: 275px; aspect-ratio: 1; touch-action: none; }
#shape-canvas.can-draw { cursor: crosshair; }
.canvas-footer { display: flex; align-items: center; justify-content: space-between; gap: 5px; color: var(--muted); font-size: 11px; }
.canvas-footer > div { display: flex; flex-shrink: 0; }
.shape-controls { display: grid; gap: 10px; align-content: start; }
.shape-controls .tag-field { margin: 0; }
.color-opacity { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 9px; }
.color-opacity input[type="color"] { height: 31px; width: 100%; padding: 2px; border: 1px solid #e9dfed; border-radius: 7px; background: white; cursor: pointer; }
.color-opacity input[type="range"] { width: 100%; margin: 0; align-self: center; }
.color-opacity output { color: var(--muted); font-weight: 500; margin-left: 4px; }
.reference-list { max-height: 300px; overflow: auto; display: grid; gap: 5px; }
.reference-row { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid #f0e8f3; border-radius: 9px; background: #fbf8fd; cursor: pointer; }
.safety-callout { display: flex; align-items: flex-start; gap: 8px; padding: 10px 11px; border-radius: 10px; background: #fff0eb; color: #804e55; margin-bottom: 8px; }
#toasts { position: fixed; bottom: 16px; right: 16px; z-index: 4; display: grid; gap: 6px; max-width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e7dbec; box-shadow: 0 7px 22px #654b7725; border-radius: 11px; padding: 9px 12px; color: #65497b; font-size: 12px; }
.toast.error { color: #9a3e5a; background: #fff6f7; border-color: #f2d7e0; }
.loading { text-align: center; padding: 50px 10px; color: var(--muted); }
.loading img { display: block; margin: 0 auto 12px; }
.loading .button { margin-top: 10px; }

@media (min-width: 1460px) {
  .bag-grid { gap: 21px; }
  .drop-zone { min-height: 440px; }
  .palette-panel { padding: 20px; }
  .mood-tile { min-height: 85px; }
}
@media (max-width: 1140px) {
  #shell { grid-template-columns: 179px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .bag-grid { grid-template-columns: minmax(0, 1fr) minmax(315px, .95fr); gap: 12px; }
  .drop-zone { min-height: 375px; }
  .palette-panel { padding: 13px; }
  .mood-tile { min-height: 71px; }
  .mood-tile .character { height: 45px; }
}
@media (max-width: 940px) {
  #shell { grid-template-columns: 70px minmax(0, 1fr); }
  .sidebar { padding: 20px 9px; }
  .brand { justify-content: center; margin: 0 0 27px; }
  .brand span, .nav-item span, .nav-kicker, .nav-item.active::after, .side-footer div { display: none; }
  .nav-item { justify-content: center; padding: 8px; }
  .side-footer { justify-content: center; padding: 12px; }
  .side-footer .local-spark { margin: 0; }
  .topbar { min-height: 59px; }
  #content { padding-top: 24px; }
}
@media (max-width: 760px) {
  .bag-grid, .chart-grid, .support-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .drop-zone { min-height: 330px; }
  .bag-art { height: 246px; }
  .contacts-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-panel { min-height: 495px; }
}
@media (max-width: 520px) {
  #shell { grid-template-columns: 51px minmax(0, 1fr); }
  .sidebar { padding: 14px 4px; }
  .brand img { width: 37px; height: 37px; }
  .topbar, .page-footer { padding-inline: 12px; }
  #content { padding-inline: 12px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .page-heading h1 { font-size: 29px; }
  #today-date { display: none; }
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
  .drop-zone { min-height: 280px; }
  .bag-art { height: 190px; }
  .mood-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
