/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */

/* normalize.css applies to screen media only. */
@media screen {
  /* Document
     ========================================================================== */

  /**
   * 1. Correct the line height in all browsers.
   * 2. Prevent adjustments of font size after orientation changes in iOS.
   */

  html {
    line-height: 1.15; /* 1 */
    -webkit-text-size-adjust: 100%; /* 2 */
  }

  /* Sections
     ========================================================================== */

  /**
   * Remove the margin in all browsers.
   */

  body {
    margin: 0;
  }

  /**
   * Render the `main` element consistently in IE.
   */

  main {
    display: block;
  }

  /**
   * Correct the font size and margin on `h1` elements within `section` and
   * `article` contexts in Chrome, Firefox, and Safari.
   */

  h1 {
    font-size: 2em;
    margin: 0.67em 0;
  }

  /* Grouping content
     ========================================================================== */

  /**
   * 1. Add the correct box sizing in Firefox.
   * 2. Show the overflow in Edge and IE.
   */

  hr {
    box-sizing: content-box; /* 1 */
    height: 0; /* 1 */
    overflow: visible; /* 2 */
  }

  /**
   * 1. Correct the inheritance and scaling of font size in all browsers.
   * 2. Correct the odd `em` font sizing in all browsers.
   */

  pre {
    font-family: monospace, monospace; /* 1 */
    font-size: 1em; /* 2 */
  }

  /* Text-level semantics
     ========================================================================== */

  /**
   * Remove the gray background on active links in IE 10.
   */

  a {
    background-color: transparent;
  }

  /**
   * 1. Remove the bottom border in Chrome 57-
   * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
   */

  abbr[title] {
    border-bottom: none; /* 1 */
    text-decoration: underline; /* 2 */
    text-decoration: underline dotted; /* 2 */
  }

  /**
   * Add the correct font weight in Chrome, Edge, and Safari.
   */

  b,
  strong {
    font-weight: bolder;
  }

  /**
   * 1. Correct the inheritance and scaling of font size in all browsers.
   * 2. Correct the odd `em` font sizing in all browsers.
   */

  code,
  kbd,
  samp {
    font-family: monospace, monospace; /* 1 */
    font-size: 1em; /* 2 */
  }

  /**
   * Add the correct font size in all browsers.
   */

  small {
    font-size: 80%;
  }

  /**
   * Prevent `sub` and `sup` elements from affecting the line height in
   * all browsers.
   */

  sub,
  sup {
    font-size: 75%;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
  }

  sub {
    bottom: -0.25em;
  }

  sup {
    top: -0.5em;
  }

  /* Embedded content
     ========================================================================== */

  /**
   * Remove the border on images inside links in IE 10.
   */

  img {
    border-style: none;
  }

  /* Forms
     ========================================================================== */

  /**
   * 1. Change the font styles in all browsers.
   * 2. Remove the margin in Firefox and Safari.
   */

  button,
  input,
  optgroup,
  select,
  textarea {
    font-family: inherit; /* 1 */
    font-size: 100%; /* 1 */
    line-height: 1.15; /* 1 */
    margin: 0; /* 2 */
  }

  /**
   * Show the overflow in IE.
   * 1. Show the overflow in Edge.
   */

  button,
  input {
    /* 1 */
    overflow: visible;
  }

  /**
   * Remove the inheritance of text transform in Edge, Firefox, and IE.
   * 1. Remove the inheritance of text transform in Firefox.
   */

  button,
  select {
    /* 1 */
    text-transform: none;
  }

  /**
   * Correct the inability to style clickable types in iOS and Safari.
   */

  button,
  [type="button"],
  [type="reset"],
  [type="submit"] {
    -webkit-appearance: button;
  }

  /**
   * Remove the inner border and padding in Firefox.
   */

  button::-moz-focus-inner,
  [type="button"]::-moz-focus-inner,
  [type="reset"]::-moz-focus-inner,
  [type="submit"]::-moz-focus-inner {
    border-style: none;
    padding: 0;
  }

  /**
   * Correct the padding in Firefox.
   */

  fieldset {
    padding: 0.35em 0.75em 0.625em;
  }

  /**
   * 1. Correct the text wrapping in Edge and IE.
   * 2. Correct the color inheritance from `fieldset` elements in IE.
   * 3. Remove the padding so developers are not caught out when they zero out
   *    `fieldset` elements in all browsers.
   */

  legend {
    box-sizing: border-box; /* 1 */
    color: inherit; /* 2 */
    display: table; /* 1 */
    max-width: 100%; /* 1 */
    padding: 0; /* 3 */
    white-space: normal; /* 1 */
  }

  /**
   * Add the correct vertical alignment in Chrome, Firefox, and Opera.
   */

  progress {
    vertical-align: baseline;
  }

  /**
   * Remove the default vertical scrollbar in IE 10+.
   */

  textarea {
    overflow: auto;
  }

  /**
   * 1. Add the correct box sizing in IE 10.
   * 2. Remove the padding in IE 10.
   */

  [type="checkbox"],
  [type="radio"] {
    box-sizing: border-box; /* 1 */
    padding: 0; /* 2 */
  }

  /**
   * Correct the cursor style of increment and decrement buttons in Chrome.
   */

  [type="number"]::-webkit-inner-spin-button,
  [type="number"]::-webkit-outer-spin-button {
    height: auto;
  }

  /**
   * 1. Correct the odd appearance in Chrome and Safari.
   * 2. Correct the outline style in Safari.
   */

  [type="search"] {
    -webkit-appearance: textfield; /* 1 */
    outline-offset: -2px; /* 2 */
  }

  /**
   * Remove the inner padding in Chrome and Safari on macOS.
   */

  [type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
  }

  /**
   * 1. Correct the inability to style clickable types in iOS and Safari.
   * 2. Change font properties to `inherit` in Safari.
   */

  ::-webkit-file-upload-button {
    -webkit-appearance: button; /* 1 */
    font: inherit; /* 2 */
  }

  /* Interactive
     ========================================================================== */

  /*
   * Add the correct display in Edge, IE 10+, and Firefox.
   */

  details {
    display: block;
  }

  /*
   * Add the correct display in all browsers.
   */

  summary {
    display: list-item;
  }

  /* Misc
     ========================================================================== */

  /**
   * Add the correct display in IE 10+.
   */

  template {
    display: none;
  }

  /**
   * Add the correct display in IE 10.
   */

  [hidden] {
    display: none;
  }
}

