:root {
  --paper: #f7f4ee;
  --paper-deep: #eee9df;
  --ink: #25231f;
  --muted: #817b70;
  --line: #ddd6ca;
  --accent: #345b4c;
  --accent-dark: #27483c;
  --accent-soft: #e1ebe5;
  --white: #fffdf9;
  --danger: #a34b45;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 276px minmax(420px, 1fr) minmax(330px, 430px); }
.library-panel, .insight-panel { min-height: 100vh; }
.library-panel { background: #2c3933; color: #f3f1ea; padding: 28px 22px 20px; display: flex; flex-direction: column; }
.brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.brand-row div:last-child { display: flex; flex-direction: column; gap: 1px; }
.brand-row strong { font-family: Georgia, "Times New Roman", serif; font-size: 21px; letter-spacing: .02em; }
.brand-row span { color: #aeb9b3; font-size: 12px; }
.brand-mark { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: white; display: grid; place-items: center; font-family: Georgia, serif; font-size: 24px; }
.brand-mark.small { width: 40px; height: 40px; font-size: 19px; background: #d8e3dc; color: #2c3933; }

.new-record-button { border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.08); color: white; border-radius: 10px; padding: 12px 15px; text-align: left; transition: .2s; }
.new-record-button:hover { background: rgba(255,255,255,.14); }
.new-record-button span { margin-right: 8px; font-size: 18px; }
.search-box { margin: 19px 0 25px; display: flex; align-items: center; gap: 8px; color: #aeb9b3; border-bottom: 1px solid rgba(255,255,255,.13); padding: 8px 2px; }
.search-box input { width: 100%; border: 0; outline: 0; color: white; background: transparent; font-size: 13px; }
.search-box input::placeholder { color: #8f9c96; }
.library-heading { display: flex; justify-content: space-between; padding: 0 4px 10px; color: #aeb9b3; font-size: 12px; }
.record-list { flex: 1; overflow: auto; margin: 0 -8px; padding: 0 4px; scrollbar-width: thin; }
.record-item { width: 100%; border: 0; border-left: 2px solid transparent; border-radius: 0 8px 8px 0; color: #d8dedb; background: transparent; text-align: left; padding: 13px 12px; margin-bottom: 3px; }
.record-item:hover { background: rgba(255,255,255,.06); }
.record-item.active { background: rgba(255,255,255,.1); border-left-color: #c9d9d0; color: white; }
.record-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.record-item span { display: block; color: #8f9c96; font-size: 11px; margin-top: 6px; }
.text-button { border: 0; background: transparent; color: inherit; }
.logout-button { color: #8f9c96; font-size: 12px; align-self: flex-start; padding: 9px 4px 0; }

.editor-panel { min-height: 100vh; display: flex; flex-direction: column; background: var(--white); border-right: 1px solid var(--line); }
.editor-header { height: 82px; padding: 19px 34px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee9e1; }
.date-label { font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.save-state { font-size: 12px; color: var(--accent); margin: 0; }
.editor-actions { display: flex; gap: 8px; }
.secondary-button, .icon-button { border: 1px solid var(--line); background: transparent; color: #615d55; border-radius: 8px; padding: 8px 13px; font-size: 12px; }
.writing-surface { flex: 1; padding: 56px clamp(38px, 7vw, 92px) 30px; display: flex; flex-direction: column; }
.title-input { border: 0; outline: 0; background: transparent; color: var(--ink); font-family: Georgia, "Noto Serif KR", serif; font-size: clamp(24px, 3vw, 34px); line-height: 1.3; margin-bottom: 28px; }
.title-input::placeholder { color: #bbb4a8; }
.content-input { flex: 1; min-height: 420px; resize: none; border: 0; outline: 0; background: transparent; color: #37342f; font-family: Georgia, "Noto Serif KR", serif; font-size: 17px; line-height: 2; }
.content-input::placeholder { color: #b5aea2; }
.editor-footer { padding: 20px 34px 24px; border-top: 1px solid #eee9e1; display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; }
.primary-button { border: 0; border-radius: 9px; color: white; background: var(--accent); padding: 12px 19px; font-weight: 600; transition: .2s; }
.primary-button:hover { background: var(--accent-dark); transform: translateY(-1px); }
.primary-button:disabled { opacity: .58; cursor: wait; transform: none; }
.analyze-button { min-width: 208px; }

.insight-panel { background: var(--paper); padding: 32px clamp(25px, 3vw, 45px); overflow: auto; }
.insight-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 7px; font-size: 10px; letter-spacing: .18em; color: var(--accent); font-weight: 700; }
.insight-header h2 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 21px; font-weight: 500; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #c8c1b5; margin-top: 7px; }
.status-dot.online { background: #4b8168; box-shadow: 0 0 0 4px rgba(75,129,104,.1); }
.empty-insight { min-height: 64vh; display: grid; place-items: center; align-content: center; text-align: center; color: #918a7f; font-family: Georgia, "Noto Serif KR", serif; font-size: 14px; line-height: 1.9; }
.empty-orbit { width: 74px; height: 74px; border: 1px solid #cfc8bc; border-radius: 50%; position: relative; margin-bottom: 20px; }
.empty-orbit::after { content: ""; position: absolute; inset: 12px; border: 1px solid #ded8ce; border-radius: 50%; }
.empty-orbit span { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); top: 5px; left: 31px; }
.insight-content { padding-top: 30px; }
.analysis-text { font-family: Georgia, "Noto Serif KR", serif; color: #38352f; font-size: 15px; line-height: 1.9; white-space: pre-wrap; }
.analysis-text a { color: var(--accent); text-underline-offset: 3px; }
.metadata-section { margin-top: 35px; border-top: 1px solid var(--line); padding-top: 20px; }
.metadata-row { display: flex; justify-content: space-between; gap: 15px; font-size: 12px; }
.metadata-label { color: var(--muted); }
.metadata-row strong { color: var(--accent); }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.tag { border: 1px solid #cfc8bc; border-radius: 999px; padding: 5px 9px; color: #716b62; font-size: 11px; }
.potential-box { background: var(--accent-soft); border-radius: 10px; padding: 15px 17px; margin-top: 18px; }
.potential-box span { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.potential-box p { margin: 7px 0 0; color: #405148; font-size: 13px; line-height: 1.7; }
.app-message { min-height: 20px; margin: 22px 0 0; color: var(--danger); font-size: 12px; line-height: 1.6; }

.login-view { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #fbfaf6, var(--paper-deep)); padding: 24px; }
.login-card { width: min(390px, 100%); padding: 48px 42px; text-align: center; background: rgba(255,253,249,.88); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(62,55,45,.09); }
.login-card .brand-mark { margin: 0 auto 26px; }
.login-card h1 { margin: 0; font-family: Georgia, "Noto Serif KR", serif; font-size: 24px; font-weight: 500; }
.login-copy { margin: 12px 0 28px; color: var(--muted); font-size: 13px; }
.login-card input { width: 100%; border: 1px solid var(--line); background: white; border-radius: 9px; padding: 13px 14px; outline: 0; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(52,91,76,.08); }
.login-card .primary-button { width: 100%; margin-top: 11px; }
.form-error { min-height: 18px; color: var(--danger); font-size: 12px; margin: 12px 0 0; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 230px 1fr; }
  .insight-panel { grid-column: 2; min-height: auto; border-top: 1px solid var(--line); }
  .empty-insight { min-height: 300px; }
}

@media (max-width: 700px) {
  .app-shell { display: block; }
  .library-panel { min-height: auto; padding: 16px; }
  .brand-row { margin-bottom: 15px; }
  .new-record-button { width: 100%; }
  .search-box, .library-heading, .record-list, .logout-button { display: none; }
  .editor-panel { min-height: 72vh; border-right: 0; }
  .editor-header { height: 65px; padding: 12px 18px; }
  .writing-surface { padding: 35px 23px 20px; }
  .content-input { min-height: 330px; font-size: 16px; }
  .editor-footer { padding: 16px 18px; }
  .analyze-button { min-width: 0; }
  .insight-panel { min-height: 55vh; padding: 27px 23px; }
}
