/* REASON Platform - apple.com design language.
 *
 * Structure now follows Apple's too, not just the colours: a slim sticky
 * global nav with a saturated blur behind it and hover panels, over a
 * centred content column, rather than the dashboard sidebar this had before.
 *
 * Taken from apple.com: the 48px translucent nav; the type scale with tight
 * negative tracking on headlines; near-black #1d1d1f rather than pure black;
 * the #f5f5f7 ground with white cards; hairline #d2d2d7 rules instead of
 * borders; fully-rounded pill controls; and far more vertical whitespace
 * than a dashboard normally allows itself.
 */

:root {
  --ink:        #1d1d1f;
  --ink-2:      #6e6e73;
  --ink-3:      #86868b;
  --bg:         #ffffff;
  --bg-2:       #f5f5f7;
  --bg-3:       #fafafa;
  --line:       #d2d2d7;
  --line-soft:  #e8e8ed;
  --blue:       #0066cc;
  --blue-btn:   #0071e3;
  --blue-dark:  #0077ed;
  --green:      #008009;
  --red:        #e30000;
  --amber-bg:   #fff8e6;
  --amber-line: #f0c36d;
  --amber-ink:  #6b4c0d;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --pill: 980px;

  --shadow: 0 2px 10px rgba(0, 0, 0, .04);
  --shadow-lift: 0 6px 24px rgba(0, 0, 0, .08);

  --nav-h: 48px;
  --page:  1480px;   /* content column; wide enough for a 13-column table */

  --font: "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-2);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.47059;
  letter-spacing: -.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===================================================== global navigation */
.globalnav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: background .25s ease, border-color .25s ease;
}
.globalnav.scrolled {
  background: rgba(255, 255, 255, .88);
  border-bottom-color: var(--line-soft);
}
.globalnav-inner {
  max-width: var(--page); margin: 0 auto; height: 100%;
  padding: 0 28px;
  display: flex; align-items: center; gap: 30px;
}
.globalnav-brand { display: flex; align-items: center; color: var(--ink); text-decoration: none; }
.globalnav-brand .wordmark { display: block; width: 92px; height: auto; color: var(--ink); }
.globalnav-brand img { display: block; width: 92px; height: auto; }

.globalnav-links { display: flex; align-items: center; gap: 4px; flex: 1; height: 100%; }
.gn-item {
  display: inline-flex; align-items: center; height: var(--nav-h);
  padding: 0 11px;
  font-size: 12px; font-weight: 500; letter-spacing: -.01em;
  color: var(--ink); text-decoration: none;
  opacity: .82; cursor: pointer; white-space: nowrap;
  transition: opacity .15s ease;
}
.gn-item:hover { opacity: 1; text-decoration: none; }
.gn-item.active { font-weight: 700; opacity: 1; }

/* Hover/focus panel - Apple's dropdown. */
.gn-group { position: relative; height: 100%; display: flex; align-items: center; }
.gn-group.gn-right { margin-left: auto; }
/* Toggled with `display`, not opacity+visibility. An opacity/visibility
   pair leaves the panel in the layout and in the accessibility tree, and
   renderers that ignore `visibility` paint every panel at once on top of the
   page - which is exactly what happened. `display: none` cannot be
   misread; the entrance is animated separately so the fade is kept. */
.gn-panel {
  display: none;
  position: absolute; top: var(--nav-h); left: 50%;
  min-width: 232px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line-soft);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .12);
}
.gn-group:hover > .gn-panel,
.gn-group:focus-within > .gn-panel {
  display: block;
  animation: gn-drop .18s ease both;
}
@keyframes gn-drop {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.gn-panel-inner { display: flex; flex-direction: column; padding: 16px 10px 14px; }
.gn-panel-head {
  font-size: 11px; font-weight: 700; color: var(--ink-3);
  padding: 0 14px 8px; letter-spacing: .01em;
}
.gn-panel a {
  font-size: 15px; font-weight: 500; color: var(--ink);
  padding: 7px 14px; border-radius: var(--r-sm); text-decoration: none;
  transition: background .12s ease;
}
.gn-panel a:hover { background: var(--bg-2); text-decoration: none; }

/* =============================================================== layout */
main {
  max-width: var(--page); margin: 0 auto;
  padding: 52px 28px 110px;
}

h1 { font-size: 44px; line-height: 1.07; font-weight: 700; letter-spacing: -.022em; margin: 0 0 30px; }
h2 { font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; margin: 54px 0 18px; }
h3 { font-size: 15px; font-weight: 700; letter-spacing: -.012em; margin: 0 0 12px; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin: 0 0 14px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; line-height: 1.4; }
.muted.small { color: var(--ink-3); }
.r { text-align: right; }
.dim { opacity: .4; }
code {
  background: var(--bg-2); padding: 2px 6px; border-radius: 5px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: .88em;
}

/* ============================================================== filters */
.filters {
  display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap;
  background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 18px 22px; margin-bottom: 28px;
}
.filters label, .card form.grid label, .loginbox label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em;
  color: var(--ink-3); text-transform: uppercase;
}
.filters input, .filters select, .card input, .card select, .loginbox input {
  font-family: var(--font); font-size: 15px; padding: 9px 13px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.filters input:focus, .filters select:focus,
.card input:focus, .card select:focus, .loginbox input:focus {
  outline: none; border-color: var(--blue-btn);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .15);
}
.filters .storepick select { min-width: 260px; }
.filters .clear { font-size: 13px; align-self: center; }

