/* ==========================================================================
   Epiko admin — Riso Press
   ==========================================================================

   The admin runs on a Bootstrap 4 template whose stylesheet is 52,955 lines.
   Rewriting that, or editing 32 EJS templates, would be a great deal of churn
   for a change that is almost entirely visual. This file is loaded AFTER
   admin-style.css and overrides the surface the template paints: colour,
   radius, border, shadow and type. The markup is untouched, which is the same
   approach that moved the main site over — retune what exists rather than
   replace it.

   The tokens are copied from the website's src/styles/tokens.css rather than
   imported, because the two apps do not share a build. If a value changes
   there it has to change here; there is no mechanism that keeps them honest,
   so the list is deliberately short and the names match exactly.

   Riso Press in one line: paper ground, ink keyline, one loud red, square
   corners, and shadows that are hard offsets rather than blur — a press
   cannot print a soft edge.
   ========================================================================== */

:root {
  --eg-paper:      #F3EFE4;
  --eg-surface:    #FFFDF6;
  --eg-bg-sunk:    #EAE4D4;
  --eg-ink:        #141414;
  --eg-line:       #141414;
  --eg-line-soft:  #D8D1C0;

  /* Text steps, all measured against paper and the sunk ground: 16.03 /
     8.06 / 5.50 / 4.97. Nothing here is lighter than AA. */
  --eg-text:       #141414;
  --eg-text-dim:   #4A4741;
  --eg-text-mute:  #655F55;

  --eg-red:        #FF3B30;  /* the action colour */
  --eg-red-ink:    #C41F16;  /* red as TYPE, holds on paper, sunk and wash */
  --eg-red-on:     #141414;  /* ink on the red: 5.19. Off-white is 3.49. */
  --eg-red-wash:   #FFE6E4;
  --eg-blue:       #2B6CFF;  /* the second plate */
  --eg-yellow:     #FFD400;  /* the marker */
  --eg-green:      #1B7F4B;
  --eg-green-wash: #DCF2E6;

  --eg-border:      2px;
  --eg-shadow-mat:  4px 4px 0 0 var(--eg-line);
  --eg-shadow-lift: 6px 6px 0 0 var(--eg-line);

  --eg-font-display: "Bricolage Grotesque", "Archivo", system-ui, sans-serif;
  --eg-font-ui:      "Instrument Sans", system-ui, -apple-system, sans-serif;
  --eg-font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
}

/* --- ground -------------------------------------------------------------- */

body,
#main-wrapper,
.content-body,
.container-fluid {
  background: var(--eg-paper) !important;
  color: var(--eg-text);
  font-family: var(--eg-font-ui);
}

/* The template ships a three-dot bouncing preloader over a white sheet. On a
   paper ground the sheet flashed white on every navigation. */
#preloader { background: var(--eg-paper) !important; }
.sk-three-bounce .sk-child { background-color: var(--eg-red) !important; }

h1, h2, h3, h4, h5, h6,
.card-title, .brand-title {
  font-family: var(--eg-font-display);
  color: var(--eg-text);
  letter-spacing: -0.01em;
}

/* Figures, ids, addresses and dates line up only in a mono face. */
.text-figure, .fs-20, td .font-w600, .tx-hash, code, pre {
  font-family: var(--eg-font-mono);
  font-variant-numeric: tabular-nums;
}

/* --- chrome: top bar and sidebar ---------------------------------------- */

.nav-header,
.header,
.header .navbar {
  background: var(--eg-surface) !important;
  border-bottom: var(--eg-border) solid var(--eg-line);
  box-shadow: none !important;
}
.nav-header { border-right: var(--eg-border) solid var(--eg-line); }

.deznav,
.deznav .deznav-scroll {
  background: var(--eg-bg-sunk) !important;
  border-right: var(--eg-border) solid var(--eg-line);
  box-shadow: none !important;
}

/* Sidebar items: a flat list with a red marker on the current one, rather
   than the template's pill with a gradient. */
.deznav .metismenu > li > a {
  color: var(--eg-text-dim) !important;
  font-family: var(--eg-font-ui);
  font-weight: 600;
  font-size: 14px;
  border-radius: 0 !important;
  border-left: 3px solid transparent;
  padding: 12px 18px;
  transition: background 120ms ease, color 120ms ease;
}
.deznav .metismenu > li > a:hover {
  background: var(--eg-surface) !important;
  color: var(--eg-text) !important;
}
.deznav .metismenu > li.mm-active > a,
.deznav .metismenu > li > a.active {
  background: var(--eg-surface) !important;
  color: var(--eg-text) !important;
  border-left-color: var(--eg-red);
}
.deznav .metismenu > li > a i { color: inherit !important; }
.deznav .metismenu > li > a::after { border-color: currentColor !important; }

