/* Windows 95 look. No inline styles anywhere (CSP): everything lives here. */

:root {
  --desktop: #008080;
  --face: #c0c0c0;
  --light: #dfdfdf;
  --highlight: #ffffff;
  --shadow: #808080;
  --dark: #0a0a0a;
  --text: #000000;
  --navy: #000080;
  --title-end: #1084d0;
  --link: #0000ee;
  --visited: #551a8b;
  --error: #a00000;

  /* Bevels: raised (windows, buttons) and sunken (inputs, panels). */
  --raised: inset -1px -1px var(--dark), inset 1px 1px var(--light),
    inset -2px -2px var(--shadow), inset 2px 2px var(--highlight);
  --sunken: inset -1px -1px var(--highlight), inset 1px 1px var(--shadow),
    inset -2px -2px var(--light), inset 2px 2px var(--dark);
  --pressed: inset -1px -1px var(--highlight), inset 1px 1px var(--dark),
    inset -2px -2px var(--light), inset 2px 2px var(--shadow);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Keep the hidden attribute working even on elements we give a display value (e.g. .banner). */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--desktop);
  color: var(--text);
  font-family: "Microsoft Sans Serif", "MS Sans Serif", Tahoma, Geneva, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

/* Desktop and window */

.desktop {
  padding: 2rem 1rem;
}

.window {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3px;
  background: var(--face);
  box-shadow: var(--raised);
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 3px 3px 4px;
  background: linear-gradient(90deg, var(--navy), var(--title-end));
  color: #ffffff;
  font-weight: 700;
}

.title-bar-text {
  letter-spacing: 0.02em;
}

.title-bar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 14px;
  background: var(--face);
  box-shadow: var(--raised);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.title-bar-close:active {
  box-shadow: var(--pressed);
}

/* Menu bar */

.menu-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 0;
  border-bottom: 1px solid var(--shadow);
  box-shadow: 0 1px 0 var(--highlight);
}

.menu-bar a,
.menu-bar-user {
  padding: 2px 8px;
  color: var(--text);
  text-decoration: none;
}

.menu-bar a:hover,
.menu-bar a:focus-visible {
  background: var(--navy);
  color: #ffffff;
  outline: none;
}

.menu-bar-user {
  margin-left: auto;
  color: var(--shadow);
}

/* Body */

.window-body {
  padding: 12px 14px 16px;
}

main {
  min-height: 6rem;
}

h1,
h2,
h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
}

h2 {
  font-size: 13px;
  margin-top: 16px;
}

p {
  margin: 0 0 10px;
}

a {
  color: var(--link);
}

a:visited {
  color: var(--visited);
}

.muted {
  color: var(--shadow);
}

hr {
  border: 0;
  border-top: 1px solid var(--shadow);
  border-bottom: 1px solid var(--highlight);
  margin: 14px 0;
}

/* Forms */

form {
  margin: 12px 0 0;
}

label {
  display: block;
  margin-bottom: 3px;
}

input:not([type="checkbox"], [type="radio"], [type="hidden"]),
select,
textarea {
  display: block;
  width: 100%;
  padding: 4px 5px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: var(--sunken);
  color: var(--text);
  font: inherit;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px dotted var(--text);
  outline-offset: -4px;
}

input::placeholder {
  color: var(--shadow);
}

/* "Remember me": checkbox and its label on one line. */
form p:has(> input[type="checkbox"]) {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

form p:has(> input[type="checkbox"]) label {
  display: inline;
  margin: 0;
}

input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
}

.helptext,
form p > span {
  display: block;
  margin-top: 3px;
  color: #404040;
  font-size: 12px;
}

.errorlist {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  color: var(--error);
}

.errorlist.nonfield {
  margin-bottom: 10px;
  padding: 6px 8px;
  background: #ffffff;
  box-shadow: var(--sunken);
}

/* Buttons */

button,
input[type="submit"] {
  min-width: 75px;
  min-height: 23px;
  padding: 3px 12px;
  border: 0;
  border-radius: 0;
  background: var(--face);
  box-shadow: var(--raised);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:active,
input[type="submit"]:active {
  box-shadow: var(--pressed);
  padding: 4px 11px 2px 13px;
}

button:focus-visible,
input[type="submit"]:focus-visible {
  outline: 1px dotted var(--text);
  outline-offset: -4px;
}

/* Banners (flash messages, htmx errors) */

.messages {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.banner {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin: 0 0 6px;
  padding: 6px 8px;
  background: #ffffff;
  box-shadow: var(--sunken);
}

.banner::before {
  flex: none;
  font-weight: 700;
  content: "\2139"; /* info */
  color: var(--navy);
}

.banner-success::before {
  content: "\2714";
  color: #007000;
}

.banner-warning::before {
  content: "\26A0";
  color: #8a6d00;
}

.banner-error::before {
  content: "\2716";
  color: var(--error);
}

/* Status bar */

.status-bar {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}

.status-bar-field {
  flex: 1;
  padding: 2px 4px;
  box-shadow: inset -1px -1px var(--highlight), inset 1px 1px var(--shadow);
  font-size: 12px;
}

@media (max-width: 480px) {
  .desktop {
    padding: 0;
  }
}
