* { box-sizing: border-box; }
:root { color-scheme: light; font: 16px/1.55 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif; background: #edf1ee; color: #172b26; --ink: #172b26; --muted: #536861; --line: #d3ded7; --white: #fff; --green: #244f3c; --lime: #d4ed9e; }
body { margin: 0; display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select { min-height: 42px; }
button { cursor: pointer; border: 1px solid var(--line); border-radius: 8px; padding: .48rem .84rem; background: var(--white); font-weight: 650; }
button:hover:not(:disabled) { border-color: #7e9e89; background: #e9f0e9; }
button:disabled { opacity: .55; cursor: wait; }
button.primary { background: var(--lime); border-color: transparent; color: #203327; }
button.primary:hover:not(:disabled) { background: #bfe182; }
a { color: var(--green); font-weight: 650; text-underline-offset: 3px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { width: 100%; min-width: 0; padding: .54rem .7rem; background: white; border: 1px solid var(--line); border-radius: 8px; }
input[type=checkbox] { width: 1.12rem; height: 1.12rem; accent-color: var(--green); flex: none; }
:focus-visible { outline: 3px solid #3e8761; outline-offset: 3px; }
[hidden] { display: none !important; }
h1,h2,h3,p { margin: 0; }
h1,h2,h3 { line-height: 1.25; letter-spacing: -.035em; }
.sidebar { position: sticky; top: 0; height: 100dvh; padding: 1.65rem 1rem 1rem; background: var(--ink); color: #e9f3eb; display: flex; flex-direction: column; overflow: auto; }
.brand, .mobile-brand { display: flex; align-items: center; gap: .62rem; font-size: 1.24rem; font-weight: 800; letter-spacing: -.06em; }
.brand { padding: 0 .52rem 1.85rem; }
.brand-mark { display: inline-block; position: relative; width: 31px; height: 31px; border-radius: 9px 9px 9px 3px; background: var(--lime); flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; left: 8px; width: 15px; height: 2px; border-radius: 2px; background: var(--ink); top: 10px; transform: rotate(-17deg); }
.brand-mark::after { width: 11px; top: 17px; }
.sidebar nav { display: grid; gap: .2rem; }
.nav-heading { color: #aac0b3; font-size: .83rem; margin: 1.45rem .6rem .45rem; }
.nav-button { display: flex; align-items: center; text-align: left; gap: .6rem; width: 100%; border: 1px solid transparent; background: transparent; color: #dce9e0; font-weight: 550; padding: .42rem .58rem; }
.nav-button:hover:not(:disabled) { background: #29473d; color: white; border-color: transparent; }
.nav-button[aria-pressed=true] { background: #34483a; color: var(--lime); border-color: #586746; }
.nav-icon { width: 1.4em; text-align: center; font-size: 1.07rem; }
.nav-count { margin-left: auto; color: inherit; opacity: .75; font-size: .85rem; }
.side-bottom { margin-top: auto; padding-top: 1rem; }
main { min-width: 0; }
.toolbar { position: sticky; top: 0; z-index: 2; background: #f9fbf9; border-bottom: 1px solid var(--line); padding: .88rem clamp(1rem, 4vw, 3.4rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.mobile-brand { display: none; }
.search { display: flex; gap: .62rem; align-items: center; width: min(100%, 370px); color: var(--muted); }
.search input { background: #edf2ee; border: 0; }
.search span { width: 13px; height: 13px; border: 1.8px solid currentColor; border-radius: 50%; position: relative; flex: none; }
.search span::after { content: ""; position: absolute; right: -5px; bottom: -3px; width: 6px; height: 2px; background: currentColor; transform: rotate(45deg); }
#new { white-space: nowrap; }
.library { max-width: 1540px; margin: auto; padding: 2.8rem clamp(1rem, 4vw, 3.4rem) 5rem; }
.library-header { display: flex; align-items: end; justify-content: space-between; gap: .8rem; margin-bottom: 1.6rem; }
h1 { font-size: clamp(2rem, 3.5vw, 3.3rem); font-weight: 850; }
#count { margin-top: .38rem; color: var(--muted); }
.sort { display: flex; align-items: center; gap: .45rem; color: var(--muted); white-space: nowrap; }
.tag-filter:empty { display: none; }
.tag-filter { margin-bottom: .85rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 278px), 1fr)); align-items: start; gap: 1.15rem; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; min-width: 0; }
.cover { display: block; width: 100%; height: 147px; border: 0; border-radius: 0; background: #dbe8df; padding: 0; text-align: left; overflow: hidden; color: var(--green); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-fallback { display: grid; place-items: center; height: 100%; font-size: 3.15rem; font-weight: 750; }
.card-copy { padding: 1.02rem; }
.card-meta, .card-actions, .tag-list, .checks, .file-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.card-meta { margin-bottom: .6rem; color: var(--muted); font-size: .84rem; }
.pill, .tag { display: inline-flex; align-items: center; border: 0; border-radius: 6px; min-height: 0; padding: .19rem .47rem; font-size: .81rem; font-weight: 700; background: #e5eee7; color: #244f3c; }
.pill.saved { color: #304f68; background: #e0ecf4; }
.card-title { padding: 0; min-height: 0; border: 0; background: none; text-align: left; font-size: 1.22rem; font-weight: 800; line-height: 1.36; overflow-wrap: anywhere; }
.card-title:hover:not(:disabled) { background: none; text-decoration: underline; }
.card-caption { color: var(--muted); margin: .55rem 0 .76rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.card-actions { margin-top: .85rem; border-top: 1px solid #e2e9e4; padding-top: .7rem; justify-content: space-between; }
.card-actions div { display: flex; gap: .35rem; }
.icon { padding: 0 .4rem; width: 42px; font-size: 1.3rem; line-height: 1; }
.icon[aria-pressed=true] { background: #eef4da; color: #315619; }
.empty { grid-column: 1/-1; color: var(--muted); padding: 3rem 1rem; border: 1px dashed #a8bdb0; border-radius: 12px; text-align: center; }
.message { color: var(--green); overflow-wrap: anywhere; margin-top: .45rem; }
.message:empty { display: none; }
dialog { color: inherit; padding: 0; border: 1px solid var(--line); border-radius: 16px; width: min(650px, calc(100% - 1.5rem)); max-height: calc(100dvh - 2rem); background: #fbfdfa; }
dialog::backdrop { background: rgb(12 31 25 / 55%); }
#record { width: min(850px, calc(100% - 1.5rem)); }
.dialog-head, .dialog-foot { padding: 1rem 1.3rem; background: #fbfdfa; position: sticky; z-index: 1; display: flex; align-items: center; gap: .55rem; }
.dialog-head { top: 0; justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-foot { bottom: 0; justify-content: end; border-top: 1px solid var(--line); }
.dialog-body { display: grid; gap: .88rem; padding: 1.2rem 1.3rem; }
.dialog-body > label, .fields > label { display: grid; gap: .27rem; font-weight: 650; }
.fields { display: grid; grid-template-columns: 1fr 1.5fr; gap: .65rem; }
.checks label, .recipe-item, .file-option { display: flex; align-items: flex-start; gap: .4rem; }
.draft-preview, .note, .facts, .reader { padding: .85rem; border-radius: 8px; background: #eaf0e9; overflow-wrap: anywhere; }
.draft-preview p { margin-top: .28rem; color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
#draft-files { display: grid; gap: .42rem; max-height: 12rem; overflow: auto; }
.reader { white-space: pre-wrap; line-height: 1.8; max-width: 74ch; }
.note { white-space: pre-wrap; }
.record-actions { display: flex; gap: .45rem; flex-wrap: wrap; align-items: center; }
.record-section { display: grid; gap: .65rem; }
.record-section + .record-section { border-top: 1px solid var(--line); padding-top: 1rem; }
.record-section > summary { cursor: pointer; font-size: 1.08rem; font-weight: 780; }
.recipe-columns { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 1.4fr); gap: 1.15rem; }
.recipe-columns h3 { margin-bottom: .5rem; }
.recipe-columns ol, .recipe-columns ul { margin: 0; padding-left: 1.4rem; }
.recipe-columns ul { list-style: none; padding: 0; }
.recipe-columns li { margin-bottom: .45rem; }
.recipe-item:has(input:checked) span { text-decoration: line-through; color: var(--muted); }
.media-row { border-top: 1px solid #e2e9e4; display: flex; align-items: center; justify-content: space-between; gap: .55rem; flex-wrap: wrap; padding: .5rem 0; }
.media-label { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.media-preview { width: 60px; height: 43px; object-fit: cover; border-radius: 5px; }
.saved-asset img, .saved-asset video { display: block; max-width: 100%; max-height: 420px; border-radius: 7px; }
.saved-asset audio { display: block; width: min(100%, 360px); }
.saved-asset { margin-bottom: .6rem; }
.muted { color: var(--muted); }
@media (max-width: 760px) {
  body { display: block; }
  .sidebar { position: static; height: auto; padding: .5rem .7rem; }
  .sidebar nav { display: flex; overflow: auto; align-items: center; }
  .sidebar nav + .nav-heading { margin: .3rem .45rem 0; }
  .nav-button { flex: none; width: auto; gap: .35rem; padding: .26rem .45rem; min-height: 38px; }
  .brand { padding: .36rem .35rem .6rem; }
  .side-bottom { padding: 0; }
  .toolbar { gap: .6rem; padding: .66rem .8rem; }
  .search { gap: .45rem; }
  .library { padding-top: 1.35rem; }
  .cards { gap: .75rem; }
}
@media (max-width: 495px) {
  .recipe-columns, .fields { grid-template-columns: 1fr; }
  .dialog-head,.dialog-body,.dialog-foot { padding-left: .8rem; padding-right: .8rem; }
  .sort > span { display: none; }
  .cover { height: 137px; }
}

.toolbar { justify-content: flex-start; }
.search { margin-right: auto; }
#jobs, #resume { white-space: nowrap; }
#download-list, #draft-list { gap: 0; }
.job-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .8rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.job-row:last-child { border-bottom: 0; }
.job-row p, .job-row strong { overflow-wrap: anywhere; }
.job-actions { align-self: start; display: flex; gap: .4rem; align-items: center; }
.pill.failed { background: #f7e2d7; color: #783b22; }
.share-context { display: flex; flex-wrap: wrap; gap: .45rem 1rem; }
@media (max-width: 690px) {
  .toolbar { flex-wrap: wrap; }
  .search { width: 100%; max-width: none; }
}
@media (max-width: 440px) {
  .toolbar > button { padding: .42rem .56rem; font-size: .9rem; }
  .job-row { grid-template-columns: 1fr; }
}

.mode-options { display: flex; flex-wrap: wrap; gap: .4rem .85rem; }
.mode-options label { display: flex; align-items: center; gap: .3rem; font-weight: 650; min-height: 42px; }
.mode-options input { width: 1.05rem; height: 1.05rem; accent-color: var(--green); }
#trash-open { margin-top: .25rem; }
.danger { color: #883c30; }
.saved-asset .file-actions { margin-top: .55rem; }
@media (max-width: 760px) { #trash-open { margin-left: .35rem; } }


.display-options { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: end; }
.cards.list { display: grid; grid-template-columns: minmax(0, 1fr); }
.cards.list .card { display: grid; grid-template-columns: 128px minmax(0,1fr); }
.cards.list .cover { height: 100%; min-height: 126px; }
.cards.list .card-copy { padding: .8rem; }
.cards.list .card-caption { min-height: 0; -webkit-line-clamp: 2; }
.cards.list .card-actions { margin-top: .45rem; padding-top: .35rem; }
.download-progress { width: 100%; display: grid; gap: .25rem; grid-column: 1 / -1; }
.download-progress progress { width: 100%; height: .75rem; accent-color: var(--green); }
#pin, #pin-confirm, #current-pin { letter-spacing: .5em; }
@media (max-width: 495px) {
  .cards.list .card { grid-template-columns: 84px minmax(0,1fr); }
  .display-options { justify-content: start; }
  .library-header { align-items: start; flex-direction: column; }
  .side-bottom { display: flex; flex-wrap: wrap; }
}