button, .btn {
  font-family: var(--font); font-size: 14px; font-weight: 500; letter-spacing: -.012em;
  padding: 9px 20px; border: 0; border-radius: var(--pill);
  background: var(--blue-btn); color: #fff;
  cursor: pointer; display: inline-block; text-align: center;
  transition: background .15s ease, transform .1s ease;
}
button:hover, .btn:hover { background: var(--blue-dark); text-decoration: none; }
button:active, .btn:active { transform: scale(.97); }

form.inline { display: inline-flex; gap: 10px; align-items: center; margin: 0 10px 10px 0; }
form.inline label { font-size: 13px; color: var(--ink-2); font-weight: 400;
                    text-transform: none; letter-spacing: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }

/* ================================================================= KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 14px; margin-bottom: 30px; }
.kpi {
  background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 22px 24px; display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow .2s ease, transform .2s ease;
}
.kpi:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.kpi .lbl { font-size: 11px; font-weight: 700; letter-spacing: .01em;
            text-transform: uppercase; color: var(--ink-3); }
.kpi .val { font-size: 32px; line-height: 1.08; font-weight: 700;
            letter-spacing: -.022em; font-variant-numeric: tabular-nums; }
.kpi .dl { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dl.up { color: var(--green); }
.dl.dn { color: var(--red); }

/* =============================================================== tables */
.tablewrap {
  overflow-x: auto; background: var(--bg);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  box-shadow: var(--shadow); margin-bottom: 10px;
}
.tablewrap > table { border: 0; border-radius: 0; box-shadow: none; margin: 0; }
table {
  width: 100%; border-collapse: collapse; background: var(--bg);
  border: 1px solid var(--line-soft); border-radius: var(--r-lg); font-size: 14px;
}
table.narrow { width: auto; min-width: 460px; }
th, td { padding: 13px 16px; text-align: left;
         border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
thead th {
  background: var(--bg); font-size: 11px; font-weight: 700; letter-spacing: .01em;
  text-transform: uppercase; color: var(--ink-3);
  position: sticky; top: var(--nav-h); z-index: 1;
  border-bottom: 1px solid var(--line);
}
td.r, th.r, .kpi .val { font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: var(--bg-3); }
tfoot th { background: var(--bg-2); font-size: 13px; border-top: 1px solid var(--line); top: auto; }
td.actions { white-space: nowrap; }
table.kv { border: 0; box-shadow: none; }
table.kv th { color: var(--ink-2); font-weight: 400; width: 46%; white-space: normal;
              text-transform: none; letter-spacing: -.012em; font-size: 14px;
              background: transparent; position: static; }
table.kv td { white-space: normal; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }

/* ================================================================ cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card { background: var(--bg); border: 1px solid var(--line-soft);
        border-radius: var(--r-lg); box-shadow: var(--shadow);
        padding: 24px 26px; margin-bottom: 18px; }
.card form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
                  gap: 16px; align-items: end; }
.card form.grid.danger { border-top: 1px solid var(--line-soft); margin-top: 18px; padding-top: 18px; }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
          gap: 8px; margin: 14px 0; }
.checks label { font-size: 13px; }
details summary { cursor: pointer; font-size: 13px; color: var(--blue); font-weight: 500; }

/* ============================================================= messages */
.err, .warn, .empty, .flash {
  border-radius: var(--r); padding: 16px 20px; margin-bottom: 20px;
  font-size: 14px; line-height: 1.43;
}
.err { background: #fff5f5; border: 1px solid #f5c2c0; color: #8c1d18; }
.warn { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-ink); }
.warn a { color: #8a5a06; }
.warn ul { margin: 10px 0 4px; padding-left: 22px; }
.warn li { margin-bottom: 8px; }
.empty { background: var(--bg); border: 1px solid var(--line-soft); box-shadow: var(--shadow);
         border-radius: var(--r-lg); padding: 56px 40px; text-align: center; }
.empty h2 { margin-top: 0; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px;
       border-radius: var(--pill); background: var(--bg-2); color: var(--ink-2);
       letter-spacing: 0; text-transform: none; vertical-align: middle; }
.tag.warn { background: var(--amber-bg); border: 1px solid var(--amber-line);
            color: var(--amber-ink); padding: 2px 8px; }

/* ============================================================ bar chart */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 190px;
         background: var(--bg); border: 1px solid var(--line-soft);
         border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; }
.spark .bar { flex: 1; min-width: 2px; background: var(--blue-btn);
              border-radius: 3px 3px 0 0; min-height: 2px; opacity: .85;
              transition: opacity .15s ease; }
.spark .bar:hover { opacity: 1; }

.pager { display: flex; gap: 20px; align-items: center; margin: 20px 0; font-size: 14px; }
pre { background: var(--bg-2); color: var(--ink); padding: 18px; border-radius: var(--r);
      overflow-x: auto; font-size: 13px; line-height: 1.5;
      font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; }

/* ============================================================== job bar */
#jobbar {
  border-radius: var(--r); padding: 14px 18px; margin-bottom: 22px;
  font-size: 14px; font-weight: 500;
  position: sticky; top: calc(var(--nav-h) + 12px); z-index: 20;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
#jobbar.running { background: rgba(0, 113, 227, .09); border: 1px solid rgba(0, 113, 227, .25); }
#jobbar.done { background: rgba(0, 128, 9, .08); border: 1px solid rgba(0, 128, 9, .25); }
.jobbar-track { height: 4px; background: rgba(0, 0, 0, .1); border-radius: var(--pill);
                margin-top: 10px; overflow: hidden; }
.jobbar-fill { height: 100%; background: var(--blue-btn); border-radius: var(--pill); }
.jobbar-fill.indet { width: 35%; animation: slide 1.2s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 65%; } }

