:root { --forest: #17221b; --forest-2: #24342a; --sage: #6f8570; --sage-soft: #e6ece3; --cream: #f6f0e6; --gold: #c9a45c; --gold-2: #e8cf96; --ink: #1b241e; --muted: #6b746c; --line: #e3ddd1; --danger: #b44a3c; --white: #fff; }
* { box-sizing: border-box; }
body { margin: 0; font-family: "Manrope", system-ui, sans-serif; background: #f3efe7; color: var(--ink); font-size: 15px; }
h1, h2, h3 { font-family: "Cormorant Garamond", serif; font-weight: 600; margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 12px; border: 1px solid transparent; font-weight: 600; font-size: 14px; text-decoration: none; transition: transform .2s, background .2s, box-shadow .2s; }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--forest); color: var(--cream); }
.btn--primary:hover { background: #2a3d30; box-shadow: 0 8px 20px -8px rgba(23,34,27,.5); }
.btn--primary:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn--ghost { background: var(--white); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--sage); }
.btn--danger { background: #fbeceb; color: var(--danger); }
.btn--link { background: none; color: var(--muted); }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 70% 20%, #2c3f31, var(--forest) 60%); }
.login[hidden] { display: none; }
.login__card { width: min(400px, 100%); background: var(--cream); border-radius: 24px; padding: 40px 32px; text-align: center; box-shadow: 0 40px 80px -20px rgba(0,0,0,.5); }
.login__logo { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 16px; }
.login__card h1 { font-size: 34px; }
.login__card p { color: var(--muted); margin: 6px 0 24px; }
.login__card label { display: block; text-align: left; font-weight: 600; font-size: 13px; margin-bottom: 18px; }
.login__card input { width: 100%; margin-top: 6px; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.login__card .btn { width: 100%; padding: 14px; }
.login__err { color: var(--danger) !important; min-height: 20px; margin: 12px 0 0 !important; }
.login__back { color: var(--muted); font-size: 13px; text-decoration: none; }

/* layout */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.app[hidden] { display: none; }
.side { background: var(--forest); color: var(--cream); padding: 22px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 22px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 14px; }
.side__brand img { width: 42px; height: 42px; border-radius: 50%; }
.side__brand strong { font-family: "Cormorant Garamond", serif; font-size: 22px; display: block; line-height: 1; }
.side__brand small { color: var(--gold-2); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav button { text-align: left; background: none; border: 0; color: #c9d3c7; padding: 11px 14px; border-radius: 10px; font-weight: 500; display: flex; gap: 12px; align-items: center; }
.side nav button span { width: 22px; text-align: center; }
.side nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav button.is-active { background: var(--gold); color: var(--forest); font-weight: 700; }
.side__foot { display: grid; gap: 8px; padding-top: 16px; }
.side__foot .btn--ghost { background: transparent; color: var(--cream); border-color: rgba(255,255,255,.2); }
.side__foot .btn--link { color: #a9b5a9; }

.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 18px 32px; background: rgba(243,239,231,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 30px; line-height: 1.1; }
.top > div:nth-child(2) { flex: 1; min-width: 0; }
.top__actions { display: flex; align-items: center; gap: 14px; }
.top__menu { display: none; background: var(--white); border: 1px solid var(--line); border-radius: 10px; width: 42px; height: 42px; font-size: 18px; }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.status { font-size: 13px; color: var(--muted); white-space: nowrap; }
.status.dirty { color: #a66b00; font-weight: 600; }

.content { padding: 28px 32px 80px; max-width: 1100px; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 24px; margin-bottom: 20px; }
.card h3 { font-size: 22px; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field--full { grid-column: 1 / -1; }
.field > span { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.field input[type=text], .field input[type=number], .field textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fcfbf8; transition: border .2s, box-shadow .2s; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px rgba(111,133,112,.18); background: #fff; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field small { color: var(--muted); font-size: 12px; }
.field--price input { font-size: 22px; font-weight: 700; color: var(--forest); }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--forest); }

.img-field { display: flex; gap: 14px; align-items: center; }
.img-field__thumb { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; background: var(--sage-soft); border: 1px solid var(--line); flex: none; }
.img-field__btns { display: flex; flex-wrap: wrap; gap: 8px; }

.list { display: grid; gap: 16px; }
.item { background: var(--white); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.item__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #faf7f1; border-bottom: 1px solid var(--line); }
.item__head strong { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__head img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.item__tools { display: flex; gap: 4px; }
.item__tools button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 14px; }
.item__tools button:hover { border-color: var(--sage); }
.item__tools button.del:hover { background: #fbeceb; color: var(--danger); border-color: #f0c9c4; }
.item__body { padding: 18px; }
.item.is-collapsed .item__body { display: none; }

.strings { display: grid; gap: 8px; }
.strings__row { display: flex; gap: 8px; }
.strings__row input { flex: 1; }
.strings__row button { width: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }

.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.imgs__cell { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.imgs__cell img { width: 100%; height: 100%; object-fit: cover; }
.imgs__cell button { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; }
.imgs__add { aspect-ratio: 1; border-radius: 12px; border: 2px dashed var(--line); background: #fcfbf8; color: var(--muted); font-weight: 600; }
.imgs__add:hover { border-color: var(--sage); color: var(--forest); }

.add-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15,22,17,.6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__card { background: var(--cream); border-radius: 22px; width: min(980px, 100%); max-height: 88vh; display: flex; flex-direction: column; padding: 22px; }
.modal__card header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.modal__card header > div { display: flex; gap: 8px; flex-wrap: wrap; }
.modal__card h2 { font-size: 28px; }
.media-grid { overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; padding: 2px; }
.media { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; cursor: pointer; border: 2px solid transparent; background: #ddd; }
.media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.media:hover { border-color: var(--gold); }
.media:hover img { transform: scale(1.05); }
.media .del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; opacity: 0; transition: opacity .2s; }
.media:hover .del { opacity: 1; }
.media-grid.is-library .media { cursor: default; }

.uploading { display: grid; place-items: center; aspect-ratio: 1; border-radius: 14px; background: var(--sage-soft); color: var(--forest); font-weight: 600; font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); background: var(--forest); color: var(--cream); padding: 13px 22px; border-radius: 12px; font-weight: 600; transition: transform .4s cubic-bezier(.2,.8,.2,1); z-index: 60; box-shadow: 0 16px 40px -10px rgba(0,0,0,.4); }
.toast.show { transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 30; transform: translateX(-100%); transition: transform .35s; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.4); }
  .top { padding: 12px 16px; flex-wrap: wrap; }
  .top__menu { display: block; }
  .top h1 { font-size: 24px; }
  .top__actions { width: 100%; justify-content: space-between; }
  .content { padding: 18px 16px 80px; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .img-field { flex-direction: column; align-items: flex-start; }
}
