/* ============================================================
   City Hospital — Admin Portal styles (loaded after styles.css)
   ============================================================ */
.admin-body { background: var(--bg-soft); }

/* Make the native hidden attribute win over display rules below
   (otherwise .modal/.gate display:grid keeps them visible). */
[hidden] { display: none !important; }

/* ---- Gate ---- */
.gate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teal-900), var(--teal-600)); padding: 1.5rem;
}
.gate-box {
  background: #fff; border-radius: var(--radius); padding: 2.2rem 2rem; width: 100%;
  max-width: 360px; text-align: center; box-shadow: var(--shadow-lg);
}
.gate-box .brand-mark { margin: 0 auto .8rem; }
.gate-box h1 { font-size: 1.4rem; margin: 0; }
.gate-box p { color: var(--slate); margin: .2rem 0 1.4rem; }
.gate-box input {
  width: 100%; padding: .8rem .9rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: 1rem; margin-bottom: 1rem;
}
.gate-note { color: #c0392b; font-size: .85rem; min-height: 1em; margin: .6rem 0 0; }

/* ---- Header ---- */
.admin-header { background: #fff; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 40; }
.admin-header-inner { max-width: 1160px; margin: 0 auto; padding: .8rem 22px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.admin-header .brand-text small { color: var(--teal-600); font-weight: 600; }
.admin-header-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.save-status { font-size: .82rem; font-weight: 600; color: var(--slate); padding: .3rem .6rem; border-radius: 50px; }
.save-status.ok { color: #1c7a41; background: #e7f7ec; }
.save-status.saving { color: #7a5b00; background: #fff8e6; }
.save-status.error { color: #c0392b; background: #fdecec; }

.btn-sm { padding: .55rem 1rem; font-size: .85rem; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--teal-500); color: var(--teal-700); }
.btn-ghost-dark { background: transparent; border-color: var(--line); color: var(--slate); }
.btn-ghost-dark:hover { border-color: var(--slate); color: var(--ink); }

/* ---- Layout ---- */
.admin-main { max-width: 1160px; margin: 0 auto; padding: 1.5rem 22px 4rem; }
.admin-hint { background: #fff8e6; border: 1px solid #f0d488; color: #7a5b00; padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; margin: 0 0 1.4rem; }
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.25rem; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.count-pill { background: var(--teal-050); color: var(--teal-700); font-weight: 700; border-radius: 50px; padding: .15rem .7rem; font-size: .85rem; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hint-sm { color: var(--slate); font-size: .82rem; margin: .35rem 0 0; }
.form-actions { display: flex; gap: .7rem; margin-top: .4rem; flex-wrap: wrap; }

.table-preview { margin: 1rem 0; padding: 1rem; background: var(--bg-soft); border-radius: var(--radius-sm); border: 1px dashed var(--line); }
.table-preview .update-table { min-width: 0; }

/* ---- List ---- */
.admin-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .8rem; }
.admin-item { display: flex; gap: 1rem; justify-content: space-between; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .8rem 1rem; transition: .2s; }
.admin-item.is-hidden { opacity: .6; background: var(--bg-soft); }
.ai-main { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.ai-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.ai-main strong { font-size: 1rem; }
.ai-meta { color: var(--slate); font-size: .8rem; }
.hidden-tag { background: #fdecec; color: #c0392b; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 50px; }
.ai-actions { display: flex; align-items: center; gap: .35rem; flex: none; }
.icon-btn { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; font-size: .95rem; transition: .15s; }
.icon-btn:hover:not(:disabled) { border-color: var(--teal-500); background: var(--teal-050); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn.danger:hover { border-color: #e0b4b4; background: #fdecec; }
.empty-msg { color: var(--slate); text-align: center; padding: 1.4rem 0; }

/* ---- Switch ---- */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd8dd; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--teal-500); }
.switch input:checked + span::before { transform: translateX(18px); }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: rgba(6,30,32,.6); padding: 1.5rem; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 1.8rem; max-width: 520px; width: 100%; box-shadow: var(--shadow-lg); }
.publish-steps { color: var(--ink); padding-left: 1.2rem; margin: .5rem 0 1rem; }
.publish-steps code { background: var(--bg-soft); padding: .1rem .4rem; border-radius: 5px; font-size: .85rem; }
.publish-cmd { background: #0b3d40; color: #d7f5f6; padding: .9rem 1rem; border-radius: var(--radius-sm); overflow-x: auto; font-size: .85rem; }

@media (max-width: 820px) {
  .admin-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  .admin-item { flex-direction: column; align-items: stretch; }
  .ai-actions { justify-content: flex-end; }
}
