/* Admin editor styles (loaded after style.css) */
body.admin { background: #f3efe6; font-size: 16px; }
.admin .site-header { position: sticky; }
.dirty { background: var(--terracotta); color: #fff; font-weight: 700; font-size: .8rem; padding: 4px 10px; border-radius: 999px; }
.admin-layout { display: grid; grid-template-columns: 270px 1fr; min-height: calc(100vh - 64px); }
.admin-side { background: #fff; border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 64px; height: calc(100vh - 64px); overflow-y: auto; }
.admin-side nav a, .side-btn {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: .95rem; background: none; border: 0; cursor: pointer; font-family: var(--sans);
}
.admin-side nav a:hover, .side-btn:hover { background: #eef8f6; color: var(--teal-ink); }
.admin-side nav a.active, .side-btn.active { background: var(--night); color: #fff; }
.side-group { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.admin-main { padding: 24px clamp(16px, 3vw, 40px) 80px; max-width: 980px; }
.admin-main h1 { font-size: 1.8rem; }
.panel { animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-side nav a, .side-btn { width: auto; padding: 7px 10px; font-size: .88rem; background: #f6f3ec; }
  .side-group { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
  .admin .header-actions .btn-ghost { display: inline-flex; }
}

.status { position: sticky; top: 72px; z-index: 20; }
.status .msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; box-shadow: var(--shadow); }
.status .ok { background: #e3f6f1; color: #0b5a4f; border: 1px solid #bfe7de; }
.status .err { background: #fdecea; color: #8a1f12; border: 1px solid #f6c7c0; }
.status .info { background: #fff6e1; color: #6b4a00; border: 1px solid #f1dfae; }

/* Form fields */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span2 { grid-column: auto; } }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 700; font-size: .9rem; color: var(--night-2); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff; border: 1px solid #cfc7b6; border-radius: 8px;
  padding: 9px 11px; width: 100%; font-size: 1rem;
}
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--teal); flex: none; }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(25,169,154,.2); }
.hint { font-weight: 400; color: var(--ink-2); font-size: .85rem; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
.btn-link { background: none; border: 0; color: var(--terracotta); text-decoration: underline; font-weight: 600; cursor: pointer; padding: 8px; font-family: var(--sans); }
#raw-json { min-height: 60vh; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85rem; }
code { background: #ece6d8; padding: 1px 6px; border-radius: 5px; font-size: .9em; }

/* Generic editor */
.field { margin-bottom: 14px; }
.obj { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); }
.obj .obj { box-shadow: none; background: #fbf9f4; }
.obj-title { font-family: var(--serif); font-size: 1.1rem; margin: 0 0 12px; color: var(--night); }
.arr { display: grid; gap: 10px; }
.item { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.item > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.item > summary::-webkit-details-marker { display: none; }
.item > summary .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--night); color: var(--teal-bright); display: grid; place-items: center; font-size: .78rem; }
.item > summary .ttl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item > summary .chev { color: var(--ink-2); transition: transform .15s; }
.item[open] > summary .chev { transform: rotate(90deg); }
.item-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.item-tools, .str-tools { display: flex; gap: 4px; flex: none; }
.tool { background: #f3efe6; border: 1px solid var(--line); border-radius: 6px; width: 32px; height: 32px; cursor: pointer; font-size: .95rem; color: var(--ink); display: grid; place-items: center; }
.tool:hover { background: #e3f6f3; border-color: var(--teal); }
.tool.del:hover { background: #fdecea; border-color: #e8a99f; color: #8a1f12; }
.str-row { display: flex; gap: 8px; align-items: flex-start; }
.str-row textarea, .str-row input { flex: 1; }
.add { justify-self: start; background: #fff; border: 2px dashed #b9d9d3; color: var(--teal-ink); border-radius: 10px; padding: 8px 14px; font-weight: 700; cursor: pointer; font-family: var(--sans); font-size: .95rem; }
.add:hover { border-color: var(--teal); background: #eef8f6; }
.arr-label { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.arr-label span { font-weight: 700; font-size: .9rem; color: var(--night-2); }

.up-ok { margin-top: 16px; }
.admin-layout > * { min-width: 0; }
.item > summary { min-width: 0; }
.arr > *, .item, .field { min-width: 0; }
.who { color: #c9d7e2; font-size: .88rem; margin-right: 4px; }
@media (max-width: 700px) { .who { display: none; } }

/* Sign-in screens */
body.admin.locked .site-header, body.admin.locked .admin-layout { display: none; }
.auth { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; padding: 24px; overflow-y: auto;
  background: var(--lagoon) url("../img/murano-palms.jpg") center / cover no-repeat; }
.auth::before { content: ""; position: fixed; inset: 0; background: rgba(14, 27, 44, .82); }
body.admin.locked .auth { display: grid; }
.auth-card { position: relative; width: min(420px, 100%); color: #d3dfe9; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-bottom: 22px; text-align: center; }
.auth-brand .hero-word { font-size: 2.8rem; animation: none; letter-spacing: .14em; }
.auth-brand span:last-child { color: #a9c4cc; }
.auth h1 { color: #fff; font-family: var(--sans); font-size: 1.5rem; letter-spacing: 0; margin-bottom: .6em; }
.auth form { display: grid; gap: 14px; background: rgba(23, 42, 66, .92); border: 1px solid rgba(255,255,255,.1); border-radius: 18px; padding: 26px; }
.auth label { color: #e6eef5; font-size: 1rem; }
.auth input { font-size: 1.1rem; padding: 12px 14px; border-radius: 10px; border-color: rgba(255,255,255,.25); }
.btn-block { width: 100%; padding: 1em; font-size: 1.08rem; margin-top: 4px; }
.auth-note { color: #b9c8d6; font-size: .95rem; margin: 0; }
.hint-dark { color: #a9c4cc; font-weight: 400; font-size: .85rem; }
.auth-msg { margin-top: 14px; background: #fdecea; color: #8a1f12; border-radius: 10px; padding: 12px 14px; font-weight: 600; }
.auth-msg.ok { background: #e3f6f1; color: #0b5a4f; }
.auth-foot { text-align: center; margin-top: 18px; }
.auth-foot a { color: var(--palm); }
#auth-setup-needed { background: rgba(23, 42, 66, .92); border-radius: 18px; padding: 26px; }

/* Accounts list */
.user-row { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.user-row .nm { font-weight: 700; color: var(--lagoon); }
.user-row .em { color: var(--ink-2); font-size: .92rem; overflow-wrap: anywhere; }
.user-row .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.pill { font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #e8f1f0; color: var(--lagoon); }
.pill.warn { background: #fff4d8; color: #7a5a00; }
.user-row .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 600px) { .user-row { grid-template-columns: 1fr; } .user-row .acts { justify-content: flex-start; } }
.temp-card { background: #fff4d8; border: 1px solid #f1dfae; border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.temp-card .pw { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.4rem; font-weight: 700; color: var(--lagoon); background: #fff; border-radius: 8px; padding: 8px 12px; display: inline-block; margin: 6px 0; letter-spacing: .02em; }
