/* Mala Lens admin: brand colours (ink, paper, Bleu Sidi Bou), simple and readable on a phone. */
:root {
  --ink: #0A0B0D; --raised: #15171B; --raised2: #1C1F24; --line: #2A2D33; --fog: #9A9DA5; --white: #fff;
  --blue: #4F86F0; --danger: #E5675F;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace; --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--ink); color: var(--white); font: 15px/1.5 var(--sans); }
img { display: block; max-width: 100%; }
h1, h2, p { margin: 0; }
.meta { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 400; }
.muted { color: var(--fog); }
.hint { color: var(--fog); font-size: 13px; }
.empty { color: var(--fog); padding: 30px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 2px; background: transparent; color: var(--white);
  font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; text-decoration: none;
}
.btn:hover:not(:disabled) { border-color: var(--white); }
.btn:disabled { opacity: .35; cursor: default; }
.btn-solid { background: var(--white); color: var(--ink); border-color: var(--white); }
.btn-solid:hover:not(:disabled) { background: var(--blue); border-color: var(--blue); }
.btn-ghost { border-color: transparent; color: var(--fog); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 11px; }
.btn.danger { color: var(--danger); }
.btn.danger:hover:not(:disabled) { border-color: var(--danger); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.file { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(380px, 100%); display: grid; gap: 22px; }
.login-logo { height: 32px; width: auto; }
.login-form { display: grid; gap: 16px; }
.login-form label { display: grid; gap: 6px; font-size: 13px; color: var(--fog); }
.form-error { color: var(--danger); min-height: 1.2em; font-size: 14px; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px clamp(14px, 3vw, 32px); background: rgb(10 11 13 / .95); border-bottom: 1px solid var(--line);
}
.bar-logo { height: 22px; width: auto; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button {
  background: none; border: 0; color: var(--fog); padding: 8px 12px; cursor: pointer;
  font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; border-bottom: 2px solid transparent;
}
.tabs button.is-on { color: var(--white); border-bottom-color: var(--blue); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.save-state.warn { color: #F2C14E; }
@media (max-width: 760px) { .bar-right { margin-left: 0; width: 100%; } .save-state { flex: 1; } }

.toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 50; translate: -50% 20px; opacity: 0; pointer-events: none;
  background: var(--white); color: var(--ink); padding: 10px 16px; font-size: 14px; transition: opacity .2s, translate .2s; max-width: 90vw;
}
.toast.on { opacity: 1; translate: -50% 0; }
.toast.bad { background: var(--danger); color: #fff; }

/* content */
.view { padding: 24px clamp(14px, 3vw, 32px) 80px; display: grid; gap: 20px; max-width: 1400px; margin: 0 auto; }
.intro { color: var(--fog); max-width: 70ch; }
.card { background: var(--raised); border: 1px solid var(--line); padding: clamp(14px, 2vw, 24px); display: grid; gap: 16px; }
.card h2 { font-size: 17px; font-weight: 500; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-title { font-size: 17px; font-weight: 500; margin-top: 10px; }
.form { max-width: 760px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.stack { display: grid; gap: 10px; align-content: start; }

.field { display: grid; gap: 6px; }
.field-label { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--fog); }
.count { color: #5C5F66; }
input, textarea {
  width: 100%; background: var(--ink); color: var(--white); border: 1px solid var(--line); border-radius: 2px;
  padding: 10px 12px; font: 15px/1.4 var(--sans);
}
input:focus, textarea:focus { border-color: var(--blue); outline: none; }
textarea { resize: vertical; }

/* photo slots */
.slot { position: relative; display: grid; gap: 8px; justify-items: start; }
.slot img, .slot-empty { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--ink); border: 1px solid var(--line); }
.slot.wide img, .slot.wide .slot-empty { aspect-ratio: 2.39; }
.slot-empty { display: grid; place-items: center; color: var(--fog); }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 32px 160px 1fr auto; gap: 14px; align-items: center; padding: 10px; background: var(--raised2); }
.row .slot img, .row .slot-empty { aspect-ratio: 3 / 2; }
.row-n { color: var(--fog); }
.row-tools { display: flex; gap: 6px; }
@media (max-width: 760px) {
  .row { grid-template-columns: 28px 1fr; }
  .row > :nth-child(3), .row-tools { grid-column: 2; }
}

/* upload + library */
.drop { border: 1px dashed var(--line); padding: 26px; display: grid; gap: 12px; justify-items: start; background: var(--raised); }
.drop.over { border-color: var(--blue); background: #182033; }
.upload-status { color: var(--blue); }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.photo { background: var(--raised); border: 1px solid var(--line); display: grid; }
.photo > img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.photo-body { padding: 12px; display: grid; gap: 10px; }

/* picker */
.picker { width: min(1100px, 96vw); max-height: 90vh; padding: 0; background: var(--raised); color: var(--white); border: 1px solid var(--line); }
.picker:modal { overscroll-behavior: contain; }
.picker::backdrop { background: rgb(0 0 0 / .75); overflow: hidden; overscroll-behavior: contain; }
.picker-head { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; background: var(--raised); border-bottom: 1px solid var(--line); }
.picker-head h1 { flex: 1 0 100%; }
.picker-head input { flex: 1; min-width: 160px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px; }
.pick { position: relative; display: grid; gap: 6px; padding: 6px; background: var(--ink); border: 2px solid transparent; color: var(--white); cursor: pointer; text-align: left; }
.pick img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.pick.is-on { border-color: var(--blue); }
.pick:hover { border-color: var(--fog); }
.pick-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-used { position: absolute; top: 10px; left: 10px; background: rgb(10 11 13 / .85); padding: 3px 6px; font-size: 9px; }

.publish-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.publish-out a { color: var(--blue); }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; color: var(--fog); font-size: 14px; }