/* --- cards --------------------------------------------------------------- */

.card {
  background: var(--eg-surface);
  border: var(--eg-border) solid var(--eg-line);
  border-radius: 0 !important;
  box-shadow: var(--eg-shadow-mat) !important;
}
.card-header {
  background: transparent;
  border-bottom: var(--eg-border) solid var(--eg-line);
  border-radius: 0 !important;
  padding: 16px 20px;
}
.card-title {
  font-size: 17px; font-weight: 700; margin: 0;
}
.card-body { padding: 20px; }

/* --- buttons ------------------------------------------------------------- */
/* Square, 2px keyline, hard offset shadow. The press has no soft edges, and
   an offset block reads as a physical thing the cursor can push. */

.btn {
  border-radius: 0 !important;
  font-family: var(--eg-font-ui);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-width: var(--eg-border);
  transition: transform 100ms ease, box-shadow 100ms ease,
              background 120ms ease, color 120ms ease;
}
.btn:active { transform: translate(2px, 2px); box-shadow: none !important; }

.btn-primary {
  /* Ink on the red, not white. Off-white on #FF3B30 is 3.49 and fails AA;
     ink is 5.19, and black on a flat spot colour is the press idiom. */
  background: var(--eg-red) !important;
  border-color: var(--eg-line) !important;
  color: var(--eg-red-on) !important;
  box-shadow: 3px 3px 0 0 var(--eg-line);
}
.btn-primary:hover,
.btn-primary:focus {
  background: var(--eg-ink) !important;
  color: var(--eg-surface) !important;
  border-color: var(--eg-line) !important;
  box-shadow: var(--eg-shadow-mat);
}

.btn-secondary, .btn-light, .btn-default {
  background: var(--eg-surface) !important;
  border-color: var(--eg-line) !important;
  color: var(--eg-text) !important;
  box-shadow: 3px 3px 0 0 var(--eg-line);
}
.btn-secondary:hover, .btn-light:hover, .btn-default:hover {
  background: var(--eg-bg-sunk) !important;
}

.btn-danger {
  background: var(--eg-red) !important;
  border-color: var(--eg-line) !important;
  color: var(--eg-red-on) !important;
}
.btn-success {
  background: var(--eg-green) !important;
  border-color: var(--eg-line) !important;
  color: var(--eg-surface) !important;
}
.btn-link { color: var(--eg-red-ink) !important; }

/* --- forms --------------------------------------------------------------- */

.form-control,
.custom-select,
select.form-control,
textarea.form-control,
.input-group-text {
  background: var(--eg-surface) !important;
  border: var(--eg-border) solid var(--eg-line) !important;
  border-radius: 0 !important;
  color: var(--eg-text) !important;
  font-family: var(--eg-font-ui);
  box-shadow: none !important;
}
.form-control::placeholder { color: var(--eg-text-mute); opacity: 1; }
.form-control:focus {
  border-color: var(--eg-red) !important;
  box-shadow: 3px 3px 0 0 var(--eg-red) !important;
}
.col-form-label, label {
  color: var(--eg-text);
  font-weight: 600;
  font-size: 13px;
}
.invalid-feedback { color: var(--eg-red-ink); font-weight: 600; }
.form-control.is-invalid { border-color: var(--eg-red) !important; }

/* --- tables -------------------------------------------------------------- */
/* The admin is mostly tables, so this is most of the work. Rules, not stripes:
   a ruled table reads as a ledger, which is what these are. */

.table { color: var(--eg-text); border-collapse: collapse; }
.table thead th {
  background: var(--eg-bg-sunk);
  border-bottom: var(--eg-border) solid var(--eg-line) !important;
  border-top: none !important;
  font-family: var(--eg-font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--eg-text-dim);
  padding: 12px 14px;
  white-space: nowrap;
}
.table tbody td {
  border-top: 1px solid var(--eg-line-soft) !important;
  padding: 12px 14px;
  vertical-align: middle;
  font-size: 14px;
}
.table tbody tr:hover { background: var(--eg-bg-sunk); }
.table-responsive { border: var(--eg-border) solid var(--eg-line); }

