:root {
  --blue: #124ceb; --blue-soft: #f0f5ff; --blue-line: #c9d8ff; --navy: #162260; --navy-2: #253687; --amber: #ffb000;
  --green: #11b20d; --orange: #f06a00; --red: #e5383b;
  --ink: #222; --sub: #555; --muted: #999; --line: #e9e9e9; --bg: #f5f6f8;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", sans-serif; word-break: keep-all; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 60px; }
.logo { font-size: 20px; font-weight: 900; letter-spacing: -.06em; }
.logo__a { color: var(--navy-2); } .logo__b { color: var(--amber); }

.btn { height: 46px; padding: 0 22px; border: 0; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 700; font-size: 15px; }
.btn:hover { background: #0b3fd0; }
.btn:disabled { opacity: .55; cursor: default; }
.btn--sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn--line { background: #fff; color: var(--ink); border: 1px solid #d9dce3; }
.btn--line:hover { background: #fafafa; }
.btn--danger { color: var(--red); }
.msg { font-size: 13.5px; min-height: 1.3em; }
.msg.err { color: var(--red); font-weight: 600; }
.msg.ok { color: var(--green); font-weight: 600; }

/* 로그인 */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__box { width: min(360px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 26px; display: grid; gap: 14px; box-shadow: 0 6px 30px rgba(20, 40, 100, .07); }
.login__box h1 { font-size: 18px; color: var(--sub); font-weight: 600; margin-bottom: 4px; }

.field { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--sub); min-width: 0; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #d9dce3; border-radius: 8px; padding: 10px 12px; font-size: 16px; font-weight: 400; color: var(--ink); background: #fff; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(18, 76, 235, .1); }
.field.invalid input { border-color: var(--red); }
.unit { position: relative; display: block; }
.unit input { padding-right: 46px; }
.unit em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 13px; }
.read { color: var(--blue) !important; font-weight: 600 !important; min-height: 1.2em; }

/* 상단 */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); }
.top__title { font-weight: 700; color: var(--sub); margin-right: auto; padding-left: 12px; border-left: 1px solid var(--line); }
.top__link { border: 0; background: none; padding: 0; font-size: 13.5px; color: var(--sub); }
.top__link:hover { color: var(--blue); }

.warn { margin-top: 16px; background: #fff6df; color: #7a5200; border-radius: 10px; padding: 12px 14px; font-size: 13.5px; line-height: 1.6; }
.warn b { color: #5c3d00; }

.info { margin-top: 16px; background: #effaf3; color: #1d5b37; border-radius: 10px; padding: 12px 14px; font-size: 13.5px; line-height: 1.65; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 12px; flex-wrap: wrap; }
.bar__tabs { display: flex; gap: 4px; }
.bar__tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 16px; font-weight: 600; color: var(--muted); font-size: 14px; }
.bar__tabs button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.bar__tabs em { font-style: normal; font-size: 12px; opacity: .8; margin-left: 2px; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; transition: border-color .15s; }
.item:hover { border-color: var(--blue-line); }
.item.is-hidden { opacity: .6; }
.item__ph { width: 96px; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: linear-gradient(160deg, #e7eefc, #cbd9f7); display: grid; place-items: center; color: #7d93c9; font-size: 12px; position: relative; }
.item__ph img { width: 100%; height: 100%; object-fit: cover; }
.item__ph b { position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; }
.item__no { font-size: 12px; color: var(--muted); }
.item__name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__price { font-size: 15px; font-weight: 800; }
.item__price .d--매매 { color: var(--blue); } .item__price .d--전세 { color: var(--green); } .item__price .d--월세 { color: var(--orange); }
.item__meta { font-size: 12.5px; color: var(--sub); }
.item__state { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; background: #e8f7e8; color: #138a10; white-space: nowrap; }
.item.is-hidden .item__state { background: #eee; color: #777; }
.item > div { min-width: 0; }
.empty { text-align: center; padding: 60px 0; color: var(--sub); }

/* 등록 시트 */
dialog { border: 0; padding: 0; }
dialog::backdrop { background: rgba(10, 16, 40, .55); }
.sheet { width: min(720px, 100%); max-height: min(92vh, 100%); border-radius: 16px; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
.sheet[open] { display: flex; flex-direction: column; }
.sheet form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sheet__head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.sheet__head h2 { font-size: 18px; font-weight: 800; }
.sheet__no { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); padding: 0 4px; }
.sheet__body { overflow-y: auto; padding: 6px 18px 18px; display: grid; gap: 4px; }
.sheet__foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.sheet__foot .msg { flex: 1; }

.sec { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
.sec h3 { font-size: 15px; font-weight: 800; display: inline; }
.sec h3 small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
details.sec summary { cursor: pointer; list-style: none; }
details.sec summary::-webkit-details-marker { display: none; }
details.sec summary::after { content: " ▾"; color: var(--muted); }
details.sec:not([open]) summary::after { content: " ▸"; }
details.sec[open] { gap: 12px; }
details.sec > :not(summary) { margin-top: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); padding: 3px; border-radius: 10px; }
.seg input, .chips input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 9px; border-radius: 8px; font-weight: 700; color: var(--sub); cursor: pointer; }
.seg input:checked + span { background: #fff; color: var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { display: block; padding: 6px 13px; border: 1px solid #d9dce3; border-radius: 16px; font-size: 14px; cursor: pointer; }
.chips input:checked + span { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.seg input:focus-visible + span, .chips input:focus-visible + span { outline: 2px solid var(--blue); }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.photos:empty { display: none; }
.ph { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--bg); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph button { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1; }
.ph .tag { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 3px; }
.ph.is-pending img { opacity: .55; }
.ph:first-child::after { content: "대표"; position: absolute; left: 4px; top: 4px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 3px; }
.add-photo { display: flex; align-items: center; justify-content: center; height: 52px; border: 1.5px dashed var(--blue-line); border-radius: 10px; color: var(--blue); font-weight: 700; cursor: pointer; background: var(--blue-soft); }
.add-photo input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.add-photo:focus-within { outline: 2px solid var(--blue); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.folder-link { font-size: 13.5px; font-weight: 700; color: #188038; justify-self: start; }

.toggle { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center; padding: 14px 0 4px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--blue); }
.toggle span { font-weight: 700; }
.toggle small { grid-column: 2; font-size: 12px; color: var(--muted); }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--navy); color: #fff; font-size: 14px; padding: 12px 18px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

@media (max-width: 640px) {
  .top__title { display: none; }
  .logo { margin-right: auto; }
  .item { grid-template-columns: 80px 1fr; }
  .item__ph { width: 80px; }
  .item__state { grid-column: 2; justify-self: start; }
  .sheet { max-height: 100%; height: 100%; max-width: 100%; border-radius: 0; }
}
