/*
  RSK.Tav - base stylesheet: design tokens, reset, form-control defaults and the page shell.
  Every layout loads this file first.

  Plain CSS with no build step, split by what a page needs (base, components, forms, tables, then the
  per-area files). Tokens are custom properties; views use semantic class names, never utility classes.
*/

:root {
  /* Brand */
  --primary-50: #f5f3ff;
  --primary-100: #ede9fe;
  --primary-200: #ddd6fe;
  --primary-300: #c4b5fd;
  --primary-400: #a78bfa;
  --primary-500: #8b5cf6;
  --primary-600: #7c3aed;
  --primary-700: #1b1c89;
  --primary-800: #15156a;
  --primary-900: #0f0f42;

  --secondary-500: #7d7d7d;
  --secondary-600: #5a5a5a;

  --success: #0cad39;
  --success-dark: #08842e;
  --danger: #cc4c25;
  --danger-dark: #a0302f;
  --warning: #f0c42b;
  --info: #4099f3;

  --page: #dadee0;
  --surface: #ffffff;
  --footer: #242582;

  /* Neutrals (Tailwind's gray scale, as hex) */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --border: #cbd5e1;

  /* Status colours: background, border, text. */
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-300: #fca5a5;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-800: #991b1b;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --yellow-50: #fefce8;
  --yellow-100: #fef9c3;
  --yellow-200: #fef08a;
  --yellow-300: #fde047;
  --yellow-600: #ca8a04;
  --yellow-800: #854d0e;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-300: #93c5fd;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --orange-100: #ffedd5;
  --orange-800: #9a3412;
  --cyan-100: #cffafe;
  --cyan-800: #155e75;
  --purple-100: #f3e8ff;
  --purple-800: #6b21a8;
  --indigo-100: #e0e7ff;
  --indigo-800: #3730a3;
  --pink-100: #fce7f3;
  --pink-800: #9d174d;
  --violet-100: #ede9fe;
  --violet-800: #5b21b6;
  --amber-100: #fef3c7;
  --amber-800: #92400e;

  --font: "Public Sans", "Roboto", "Arial", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius: 6px;
  --radius-lg: 8px;
  --page-width: 1440px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 5%);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -2px rgb(0 0 0 / 10%);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 10%);
  --shadow-panel: 0 4px 6px -1px rgb(0 0 0 / 5%), 0 2px 4px -1px rgb(0 0 0 / 2.5%);
  --focus-ring: 0 0 0 2px var(--primary-200);
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  border: 0 solid;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  line-height: 1.5;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--page);
  color: var(--gray-900);
}

hr {
  height: 0;
  color: inherit;
  border-top-width: 1px;
}

h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
}

a {
  color: inherit;
  text-decoration: inherit;
}

b, strong {
  font-weight: bolder;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 1em;
}

small {
  font-size: 80%;
}

table {
  text-indent: 0;
  border-color: inherit;
  border-collapse: collapse;
}

summary {
  display: list-item;
}

ol, ul, menu {
  list-style: none;
}

img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
  vertical-align: middle;
}

img, video {
  max-width: 100%;
  height: auto;
}

button, input, select, optgroup, textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  opacity: 1;
  background-color: transparent;
  border-radius: 0;
}

button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
  appearance: button;
}

::placeholder {
  opacity: 1;
  color: var(--gray-400);
}

textarea {
  resize: vertical;
}

[hidden]:not([hidden="until-found"]) {
  display: none !important;
}

/* Form controls: the plain look an unclassed field gets; forms.css refines it for the screens. */
input:is([type="text"], :not([type]), [type="email"], [type="url"], [type="password"], [type="number"], [type="date"],
         [type="datetime-local"], [type="month"], [type="search"], [type="tel"], [type="time"], [type="week"]),
select,
textarea {
  appearance: none;
  background-color: #fff;
  border: 1px solid var(--gray-500);
  border-radius: 0;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5rem;
}

input:is([type="text"], :not([type]), [type="email"], [type="url"], [type="password"], [type="number"], [type="date"],
         [type="datetime-local"], [type="month"], [type="search"], [type="tel"], [type="time"], [type="week"]):focus,
select:focus,
textarea:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 1px var(--blue-600);
}

select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

input[type="checkbox"],
input[type="radio"] {
  appearance: none;
  display: inline-block;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  padding: 0;
  vertical-align: middle;
  user-select: none;
  color: var(--blue-600);
  background-color: #fff;
  background-origin: border-box;
  border: 1px solid var(--gray-500);
}

input[type="radio"] {
  border-radius: 100%;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--blue-600);
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background-color: currentColor;
  background-position: 50%;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  border-color: transparent;
}

input[type="checkbox"]:checked {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}

input[type="radio"]:checked {
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
}

/* Page shell */
.page-main {
  width: 100%;
  max-width: var(--page-width);
  flex-grow: 1;
  margin: 0.5rem auto;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
}

/* A hidden-by-default label for screen readers, used where a control has no visible text. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}
