/* foliovilla admin — clean, calm look */
:root {
  --bg: #f4f2ef; --card: #fff; --ink: #222; --muted: #6b6762; --line: #e3dfd9;
  --accent: #6b2f2f; --accent-ink: #fff; --warn: #a45a00; --warn-bg: #fff4e2; --danger: #b3261e; --ok-bg: #eaf6ec; --ok: #1e6b35;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 0; font-weight: 600; }
h2 { font-size: 17px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin: 0 0 10px 0; }
code { font-size: 12px; background: #f1eee9; padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.warntext { color: var(--warn); }

/* top bar */
.topbar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 10px 22px; background: #2a2523; color: #fff; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; letter-spacing: .3px; }
.brand span { font-weight: 400; opacity: .6; }
.mainnav { display: flex; gap: 4px; flex-wrap: wrap; }
.mainnav a { color: #e9e4df; text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.mainnav a:hover { background: rgba(255,255,255,.1); }
.mainnav a.on { background: #fff; color: #2a2523; }
.topbar .right { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.topbar .viewsite { color: #f3e2c4; text-decoration: none; }
.linkbtn { background: none; border: 0; color: #e9e4df; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 22px 22px 80px; }
.pagehead { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; margin: 6px 0 16px; }
.pagehead p { width: 100%; margin: 4px 0 0; }
.crumbs { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin: 0 0 18px; }
.card.two { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.card.narrow { max-width: 460px; }
.note { background: var(--warn-bg); border: 1px solid #f1d4a6; border-radius: 10px; padding: 12px 16px; margin: 0 0 18px; }
.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 12px; background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe3c8; }
.flash.error { background: #fdecea; color: var(--danger); border-color: #f5c2bd; }

/* forms */
label { display: block; margin: 0 0 14px; font-weight: 500; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input[type=text], input[type=password], input[type=url], input[type=date], input[type=email], select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; color: inherit;
  border: 1px solid #cfc9c2; border-radius: 7px; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c79b6d; outline-offset: 0; border-color: #c79b6d; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row input[type=text] { width: auto; flex: 1; margin: 0; }
form.inline { display: inline; margin: 0; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: 7px; border: 1px solid #cfc9c2; background: #fff;
  color: var(--ink); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #9b948c; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.danger { background: #fff; color: var(--danger); border-color: #e7b3ae; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }
.iconbtn { width: 30px; height: 30px; border-radius: 6px; border: 1px solid #d9d3cc; background: #fff; cursor: pointer; font-size: 14px; line-height: 1; color: var(--ink); }
.iconbtn:hover:not([disabled]) { border-color: #9b948c; }
.iconbtn[disabled] { opacity: .3; cursor: default; }
.iconbtn.danger { color: var(--danger); }
.filebtn { position: relative; overflow: hidden; }
.filebtn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 20px; background: #eee9e3; color: var(--muted); margin-left: 6px; font-weight: 500; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }

/* artworks overview */
.group-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.actions { display: inline-flex; gap: 4px; align-items: center; }
.series-list { list-style: none; margin: 0; padding: 0; }
.series-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-top: 1px solid #f0ece7; }
.series-name { flex: 1 1 auto; min-width: 0; text-decoration: none; font-weight: 500; }
.series-name:hover { text-decoration: underline; }
.series-row .meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
details.pop { position: relative; }
details.pop summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; }
details.pop summary::-webkit-details-marker { display: none; }
.popbody { position: absolute; right: 0; top: 36px; z-index: 5; width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.popbody form { margin: 0 0 10px; }

/* series page: artwork cards */
.works-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 0 0 18px; }
.work-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.work-card.missing { border: 2px dashed #e0b670; }
.thumbbox { height: 170px; background: #1d1918; display: flex; align-items: center; justify-content: center; }
.thumbbox img { max-width: 100%; max-height: 100%; display: block; }
.nophoto { color: #d6b88d; font-size: 14px; letter-spacing: .3px; }
.nophoto.big { height: 340px; display: flex; align-items: center; justify-content: center; background: #1d1918; border-radius: 8px; margin-bottom: 12px; }
.work-text { padding: 10px 12px 4px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.work-actions { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; padding: 8px 12px 12px; }
.work-card:target { box-shadow: 0 0 0 3px #c79b6d; }

.work-edit { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.work-edit .preview img { width: 100%; height: auto; display: block; border-radius: 6px; margin-bottom: 12px; background: #1d1918; }

/* image slots (contact / news) */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.imgslot { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.imgslot img { max-width: 100%; max-height: 140px; object-fit: contain; align-self: flex-start; }
.imgslot .slotlabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.imgslot input[type=file] { font-size: 13px; }
.dangerzone { border-color: #f0c9c5; }

table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 9px 8px; border-top: 1px solid #f0ece7; vertical-align: top; }
table.list th { font-size: 13px; color: var(--muted); font-weight: 500; border-top: 0; }

/* login */
.loginbox { max-width: 380px; margin: 9vh auto 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 30px 30px 20px; }
.loginbox h1 { font-size: 28px; margin-bottom: 4px; }

/* busy overlay while uploading */
#busy { position: fixed; inset: 0; background: rgba(30,25,24,.55); z-index: 100; display: flex; align-items: center; justify-content: center; }
#busy[hidden] { display: none; }
.busybox { background: #fff; border-radius: 12px; padding: 24px 30px; text-align: center; min-width: 260px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 10px; border: 3px solid #e7e1da; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 760px) {
  .card.two, .work-edit { grid-template-columns: 1fr; }
  .topbar { padding: 10px 12px; }
  .wrap { padding: 16px 12px 60px; }
  .series-row { flex-wrap: wrap; }
  .popbody { width: 280px; }
}
