/* ── Variables ── */
:root {
  --bg: #171a1f;
  --text: #1f2933;
  --card: #ffffff;
  --line: #d7dee6;
  --primary: #0f62fe;
}

@import url("https://fonts.googleapis.com/css2?family=Bitcount+Prop+Double:wght@300;400&family=VT323&display=swap");

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "VT323", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h2 {
  font-family: "Bitcount Prop Double", "VT323", monospace;
  font-weight: 400;
}

h3 {
  font-family: "Bitcount Prop Double", "VT323", monospace;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.site-header {
  background: var(--bg);
  color: #fff;
  padding: 12px 0;
  border-bottom: 1px solid #242933;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.site-logo-wrap {
  margin: 0;
  line-height: 0;
}

.site-logo {
  display: block;
  width: min(256px, 46vw);
  height: auto;
}

.header-inner a { color: #fff; text-decoration: none; margin-left: 12px; }
.page-content { padding: 24px 0 48px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.stack { display: grid; gap: 12px; }
.row { display: flex; }
.gap-sm { gap: 8px; }
.between { justify-content: space-between; }
.middle { align-items: center; }

label { display: grid; gap: 6px; font-weight: 600; }
input, textarea, select, button {
  font: inherit;
}
input, textarea, select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
}

button, .button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.ghost, .button.ghost {
  background: transparent;
  color: var(--primary);
}

button.danger, .button.danger {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}
button.danger.small, .button.danger.small {
  padding: 4px 10px;
  font-size: 0.85em;
}

.flash-list { margin-bottom: 12px; display: grid; gap: 8px; }
.flash { border-radius: 4px; padding: 10px 14px; font-family: "VT323", monospace; letter-spacing: 0.04em; font-size: 1.05rem; border: 1px solid; }
.flash.error   { background: rgba(192, 57, 43, 0.15);  color: #e07060; border-color: #7a2a20; }
.flash.success { background: rgba(40, 120, 60, 0.15);  color: #70bb80; border-color: #2a6035; }
.flash.info    { background: rgba(30, 80, 160, 0.15);  color: #7aaeee; border-color: #2a4a80; }

table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 10px; text-align: left; }

/* ── Login ── */
.refuge-login-body {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.06), transparent 40%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 4px
    ),
    #050607;
  color: #e8ecf3;
}

.refuge-login-body .site-header {
  background: rgba(0, 0, 0, 0.88);
  border-bottom: 1px solid #242933;
}

.refuge-login-kicker {
  margin: 0;
  color: #f06a6a;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 1.2rem;
}

.refuge-login-note {
  margin: 0;
  color: #a8b0be;
  letter-spacing: 0.04em;
  line-height: 1.35;
  padding-bottom: 12px;
  border-bottom: 1px solid #252c36;
}

.refuge-login-form {
  margin-top: 8px;
}

.refuge-login-form label {
  color: #d8dde7;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 1.1rem;
}

.refuge-login-form input {
  border: 1px solid #303948;
  border-radius: 0;
  background: rgba(5, 8, 12, 0.96);
  color: #edf0f6;
  min-height: 46px;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
}

.refuge-login-form input:focus {
  outline: none;
  border-color: #f04848;
  box-shadow: 0 0 0 1px #f04848;
}

.refuge-login-form button {
  border-radius: 0;
  border-color: #f04848;
  background: #f04848;
  color: #0d1015;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 1.15rem;
  min-height: 46px;
  width: 100%;
}

/* ── Dashboard card ── */
.refuge-dashboard-card {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.08), transparent 45%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 4px
    ),
    #06070a;
  border: 1px solid #2c3139;
  border-radius: 6px;
  color: #edf0f6;
}

.refuge-dashboard-header {
  margin-bottom: 10px;
}

.refuge-dashboard-new {
  border-radius: 0;
  border-color: #f04848;
  background: #f04848;
  color: #0c0f13;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.refuge-dashboard-table {
  font-family: "VT323", monospace;
  letter-spacing: 0.04em;
}