/* DataTables chrome */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 0 !important;
  border: var(--eg-border) solid var(--eg-line) !important;
  background: var(--eg-surface) !important;
  color: var(--eg-text) !important;
  margin-left: -2px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--eg-ink) !important;
  color: var(--eg-surface) !important;
}
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: var(--eg-border) solid var(--eg-line) !important;
  border-radius: 0 !important;
  background: var(--eg-surface);
}

/* --- badges, pills, states ----------------------------------------------- */

.badge {
  border-radius: 0 !important;
  border: 1px solid var(--eg-line);
  font-family: var(--eg-font-ui);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 8px;
}
.badge-primary { background: var(--eg-red-wash); color: var(--eg-red-ink); }
.badge-success { background: var(--eg-green-wash); color: var(--eg-green); }
.badge-danger  { background: var(--eg-red-wash);   color: var(--eg-red-ink); }
.badge-warning { background: var(--eg-yellow);     color: var(--eg-ink); }
.badge-info    { background: #E2EAFF;              color: #1B4ACC; }

/* --- modals, dropdowns, alerts ------------------------------------------ */

.modal-content, .dropdown-menu {
  background: var(--eg-surface);
  border: var(--eg-border) solid var(--eg-line) !important;
  border-radius: 0 !important;
  box-shadow: var(--eg-shadow-lift) !important;
}
.modal-header, .modal-footer {
  border-color: var(--eg-line) !important;
}
.dropdown-item { color: var(--eg-text); font-weight: 500; }
.dropdown-item:hover { background: var(--eg-bg-sunk); color: var(--eg-text); }

.alert {
  border-radius: 0 !important;
  border: var(--eg-border) solid var(--eg-line);
}

/* --- links --------------------------------------------------------------- */

a { color: var(--eg-red-ink); }
a:hover { color: var(--eg-ink); }
/* Sidebar and chrome links set their own colour above; do not let the link
   rule repaint them. */
.deznav a, .nav-header a, .header a, .btn { color: inherit; }

/* --- sign-in ------------------------------------------------------------- */
/* The one page every admin sees before anything else. */

.authincation, .login-form-bx, .login-wrapper {
  background: var(--eg-paper) !important;
}
.authincation .card, .login-form-bx .card {
  box-shadow: var(--eg-shadow-lift) !important;
}

/* --- utility overrides the template hardcodes --------------------------- */

.text-black { color: var(--eg-text) !important; }
.text-muted { color: var(--eg-text-mute) !important; }
.bg-white   { background: var(--eg-surface) !important; }
.rounded, .rounded-sm, .rounded-lg, .rounded-circle:not(img):not(.avatar) {
  border-radius: 0 !important;
}
/* Avatars stay round: a square face reads as a broken image. */
img.rounded-circle, .avatar.rounded-circle { border-radius: 50% !important; }

/* --- footer -------------------------------------------------------------- */
/* The template's footer link kept the old brand violet, which is not a colour
   in this palette at all. */
.footer { background: var(--eg-surface); border-top: var(--eg-border) solid var(--eg-line); }
.footer .copyright p { color: var(--eg-text-mute); margin: 0; }
.footer .copyright a { color: var(--eg-red-ink) !important; font-weight: 600; }
.footer .copyright a:hover { color: var(--eg-ink) !important; }

/* --- table container ----------------------------------------------------- */
/* .table-responsive sits inside .card, so its own 2px keyline doubled up with
   the card's and drew a second box around the header row. The card already
   provides the edge. */
.card .table-responsive { border: 0; }
.card .table { margin-bottom: 0; }
/* The template puts a border on the table itself in some views; the rules
   between rows are the structure here, not a box around them. */
.table-bordered, .table-bordered td, .table-bordered th { border: 0 !important; }
.table-bordered tbody td { border-top: 1px solid var(--eg-line-soft) !important; }
.table-bordered thead th { border-bottom: var(--eg-border) solid var(--eg-line) !important; }

/* --- header bar ---------------------------------------------------------- */
/* "Hello, Super Admin" and the profile chip. */
.header-info span, .header-info small { color: var(--eg-text); }
.header-profile img, .nav-header .brand-logo img { border-radius: 0; }

/* --- earnings tiles ------------------------------------------------------ */
/* The dashboard gave each chain tile a different Bootstrap contextual border
   -- border-primary (violet), border-warning (orange), plus custom
   border-boba and border-zkevm. Those colours identify nothing: the chain is
   already named by its own logo inside the tile, and the palette has no
   violet or orange in it. One ink keyline for all of them, which is also how
   the website treats chain marks. */
.media.border,
.media.border-dark, .media.border-primary, .media.border-warning,
.media.border-success, .media.border-info, .media.border-danger,
.media.border-boba, .media.border-zkevm {
  border: var(--eg-border) solid var(--eg-line) !important;
  background: var(--eg-surface);
  box-shadow: 3px 3px 0 0 var(--eg-line);
}
/* The chip behind each chain logo. The logos carry their own brand colour, so
   the chip under them is ink and stays out of the way. */
.media img.bg-dark, .media img.bg-primary, .media img.bg-warning,
.media img.bg-success, .media img.bg-info {
  background: var(--eg-ink) !important;
  border-radius: 0 !important;
}

/* --- tabs ---------------------------------------------------------------- */
/* The Monthly/Yearly switch was a violet pill from the old brand. */
.card-tabs .nav-tabs { border-bottom: 0; gap: 0; }
.card-tabs .nav-tabs .nav-link {
  border: var(--eg-border) solid var(--eg-line) !important;
  border-radius: 0 !important;
  background: var(--eg-surface);
  color: var(--eg-text) !important;
  font-weight: 600;
  padding: 8px 18px;
  margin: 0 0 0 -2px;   /* collapse the shared edge */
}
.card-tabs .nav-tabs .nav-link.active {
  background: var(--eg-ink) !important;
  color: var(--eg-surface) !important;
}

/* Bootstrap contextual fills the template uses for chrome, remapped so none
   of them reach for a colour outside the palette. */
.bg-primary { background: var(--eg-red) !important; color: var(--eg-red-on) !important; }
.bg-warning { background: var(--eg-yellow) !important; color: var(--eg-ink) !important; }
.bg-success { background: var(--eg-green) !important; color: var(--eg-surface) !important; }
.bg-dark    { background: var(--eg-ink) !important; color: var(--eg-surface) !important; }
.text-primary { color: var(--eg-red-ink) !important; }
.text-success { color: var(--eg-green) !important; }
.text-danger  { color: var(--eg-red-ink) !important; }
.text-warning { color: #8A6A00 !important; }  /* yellow as type needs darkening */

/* --- sign in ------------------------------------------------------------- */
/* The sign-in sheet is .authincation-content, not .card, so the card rules
   above never reached it: it stayed a white rounded box with a soft drop
   shadow, the one surface on the whole admin still in the old style. It is
   also the first thing an admin sees. */
.authincation { background: var(--eg-paper) !important; }
.authincation-content {
  background: var(--eg-surface) !important;
  border: var(--eg-border) solid var(--eg-line);
  border-radius: 0 !important;
  box-shadow: var(--eg-shadow-lift) !important;
}
.auth-form { padding: 32px; }
.auth-form .brand-title img,
.authincation-content .brand-title img { max-width: 190px; }
/* The input-group prefix (the little person / padlock) reads as part of the
   field, so it takes the field's edge rather than its own box. */
.authincation-content .input-group-prepend .input-group-text {
  border-right: 0 !important;
  background: var(--eg-bg-sunk) !important;
}

/* --- icons --------------------------------------------------------------- */
/* Remix, vendored at /assets/icons/remixicon. The admin previously mixed four
   icon sets -- flaticon in the sidebar, font-awesome in forms, plus inline
   SVGs in the header with #0436ed and #712ddf baked into their paths, which
   no stylesheet could retheme. One set now, inheriting currentColor. */
[class^="ri-"], [class*=" ri-"] {
  font-size: 18px;
  line-height: 1;
  vertical-align: -0.15em;
  color: inherit;
}
.deznav .metismenu > li > a > [class^="ri-"],
.deznav .metismenu > li > a > [class*=" ri-"] {
  font-size: 19px;
  margin-right: 12px;
  width: 20px;              /* a fixed box, so the labels align down the rail */
  display: inline-block;
  text-align: center;
}
.dropdown-item [class^="ri-"] { font-size: 17px; }

/* Remix ships no spin helper, and fa-spin was doing that work on the two
   submit buttons. */
.ri-spin { display: inline-block; animation: ri-spin 900ms linear infinite; }
@keyframes ri-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ri-spin { animation: none; } }

/* --- error pages (seeds/error/page.ejs) ---------------------------------- */
/* The code is a figure, so it takes the mono face the site uses for numbers. */
.eg-error-code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  color: var(--eg-red-ink);
  margin: 8px 0 12px;
}
/* The template hides .brand-title under 767px because that class is the
   sidebar's logo; on the sign-in sheets it is the only logo there is. */
.authincation-content img.brand-title { display: inline-block !important; }
