/* Speedock, over Elastic. The import's own URLs resolve against ELASTIC's
   directory, so its images and fonts keep working. */
@import url("../../elastic/styles/styles.min.css");

:root {
  --sd-accent: #3760ba;
  --sd-accent-hover: #2e519d;
  --sd-accent-soft: #eff5ff;
  --sd-accent-line: #bfd7fe;
  --sd-ground: #f8fafc;
  --sd-surface: #ffffff;
  --sd-raised: #f1f5f9;
  --sd-line: #e2e8f0;
  --sd-text: #0f172a;
  --sd-text-2: #475569;
  --sd-text-3: #5b6a7d;
  --sd-bezel: #ffffff;
  --sd-bezel-hover: #f1f5f9;
}
html.dark-mode {
  --sd-accent: #93c5fd;
  --sd-accent-hover: #2e519d;
  --sd-accent-soft: #10213d;
  --sd-accent-line: #2b333f;
  --sd-ground: #0f1319;
  --sd-surface: #171c24;
  --sd-raised: #1f2630;
  --sd-line: #2b333f;
  --sd-text: #f6f8fc;
  --sd-text-2: #ccd5e2;
  --sd-text-3: #a3aec0;
  --sd-bezel: #0a0d12;
  --sd-bezel-hover: #1f2630;
}

/* The task rail. Elastic ships a dark slab here in both themes; the console's
   own rail is --bezel, which is WHITE on paper and near-black on dark. */
#layout > #layout-menu, #taskmenu {
  background: var(--sd-bezel) !important;
  border-right: 1px solid var(--sd-line);
}
#taskmenu a { color: var(--sd-text-2) !important; }
#taskmenu a:hover { background: var(--sd-bezel-hover) !important; color: var(--sd-text) !important; }
#taskmenu a.selected, #taskmenu a.selected:hover {
  color: var(--sd-accent) !important;
  background: var(--sd-bezel-hover) !important;
  box-shadow: inset 3px 0 0 var(--sd-accent);
}
#taskmenu a.logout { color: #cc1f1f !important; }

/* Surfaces. */
body, #layout, .content, #layout-content { background: var(--sd-ground); }
#layout > div > .header, .header { background: var(--sd-surface); border-color: var(--sd-line); }
#layout-sidebar, #layout-list { background: var(--sd-surface); border-color: var(--sd-line); }

/* Accent: links, the selected row, the primary button. */
a, a:hover { color: var(--sd-accent); }
.listing li.selected > a, .listing tr.selected > td,
#messagelist tr.selected td { background: var(--sd-accent-soft) !important; color: var(--sd-text) !important; }
#messagelist tr.selected td.subject span.subject { color: var(--sd-accent) !important; }
.folderlist li.selected > a { background: var(--sd-accent-soft) !important; color: var(--sd-accent) !important; }
a.button.primary, button.primary, input.button.mainaction, .buttons .primary {
  background: var(--sd-accent) !important; border-color: var(--sd-accent) !important; color: #fff !important;
}
a.button.primary:hover, button.primary:hover { background: var(--sd-accent-hover) !important; }

/* The login card. */
#layout-content.login-content, .login-form { background: var(--sd-ground); }
#login-form .box-inner { background: var(--sd-surface); border: 1px solid var(--sd-line); border-radius: 12px; }
#rcmloginsubmit { background: var(--sd-accent) !important; border-color: var(--sd-accent) !important; }
#rcmloginsubmit:hover { background: var(--sd-accent-hover) !important; }
#login-form .banner, #layout-content.login-content .banner { background: transparent; }

/* ---- the login screen ---------------------------------------------------
   Elastic centres a bare form on the page ground. The console presents every
   sign-in as a card, so this does too: one surface, one hairline, the brand
   above it. #layout-content is the whole viewport here, so the card is the
   form itself rather than a wrapper that does not exist. */
#layout-content.no-navbar { background: var(--sd-ground); }
/* ⚠️ width, NOT max-width. The logo SVG carries intrinsic width/height
      attributes, and max-width can only shrink such an image -- it was
      rendering at its natural 103px however large the cap was set. Scoped to
      #layout-content so the rail's copy (#layout-menu #logo) keeps its own
      size. */
