/* Admin area. Builds on the dashboard's /app/app.css (colors, buttons,
   cards, sidebar); only what is new for admin lives here. */

.admin main { max-width: 1100px; }
.admin .mobile-title { margin-bottom: 16px; }
.admin .view { display: grid; gap: 20px; }
.admin .view[hidden] { display: none; }

/* Sidebar: a small heading over the "coming soon" links. */
.side-section {
  margin: 18px 10px 6px; font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.admin .sidebar .side-nav:first-of-type { margin-top: 22px; }

/* Phone/tablet header: a "Dashboard" link where the dashboard has its icons. */
.admin-back {
  margin-left: 12px; padding: 8px 4px; font-size: 0.875rem; font-weight: 600;
  color: var(--brand-ink); text-decoration: none; white-space: nowrap;
}
@media (max-width: 599px) { .admin-back { margin-left: auto; } }
.tab-dot { width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: var(--danger); }

.admin-denied { max-width: 560px; }
.admin-denied h3 { font-family: var(--font-head); font-size: 1.1rem; }

/* ---------- overview ---------- */
.admin-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.desktop .admin-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.admin-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 899px) { .admin-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 599px) { .admin-stats .stat-detail { display: block; } }
.admin-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.admin-more { font-size: 0.875rem; font-weight: 600; color: var(--brand-ink); text-decoration: none; }
.admin-more:hover { text-decoration: underline; }

/* ---------- activity log ---------- */
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.set-head + .log-list { margin-top: 12px; }
.log-list li:first-child { border-top: 0; }
.log-text { min-width: 0; overflow-wrap: anywhere; }
.log-text .sub { display: block; margin-top: 2px; font-size: 0.86rem; color: var(--muted); }
.log-when { flex: none; font-size: 0.82rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 599px) {
  .log-list li { flex-direction: column; gap: 2px; }
}

/* ---------- accounts ---------- */
.acct-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.acct-bar input[type="search"] { flex: 1 1 260px; max-width: 360px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row .map-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-row .map-chip { position: relative; min-height: 38px; padding: 0 14px; color: var(--muted); }
.chip-row .map-chip:has(input:checked) {
  background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600;
}
.acct-table td { vertical-align: middle; }
.acct-table .email { font-weight: 600; overflow-wrap: anywhere; }
.acct-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-table td:last-child { text-align: right; }
.acct-foot { margin: 0; font-size: 0.86rem; }

.badge.role-owner { background: var(--s5); color: var(--s5t); }
.badge.role-admin { background: var(--s2); color: var(--s2t); }
.badge.role-user { background: transparent; color: var(--muted); padding-left: 0; padding-right: 0; }
.badge.st-active { background: var(--s5); color: var(--s5t); }
.badge.st-pending { background: var(--s3); color: var(--s3t); }
.badge.st-disabled { background: var(--s6); color: var(--s6t); }
.you { margin-left: 6px; font-size: 0.75rem; font-weight: 600; color: var(--muted); }

/* Phones: each account is a card instead of a table row. */
@media (max-width: 699px) {
  .acct-table thead { display: none; }
  .acct-table, .acct-table tbody, .acct-table tr, .acct-table td { display: block; }
  .acct-table tr {
    display: grid; align-items: center; gap: 6px 8px;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "email email email act" "role status seen act";
    padding: 12px 14px; border-bottom: 1px solid var(--border);
  }
  .acct-table tr:last-child { border-bottom: 0; }
  .acct-table td { padding: 0; border: 0; text-align: left !important; }
  .acct-table .c-email { grid-area: email; }
  .acct-table .c-role { grid-area: role; }
  .acct-table .c-status { grid-area: status; }
  .acct-table .c-seen { grid-area: seen; font-size: 0.82rem; }
  .acct-table .c-act { grid-area: act; }
  .acct-table .hide-sm { display: none; }
}

/* ---------- account dialog ---------- */
dialog.admin-dialog {
  width: min(520px, 100%);
  max-height: 92vh;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog.admin-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
@media (max-width: 599px) {
  dialog.admin-dialog { margin: auto 0 0; max-width: 100%; border-radius: 16px 16px 0 0; }
}
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 12px 20px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { flex: 1; margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.dlg-body { padding: 4px 20px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
.dlg-section { padding: 16px 0 0; margin-top: 16px; border-top: 1px solid var(--border); }
.dlg-section:first-child { border-top: 0; margin-top: 0; }
.dlg-section h3 { margin: 0 0 8px; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.dlg-section p { margin: 0 0 10px; font-size: 0.92rem; }
.dlg-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 0.92rem; }
.dlg-facts dt { color: var(--muted); }
.dlg-facts dd { margin: 0; overflow-wrap: anywhere; }
.dlg-facts code { font-size: 0.8rem; }
.dlg-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.dlg-buttons .btn { min-height: 42px; }
.dlg-note textarea { min-height: 72px; }
.dlg-note .set-actions { margin-top: 8px; }
.btn-approve { background: var(--energy); border-color: var(--energy); color: var(--navy); }

/* ---------- settings ---------- */
.field-count { margin: 6px 0 0; font-size: 0.8rem; text-align: right; }

/* Announcement: status badge, schedule and preview. */
.announce-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.announce-state { flex: none; margin-top: 2px; }
.announce-state[data-state="live"] { background: var(--s5); color: var(--s5t); }
.announce-state[data-state="scheduled"] { background: var(--s2); color: var(--s2t); }
.announce-publish .btn { flex: none; min-width: 140px; }
.announce-state[data-state="ended"] { background: var(--s6); color: var(--s6t); }
.announce-state[data-state="off"] { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.set-form > .set-label { margin-bottom: 12px; }
.dt-field { position: relative; display: block; margin-top: 4px; }
.dt-field input { margin-top: 0; padding-right: 44px; }
.dt-field .icon-btn { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); min-width: 40px; min-height: 40px; font-size: 1.25rem; color: var(--muted); }
.dt-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 12px; font-size: 0.875rem; }
.dt-quick .btn-small { min-height: 34px; padding: 0 12px; font-size: 0.85rem; }
#announce-preview .maint-banner { margin: 0; }
#announce-preview .announce-empty { margin: 0; padding: 12px 14px; border: 1px dashed var(--border); border-radius: 10px; font-size: 0.9rem; }
@media (max-width: 599px) {
  .announce-head { flex-direction: column; gap: 8px; }
}
.settings-save { margin-top: 0; }
.soon-big { max-width: 640px; padding-top: 32px; padding-bottom: 32px; }


/* ---------- branding ---------- */
.logo-field { display: flex; align-items: center; gap: 8px; flex: none; }
.logo-preview {
  display: flex; align-items: center; justify-content: center; width: 56px; height: 56px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.logo-preview img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; }
.logo-field label.btn { cursor: pointer; }
.color-field { display: flex; align-items: center; gap: 8px; width: 220px; flex: none; }
.color-field input[type="color"] {
  width: 44px; height: 40px; flex: none; padding: 3px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); cursor: pointer;
}
.color-field input[name] { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.brand-text { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.brand-text .field-hint { grid-column: 1 / -1; margin: 0; font-size: 0.85rem; }
@media (max-width: 599px) {
  .brand-text { grid-template-columns: minmax(0, 1fr); }
  .color-field { width: 100%; }
  .logo-field { flex-wrap: wrap; }
}
.acct-name { display: block; font-weight: 600; color: var(--text); }
.c-email .sub { display: block; font-size: 0.8rem; }
