:root {
  --bg: linear-gradient(145deg, #f5f7ff 0%, #eef2f7 45%, #e7efe9 100%);
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --line: rgba(18, 31, 38, 0.12);
  --text: #122031;
  --muted: #5a6773;
  --accent: #126e4c;
  --accent-soft: #e5f4ed;
  --danger: #b02235;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans KR", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

.lang-select {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--text);
  min-height: 36px;
  padding: 0 10px;
}

.app-shell {
  width: min(1280px, calc(100vw - 28px));
  margin: 14px auto 24px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  backdrop-filter: blur(8px);
}

.top-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

h1 {
  margin: 2px 0 0;
  font-size: 24px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.status-line {
  min-height: 24px;
  margin: 10px 4px 8px;
  color: var(--muted);
  font-size: 13px;
}

.upload-status-bar {
  position: sticky;
  top: 8px;
  z-index: 1100;
  width: min(560px, calc(100% - 8px));
  min-height: 48px;
  margin: 0 4px 10px auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(18, 110, 76, 0.28);
  border-radius: 12px;
  padding: 9px 12px;
  background: var(--surface-strong);
  color: var(--text);
  box-shadow: 0 10px 28px rgba(18, 32, 49, 0.14);
  cursor: pointer;
  text-align: left;
}

.upload-status-bar.upload-status-error {
  border-color: rgba(176, 34, 53, 0.42);
}

.upload-status-summary {
  min-width: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
}

.upload-status-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 110, 76, 0.12);
}

.upload-status-progress {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

.upload-status-error .upload-status-progress {
  background: var(--danger);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

#create-view.view.active {
  display: flex;
}

.memo-workspace {
  min-width: 0;
}

.memo-stage {
  min-width: 0;
}

.memo-list-panel {
  display: none;
}

.memo-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 9px;
  border-bottom: 1px solid var(--line);
}

.memo-list-head h2 {
  margin: 0;
  font-size: 14px;
}

.memo-list-count {
  color: var(--muted);
  font-size: 12px;
}

.memo-list {
  display: grid;
  gap: 4px;
  overflow: auto;
  padding: 8px;
}

.memo-list-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 4px;
  padding: 10px;
  text-align: left;
  font: inherit;
}

.memo-list-item:hover {
  background: rgba(18, 110, 76, 0.06);
}

.memo-list-item.active {
  border-color: rgba(18, 110, 76, 0.32);
  background: var(--accent-soft);
}

.memo-list-item.inactive {
  opacity: 0.72;
}

