/* Shared design variables. Change these to adjust the dashboard palette/fonts consistently. */
:root {
  --pink: #e985a6;
  --teal: #083f42;
  --teal-2: #0e5a5d;
  --cream: #fffaf0;
  --paper: #ffffff;
  --line: #e7dfd2;
  --muted: #6b7b79;
  --danger: #9f334a;
  --danger-bg: #fff0f3;
  --warning: #8a6118;
  --warning-bg: #fff5d8;
  --success: #2d6c51;
  --success-bg: #eef8f2;
  --sidebar: #f7eee2;
  --shadow: 0 18px 55px rgba(8, 63, 66, .10);
  --sans: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

/* Base/reset rules used by every page element. */
* { box-sizing: border-box; }
html { background: var(--cream); }
body { margin: 0; background: var(--cream); color: var(--teal); font-family: var(--sans); }
button, input, select, textarea { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(233, 133, 166, .42); outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .5; }
code { padding: 2px 5px; border-radius: 5px; background: rgba(8, 63, 66, .08); }
[hidden] { display: none !important; }

.noscript { padding: 16px; background: var(--danger); color: white; text-align: center; font-weight: 700; }
.eyebrow { margin: 0; color: var(--muted); font-size: .71rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.subtle { color: var(--muted); }
.small-heading { margin: 16px 0 8px; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3 { color: var(--teal); font-family: var(--serif); }
h1 { margin: 4px 0 8px; font-size: clamp(2rem, 4vw, 2.6rem); }
h2 { margin: 3px 0 0; }
h3 { margin: 0; }
p { line-height: 1.5; }

/* Reusable button variants: primary, ghost and destructive actions. */
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 40px; padding: 9px 13px; border: 1px solid var(--teal); border-radius: 9px; background: white; color: var(--teal); font-weight: 700; cursor: pointer; }
.button:hover:not(:disabled) { filter: brightness(.97); }
.button.primary { background: var(--teal); color: white; }
.button.ghost { background: white; }
.button.danger, .button.danger-outline { border-color: var(--danger); color: var(--danger); }
.button.danger { background: var(--danger); color: white; }
.button.danger-outline { background: var(--danger-bg); }
.button.full { width: 100%; }

/* Feedback banners for warnings, errors and successful actions. */
.notice { margin: 12px 0; padding: 11px 13px; border: 1px solid; border-radius: 10px; font-size: .88rem; line-height: 1.45; }
.notice strong, .notice span { display: block; }
.notice.warning { border-color: #edcd84; background: var(--warning-bg); color: #684b15; }
.notice.danger { border-color: #efbbc6; background: var(--danger-bg); color: var(--danger); }
.notice.success { border-color: #bcdcc9; background: var(--success-bg); color: var(--success); }

/* Moderator sign-in screen. */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at top left, #fff4f6 0, transparent 36%), var(--cream); }
.login-card { width: min(470px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.login-logo, .logo { color: var(--teal); text-decoration: none; font: 700 1.72rem/1 var(--serif); }
.login-logo { display: inline-block; margin-bottom: 35px; }
.login-logo span, .logo span { display: block; margin-top: 8px; font: 700 .71rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.login-copy { margin-bottom: 22px; color: var(--muted); }
.login-form { display: grid; gap: 14px; }
.login-form label, .modal-card label { display: grid; gap: 6px; color: var(--muted); font-size: .82rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--teal); }
input, select { min-height: 42px; padding: 8px 10px; }
textarea { padding: 10px; resize: vertical; line-height: 1.45; }
.security-note { margin: 18px 0 0; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: .77rem; }
.api-address { margin-bottom: 0; color: var(--muted); font-size: .72rem; word-break: break-all; }

/* Authenticated dashboard shell: fixed-width sidebar + flexible main area. */
.app-shell { display: grid; grid-template-columns: 235px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 18px; border-right: 1px solid var(--line); background: var(--sidebar); }
.logo { display: block; margin: 0 10px 34px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.nav-item:hover:not(:disabled), .nav-item.active { background: var(--paper); }
.nav-item:disabled { opacity: .55; }
.badge { min-width: 24px; padding: 2px 7px; border-radius: 999px; background: var(--pink); text-align: center; font-size: .78rem; }
.soon { color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.sidebar-footer { position: absolute; right: 18px; bottom: 20px; left: 18px; display: grid; gap: 10px; }
.staff-summary { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.62); }
.staff-summary strong, .staff-summary span { display: block; }
.staff-summary strong { margin: 4px 0 2px; }
.staff-summary > span:last-child { overflow: hidden; color: var(--muted); font-size: .74rem; text-overflow: ellipsis; }

/* Main report-queue area. */
.dashboard { min-width: 0; padding: 32px 36px 52px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 24px; }
.topbar .subtle { margin: 0; }
.moderator-chip { max-width: 250px; overflow: hidden; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); text-overflow: ellipsis; white-space: nowrap; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metrics article { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.metrics span, .metrics small { display: block; }
.metrics strong { display: block; overflow: hidden; margin: 6px 0 3px; font: 700 1.8rem/1.1 var(--serif); text-overflow: ellipsis; white-space: nowrap; }
.metrics small { color: var(--muted); }

.controls { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.status-tab { padding: 8px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--teal); font-weight: 700; cursor: pointer; }
.status-tab:hover, .status-tab.active { border-color: var(--line); background: #fff8f3; }
.filters { display: flex; gap: 9px; align-items: end; }
.filters label { display: grid; gap: 4px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.filters select { min-width: 145px; }

/* Desktop workspace uses queue + detail columns; media queries below stack them on smaller screens. */
.workspace { display: grid; grid-template-columns: minmax(430px, .95fr) minmax(480px, 1.3fr); gap: 16px; align-items: start; }
.queue-panel, .detail-panel { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.queue-panel { overflow: hidden; }
.detail-panel { min-height: 620px; padding: 22px; }
.panel-heading { display: flex; justify-content: space-between; align-items: end; padding: 18px; border-bottom: 1px solid var(--line); }
.loading-label { color: var(--muted); font-size: .8rem; }
.report-list { display: grid; min-height: 160px; }
.report-card { width: 100%; padding: 15px 17px; border: 0; border-bottom: 1px solid var(--line); background: white; color: inherit; text-align: left; cursor: pointer; }
.report-card:hover, .report-card.selected { background: #fff8f5; }
.report-card.selected { box-shadow: inset 4px 0 var(--pink); }
.report-card__top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.report-card h3 { font-family: var(--sans); font-size: .96rem; }
.report-card p { margin: 6px 0 0; color: var(--muted); font-size: .82rem; }
.card-signals { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.card-signals span { padding: 3px 7px; border-radius: 999px; background: #f4f2ec; color: var(--muted); font-size: .68rem; }
.empty-list, .empty-detail { padding: 28px; color: var(--muted); text-align: center; }
.empty-list h3, .empty-detail h2 { color: var(--teal); }
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }

/* Small status pills make report priority/state scannable without relying on long text. */
.priority, .status-badge, .state-chip, .reported-chip { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.priority.normal { background: #f1f0eb; color: #6f6b61; }
.priority.elevated { background: #fff0ce; color: var(--warning); }
.priority.high { background: #ffe3e8; color: var(--danger); }
.priority.urgent { background: var(--danger); color: white; }
.status-badge { background: #edf4f3; color: var(--teal); }
.status-badge.in_review { background: #fff0ce; color: var(--warning); }
.status-badge.actioned { background: var(--success-bg); color: var(--success); }
.status-badge.dismissed { background: #f1f0eb; color: #6f6b61; }
.state-chip { background: #f1f0eb; color: #6f6b61; }
.state-chip.active { background: var(--success-bg); color: var(--success); }
.reported-chip { background: var(--danger); color: white; }

/* Selected-report detail panel: metadata, evidence, history and actions. */
.detail-header { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-header__top { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.detail-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: end; }
.detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin: 18px 0 0; }
.detail-meta div, .signal-grid div { min-width: 0; padding: 10px; border-radius: 9px; background: #f7f7f3; }
.detail-meta span, .signal-grid span { display: block; color: var(--muted); font-size: .65rem; letter-spacing: .07em; text-transform: uppercase; }
.detail-meta strong, .signal-grid strong { display: block; overflow-wrap: anywhere; margin-top: 3px; }
.detail-copy { margin-bottom: 0; color: var(--muted); font-size: .84rem; }
.reporter-details, .resolution-summary { margin-top: 13px; padding: 12px; border-radius: 9px; background: #fff8f5; }
.reporter-details p, .resolution-summary p { margin: 6px 0 0; }
.resolution-summary { background: var(--success-bg); }

.detail-section { padding: 20px 0; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.section-heading { margin-bottom: 12px; }
.section-heading h3 { margin-top: 3px; font-size: 1.15rem; }
.evidence-box { padding: 14px; border-left: 4px solid var(--pink); border-radius: 8px; background: #fff5f7; }
.evidence-label { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.evidence-box p { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.evidence-messages { display: grid; gap: 8px; margin-top: 10px; }
.evidence-message { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fafaf7; }
.evidence-message.reported { border-color: #efb5c2; background: #fff2f5; }
.evidence-message__header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .72rem; }
.evidence-message__header strong { color: var(--teal); }
.evidence-message p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.privacy-note { margin-bottom: 0; padding: 10px; border-radius: 8px; background: #f3f8f6; color: var(--success); font-size: .77rem; }
.signal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.suggestion-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.suggestion-chips span { padding: 5px 8px; border-radius: 999px; background: #f3f8f6; color: var(--success); font-size: .72rem; }
.moderator-notes { margin-bottom: 8px; }

.history-list { display: grid; gap: 7px; }
.history-row { padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.history-row__top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.history-row__top span { color: var(--muted); font-size: .72rem; }
.history-row p { margin: 5px 0 0; font-size: .82rem; }
.history-row small { display: block; margin-top: 4px; }

.action-groups { display: grid; gap: 12px; }
.action-group { display: flex; gap: 7px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fdfcf9; }
.action-group .small-heading { width: 100%; margin: 0 0 3px; }
.action-group > .subtle { width: 100%; margin: 0; font-size: .82rem; }
.resolution-group { background: #f6faf8; }
.future-actions { display: grid; gap: 3px; padding: 11px; border-radius: 9px; background: #f1f0eb; color: var(--muted); font-size: .78rem; }
.future-actions strong { color: var(--teal); }

/* Native <dialog> elements used as confirmation/action forms. */
.modal { width: min(520px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 14px; background: transparent; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(5, 32, 34, .45); backdrop-filter: blur(2px); }
.modal-card { display: grid; gap: 13px; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.modal-card h2 { margin: 0; }
.modal-card .subtle { margin: 0; }
.modal-actions { display: flex; justify-content: end; gap: 8px; margin-top: 3px; }

/* Responsive rules: progressively collapse the two-column admin layout on narrow screens. */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 1fr; }
  .detail-panel { min-height: 400px; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; padding: 16px; }
  .sidebar .logo { margin-bottom: 15px; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .nav-item { width: auto; white-space: nowrap; }
  .sidebar-footer { position: static; grid-template-columns: 1fr auto; margin-top: 14px; }
  .staff-summary { display: none; }
  .dashboard { padding: 22px 16px 40px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .controls { align-items: stretch; flex-direction: column; }
  .filters { flex-wrap: wrap; }
  .filters label { flex: 1 1 150px; }
  .topbar { align-items: start; }
  .moderator-chip { display: none; }
}

@media (max-width: 560px) {
  .login-view { padding: 14px; }
  .login-card { padding: 24px 20px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metrics article { padding: 12px; }
  .metrics strong { font-size: 1.4rem; }
  .status-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  .detail-meta, .signal-grid { grid-template-columns: 1fr 1fr; }
  .detail-panel { padding: 16px; }
  .detail-header__top { flex-direction: column; }
  .detail-badges { justify-content: start; }
  .action-group .button { width: 100%; }
}
