/* MakeItMatter — brutalist black & white.
   Only two colours: #000 and #fff (swapped in dark mode). No greys, no
   gradients, no shadows, no rounded corners, no external assets. */

:root {
  --bg: #fff;
  --fg: #000;
  --backdrop: rgba(0, 0, 0, 0.85);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000;
    --fg: #fff;
    --backdrop: rgba(255, 255, 255, 0.85);
  }
}

* {
  box-sizing: border-box;
  border-radius: 0 !important;
}

/* Class rules like .centered / .error / .ok set `display`, which beats the UA
   `[hidden] { display: none }`. Without this, hidden views (the login form
   after a successful login, empty error boxes) stay on screen. */
[hidden] {
  display: none !important;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
}

h1, h2, h3 {
  text-transform: uppercase;
  letter-spacing: -0.02em;
  font-weight: 800;
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover, a:focus {
  background: var(--fg);
  color: var(--bg);
}

:focus-visible,
:focus {
  outline: 3px solid var(--fg);
  outline-offset: 2px;
}

.muted {
  font-size: 0.85em;
}

/* errors are an inverted block — never red */
.error {
  background: var(--fg);
  color: var(--bg);
  padding: 0.35rem 0.6rem;
  display: inline-block;
}

/* one-time credentials etc. */
.ok {
  display: block;
  border: 2px solid var(--fg);
  padding: 0.6rem 0.8rem;
  font-weight: 700;
}

/* ---- login ---- */
.centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.card {
  background: var(--bg);
  border: 3px solid var(--fg);
  padding: 2rem;
  width: min(420px, 100%);
}

.card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
}

form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

label {
  display: grid;
  gap: 0.3rem;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
}

input, select {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 2px solid var(--fg);
  padding: 0.55rem 0.65rem;
}

input:focus, select:focus {
  border-width: 3px;
  outline: none;
}

/* ---- buttons ---- */
button {
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 0.55rem 1rem;
  border: 2px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

button.primary,
button[type="submit"] {
  border-width: 3px;
  background: var(--fg);
  color: var(--bg);
}

button:hover,
button:focus,
button:focus-visible {
  background: var(--fg);
  color: var(--bg);
}

button.primary:hover,
button.primary:focus,
button.primary:focus-visible {
  background: var(--bg);
  color: var(--fg);
}

button.ghost {
  background: transparent;
  color: var(--fg);
}

/* ---- app shell ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--fg);
}

.brand {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

.spacer { flex: 1; }

/* the blocks: a vertical stack of full-width bars */
.blocks {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.block {
  display: block;
  width: 100%;
  text-align: left;
  padding: 1.4rem 1.25rem;
  background: var(--bg);
  color: var(--fg);
  border: 2px solid var(--fg);
  font-weight: 800;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.block:hover,
.block:focus,
.block:focus-visible {
  background: var(--fg);
  color: var(--bg);
}

/* ---- admin panels ---- */
.panel {
  max-width: 960px;
  margin: 1.25rem auto;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--fg);
}

.panel h2 {
  margin-top: 0;
  border-bottom: 2px solid var(--fg);
  padding-bottom: 0.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--fg);
}

thead tr {
  border-bottom: 2px solid var(--fg);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0;
}

.inline-form input[type="text"],
.inline-form input:not([type]) {
  flex: 1 1 180px;
}

/* ---- file lists / dialog ---- */
.file-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.file-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--fg);
}

.file-list li .muted {
  margin-left: auto;
}

dialog {
  border: 3px solid var(--fg);
  padding: 1.5rem;
  width: min(560px, 92vw);
  background: var(--bg);
  color: var(--fg);
}

dialog.wide {
  width: min(860px, 94vw);
}

dialog::backdrop {
  background: var(--backdrop);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  border-bottom: 2px solid var(--fg);
  padding-bottom: 0.6rem;
}

.dialog-head h2 {
  margin: 0;
}

.dialog-body {
  max-height: 70vh;
  overflow-y: auto;
  margin-top: 0.25rem;
}

.dialog-body h3 {
  margin-top: 1.6rem;
  text-transform: uppercase;
}

.dialog-body h3:first-child {
  margin-top: 0.8rem;
}

/* ---- toast ---- */
.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border: 2px solid var(--fg);
  font-weight: 700;
}