/* Shared admin/user page styles. Screens get the dark scheme (see the
   @media screen block below); print keeps the light base styles. */
:root {
  color-scheme: dark;
}
@media print {
  :root {
    color-scheme: light;
  }
}

/* One visible keyboard-focus ring everywhere (also replaces the button
   focus restore normalize.css used to carry). */
:focus-visible {
  outline: 2px solid #4d90fe;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: sans-serif;
  margin: 0 auto;
  padding: 1em;
  max-width: 800px;
}

details summary {
  cursor: pointer;
  font-weight: bold;
}
details > *:not(summary) {
  margin: 0.5em;
}
[hidden] {
  display: none !important;
}

.pagination {
  list-style-type: none;
  padding: 0;
}
.pagination li {
  display: inline-block;
}
.pagination li a {
  display: block;
  padding: 0.5em 1em;
  border-bottom: none;
  text-decoration: none;
}
.pagination li.active a {
  background-color: #58739c;
  color: #fff;
}

table.striped tr:nth-child(even) {
  background-color: #eaeaea;
}
table.full-width {
  width: min(1180px, calc(100vw - 3rem));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}

th.active {
  background-color: #e0e6f6;
}
th.sortable:hover {
  background-color: #e0e6f6;
}
.sort-button {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 0;
}
th.sortable .sort-indicator::after {
  content: "\21C5";
  opacity: 0.4;
  margin-left: 0.3em;
  font-size: 0.8em;
}
th[aria-sort="ascending"] .sort-indicator::after {
  content: "\25B2";
  opacity: 1;
}
th[aria-sort="descending"] .sort-indicator::after {
  content: "\25BC";
  opacity: 1;
}
td.actions {
  padding: 0;
  width: 0;
  text-align: center;
}
td.actions a {
  text-decoration: none;
  background-color: transparent;
  padding: 0.5em;
  height: 100%;
  width: 100%;
}
td.actions:hover {
  background-color: #e0e6f6;
}
tr > td,
tr > th {
  border-right: 1px solid #dedede;
}