/* ⭐ 80px TALL, WHICH IS THE CONSOLE'S EXACT VALUE. Login.tsx renders
      <Logo height={80} /> and .authLogo sets no size, so 80 is the number --
      and it is stated as a HEIGHT here for the same reason it is there: the
      lockup is 2.59:1, so a width is a derived quantity that drifts the
      moment the artwork's aspect changes.

   ⚠️ height, NOT max-height. The SVG carries intrinsic width/height
      attributes, and a max-* can only SHRINK such an image -- an earlier
      max-width left it rendering at its natural 103px however large the cap
      was set. width:auto keeps the aspect. */
#layout-content #logo {
  height: 80px; width: auto; max-width: 76vw;
  margin-bottom: 14px;
}
/* ⚠️ NO `content: url()` SWAP HERE, AND THAT IS THE FIX FOR A REAL BUG.
      Swapping the dark lockup in CSS put TWO mechanisms on one element: this
      rule setting `content`, and elastic's own screen_logo() setting `src`.
      Toggling the theme then left the DARK logo on a LIGHT page until the
      user reloaded -- dropping a `content` rule does not reliably force a
      repaint back to the element's own src in Chrome, and whichever
      mechanism had last written won.

      The logo is an <img>. Its `src` is the one thing that decides what it
      shows, so both the login page's toggle and elastic's rail toggle now
      write that and nothing writes `content`. */
#login-form {
  background: var(--sd-surface);
  border: 1px solid var(--sd-line);
  border-radius: 14px;
  padding: 28px 26px 24px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  max-width: 380px;
}
html.dark-mode #login-form { box-shadow: 0 8px 28px rgba(0,0,0,.45); }
#login-form .form-control { border-color: var(--sd-line); color: var(--sd-text); background: var(--sd-surface); }
#login-form .form-control:focus { border-color: var(--sd-accent); box-shadow: 0 0 0 3px var(--sd-accent-soft); }
#login-form .input-group-text { background: var(--sd-raised); border-color: var(--sd-line); color: var(--sd-text-3); }
#rcmloginsubmit {
  background: var(--sd-accent) !important; border-color: var(--sd-accent) !important;
  color: #fff !important; border-radius: 8px; font-weight: 600; letter-spacing: .01em;
}
#rcmloginsubmit:hover { background: var(--sd-accent-hover) !important; border-color: var(--sd-accent-hover) !important; }
#login-footer { color: var(--sd-text-3); font-size: 12px; }

/* ---- the task rail ------------------------------------------------------
   Elastic paints the bottom group (dark mode / about / logout) on its own
   dark slab, separate from the rail above it. Both have to move together or
   the rail reads as two different surfaces stacked. */
#taskmenu .special-buttons, #taskmenu > span { background: var(--sd-bezel); }
#taskmenu .special-buttons a { color: var(--sd-text-3) !important; }
#taskmenu .special-buttons a:hover { background: var(--sd-bezel-hover) !important; color: var(--sd-text) !important; }
#taskmenu a.logout, #taskmenu .special-buttons a.logout { color: #cc1f1f !important; }
html.dark-mode #taskmenu a.logout { color: #f87171 !important; }

/* ⚠️ THE FULL WORDMARK IN THE RAIL, WHICH MEANS WIDENING THE RAIL.
      Elastic's rail is 78px and the lockup is 2.59:1, so at that width it is
      27px tall -- legible only just, and it was clipped to "SPEE.OCK" before
      this. The mark alone fitted, and is not what this platform's logo is.

      So the rail becomes 112px and the wordmark sits in it whole. Everything
      to its right is positioned from the rail's width, so the three places
      elastic hard-codes 78px have to move together or the columns overlap it.

      ⚠️ THE TILE BEHIND IT IS .popover-header, which elastic paints
         rgb(47,58,63) -- its own dark chrome, independent of the rail. Moving
         the rail alone left a dark square at the top of a white column. */
