:root {
  --brand: #1F3A4D;
  --sea: #2A5066;
  --cream: #f7f1e6;
  --cream-deep: #efe4d2;
  --yolk: #e8a317;
  --yolk-deep: #c8880a;
  --ink: #1c2428;
  --muted: #5a656b;
  --white: #fffcf7;
  --card: #fffdf9;
  --line: rgba(28, 36, 40, 0.12);
  --ok: #1b6b45;
  --ok-bg: #e5f6ec;
  --err: #8a1f1f;
  --err-bg: #fdecec;
  --font: "Source Sans 3", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  font-size: 16.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sea); }
h1, h2, h3 { font-family: var(--display); color: var(--brand); letter-spacing: -0.02em; font-weight: 600; }
.wrap { width: min(1120px, calc(100% - 1.5rem)); margin-inline: auto; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.login-card {
  width: min(26rem, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem 1.5rem 1.5rem;
  box-shadow: 0 18px 50px rgba(31, 58, 77, 0.1);
}
.login-card img { display: block; width: min(14rem, 80%); height: auto; margin: 0 auto 1.25rem; }
.login-card h1 { text-align: center; font-size: 1.6rem; margin-bottom: .4rem; }
.login-card .intro { text-align: center; color: var(--muted); margin-bottom: 1.25rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .82rem; font-weight: 700; color: var(--muted); margin-bottom: .35rem; }
.field .hint { display: block; font-size: .8rem; color: var(--muted); margin-top: .3rem; font-weight: 400; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], input[type="tel"], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: 12px;
  padding: .7rem .8rem;
  font: inherit;
  color: var(--ink);
}
textarea { min-height: 6.5rem; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--sea);
  outline-offset: 1px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 999px; padding: .75rem 1.2rem;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; color: inherit;
}
.btn-primary { background: var(--yolk); color: var(--ink); }
.btn-primary:hover { background: #f0b02a; }
.btn-sea { background: var(--sea); color: #fff; }
.btn-ghost { background: transparent; border: 1.5px solid rgba(42,80,102,.25); color: var(--brand); }
.btn-danger { background: #f3d0d0; color: var(--err); }
.btn-sm { padding: .45rem .85rem; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-wide { width: 100%; }

.msg { border-radius: 12px; padding: .7rem .85rem; margin: .75rem 0; font-size: .95rem; }
.msg.ok { background: var(--ok-bg); color: var(--ok); }
.msg.err { background: var(--err-bg); color: var(--err); }
.msg.warn { background: #fff3cd; color: #7a5b00; }
.hidden { display: none !important; }

/* Admin shell */
.top {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247,241,230,.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .7rem 0;
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: .7rem;
}
.brand img { height: 3.1rem; width: auto; display: block; }
.brand small { display: block; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.top-actions { display: flex; flex-wrap: wrap; gap: .4rem; }

.layout {
  display: grid;
  grid-template-columns: 16.5rem 1fr;
  gap: 1.5rem;
  padding: 1.25rem 0 7rem;
  align-items: start;
}
.nav-side {
  position: sticky; top: 5.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .6rem;
}
.nav-side a {
  display: block;
  padding: .55rem .7rem;
  border-radius: 10px;
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
}
.nav-side a:hover, .nav-side a.active { background: var(--cream-deep); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.15rem 1.4rem;
  margin-bottom: 1.1rem;
  box-shadow: 0 10px 30px rgba(31,58,77,.06);
}
.panel h2 { font-size: 1.35rem; margin-bottom: .35rem; }
.panel .intro { color: var(--muted); margin-bottom: 1.1rem; }

.img-edit {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1rem;
  align-items: center;
  background: var(--cream);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: .8rem;
}
.img-edit > div:first-child {
  border-radius: 8px;
  padding: .35rem;
  min-height: 5rem;
  display: grid;
  place-items: center;
  background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 12px 12px;
}
.img-edit img, .img-edit .ph-img {
  width: 100%;
  max-height: 7.5rem;
  object-fit: contain;
  background: transparent;
  border-radius: 8px;
}
.img-edit .btn { width: max-content; display: inline-flex; }

.ph-img { height: 5rem; display: grid; place-items: center; color: var(--muted); font-size: .8rem; }

.list { display: grid; gap: .75rem; }
.list-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: .85rem;
  background: var(--white);
}
.list-toolbar {
  display: flex; justify-content: space-between; gap: .4rem; align-items: center;
  margin-bottom: .55rem;
}
.list-toolbar strong { font-size: .85rem; color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: .3rem; }

.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--brand);
  color: #fff;
  padding: .7rem 0;
  box-shadow: 0 -8px 24px rgba(0,0,0,.15);
}
.savebar .wrap { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.savebar .status { font-size: .95rem; opacity: .9; }
.savebar .btn-primary { box-shadow: 0 4px 14px rgba(232,163,23,.35); }
.save-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

.restore { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.restore select { width: auto; min-width: 16rem; background: var(--white); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .nav-side { position: static; display: flex; overflow-x: auto; gap: .25rem; }
  .nav-side a { white-space: nowrap; }
  .img-edit { grid-template-columns: 1fr; }
  .brand img { height: 2.6rem; }
  .savebar { padding: .65rem 0 calc(.65rem + env(safe-area-inset-bottom)); }
}