.memo-list-title {
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memo-list-meta,
.memo-list-preview,
.memo-list-empty {
  color: var(--muted);
  font-size: 12px;
}

.memo-list-preview {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.memo-list-empty {
  padding: 10px;
}

.memo-grid {
  display: grid;
  gap: 12px;
}

.memo-section {
  display: grid;
  gap: 8px;
}

.memo-section-title {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.memo-grid-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.memo-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  padding: 12px;
  min-height: 178px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.memo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 20px rgba(18, 32, 49, 0.1);
}

.memo-card.inactive {
  background: #f6f8fa;
  border-style: dashed;
  opacity: 0.82;
}

.memo-card.inactive:hover {
  transform: none;
  box-shadow: none;
}

.memo-card-empty {
  min-height: 78px;
  cursor: default;
}

.memo-card h3 {
  margin: 0;
  font-size: 16px;
}

.meta,
.preview {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.preview {
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hint-text {
  margin: 2px 2px 8px;
  font-size: 12px;
  color: var(--muted);
}

.target-picker {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 8px;
  margin-bottom: 8px;
}

.target-picker-head {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}

.target-list {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
}

.target-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.target-item span {
  color: var(--text);
}

.icon-btn,
.ghost-btn {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  color: var(--text);
  border-radius: 10px;
  min-width: 40px;
  height: 40px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover,
.ghost-btn:hover {
  border-color: rgba(18, 110, 76, 0.45);
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
}

.detail-screen {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 44px rgba(18, 32, 49, 0.08);
  overflow: hidden;
}

.detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
}

.detail-title-wrap {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.detail-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

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

.danger-icon-btn:hover:not(:disabled) {
  background: rgba(176, 34, 53, 0.1);
}

.detail-title-field {
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 25px;
  font-weight: 700;
  line-height: 1.28;
}

.detail-title-field:focus {
  outline: none;
}

.detail-title-field:disabled {
  color: var(--text);
  opacity: 1;
}

.detail-save-action {
  min-width: 84px;
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: calc(100vh - 210px);
  align-items: stretch;
  background: rgba(248, 250, 252, 0.78);
}

.detail-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  padding: 18px;
}

.detail-side {
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.detail-side-section {
  display: grid;
  gap: 10px;
}

.detail-side-section h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.detail-field-stack {
  display: grid;
  gap: 5px;
}

.detail-inline-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.detail-inline-action > .field {
  min-width: 0;
}

.detail-inline-action .icon-btn {
  width: 40px;
  min-width: 40px;
}

.pane-primary {
  min-height: 0;
}

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

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

.pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 12px;
}

.detail-content-pane {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  box-shadow: 0 10px 26px rgba(18, 32, 49, 0.06);
}

.pane-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

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

.list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.entries-list {
  max-height: none;
  padding-top: 12px;
  align-content: start;
}

.detail-side-list {
  max-height: 280px;
}

.detail-side-pane h2 {
  margin-bottom: 10px;
}

.item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-strong);
}

.entry-item {
  border-color: rgba(18, 31, 38, 0.1);
  padding: 15px;
}

.entry-meta {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.item p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.item small {
  color: var(--muted);
}

.detail-composer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-editor-wrap {
  min-height: 0;
}

.detail-entry-input {
  min-height: 150px;
  max-height: 280px;
  line-height: 1.58;
  padding: 13px 14px;
}

.detail-entry-preview {
  min-height: 150px;
  max-height: 280px;
  padding: 13px 14px;
}

.rich-input-disabled {
  cursor: default;
  opacity: 0.64;
  background: #f6f8fa;
}

.detail-entry-submit {
  width: min(360px, 100%);
  justify-self: center;
}

.attachment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.attachment-head > small {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.attachment-download,
.attachment-delete {
  width: 30px;
  min-width: 30px;
  height: 30px;
}

.attachment-download-state {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(18, 110, 76, 0.18);
  border-radius: 8px;
  background: rgba(18, 110, 76, 0.06);
}

.attachment-download-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.attachment-download-state-icon {
  color: var(--accent);
  font-size: 17px;
}

.attachment-download-state-text {
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-download-percent {
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.attachment-download-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 110, 76, 0.13);
}

.attachment-download-progress {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

.attachment-download-track.indeterminate .attachment-download-progress {
  animation: attachment-download-indeterminate 1.15s ease-in-out infinite;
}

.attachment-download-state[data-status="complete"] {
  border-color: rgba(18, 110, 76, 0.24);
  background: rgba(18, 110, 76, 0.09);
}

.attachment-download-state[data-status="error"] {
  border-color: rgba(188, 56, 56, 0.25);
  background: rgba(188, 56, 56, 0.07);
}

.attachment-download-state[data-status="error"] .attachment-download-state-icon,
.attachment-download-state[data-status="error"] .attachment-download-state-text {
  color: var(--danger, #b42318);
}

@keyframes attachment-download-indeterminate {
  0% { transform: translateX(-120%); }
  55% { transform: translateX(120%); }
  100% { transform: translateX(260%); }
}

@media (prefers-reduced-motion: reduce) {
  .attachment-download-track.indeterminate .attachment-download-progress {
    animation: none;
  }
}

.attachment-preview-wrap {
  margin-top: 8px;
}

.attachment-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fb;
  padding: 6px;
}

.attachment-image,
.attachment-video {
  width: 100%;
  max-height: 260px;
  border-radius: 6px;
  display: block;
  object-fit: contain;
  background: #eaf0f7;
}
.attachment-image {
  cursor: zoom-in;
}

.attachment-audio {
  width: 100%;
}

.create-screen {
  width: 100%;
  min-height: calc(100vh - 160px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 44px rgba(18, 32, 49, 0.08);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.create-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
}

.create-title-stack {
  min-width: 0;
}

.create-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.create-head h2 {
  margin: 0;
  font-size: 19px;
}

.create-head-actions {
  display: flex;
  justify-content: flex-end;
}

.primary-action {
  border: 1px solid rgba(18, 110, 76, 0.28);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
}

.primary-action:hover {
  background: #0f5f41;
}

.primary-action:disabled {
  cursor: default;
  opacity: 0.48;
}

.primary-action .material-symbols-rounded {
  font-size: 21px;
}

.create-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  min-height: 0;
  align-items: stretch;
  background: rgba(248, 250, 252, 0.78);
}

.create-compose {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 18px;
}

.title-field {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 2px 13px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
}

.title-field:focus {
  outline: none;
  border-bottom-color: rgba(18, 110, 76, 0.55);
}

.title-field::placeholder {
  color: rgba(90, 103, 115, 0.72);
}

.create-side {
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  padding: 14px;
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.create-side-section {
  display: grid;
  gap: 10px;
}

.create-side-section h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.create-field-stack {
  display: grid;
  gap: 5px;
}

.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.side-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.create-attach-row {
  display: flex;
  gap: 6px;
}

.create-attach-row .icon-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
}

.attach-preview-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  min-height: 72px;
  max-height: 210px;
  overflow: auto;
  padding: 7px;
  display: grid;
  gap: 6px;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.attach-preview-list.drag-over {
  border-color: rgba(18, 110, 76, 0.62);
  background: rgba(218, 244, 233, 0.78);
  box-shadow: inset 0 0 0 1px rgba(18, 110, 76, 0.16);
}

.attach-preview-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.editor-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  overflow: hidden;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  box-shadow: 0 10px 26px rgba(18, 32, 49, 0.06);
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  flex-wrap: wrap;
}

.editor-tool-group {
  display: inline-flex;
  gap: 4px;
  padding-right: 8px;
  border-right: 1px solid var(--line);
}

.editor-tool-group:last-child {
  border-right: 0;
  padding-right: 0;
}

.editor-toolbar .icon-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
  background: transparent;
}

.editor-heading-label {
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.rich-editor {
  min-height: 430px;
  max-height: none;
  overflow: auto;
  padding: 18px;
  outline: none;
  line-height: 1.72;
}

.rich-editor.toast-editor-host {
  min-height: 0;
  overflow: visible;
  padding: 0;
}

.rich-editor p,
.rich-editor ul,
.rich-editor ol,
.rich-editor blockquote {
  margin: 0 0 10px;
}

.rich-input {
  width: 100%;
  border: 0;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface-strong);
}

.rich-input:focus {
  outline: none;
}

.rich-input .toastui-editor-defaultUI {
  border: 0;
  border-radius: 0;
  font-family: inherit;
}

.rich-input .toastui-editor-defaultUI-toolbar {
  border-bottom-color: var(--line);
}

.rich-input .toastui-editor-main {
  background: var(--surface-strong);
}

.rich-input .toastui-editor-contents {
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.72;
}

.rich-input .toastui-editor-contents p {
  color: var(--text);
}

.rich-input .ProseMirror {
  min-height: 300px;
  padding: 18px;
}

.toast-editor-disabled {
  opacity: 0.58;
  pointer-events: none;
}

.toast-viewer-host .toastui-editor-contents {
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.68;
}

.toast-viewer-host .toastui-editor-contents p {
  color: var(--text);
}

.rich-input:empty::before {
  content: attr(data-placeholder);
  color: rgba(90, 103, 115, 0.72);
}

.rich-input ul,
.rich-input ol {
  padding-left: 24px;
}

.rich-preview {
  background: #fbfcff;
}

.rich-editor blockquote {
  border-left: 3px solid #b8c6d3;
  padding-left: 10px;
  color: #4a5d6f;
}

.rich-preview h1,
.rich-preview h2,
.rich-preview h3,
.memo-markdown h1,
.memo-markdown h2,
.memo-markdown h3 {
  margin: 0 0 8px;
  line-height: 1.24;
}

.memo-markdown h1 {
  font-size: 24px;
}

.memo-markdown h2 {
  font-size: 20px;
}

.memo-markdown h3 {
  font-size: 17px;
}

.rich-preview code,
.memo-markdown code {
  background: #ecf2fb;
  border-radius: 6px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.rich-preview a,
.memo-markdown a {
  color: #0f5cc0;
  text-decoration: underline;
}

.memo-markdown ul,
.memo-markdown ol {
  margin: 0 0 8px 20px;
  padding: 0;
}

.memo-markdown p {
  margin: 0 0 8px;
  line-height: 1.62;
}

.memo-markdown li {
  margin-bottom: 4px;
  line-height: 1.6;
}

.memo-markdown input[type="checkbox"] {
  margin-right: 6px;
  transform: translateY(1px);
}

.memo-markdown blockquote {
  margin: 0 0 8px;
  border-left: 3px solid #b8c6d3;
  padding-left: 10px;
  color: #4a5d6f;
}

.material-symbols-rounded {
  font-variation-settings: "FILL" 0, "wght" 500, "GRAD" 0, "opsz" 24;
}

.image-viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(8, 14, 22, 0.94);
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 20px 20px 14px;
}

.image-viewer-stage {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-image {
  max-width: min(96vw, 1800px);
  max-height: calc(100vh - 92px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
}

.image-viewer-caption {
  margin: 8px 4px 0;
  color: #dbe6f2;
  text-align: center;
  font-size: 13px;
  word-break: break-word;
}

.image-viewer-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  min-width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.9);
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 14, 22, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-content {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: 0 24px 64px rgba(8, 14, 22, 0.28);
}

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

.dialog-title,
.dialog-overall-progress p,
.upload-item p {
  margin: 0;
}

.dialog-title {
  font-size: 18px;
}

.dialog-overall-progress {
  display: grid;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.dialog-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding: 14px 18px 18px;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}

.upload-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcff;
}

.upload-item-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.upload-item-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-item-status {
  color: var(--muted);
  font-size: 12px;
}

.upload-item-progress-bar {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 110, 76, 0.12);
}

.dialog-overall-progress .upload-item-progress-bar {
  grid-column: auto;
}

.upload-item-progress {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 160ms ease;
}

@media (max-width: 980px) {
  .panes,
  .panes-secondary {
    grid-template-columns: 1fr;
  }
  .detail-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .detail-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .detail-side-list {
    max-height: 340px;
  }
  .create-body {
    grid-template-columns: 1fr;
  }
  .create-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .create-screen {
    min-height: calc(100vh - 140px);
  }
  .rich-editor {
    min-height: 360px;
  }
}

@media (min-width: 1100px) {
  body.detail-mode .app-shell {
    width: min(1592px, calc(100vw - 28px));
  }

  body.detail-mode .memo-workspace {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }

  body.detail-mode .memo-stage {
    width: min(1280px, 100%);
    min-width: 0;
  }

  body.detail-mode .memo-list-panel {
    position: sticky;
    top: 12px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    max-height: calc(100vh - 118px);
    min-height: calc(100vh - 210px);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-strong);
    box-shadow: 0 14px 34px rgba(18, 32, 49, 0.07);
    overflow: hidden;
  }

  body.detail-mode .detail-screen {
    min-width: 0;
  }

  body.detail-mode .detail-layout {
    min-height: calc(100vh - 210px);
  }
}

@media (max-width: 640px) {
  html,
  body {
    min-height: 100dvh;
    overflow-x: clip;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  h1 {
    font-size: 20px;
  }
  .app-shell {
    width: calc(100vw - 16px);
    margin: 8px auto 14px;
  }
  .top-bar {
    position: sticky;
    z-index: 1200;
    top: 8px;
    border-radius: 12px;
    padding: 10px;
    backdrop-filter: blur(18px);
  }
  .top-actions {
    max-width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }
  .top-actions::-webkit-scrollbar {
    display: none;
  }
  .top-actions > * {
    flex: 0 0 auto;
  }
  .top-actions .icon-btn,
  .top-actions .lang-select {
    min-width: 44px;
    min-height: 44px;
  }
  .memo-grid-section {
    grid-template-columns: 1fr;
  }
  .detail-head {
    grid-template-columns: auto 1fr;
  }
  .detail-save-action {
    flex: 1;
  }
  .detail-head-actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: stretch;
  }
  .detail-main,
  .detail-side {
    padding: 12px;
  }
  .detail-title-field {
    font-size: 22px;
  }
  .create-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 10px;
  }
  .create-head-actions {
    grid-column: auto;
    justify-content: end;
  }
  .primary-action {
    width: 100%;
  }
  .create-head .primary-action {
    width: auto;
    min-width: 76px;
    min-height: 44px;
    padding: 0 12px;
  }
  .create-kicker {
    display: none;
  }
  .create-head h2 {
    font-size: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .create-compose,
  .create-side {
    padding: 12px;
  }
  .title-field {
    font-size: 23px;
    scroll-margin-top: calc(env(safe-area-inset-top) + 142px);
  }
  .editor-toolbar {
    gap: 6px;
  }
  .editor-tool-group {
    border-right: 0;
    padding-right: 0;
  }
  .rich-editor {
    min-height: 300px;
    max-height: none;
    overflow: visible;
    padding: 14px;
  }

  .detail-layout,
  .create-screen {
    min-height: 0;
  }

  .list,
  .target-list,
  .detail-side-list,
  .attachment-dropzone,
  .detail-entry-input,
  .detail-entry-preview {
    max-height: none;
    overflow: visible;
  }
  .image-viewer-overlay {
    padding: 14px 8px 10px;
  }
  .image-viewer-image {
    max-width: 98vw;
    max-height: calc(100vh - 82px);
    border-radius: 8px;
  }
  .image-viewer-caption {
    font-size: 12px;
  }
  .dialog-overlay {
    align-items: end;
    padding: 8px;
  }
  .dialog-content {
    max-height: calc(100vh - 16px);
    border-radius: 14px;
  }

  .detail-head,
  .create-head {
    position: sticky;
    z-index: 20;
    top: 72px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
  }
  body.create-mode .create-head {
    position: relative;
    top: auto;
  }
  .dialog-header,
  .dialog-overall-progress,
  .dialog-body {
    padding-left: 14px;
    padding-right: 14px;
  }
}
.resource-links{border:1px solid #dfe5ee;border-radius:10px;padding:14px;margin:12px 0}
.resource-links form,.resource-links li{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0}
.resource-links li a,.resource-links li span{flex:1;min-width:0;overflow-wrap:anywhere}
.resource-links ul{list-style:none;padding:0}.resource-links p{color:#5d687b;font-size:.9rem}