.refuge-dashboard-table th,
.refuge-dashboard-table td {
  border-bottom: 1px solid #262c35;
  color: #e0e5ee;
  padding: 12px 10px;
  vertical-align: middle;
}

.refuge-dashboard-table thead th {
  text-transform: uppercase;
  color: #9ba4b3;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.refuge-dashboard-table .button,
.refuge-dashboard-table .button.ghost {
  border-radius: 0;
  border-color: #3a4050;
  color: #9ba4b3;
  background: transparent;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.refuge-dashboard-table .button:hover,
.refuge-dashboard-table .button.ghost:hover {
  border-color: #f04848;
  color: #ff8b8b;
}

.refuge-dashboard-table tbody tr {
  transition: background 0.1s;
}

.refuge-dashboard-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ── Form card ── */
.refuge-form-card {
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.08), transparent 45%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      transparent 1px,
      transparent 4px
    ),
    #07080a;
  border: 1px solid #2e323a;
  border-radius: 6px;
  color: #f4f6fb;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.refuge-form-title {
  margin: 0 0 10px;
  font-family: "Bitcount Prop Double", "VT323", monospace;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  color: #f1f3f7;
}

.refuge-form {
  font-family: "VT323", monospace;
  letter-spacing: 0.03em;
}

.refuge-form label {
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #cfd5de;
}

.refuge-form input,
.refuge-form textarea,
.refuge-form select {
  border: 1px solid #303845;
  border-radius: 0;
  background: rgba(7, 9, 12, 0.92);
  color: #e7ebf3;
  min-height: 42px;
}

.refuge-form textarea {
  min-height: 96px;
  resize: vertical;
}

.refuge-form input:focus,
.refuge-form textarea:focus,
.refuge-form select:focus {
  outline: none;
  border-color: #f04848;
  box-shadow: 0 0 0 1px #f04848;
}

.refuge-form .button,
.refuge-form button {
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-color: #f04848;
  background: #f04848;
  color: #0d1117;
}

.refuge-form .button.ghost,
.refuge-form button.ghost {
  background: transparent;
  color: #ff7c7c;
  border-color: #f04848;
}

/* ── Status badges ── */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 3px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "VT323", monospace;
}

.status-active {
  background: rgba(30, 80, 160, 0.25);
  color: #7aaeee;
  border: 1px solid #2a4a80;
}

.status-complete {
  background: rgba(30, 80, 40, 0.25);
  color: #7aaa7a;
  border: 1px solid #2a5030;
}

.status-archived {
  background: rgba(50, 50, 55, 0.4);
  color: #8a8d94;
  border: 1px solid #3a3d44;
}

/* ── Comment cards ── */
.comment-card {
  background: rgba(10, 12, 16, 0.7);
  border: 1px solid #2e323a;
  border-radius: 4px;
  padding: 14px 16px;
}

.comment-urgent {
  border-left: 3px solid #c0392b;
}

.comment-resolved {
  opacity: 0.55;
}

.comment-body {
  margin: 0;
  color: #d8dde8;
  line-height: 1.5;
  font-size: 1rem;
  white-space: pre-wrap;
}

.comment-resolved .comment-body {
  text-decoration: line-through;
  color: #6b7280;
}

.resolved-note {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #5a8a5a;
  font-style: italic;
}

.urgent-label {
  display: inline-block;
  background: rgba(192, 57, 43, 0.2);
  color: #e05040;
  border: 1px solid #8b2a20;
  border-radius: 2px;
  padding: 1px 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Unresolved count badge ── */
.unresolved-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: #c0392b;
  color: #fff;
  border-radius: 10px;
  font-size: 0.78rem;
  font-family: "VT323", monospace;
  letter-spacing: 0;
}