#layout-menu, #layout > #layout-menu { width: 112px !important; max-width: 112px !important; }
#layout-menu .popover-header {
  background: var(--sd-bezel) !important;
  border-bottom: 1px solid var(--sd-line);
  height: auto; padding: 10px 8px;
}
#layout-menu #logo {
  width: 92px; height: auto; max-width: 92px;
  margin: 2px auto; display: block;
}
/* The rail's dark lockup is elastic's own job: screen_logo() reads
   skin_logo's [dark] key inside switch_color_mode(). Nothing to do here --
   see the note above about why a second mechanism is worse than none. */

/* ⚠️ NOTHING IS OFFSET HERE, AND THAT IS THE POINT. #layout is flex, so the
      columns already start where the rail ends -- adding `left: 112px` to
      them offset an already-offset column and left a 112px dead strip beside
      the rail with the toolbar clipped off the right edge. Widening the rail
      is the whole change. */


/* ---- inputs -------------------------------------------------------------
   The console's Field control, copied from
   platform/apps/console/src/components/ui.module.css -- 36px tall, a 6px
   radius, a hairline that strengthens on hover, and a 3px accent halo on
   focus. Elastic's own inputs are 1px grey with a blue glow; side by side
   with the console they read as a different product.

   ⚠️ THE TEXT COLOUR IS STATED, NOT INHERITED. A control that sets a
      background and leaves its text to inheritance is one declaration away
      from unreadable -- the note this rule is copied from says so because it
      happened there. */
:root { --sd-line-strong: #cbd5e1; }
html.dark-mode { --sd-line-strong: #3d4757; }

#login-form .form-control,
input.form-control, textarea.form-control, select.form-control,
#messagesearch input, .searchbar input, input[type="text"], input[type="password"],
input[type="email"], input[type="search"] {
  height: 36px;
  padding: 0 12px;
  background: var(--sd-surface);
  color: var(--sd-text);
  border: 1px solid var(--sd-line);
  border-radius: 6px;
  font-size: 13px;
  box-shadow: none;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
textarea.form-control { height: auto; padding: 8px 12px; }
input.form-control::placeholder, input::placeholder { color: var(--sd-text-3); }
input.form-control:hover:not(:disabled), #login-form .form-control:hover:not(:disabled) {
  border-color: var(--sd-line-strong);
}
input.form-control:focus, #login-form .form-control:focus,
input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus {
  outline: none;
  border-color: var(--sd-accent);
  box-shadow: 0 0 0 3px var(--sd-accent-soft);
}
input.form-control:disabled { background: var(--sd-raised); color: var(--sd-text-3); }

/* The login form's icon prefix has to match the field's new height and
   radius, or the pair reads as two controls that happen to touch. */
#login-form .input-group-text {
  height: 36px; border-radius: 6px 0 0 6px;
  background: var(--sd-raised); border: 1px solid var(--sd-line); border-right: 0;
  color: var(--sd-text-3);
}
#login-form .input-group > .form-control { border-radius: 0 6px 6px 0; }

/* ⚠️ THE SEARCH BOX IS NOT A FIELD. It sits inside the list header as a flush
      strip; giving it a 36px box and a halo would put a floating control in a
      toolbar. It keeps the border it never had. */
#messagesearch input, .searchbar input {
  border: 0; background: transparent; box-shadow: none; height: auto;
}
#messagesearch input:focus, .searchbar input:focus { box-shadow: none; border: 0; }


/* ---- the login theme toggle ---------------------------------------------
   Elastic's only theme control lives in the task rail, which does not exist
   until you are logged in -- so the login screen could not leave the
   browser's default. The button is in this skin's login.html; these are its
   clothes, and the console's: a hairline circle in the top-right corner. */
#sd-theme {
  position: fixed; top: 18px; right: 18px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--sd-surface);
  color: var(--sd-text-2);
  border: 1px solid var(--sd-line);
  border-radius: 999px;
  cursor: pointer; padding: 0;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
#sd-theme:hover { border-color: var(--sd-line-strong); color: var(--sd-text); background: var(--sd-raised); }
#sd-theme:focus-visible { outline: none; border-color: var(--sd-accent); box-shadow: 0 0 0 3px var(--sd-accent-soft); }
/* One icon at a time: the moon offers dark, the sun offers light back. */
#sd-theme .sd-sun { display: none; }
html.dark-mode #sd-theme .sd-moon { display: none; }
html.dark-mode #sd-theme .sd-sun { display: block; }
