/*
 * Mindler brand, taken from `packages/ui/src/theme.css` in the nova
 * repository. The token values below are copied from there, so the two apps
 * look like one product. Nova has no dark theme, so neither does this.
 *
 * Fonts are served from this app rather than from a CDN: no third-party
 * request, and `default-src 'self'` in the content security policy already
 * allows them.
 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/Inter-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/Inter-Medium.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/Inter-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "InterDisplay";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/InterDisplay-Medium.woff2") format("woff2");
}

:root {
  color-scheme: light;

  /* ── Brand tokens, copied from nova ─────────────────────────────────── */
  --brand:        #f0affa; /* Mindler pink */
  --brand-hover:  #e99cf5;
  --brand-dark:   #49125c;
  --brand-xlight: #fdebff;

  --neutral-black:     #1d1b1b;
  --neutral-gray:      #656565;
  --neutral-medium:    #c7c7c7;
  --neutral-light:     #f2f0e9;
  --neutral-xlight:    #f5f3f3;
  --neutral-white:     #ffffff;
  --neutral-divider:   #e6e6e6;
  --neutral-warm-dark: #554f4d;
  /* The one muted tone that clears 4.5:1 on white. */
  --neutral-muted:     #767472;

  --semantic-error:       #b11500;
  --semantic-error-light: #ffebea;
  --semantic-success:     #00714f;
  --semantic-success-light: #ebf7f2;

  /* Focus is deliberately not a brand colour: the pink is chosen to sit under
   * text and has no contrast floor of its own. */
  --focus: #0061b6;

  --font-body:    "Inter", system-ui, sans-serif;
  --font-display: "InterDisplay", "Inter", system-ui, sans-serif;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 12px;

  --shadow-card: 0 2px 12px rgba(118, 116, 114, 0.15);

  /* ── Roles this app uses ────────────────────────────────────────────── */
  --bg:          var(--neutral-light);
  --surface:     var(--neutral-white);
  --surface-raised: var(--neutral-xlight);
  --border:      var(--neutral-divider);
  --border-strong: var(--neutral-medium);
  --text:        var(--neutral-black);
  --muted:       var(--neutral-muted);
  --link:        var(--brand-dark);
  --accent:      var(--brand);
  --accent-text: var(--brand-dark);

  --danger-bg:     var(--semantic-error-light);
  --danger-border: #f3c4c0;
  --danger-text:   var(--semantic-error);
  --ok-bg:         var(--semantic-success-light);
  --ok-border:     #bfe2d4;
  --ok-text:       var(--semantic-success);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, .brand {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 12px 16px;
}

.header-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}

.brand img { display: block; width: 28px; height: 28px; }

.sep { color: var(--border-strong); }

.crumb {
  color: var(--muted);
  text-decoration: none;
}

.crumb:hover { color: var(--text); text-decoration: underline; }

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px 0;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
}

.nav a.active { color: var(--text); border-bottom-color: var(--brand-hover); }
.nav a:hover { color: var(--text); }

.nav-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.who { color: var(--muted); font-size: 14px; }

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}

.link-button:hover { color: var(--text); }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}

h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 28px 0 8px; }

.lede { color: var(--muted); margin: 0 0 24px; }

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

.field { margin-bottom: 20px; }

label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
}

.hint {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 6px;
}

input[type="text"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

textarea { min-height: 150px; resize: vertical; }

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.radio-list { display: grid; gap: 8px; }

.radio {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface-raised);
  cursor: pointer;
}

.radio:hover { border-color: var(--brand-hover); }
.radio input { margin-top: 4px; accent-color: var(--brand-dark); }
.radio strong { display: block; font-weight: 500; }
.radio span { color: var(--muted); font-size: 14px; }

/* `button.primary` for forms, `a.primary` for a link that is the main action. */
.primary {
  display: inline-block;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius);
  padding: 12px 22px;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.primary:hover { background: var(--brand-hover); }
.primary:disabled { opacity: 0.6; cursor: progress; }

.banner {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid;
}

.banner.error { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
.banner.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }

.kb {
  display: block;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
}

.kb:hover { border-color: var(--brand-hover); box-shadow: var(--shadow-card); }

/* ── The welcome page: one card per tool in src/tools.ts ────────────────── */
.tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

/* The whole card is the link. `.tool-name a` is stretched across it with a
 * pseudo-element, which keeps one real link in the markup instead of wrapping
 * the card in an anchor that cannot legally contain the quick links. */
.tool {
  position: relative;
  display: flex;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;
}

.tool:hover { border-color: var(--brand-hover); box-shadow: var(--shadow-card); }

.tool-name a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
}

/* The ring belongs on the card, because the card is what the link covers. */
.tool:has(.tool-name a:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.tool-name a:focus-visible { outline: none; }

.tool-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--brand-xlight);
  color: var(--brand-dark);
}

.tool-body { min-width: 0; }

.tool-name { font-size: 17px; margin: 0 0 4px; }
.tool-name a { color: var(--text); text-decoration: none; }
.tool:hover .tool-name a { text-decoration: underline; }

.tool-summary { color: var(--muted); font-size: 14px; margin: 0 0 10px; }

/* Above the stretched link, so the quick actions stay clickable. */
.tool-links {
  position: relative;
  z-index: 1;
  margin: 0;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  width: fit-content;
}

.tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.ticket {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.ticket a { color: var(--text); font-weight: 500; text-decoration: none; }
.ticket a:hover { text-decoration: underline; }

.meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  display: inline-block;
  border-radius: 9999px;
  padding: 1px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
}

.pill.open { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.pill.closed { background: var(--surface-raised); color: var(--muted); }

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