:root {
  /* =========================
     BASE COLORS (only edit these)
     ========================= */

  --base-main: #5cb8e7;
  --base-secondary: #192a56;
  --base-text: #111827;

  /* =========================
     DEFAULT COLORS
     ========================= */

  --base-note: #fcfadc;
  --base-highlight: #007bff;
  --base-success: #418241;
  --base-warning: #ffa94d;
  --base-error: #e74c3c;

  /* =========================
     GENERATED SCALES
     ========================= */

  /* main */
  --main-10: color-mix(in srgb, var(--base-main) 10%, #ffffff);
  --main-40: color-mix(in srgb, var(--base-main) 40%, #ffffff);
  --main-70: color-mix(in srgb, var(--base-main) 70%, black);

  /* text */
  --text-3: color-mix(in srgb, var(--base-text) 3%, #ffffff);
  --text-4: color-mix(in srgb, var(--base-text) 4%, #ffffff);
  --text-5: color-mix(in srgb, var(--base-text) 5%, #ffffff);
  --text-10: color-mix(in srgb, var(--base-text) 10%, #ffffff);
  --text-30: color-mix(in srgb, var(--base-text) 30%, #ffffff);
  --text-50: color-mix(in srgb, var(--base-text) 50%, #ffffff);
  --text-60: color-mix(in srgb, var(--base-text) 60%, #ffffff);
  --text-70: color-mix(in srgb, var(--base-text) 70%, #ffffff);

  /* status */
  --highlight-80: color-mix(in srgb, var(--base-highlight) 80%, black);
  --error-20: color-mix(in srgb, var(--base-error) 20%, white);
  --success-20: color-mix(in srgb, var(--base-success) 20%, white);
  --disabled: color-mix(in srgb, var(--base-text) 10%, white);

  /* =========================
     SEMANTIC TOKENS
     ========================= */

  /* primary */
  --color-primary: var(--base-main);
  --color-primary-soft: var(--main-10);
  --color-primary-hover: var(--main-70);

  /* secondary */
  --color-secondary: var(--base-secondary);

  /* text */
  --color-text: var(--base-text);
  --color-text-muted: var(--text-60);
  --color-placeholder: var(--text-30);

  /* backgrounds */
  --color-bg: var(--text-50);
  --color-bg-soft: var(--text-5);
  --color-bg-softer: var(--text-3);
  --color-bg-hover: var(--text-4);
  --color-bg-white: #ffffff;
  --color-disabled: var(--disabled);

  /* border */
  --color-border: var(--text-30);

  /* links / highlight */
  --color-highlight: var(--base-highlight);
  --color-link: var(--highlight-80);

  /* status */
  --color-success: var(--base-success);
  --color-success-soft: var(--success-20);
  --color-error: var(--base-error);
  --color-error-soft: var(--error-20);
}

/* =========================
   DARK THEME
   ========================= */

.theme-dark {
  /* primary */
  --color-primary: var(--base-main);
  --color-primary-soft: var(--main-40);
  --color-primary-hover: var(--main-10);

  /* text */
  --color-text: var(--text-10);
  --color-text-muted: var(--text-30);
  --color-placeholder: var(--text-30);
  --color-text-inverse: var(--text-70);

  /* backgrounds */
  --color-bg: var(--text-70);
  --color-bg-soft: var(--text-60);
  --color-bg-softer: var(--text-50);
  --color-bg-hover: var(--text-60);
  --color-bg-white: var(--text-30);

  /* border */
  --color-border: var(--text-50);

  /* links / highlight */
  --color-link: var(--base-highlight);

  /* status */
  --color-success: var(--base-success);
  --color-success-soft: var(--success-20);
  --color-error: var(--base-error);
  --color-error-soft: var(--error-20);
}

body {
  font-family:
    "Noto Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif,
    "Apple Color Emoji",
    "Segoe UI Emoji",
    "Segoe UI Symbol";
  background-color: var(--color-bg-soft);
  min-height: 100vh;
  margin: 0;
}

main {
  max-width: 95%;
  margin: 0 auto;
}

nav menu {
  display: flex;
  width: 95%;
  align-items: center;
  justify-content: space-between;
  padding: 0;
}

nav {
  display: flex;
  justify-content: center;
  background-color: var(--color-bg-white);
  margin-left: auto;
  gap: 0.5rem;
}

nav a:has(img) {
  background-color: transparent;
  display: inline;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95em;
  padding: 0;
  display: flex;
}

nav img {
  height: 2em;
}

nav a,
button[type="submit"],
.new-request-btn,
.new-support-btn,
.new-person-btn {
  padding: 10px 15px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95em;
}

trix-editor {
  min-height: 15em !important;
}

.new-request-btn,
.new-support-btn,
.new-person-btn {
  background-color: var(--color-primary);
  color: var(--color-bg-white);
  border: none;
  text-decoration: none;
  padding: 8px 15px;
}

.new-request-btn:hover,
.new-support-btn:hover,
.new-person-btn:hover {
  background-color: var(--color-primary);
  color: var(--color-bg-white);
}

.requests-nav,
.dashboard-nav,
.people-nav,
.team-nav,
.tag-nav {
  text-decoration: none;
  color: var(--color-text-muted);
}

.requests-nav.active,
.dashboard-nav.active,
.people-nav.active,
.team-nav.active,
.tag-nav.active {
  text-decoration: none;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  padding: 6px 14px;
}

nav form a {
  padding: 6px 14px;
  display: inline-block;
  transition: all 0.2s ease;
}

nav form a:hover {
  filter: brightness(0.9);
  transform: scale(0.98); /* "pop" effect */
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

input,
select,
textarea {
  padding: 10px 12px;
  border: var(--color-border) 1px solid;
  border-radius: 4px;
  font-size: 1rem;
  background: var(--color-bg-white);
}

select {
  color: var(--color-placeholder);
}

select option {
  color: var(--color-text);
}

select:has(option:not([value=""]):checked) {
  color: var(--color-text);
}

label {
  font-weight: bold;
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

fieldset input,
fieldset select,
fieldset textarea {
  display: block;
}

fieldset:has(textarea) {
  width: 100%;
}

textarea {
  width: 100%;
}

form h2 input:focus,
input:focus {
  border-color: var(--color-highlight);
  outline: none;
}

button[type="submit"] {
  background-color: var(--color-primary);
  color: var(--color-bg-white);
  border: none;
  display: inline;
  transition: background-color 0.2s;
}

button {
  transition: all 0.2s ease;
}

button:hover,
menu a img:hover {
  filter: brightness(0.9);
  transform: scale(0.98); /* "pop" effect */
}

section {
  margin: 20px auto;
  background-color: var(--color-bg-white);
  border-radius: 8px;
  border: var(--color-border) 1px solid;
}

header {
  display: flex;
  align-items: center;
}

header h1 {
  font-size: 1.5em;
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

a.subtle {
  color: inherit;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  table-layout: fixed;
  background: var(--color-bg-white);
}

table tr + tr {
  border-top: 1px solid var(--color-bg-soft);
}

table th,
table td {
  text-align: left;
  border-bottom: none;
  word-break: break-all;
}

table th {
  font-weight: 500;
  color: var(--color-text-muted);
  background-color: var(--color-bg-softer);
}

table th.sort-asc::after {
  content: " ↑";
}

table th.sort-desc::after {
  content: " ↓";
}

table a {
  color: var(--color-link);
  text-decoration: none;
}

table a:hover {
  text-decoration: underline;
}

table tr:hover {
  background-color: var(--color-bg-hover);
}

/* Request column width */
.col-id {
  width: 6%;
}

.col-author {
  width: 10%;
}

.col-subject {
  width: 35%;
}

.col-tags {
  width: 16%;
}

.col-priority {
  width: 8%;
  white-space: nowrap;
}

.col-status {
  width: 9%;
  white-space: nowrap;
}

.col-assignee {
  width: 10%;
}

.col-created {
  width: 6%;
}

/* <mark> is used for tags/badges */
mark {
  display: inline-block;
  font-size: 0.75rem;
  padding: 3px 8px;
  margin: 2px 2px 0 0;
  border-radius: 6px;
  text-align: center;
  background-color: var(--color-bg-soft);
  color: var(--color-text);
  border: none;
  font-weight: 500;
}

mark form {
  display: inline-block;
  visibility: hidden;
}

mark:hover form {
  visibility: visible;
}

mark button[type="submit"] {
  padding: 3px;
  margin-left: 1em;
  display: inline;
  color: var(--color-bg-white);
  border: none;
  cursor: pointer;
  font-size: inherit;
  font-weight: inherit;
  gap: 0;
  transition: none;
  background-color: inherit;
  backdrop-filter: brightness(1.5);
}

time {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

cite {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-style: normal;
}

nav > form {
  display: flex;
  align-items: center;
}

/* Input Field Floating Label */
search {
  display: flex;
}

.search-field,
.form-group {
  position: relative;
  flex: 1;
  border: none;
  padding: 0;
  width: 100%;
}

.search-field input,
.form-group input {
  font-size: 1rem;
  background: var(--color-bg-white);
  transition: border-color 0.2s ease;
}

.form-group textarea,
.form-group textarea {
  width: 100%;
  box-sizing: border-box;
}

.form-group label:first-of-type {
  position: absolute;
  left: 0.6rem;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  background: var(--color-bg-white);
  padding: 0 0.25rem;
  border-radius: 10px;
  transition: 0.15s ease all;
  font-size: 0.8rem;
  font-weight: initial;
}

.form-group input:focus + label,
.form-group input:not(:placeholder-shown) + label,
.form-group textarea:focus + label,
.form-group textarea:not(:placeholder-shown) + label {
  top: 0.1rem;
}

.search-field label {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
  background: var(--color-bg-white);
  color: var(--color-text);
  padding: 0 0.25rem;
  border-radius: 10px;
  transition: 0.15s ease all;
  font-size: 0.9rem;
  font-weight: initial;
}

.search-field input:focus + label,
.search-field input:not(:placeholder-shown) + label {
  top: 0.1rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.search-field input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--color-highlight);
  outline: none;
  transition: 0.15s ease all;
}

.form-group:focus-within label,
.search-field:focus-within label {
  color: var(--color-highlight);
  transition: 0.15s ease all;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-placeholder);
}

input:focus::placeholder,
textarea:focus::placeholder {
  color: transparent;
}

.plus-btn,
.search-icon-btn,
.edit-icon-btn,
.unlink-btn {
  background: none;
  border: none;
  background-color: transparent !important;
  padding: 0 !important;
}

.edit-icon-btn {
  padding: 0 !important;
  background-color: none;
}

.edit-note {
  display: flex;
  justify-content: flex-end;
}

search > form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

search > form .search-icon-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}

.plus-img,
search > form .search-icon-btn img {
  display: block;
  width: 1rem;
  height: 1rem;
  opacity: 0.6;
}

article > form .plus-btn:hover img,
article > form input:focus ~ .plus-btn img,
search > form .search-icon-btn:hover img,
search > form input:focus ~ .search-icon-btn img {
  opacity: 1;
}

.logo-container img {
  margin-bottom: 30px;
  max-width: 100%;
  height: auto;
}

.form-group {
  text-align: left;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 1rem;
  box-sizing: border-box;
  color: var(--color-text);
  appearance: none;
}

.error-message {
  border: 1px solid var(--color-error);
  background-color: var(--color-error-soft);
  color: var(--color-error);
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.error-message header {
  background-color: var(--color-error-soft);
  top: auto;
}

.error-wrapper {
  width: 95%;
  margin: 0 auto;
  margin-top: 1rem;
}

.success-message {
  border: 1px solid var(--color-success);
  background-color: var(--color-success-soft);
  color: var(--color-success);
  padding: 10px;
  border-radius: 4px;
  margin-right: 5px;
}

.success-message header {
  background-color: var(--color-success-soft);
  top: auto;
}

.success-wrapper {
  position: fixed;
  z-index: 1000;
  margin: 10px auto;
  bottom: 0;
  animation: fadeOut 5s ease-in-out forwards;
}

.wrapper {
  display: flex;
  justify-content: end;
}

@keyframes fadeOut {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  60% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
  }
}

figure {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

footer {
  background-color: var(--color-secondary);
  color: var(--color-bg-white);
  width: 100%;
  margin-top: -100px;
  position: relative;
  z-index: -1;
  padding: 140px 0 40px 0;

  background-image:
    radial-gradient(ellipse at center, rgba(30, 60, 90, 0.4) 0%, rgba(25, 42, 86, 0) 70%),
    linear-gradient(to top, rgba(25, 42, 86, 0.2) 0%, rgba(25, 42, 86, 1) 100%);
  background-size: cover;
  background-position: center;
}

/* Tooltip bubble */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.tooltip .tooltiptext {
  visibility: hidden;
  background-color: var(--color-text);
  color: var(--color-bg-white);
  text-align: center;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  position: absolute;
  z-index: 10;
  top: 140%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  opacity: 90%;
  font-size: small;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent var(--color-text) transparent;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
}

.back-button {
  width: 2rem;
  align-self: end;
}

.back-button img {
  width: 1.4rem;
  height: 1.4rem;
}

.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
  cursor: pointer;
  display: flex;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  min-width: 160px;
  padding: 0.25rem 0;
}

.dropdown li {
  list-style: none;
}

.dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: inherit;
  z-index: 10;
}

.dropdown a:hover {
  background: var(--color-bg-hover);
}

.user-menu[open] summary {
  opacity: 0.9;
}

.navbar menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar {
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.user-menu:hover .dropdown,
.user-menu[open] .dropdown {
  transform: translateY(0);
  opacity: 1;
  z-index: 10;
}

h4.queue_header {
  margin-bottom: 0.4em !important;
  margin-top: 0.4em !important;
}

.queue_header {
  display: flex;
  justify-content: center;
  font-size: 20px;
  opacity: 0.9;
}

.queue_content {
  display: flex;
  justify-content: center;
  font-size: 100px;
  font-weight: 600;
}

.queue_extras {
  font-size: 20px;
}

.small_box_container {
  font-weight: 600;
}

.box_two .queue_extras:empty {
  visibility: hidden;
}

.box_two > div {
  display: flex;
  flex-direction: column; /* stack vertically */
  align-items: center; /* center text horizontally */
  gap: 4px;
}

.metrics_header {
  margin-top: 1em;
}

.box_container,
.small_box_container {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-bg-white);
}

.small_box_container fieldset {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-inline: 1em;
  padding-block: 0.4em;
  cursor: pointer;
}

.box_container fieldset {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding-inline: 1em;
  padding-block: 1em;
  cursor: pointer;
}

.small_box_one {
  border-bottom-left-radius: 8px;
}

.small_box_three {
  border-bottom-right-radius: 8px;
}

.box_one,
.small_box_one {
  border-top: 1px solid var(--color-bg-white);
  border-left: 1px solid var(--color-bg-white);
  background: var(--color-primary);
  color: var(--color-bg-white);
  border-top-left-radius: 8px;
  outline: 0.5px solid var(--color-bg-white);
}

.box_two,
.small_box_two {
  border-left: 1px solid var(--color-bg-white);
  border-right: 1px solid var(--color-bg-white);
  border-top: 1px solid var(--color-bg-white);
  background: var(--color-primary);
  color: var(--color-bg-white);
}

.box_three,
.small_box_three {
  border-top: 1px solid var(--color-bg-white);
  border-right: 1px solid var(--color-bg-white);
  background: var(--base-warning);
  color: var(--color-bg-white);
  border-top-right-radius: 8px;
  outline: 0.5px solid var(--color-bg-white);
}

.box_four {
  border-left: 1px solid var(--color-bg-white);
  border-right: 1px solid var(--color-bg-white);
  background: var(--color-text-muted);
  color: var(--color-bg-white);
  border-bottom-left-radius: 8px;
  outline: 0.5px solid var(--color-bg-white);
  min-height: 250px;
}

.box_five {
  border-right: 1px solid var(--color-bg-white);
  background: var(--color-text-muted);
  color: var(--color-bg-white);
  border-bottom-right-radius: 8px;
  outline: 0.5px solid var(--color-bg-white);
  min-height: 250px;
}

.queue_good {
  background: var(--color-success) !important;
}

.name_grid_1::first-line,
.name_grid_2::first-line,
.name_grid_3::first-line {
  word-spacing: normal;
}

.name_grid_1,
.name_grid_2,
.name_grid_3 {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  line-height: 1;
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  color: var(--color-bg-white);
  background: none;
  padding: 0;
}

.name_grid_1 > *,
.name_grid_2 > *,
.name_grid_3 > * {
  border: 1px solid var(--color-bg-white);
  padding: 0.6em;
  border-radius: 4px;
  flex: 0 1 auto;
  margin-top: 0.2em;
  margin-bottom: 0.2em;
}

.name_grid_2 > *,
.name_grid_3 > * {
  width: 300px;
}

.name_grid_1 > * {
  background: var(--color-success);
  width: 200px;
}

/* .name_grid_2 > * {
  background: #ffc1cc;
}

.name_grid_3 > * {
  background: #cba6ff;
} */

.queue-link {
  text-decoration: none;
  color: inherit;
  padding: 0 !important;
}

/* TODO: sort out what is not used */
.user-menu {
  position: relative;
}

.user-menu .dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: #fff;
  border-radius: 8px;
  padding: 0.25rem 0;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
  display: none;
}

.user-menu[open] .dropdown {
  display: block;
}

.user-menu summary {
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-icon {
  cursor: pointer;
}

.sign-out-btn {
  background-color: var(--color-bg-white);
  border-radius: 4px;
}

.is-hidden {
  display: none;
}

.hidden {
  visibility: hidden;
}

.submit-btn {
  display: flex;
  justify-content: flex-end;
}

/* Cliclable cell formatting */
.clickable-cell {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}

.clickable-blue-cell {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: var(--color-link);
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}

.clickable-blue-cell-np {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: var(--color-link);
}

.non-clickable-cell {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}

/* Two column input fields */
.default-selects {
  display: inline-flex;
  gap: 0.5em;
}

.field_column {
  display: inline-flex;
  gap: 0.5em;
}

.field_grid {
  display: grid;
}
