:root { --cream:#f6f0e4; --paper:#fbf8f1; --gold:#c99a2e; --gold-deep:#9c7520; --ink:#2c302b; --ink-2:#5a5e56; --line:rgba(44,48,43,.14); --red:#a8432f; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: "Jost", sans-serif; font-size: 15px; }
[hidden] { display: none !important; }
h1, h2 { font-family: "Cormorant", Georgia, serif; font-weight: 600; margin: 0; }
label { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); margin-bottom: .4rem; }
input, select { font: inherit; width: 100%; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: transparent; }
.btn { font: inherit; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 500; background: var(--ink); color: var(--cream); border: 0; border-radius: 999px; padding: .85rem 1.6rem; cursor: pointer; transition: background .25s, transform .2s; }
.btn:hover { background: var(--gold-deep); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: wait; }
.err { color: var(--red); font-size: .9rem; min-height: 1.2em; margin: .6rem 0 0; }
.ghost { font: inherit; background: none; border: 1px solid var(--line); border-radius: 999px; padding: .55rem 1rem; color: var(--ink); cursor: pointer; text-decoration: none; font-size: .85rem; }
.ghost:hover { border-color: var(--gold); color: var(--gold-deep); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card { width: 100%; max-width: 380px; background: var(--paper); padding: 2.4rem; border-radius: 20px; box-shadow: 0 30px 70px -40px rgba(36,39,42,.5); text-align: center; }
.login-card img { margin: -1rem auto .4rem; border-radius: 50%; }
.login-card h1 { font-size: 2rem; }
.login-card > p { color: var(--ink-2); margin: .3rem 0 1.6rem; }
.login-card label { text-align: left; }
.login-card .btn { width: 100%; margin-top: .6rem; }
.back { display: inline-block; margin-top: 1.2rem; color: var(--ink-2); font-size: .88rem; text-decoration: none; }

.top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; padding: .9rem clamp(1rem, 4vw, 2.5rem); background: rgba(246,240,228,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; font-family: "Cormorant", serif; font-size: 1.4rem; font-weight: 600; }
.brand img { border-radius: 50%; }
.brand small { font-family: "Jost", sans-serif; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-deep); margin-left: .4rem; font-weight: 500; }
.top-actions { display: flex; gap: .5rem; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2.5rem) 4rem; display: grid; gap: 1.6rem; }
.panel { background: var(--paper); border-radius: 18px; padding: 1.8rem; border: 1px solid var(--line); }
.panel h2 { font-size: 1.8rem; margin-bottom: 1rem; }
.panel-head p { color: var(--ink-2); margin: -.5rem 0 1.4rem; }
#count { color: var(--gold-deep); font-style: italic; font-weight: 500; }

.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 2.2rem 1rem; border: 1.5px dashed rgba(156,117,32,.45); border-radius: 14px; text-align: center; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--ink); transition: background .2s, border-color .2s; margin-bottom: 1.2rem; }
.drop:hover, .drop.over { background: rgba(201,154,46,.07); border-color: var(--gold); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-title { font-family: "Cormorant", serif; font-size: 1.5rem; font-weight: 600; }
.drop-title u { color: var(--gold-deep); }
.drop-sub { color: var(--ink-2); font-size: .85rem; }
.drop-files { color: var(--gold-deep); font-size: .88rem; margin-top: .4rem; }
.row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.row > div { min-width: 160px; }
.row .grow { flex: 1; min-width: 220px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .25s, opacity .25s; }
.card:hover { box-shadow: 0 16px 34px -24px rgba(36,39,42,.5); }
.card.busy { opacity: .5; pointer-events: none; }
.thumb { position: relative; aspect-ratio: 4/5; background: var(--cream); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.hero-flag { position: absolute; top: .6rem; left: .6rem; background: var(--gold); color: #fff; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; padding: .3rem .6rem; border-radius: 999px; }
.pos { position: absolute; top: .6rem; right: .6rem; background: rgba(44,48,43,.75); color: #fff; font-size: .75rem; padding: .2rem .55rem; border-radius: 999px; }
.card-body { padding: .9rem; display: grid; gap: .55rem; }
.card-body input, .card-body select { padding: .55rem .7rem; font-size: .9rem; }
.tools { display: flex; gap: .35rem; }
.tools button { flex: 1; font: inherit; font-size: .95rem; background: var(--cream); border: 1px solid transparent; border-radius: 8px; padding: .45rem 0; cursor: pointer; color: var(--ink); }
.tools button:hover { border-color: var(--gold); }
.tools button.on { background: var(--gold); color: #fff; }
.tools button.del:hover { border-color: var(--red); color: var(--red); }
.tools button:disabled { opacity: .35; cursor: default; }
.empty { text-align: center; color: var(--ink-2); font-family: "Cormorant", serif; font-style: italic; font-size: 1.3rem; }
.skel { aspect-ratio: 4/6; border-radius: 14px; background: linear-gradient(100deg, #efe6d4 30%, #f7efdf 50%, #efe6d4 70%); background-size: 300% 100%; animation: sh 1.5s infinite; }
@keyframes sh { to { background-position: -150% 0; } }

.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 150%); background: var(--ink); color: var(--cream); padding: .8rem 1.3rem; border-radius: 999px; font-size: .9rem; transition: transform .35s cubic-bezier(.2,.7,.2,1); z-index: 50; }
.toast.show { transform: translate(-50%, 0); }
.toast.bad { background: var(--red); }
@media (max-width: 560px) {
  body { font-size: 16px; }
  input, select, .card-body input, .card-body select { font-size: 16px; }
  .brand small { display: none; }
  .brand { font-size: 1.2rem; gap: .5rem; }
  .brand img { width: 34px; height: 34px; }
  .top { padding: .7rem 1rem; gap: .6rem; }
  .ghost { padding: .5rem .8rem; font-size: .8rem; white-space: nowrap; }
  .wrap { padding: 1.2rem .85rem 3rem; gap: 1.1rem; }
  .panel { padding: 1.2rem; border-radius: 14px; }
  .panel h2 { font-size: 1.55rem; }
  .login-card { padding: 2rem 1.4rem; }
  .row > div, .row .grow { min-width: 0; width: 100%; flex: 1 1 100%; }
  .row .btn { width: 100%; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .card-body { padding: .6rem; gap: .45rem; }
  .tools button { padding: .55rem 0; }
}
@media (max-width: 340px) { .photos { grid-template-columns: 1fr; } }