.flash {
  padding: 1em;
}
.flash strong {
  color: inherit;
}
.flash-success {
  color: green;
  background-color: #ddffee;
}
.flash-error {
  color: #a40000;
  background-color: #eedddd;
}
.flash-warning {
  color: #7a4100;
  background-color: #ffeecc;
}
.flash-info {
  color: blue;
  background-color: #ddeeff;
}

/* Issue #271: usage-bar fills are theme-aware custom properties. The
   base (light/print) scheme keeps both transparent so no bar renders
   and cells stay readable; the dark @media screen block overrides them. */
:root {
  --quota-bar-fill: transparent;
  --quota-bar-fill-hot: transparent;
}

.quota-low {
  color: #7a4100;
  background-color: #ffeecc;
}

/* Quota families the user never used and the proxy cannot serve right now
   stay collapsed until the "Show all families" checkbox (a preceding
   sibling of the table) is ticked; an active family filter searches them
   too. */
.quota-show-all:not(:checked)
  ~ table:not(.quota-filtering)
  tr[data-quota-collapsed] {
  display: none;
}

@media (max-width: 800px) {
  body {
    padding: 0.5em;
  }

  table.full-width {
    width: 100%;
    position: static;
    left: auto;
    right: auto;
    transform: none;
    margin-left: 0;
    margin-right: 0;
  }
}