/* ── Version tag ── */
.version-tag {
  display: inline-block;
  padding: 1px 7px;
  background: rgba(15, 98, 254, 0.15);
  border: 1px solid #1a3a7a;
  color: #6a9aee;
  border-radius: 3px;
  font-size: 0.8rem;
  font-family: monospace;
  letter-spacing: 0.04em;
}

/* ── Filter tabs ── */
.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid #2e323a;
  padding-bottom: 12px;
}

.filter-tab {
  display: inline-block;
  padding: 5px 14px;
  border: 1px solid #2e323a;
  color: #9ba4b3;
  text-decoration: none;
  font-family: "VT323", monospace;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: border-color 0.15s, color 0.15s;
}

.filter-tab:hover {
  border-color: #f04848;
  color: #ff8b8b;
}

.filter-tab.active {
  border-color: #f04848;
  color: #f04848;
  background: rgba(240, 72, 72, 0.08);
}

.tab-count {
  display: inline-block;
  background: rgba(255,255,255,0.08);
  color: #6b7280;
  border-radius: 3px;
  padding: 0 5px;
  font-size: 0.85em;
  letter-spacing: 0;
}

.filter-tab.active .tab-count {
  background: rgba(240, 72, 72, 0.15);
  color: #f04848;
}

/* ── File input ── */
.file-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-input-hidden {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

.file-input-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid #3a4050;
  background: rgba(255,255,255,0.04);
  color: #9ba4b3;
  font-family: "VT323", monospace;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.file-input-label:hover {
  border-color: #f04848;
  color: #ff8b8b;
}

.file-input-hidden:focus + .file-input-label {
  border-color: #f04848;
  color: #ff8b8b;
  outline: none;
}

.file-input-icon {
  font-style: normal;
  font-size: 1.1em;
  line-height: 1;
}

.file-input-name {
  color: #d0d5de;
  font-family: "VT323", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

/* ── Flyer viewer ── */
.flyer-viewer {
  max-width: 720px;
  margin: 0 auto;
}

.flyer-viewer img {
  max-width: 100%;
  height: auto;
  display: block;
}

.pdf-canvas-wrap {
  max-width: 720px;
}

.pdf-canvas-wrap canvas {
  max-width: 100%;
  height: auto !important;
  display: block;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  .container { padding: 0 10px; }
  .page-content { padding: 14px 0 36px; }
  .card { padding: 14px; }
  .refuge-form-card { padding: 16px !important; }
  .refuge-dashboard-card { padding: 14px !important; }
}

@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 8px;
  }
  .header-inner nav {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    border-top: 1px solid #242933;
    padding-top: 8px;
  }
  .header-inner nav a {
    margin-left: 0;
    font-size: 0.85rem;
    padding: 4px 0;
  }
}

/* ── Dashboard: card layout on small screens ── */
@media (max-width: 640px) {
  .refuge-dashboard-table thead { display: none; }
  .refuge-dashboard-table,
  .refuge-dashboard-table tbody,
  .refuge-dashboard-table tr,
  .refuge-dashboard-table td { display: block; width: 100%; }

  .refuge-dashboard-table tr {
    border: 1px solid #262c35;
    border-radius: 6px;
    margin-bottom: 10px;
    padding: 10px 12px;
  }

  .refuge-dashboard-table td {
    padding: 4px 0;
    border-bottom: none;
  }

  .refuge-dashboard-table td:first-child {
    font-size: 1.1em;
    font-weight: 700;
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid #262c35;
  }

  .refuge-dashboard-table td[data-label]::before {
    content: attr(data-label) ": ";
    color: #9ba4b3;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
  }

  .refuge-dashboard-actions {
    padding-top: 6px;
    margin-top: 4px;
    border-top: 1px solid #262c35;
  }
}

@media (max-width: 880px) {
  .refuge-dashboard-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .refuge-dashboard-actions {
    flex-wrap: wrap;
  }
}