/* ================================================================ login */
body.loginpage { display: flex; align-items: center; justify-content: center;
                 min-height: 100vh; background: var(--bg-2); }
.loginbox { background: var(--bg); padding: 46px 42px; border-radius: var(--r-lg);
            width: 390px; display: flex; flex-direction: column; gap: 18px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, .09); border: 1px solid var(--line-soft); }
.loginbrand { color: var(--ink); margin: 0 auto 16px; }
.loginbrand .wordmark, .loginbrand img { display: block; width: 160px; height: auto; }
.loginbox input { font-size: 16px; padding: 12px 14px; }
.loginbox button { padding: 13px; font-size: 16px; margin-top: 6px; }

/* =============================================================== narrow */
@media (max-width: 1040px) {
  .globalnav { height: auto; position: static; }
  .globalnav-inner { flex-wrap: wrap; height: auto; padding: 12px 18px; gap: 12px; }
  .globalnav-links { flex-wrap: wrap; height: auto; gap: 2px; }
  .gn-item { height: 34px; padding: 0 9px; }
  .gn-group { height: auto; }
  /* No hover on touch: flatten to one wrapped row of plain links, rather
     than three panels competing for the same space. */
  .gn-panel { display: block; position: static; animation: none;
              min-width: 0; box-shadow: none; border: 0;
              background: transparent; backdrop-filter: none;
              -webkit-backdrop-filter: none; }
  .gn-panel-inner { flex-flow: row wrap; padding: 0; }
  .gn-panel-head { display: none; }
  .gn-panel a { font-size: 13px; padding: 4px 9px; opacity: .82; }
  .gn-group { flex-direction: column; align-items: flex-start; width: 100%; }
  .gn-group > .gn-item { height: 26px; padding: 0 9px; font-weight: 700; }
  .gn-group.gn-right { margin-left: 0; }
  thead th { position: static; }
  main { padding: 26px 18px 70px; }
  h1 { font-size: 32px; }
  h2 { font-size: 21px; margin-top: 38px; }
  .kpi .val { font-size: 25px; }
}