@media screen {
  html {
    scrollbar-color: #1c1c1c #0a0a0a;
    scrollbar-width: thin;
  }

  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #070707;
    color: #999;
    margin: 0 auto;
    max-width: 740px;
    padding: 2.5rem 1.5rem 4rem;
    line-height: 1.55;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: #ccc;
  }

  h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
  }

  h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 2rem 0 0.8rem;
  }

  h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 1.5rem 0 0.7rem;
  }

  p,
  li,
  label,
  legend,
  summary {
    color: #999;
  }

  strong {
    color: #bbb;
  }

  a {
    color: #8a8a8a;
    text-decoration-color: #666;
    text-underline-offset: 3px;
  }

  a:hover {
    color: #ccc;
    text-decoration-color: #999;
  }

  hr {
    border: 0;
    border-top: 1px solid #181818;
    margin: 1.5rem 0;
  }

  code,
  kbd,
  samp,
  pre {
    font-family: "SF Mono", Consolas, monospace;
  }

  code,
  kbd,
  samp {
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
    color: #c8c8c8;
    padding: 0.08rem 0.28rem;
  }

  pre {
    background: #040404;
    border: 1px solid #181818;
    border-radius: 3px;
    color: #777;
    padding: 0.7rem 0.9rem;
  }

  fieldset {
    border: 1px solid #181818;
    border-radius: 3px;
    padding: 0.85rem 1rem;
  }

  legend {
    color: #ccc;
    padding: 0 0.3rem;
  }

  input,
  select,
  textarea {
    background: #070707;
    border: 1px solid #242424;
    border-radius: 3px;
    color: #e4e4e4;
    padding: 0.45rem 0.55rem;
  }

  input:focus,
  select:focus,
  textarea:focus {
    background: #0a0a0a;
    border-color: #4a4a4a;
  }

  input::placeholder,
  textarea::placeholder {
    color: #808080;
  }

  button,
  input[type="button"],
  input[type="submit"] {
    background: #181818;
    border: 1px solid #2e2e2e;
    border-radius: 3px;
    color: #e6e6e6;
    cursor: pointer;
    transition:
      background 0.18s ease,
      border-color 0.18s ease,
      color 0.18s ease;
  }

  button:hover,
  input[type="button"]:hover,
  input[type="submit"]:hover {
    background: #242424;
    border-color: #4a4a4a;
    color: #fff;
  }

  table {
    color: #999;
    margin-left: auto;
    margin-right: auto;
  }

  table.full-width {
    display: table;
    margin-left: auto;
    margin-right: auto;
  }

  .token-cell {
    min-width: min(28rem, 38vw);
  }

  .token-link {
    display: block;
    max-width: 100%;
    text-decoration: none;
  }

  .token-link code,
  .token-code {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  th,
  td {
    border-bottom-color: #181818;
  }

  table.striped tr:nth-child(even) {
    background-color: #0d0d0d;
  }

  thead th {
    background: #0d0d0d;
    color: #ccc;
  }

  th.active {
    background-color: #181818;
    color: #e6e6e6;
  }

  th.sortable:hover {
    background-color: #181818;
  }

  .sort-button,
  .sort-button:hover {
    background: transparent;
    border-color: transparent;
    color: inherit;
  }

  td.actions:hover {
    background-color: #181818;
  }

  td.actions a {
    color: #999;
  }

  tr > td,
  tr > th {
    border-right: 1px solid #181818;
  }

  .pagination li a {
    color: #8a8a8a;
  }

  .pagination li.active a {
    background-color: #181818;
    color: #e6e6e6;
  }

  .flash {
    border: 1px solid #242424;
    border-left-width: 2px;
    border-radius: 3px;
    padding: 0.65rem 0.8rem;
  }

  .flash-success {
    background: #0c180c;
    border-color: #1f331f;
    border-left-color: #3f8b3f;
    color: #9fd29f;
  }

  .flash-error {
    background: #1a0d0d;
    border-color: #3a1c1c;
    border-left-color: #7a2424;
    color: #d79a9a;
  }

  .flash-warning {
    background: #1a1508;
    border-color: #3a2e10;
    border-left-color: #806018;
    color: #c7b36a;
  }

  .flash-info {
    background: #0b1220;
    border-color: #1a2a44;
    border-left-color: #2e5f99;
    color: #9bb9d6;
  }

  /* Issue #271: dark-scheme usage-bar fills (the base scheme above
     keeps both custom properties transparent). */
  :root {
    --quota-bar-fill: #242424;
    --quota-bar-fill-hot: #3a2e10;
  }

  /* Issue #271: Remaining under 10% of the limit takes the warning tones. */
  td.quota-low {
    color: #c7b36a;
    background-color: #1a1508;
    box-shadow: inset 3px 0 0 #806018;
  }

  /* td[data-usage-pct] usage bars ship as a per-cell inline
     background-image linear-gradient, so no rule is needed here. */

  .sort-persist-chip {
    margin: 0.35rem 0 0.6rem;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #808080;
  }

  .sort-persist-chip .chip-reset {
    margin-left: 0.6rem;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed #666;
    cursor: pointer;
  }

  .sort-persist-chip .chip-reset:hover {
    color: #ccc;
    border-bottom-color: #666;
  }

  .token-input-row {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
  }

  .token-input-row input {
    flex: 1;
    min-width: 0;
  }

  .token-toggle,
  .copy-button {
    font-family: "SF Mono", Consolas, monospace;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    padding: 0 0.6rem;
  }

  .copy-button {
    padding: 0.3rem 0.6rem;
  }

  .quota-pressure {
    font-family: "SF Mono", Consolas, monospace;
    font-size: 0.78rem;
    color: #808080;
    margin: -0.25rem 0 0.55rem;
  }

  .quota-pressure .quota-critical {
    color: #c7b36a;
  }

  .quota-show-all + label {
    font-size: 0.78rem;
    margin-left: 0.3rem;
  }

  /* Inline <details> editor inside a table cell (self-service nickname). */
  details.inline-edit {
    margin-top: 0.35rem;
  }

  details.inline-edit summary {
    color: #8a8a8a;
    font-size: 0.78rem;
    font-weight: normal;
  }

  /* Transient micro-note appended after the token when clipboard access is
     unavailable and the user has to copy by hand. Follows the micro-label tone. */
  .copy-note {
    margin-left: 0.5em;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #808080;
  }

  /* GET ?q= search box; sits directly above the Show Nicknames toggle. */
  form.user-search {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
  }

  form.user-search input[name="q"] {
    font-family: "SF Mono", Consolas, monospace;
    font-size: 0.78rem;
    width: min(22rem, 100%);
  }

  form.user-search button[type="submit"] {
    font-size: 0.78rem;
    padding: 0.45rem 0.7rem;
  }

  /* dashed-underline link convention for the clear affordance */
  form.user-search a.clear-search {
    font-size: 0.78rem;
    text-decoration-style: dashed;
    cursor: pointer;
    white-space: nowrap;
  }

  /* micro-label scope note: makes the server-side filter scope explicit */
  p.user-search-scope {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #808080;
    margin: 0 0 0.6rem;
  }

  /* One reusable modal <dialog> serves every td.actions a[data-field] edit;
     #ban-dialog is the confirm variant. Both are pinned fixed so the
     statically-open state and the live showModal() state match. */
  #edit-dialog,
  #ban-dialog,
  dialog.dlg {
    box-sizing: border-box;
    background: #0d0d0d;
    border: 1px solid #202020;
    border-radius: 4px;
    width: min(420px, 90vw);
    padding: 1.1rem 1.2rem;
    color: inherit;
  }
  #edit-dialog[open],
  #ban-dialog[open],
  dialog.dlg[open] {
    position: fixed;
    inset: 0;
    margin: auto;
    height: fit-content;
    max-height: calc(100vh - 3rem);
    overflow: auto;
    z-index: 1000;
  }
  #edit-dialog::backdrop,
  #ban-dialog::backdrop,
  dialog.dlg::backdrop {
    background: rgba(0, 0, 0, 0.78);
  }
  .dlg-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 0.9rem;
  }
  .dlg-title {
    font-size: 0.84rem;
    color: #d6d6d6;
  }
  .dlg-close {
    background: transparent;
    border: 0;
    color: #8a8a8a;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1;
    padding: 0.15rem 0.2rem;
  }
  .dlg-close:hover {
    background: transparent;
    border-color: transparent;
    color: #ccc;
  }
  .dlg-label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #808080;
    margin-bottom: 0.35rem;
  }
  .dlg-input {
    width: 100%;
    box-sizing: border-box;
    font-family: "SF Mono", Consolas, monospace;
    font-size: 0.8rem;
  }
  .dlg-hint {
    font-size: 0.68rem;
    color: #808080;
    margin: 0.4rem 0 0;
  }
  .dlg-error {
    font-size: 0.78rem;
    color: #d79a9a;
    background: #1a0d0d;
    border-left: 2px solid #7a2424;
    padding: 0.35rem 0.5rem;
    margin: 0.5rem 0 0;
  }
  .dlg-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
  }
  .dlg-save {
    background: #242424;
    border-color: #4a4a4a;
  }
  .dlg-save:hover {
    background: #2a2a2a;
    border-color: #4a4a4a;
  }
  .dlg-danger {
    color: #d79a9a;
    border-left: 2px solid #7a2424;
  }
  .dlg-danger:hover {
    color: #d79a9a;
  }

  footer {
    color: #808080;
  }

  ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  ::-webkit-scrollbar-track {
    background: #0a0a0a;
  }

  ::-webkit-scrollbar-thumb {
    background: #1c1c1c;
    border-radius: 3px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: #2a2a2a;
  }

  ::-webkit-scrollbar-corner {
    background: #0a0a0a;
  }
}

@media screen and (max-width: 800px) {
  body {
    padding: 1.5rem 1rem 3rem;
  }

  .token-cell {
    min-width: 0;
  }
}
