:root {
  --cream: #faf8f4;
  --cream-2: #f1ede4;
  --ink: #171512;
  --gold: #b08d4a;
  --line: #e4ddcf;
  --muted: #7a7466;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
body { font-family: var(--sans); background: var(--cream); color: var(--ink); font-weight: 300; }
img { max-width: 100%; }
h2 { font-family: var(--serif); font-size: 30px; font-weight: 500; letter-spacing: .04em; margin-bottom: 22px; }
h3 { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-bottom: 14px; }
label { display: block; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }

.input, textarea.input, select.input {
  width: 100%; border: 1px solid var(--line); border-radius: 3px; background: #fff;
  padding: 11px 12px; font-family: var(--sans); font-size: 14px; color: var(--ink);
  outline: none; resize: vertical;
}
.input:focus { border-color: var(--gold); }
.btn-dark {
  background: var(--ink); color: #fff; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  padding: 13px 22px; border-radius: 3px; margin-top: 14px;
}
.btn-dark:hover { background: #2e2a24; }
.btn-ghost {
  background: none; border: 1px solid var(--line); color: var(--ink); cursor: pointer;
  font-family: var(--sans); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  padding: 9px 16px; border-radius: 3px;
}
.btn-danger { border-color: #d4b5b0; color: #a33; }
.w100 { width: 100%; }
.form-error { color: #a33; font-size: 13px; margin-top: 10px; min-height: 16px; }
.ok-msg { color: #4a7c48; font-size: 13px; margin-top: 10px; min-height: 16px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 360px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 40px 34px; text-align: center; }
.login-logo { height: 24px; margin-bottom: 10px; }
.login-sub { font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); margin-bottom: 26px; }
.login-card .input { margin-bottom: 12px; }

/* Layout */
.admin { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  padding: 26px 0; display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: 0; height: 100vh;
}
.side-logo { height: 18px; margin: 0 22px 10px; align-self: flex-start; }
.sidebar nav { display: flex; flex-direction: column; }
.side-link {
  background: none; border: none; text-align: left; cursor: pointer;
  font-family: var(--sans); font-size: 13px; letter-spacing: .08em;
  padding: 13px 22px; color: var(--muted);
  border-left: 2px solid transparent;
  display: flex; align-items: center; gap: 8px;
}
.side-link.active { color: var(--ink); border-left-color: var(--gold); background: var(--cream); }
.pill { background: var(--gold); color: #fff; border-radius: 20px; font-size: 10px; padding: 1px 8px; }
.pill:empty { display: none; }
.side-foot { margin-top: auto; padding: 0 22px; display: flex; flex-direction: column; gap: 10px; }
.side-view { background: none; border: none; cursor: pointer; text-align: left; font-family: var(--sans); font-size: 12px; color: var(--muted); text-decoration: none; }
.side-view:hover { color: var(--ink); }

.content { padding: 36px 40px; max-width: 1000px; }
.tab-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.tab-head .btn-dark { margin-top: 0; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.card img.thumb { width: 100%; aspect-ratio: 1.4; object-fit: cover; background: var(--cream-2); }
.card .card-body { padding: 14px 16px 16px; }
.card h4 { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.card .meta { font-size: 12px; color: var(--muted); margin: 4px 0 10px; line-height: 1.5; }
.card .row { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.tag.off { color: #a33; }

/* Pedidos */
.order-card { background: #fff; border: 1px solid var(--line); border-radius: 5px; margin-bottom: 14px; padding: 18px 20px; }
.order-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.order-top strong { font-family: var(--serif); font-size: 19px; }
.order-date { color: var(--muted); font-size: 12px; }
.order-total { margin-left: auto; font-family: var(--serif); font-size: 20px; }
.status-select { border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; font-family: var(--sans); font-size: 12px; background: #fff; }
.st-nuevo { border-color: var(--gold); color: var(--gold); }
.st-enviado { color: #4a7c48; border-color: #4a7c48; }
.st-entregado { color: var(--muted); }
.st-cancelado { color: #a33; border-color: #d4b5b0; }
.order-lines { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 12px; font-size: 13px; }
.order-line { display: flex; gap: 12px; align-items: flex-start; padding: 7px 0; }
.order-line .ol-photos { display: flex; gap: 5px; }
.order-line .ol-photos img { width: 42px; height: 42px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.order-line .ol-price { margin-left: auto; white-space: nowrap; }
.order-customer { margin-top: 10px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.empty { color: var(--muted); padding: 30px 0; font-size: 14px; }

/* Formularios */
.form-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 26px 28px; max-width: 640px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.img-picker { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.img-picker img { width: 70px; height: 70px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--cream-2); }
.check-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; }
.check-row input { width: 16px; height: 16px; accent-color: var(--gold); }

/* Galería en editor */
.gallery-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.g-item { position: relative; width: 74px; height: 74px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.g-item img { width: 100%; height: 100%; object-fit: cover; }
.g-item button {
  position: absolute; top: 2px; right: 2px;
  background: rgba(23,21,18,.7); color: #fff; border: none; border-radius: 50%;
  width: 18px; height: 18px; font-size: 11px; cursor: pointer; line-height: 1;
}

/* Variantes en editor */
.variant-row {
  display: grid; grid-template-columns: 54px 1fr 90px 34px; gap: 10px; align-items: center;
  padding: 8px 0; border-bottom: 1px dashed var(--line);
}
.variant-row img { width: 54px; height: 54px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: var(--cream-2); cursor: pointer; }
.variant-row .del { background: none; border: none; color: #a33; font-size: 17px; cursor: pointer; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(23,21,18,.45); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { position: relative; background: var(--cream); border-radius: 6px; width: min(640px, 100%); max-height: 92vh; overflow-y: auto; padding: 30px 28px; }
.close-x { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 26px; cursor: pointer; color: var(--muted); }

@media (max-width: 800px) {
  .admin { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: column; }
  .content { padding: 24px 18px; }
}

/* ---------- Gestor de medios ---------- */
.media-group-title { margin: 28px 0 4px; font-family: 'Cormorant Garamond', serif; font-size: 22px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 10px; }
.media-item { position: relative; display: block; border: 1px solid var(--line, #e5ddcf); border-radius: 8px; overflow: hidden; background: #fff; }
.media-item .media-check { position: absolute; top: 8px; left: 8px; z-index: 2; width: 17px; height: 17px; accent-color: var(--gold, #b08d3f); }
.media-thumb { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #f4f0e7; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-video { font-size: 34px; }
.media-meta { padding: 8px 10px; display: grid; gap: 2px; }
.tag-free { color: #6b8f5a; }

/* Gestión de pedidos */
.order-del { border: 0; background: none; cursor: pointer; font-size: 16px; opacity: .45; }
.order-del:hover { opacity: 1; }
#ordersFilter { max-width: 190px; }

/* ---------- Tablas tipo Shopify (pedidos y clientes) ---------- */
.dtable { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: 13px; }
.dtable th { text-align: left; padding: 10px 12px; background: #faf7f0; color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--line); }
.dtable td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dtable tbody tr { cursor: pointer; }
.dtable tbody tr:hover { background: #faf8f3; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable .meta { font-size: 12px; }
.row-actions { white-space: nowrap; }
.mini-btn { border: 0; background: none; cursor: pointer; font-size: 15px; opacity: .5; padding: 2px 4px; }
.mini-btn:hover { opacity: 1; }
.tbl-search { max-width: 240px; }
.sep { border: 0; border-top: 1px dashed var(--line); margin: 18px 0; }
.st-tramitado { color: #7a6a2f; border-color: #c9b96a; }
