/* Rexline Monitor — app stylesheet */

:root {
  --bg:        #f1f5f9;
  --panel:     #ffffff;
  --ink:       #0f172a;
  --ink-2:     #475569;
  --ink-3:     #94a3b8;
  --line:      #e2e8f0;
  --brand:     #0ea5e9;
  --brand-ink: #0369a1;
  --side:      #0f172a;
  --side-2:    #1e293b;
  --side-ink:  #cbd5e1;
  --good:      #22c55e;
  --bad:       #ef4444;
  --warn:      #f59e0b;
  --idle:      #94a3b8;
  --r:         12px;
  --shadow:    0 1px 2px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.ic { flex: none; vertical-align: -.15em; }

/* ------------------------------------------------------------- shell --- */

.shell { display: flex; min-height: 100vh; }

.side {
  width: 244px; flex: none;
  background: var(--side);
  color: var(--side-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  display: grid; place-items: center; color: #fff; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { color: #fff; font-size: 15px; }
.brand-text small { color: #64748b; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { flex: 1; overflow-y: auto; padding: 6px 10px; }
.nav-a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 9px;
  color: var(--side-ink); font-size: 14px; text-decoration: none;
  margin-bottom: 2px; position: relative;
}
.nav-a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav-a.on { background: var(--brand); color: #fff; font-weight: 600; }
.nav-a .badge {
  margin-left: auto; background: var(--bad); color: #fff;
  font-size: 11px; font-style: normal; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
}
.side-foot { padding: 10px; border-top: 1px solid #1e293b; }
.ver { text-align: center; font-size: 11px; color: #475569; padding-top: 8px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px; height: 62px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.top h1 { font-size: 18px; margin: 0; font-weight: 650; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.langsw { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.langsw a { padding: 4px 9px; font-size: 12px; color: var(--ink-2); }
.langsw a:hover { background: var(--bg); text-decoration: none; }
.langsw a.on { background: var(--brand); color: #fff; }

.me { display: flex; align-items: center; gap: 9px; }
.ava {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  font-size: 12.5px; font-weight: 700; flex: none;
}
.ava.sm { width: 28px; height: 28px; font-size: 11px; }
.me-txt { display: flex; flex-direction: column; line-height: 1.25; }
.me-txt strong { font-size: 13.5px; }
.me-txt small { font-size: 11px; color: var(--ink-3); }

.burger { display: none; cursor: pointer; color: var(--ink-2); }
.scrim { display: none; }
#navtoggle { display: none; }

.content { padding: 22px; flex: 1; }

/* ------------------------------------------------------------ pieces --- */

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.card.narrow { max-width: 460px; }
.card.pad0 { padding: 0; overflow: hidden; }
.card h2 { margin: 0 0 14px; font-size: 15.5px; font-weight: 650; }
.card h2.with-act { display: flex; align-items: center; gap: 10px; }
.card h2.with-act .spacer { margin-left: auto; }

.cardhead {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.cardhead h2 { margin: 0; }
.cardhead .spacer { margin-left: auto; }

.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side-main { grid-template-columns: minmax(0, 1fr) 320px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 15px 16px; box-shadow: var(--shadow);
}
.kpi .lbl { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .val { font-size: 25px; font-weight: 700; margin-top: 5px; line-height: 1.1; }
.kpi .sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.kpi.good .val { color: var(--good); }
.kpi.bad  .val { color: var(--bad); }
.kpi.warn .val { color: var(--warn); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #0284c7; }
.btn.danger { background: #fff; border-color: #fecaca; color: var(--bad); }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=time], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(14,165,233,.13);
}
.inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline .field { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: 16px; height: 16px; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 10px 14px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3); font-weight: 700;
  border-bottom: 1px solid var(--line); background: #f8fafc;
  white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tblwrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip.green { background: #dcfce7; color: #15803d; }
.chip.red   { background: #fee2e2; color: #b91c1c; }
.chip.amber { background: #fef3c7; color: #b45309; }
.chip.gray  { background: #f1f5f9; color: #475569; }
.chip.blue  { background: #e0f2fe; color: #0369a1; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on  { background: var(--good); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.dot.off { background: #cbd5e1; }

/* Progress / meters */
.meter { height: 7px; border-radius: 6px; background: var(--line); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; }
.meter.tall { height: 12px; border-radius: 7px; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Timeline */
.tl { position: relative; }
.tl-bar {
  display: flex; height: 40px; border-radius: 8px; overflow: hidden;
  background: repeating-linear-gradient(90deg, #f1f5f9 0 1px, #f8fafc 1px 40px);
  border: 1px solid var(--line);
}
.tl-seg { height: 100%; min-width: 1px; position: relative; }
.tl-seg:hover { filter: brightness(1.15); }
.tl-axis { display: flex; margin-top: 5px; font-size: 11px; color: var(--ink-3); }
.tl-axis span { flex: 1; text-align: left; border-left: 1px solid var(--line); padding-left: 3px; }
.tl-axis span:first-child { border-left: 0; }

.tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: #0f172a; color: #fff; font-size: 12px; line-height: 1.45;
  padding: 7px 10px; border-radius: 8px; max-width: 320px;
  box-shadow: 0 8px 24px rgba(15,23,42,.28); display: none;
}
.tip b { color: #7dd3fc; }

/* Bar list (top apps) */
.barlist { display: flex; flex-direction: column; gap: 11px; }
.barrow .barhead { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 4px; gap: 10px; }
.barrow .barhead span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow .barhead b { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.barrow .bar { height: 7px; background: var(--line); border-radius: 5px; overflow: hidden; }
.barrow .bar i { display: block; height: 100%; border-radius: 5px; }

/* Employee cards on the live board */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(288px, 1fr)); gap: 14px; }
.person {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.person .phead { display: flex; align-items: center; gap: 10px; }
.person .pname { min-width: 0; flex: 1; }
.person .pname strong { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .pname small { color: var(--ink-3); font-size: 12px; }
.person .pnow {
  font-size: 12.5px; color: var(--ink-2); background: #f8fafc;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.person .pstats { display: flex; gap: 12px; font-size: 12.5px; color: var(--ink-2); }
.person .pstats b { display: block; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Screenshot grid */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.shot {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
}
.shot a { display: block; }
.shot img { width: 100%; display: block; aspect-ratio: 16/10; object-fit: cover; background: #e2e8f0; }
.shot .meta { padding: 8px 10px; font-size: 12px; }
.shot .meta strong { display: block; font-size: 12.5px; }
.shot .meta small { color: var(--ink-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.lightbox {
  position: fixed; inset: 0; background: rgba(15,23,42,.9);
  display: none; place-items: center; z-index: 80; padding: 24px;
}
.lightbox.on { display: grid; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 10px; }
.lightbox .lbmeta { color: #e2e8f0; font-size: 13px; text-align: center; margin-top: 12px; }
.lightbox .lbclose {
  position: absolute; top: 18px; right: 22px; color: #fff;
  background: rgba(255,255,255,.12); border: 0; border-radius: 8px;
  padding: 8px 11px; cursor: pointer;
}

/* Flash + empty */
.flash {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px;
  background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0;
}
.flash.err { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
.flash.warn { background: #fef3c7; color: #78350f; border-color: #fde68a; }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty p { margin: 8px 0 0; font-size: 14px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { margin-left: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 14px; font-size: 14px; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 600; }

.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 650; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }

.codebox {
  background: #0f172a; color: #e2e8f0; border-radius: 10px;
  padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px; overflow-x: auto; white-space: pre;
}
.bigcode {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px; letter-spacing: .1em; font-weight: 700;
  background: #f8fafc; border: 2px dashed var(--brand);
  border-radius: 10px; padding: 14px; text-align: center; color: var(--brand-ink);
}

/* ------------------------------------------------------------- login --- */

.loginbody {
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 55%, #0c4a6e 100%);
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.loginwrap { width: 100%; max-width: 384px; }
.loginbox {
  background: #fff; border-radius: 16px; padding: 30px 28px;
  box-shadow: 0 24px 60px rgba(2,6,23,.45);
}
.loginlogo { display: flex; justify-content: center; margin-bottom: 12px; }
.loginbox h1 { font-size: 20px; margin: 0; text-align: center; }
.loginbox .sub { text-align: center; color: var(--ink-3); font-size: 13px; margin: 4px 0 20px; }
.loginbox label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 13px; }
.loginbox label input { margin-top: 5px; }
.loginerr {
  background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca;
  padding: 9px 12px; border-radius: 9px; font-size: 13.5px; margin-bottom: 14px;
}
.loginlang { text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--ink-3); }
.loginlang a { color: var(--ink-2); }
.loginlang a.on { color: var(--brand-ink); font-weight: 600; }
.loginfoot { text-align: center; color: #64748b; font-size: 12px; margin-top: 16px; }

/* ------------------------------------------------------------ mobile --- */

@media (max-width: 980px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side-main { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
    transform: translateX(-100%); transition: transform .22s ease;
    height: 100vh;
  }
  #navtoggle:checked ~ .shell .side { transform: translateX(0); }
  #navtoggle:checked ~ .scrim {
    display: block; position: fixed; inset: 0;
    background: rgba(15,23,42,.5); z-index: 40;
  }
  .burger { display: inline-flex; }
  .top { padding: 0 14px; gap: 10px; }
  .top h1 { font-size: 16px; }
  .me-txt { display: none; }
  .content { padding: 14px; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .val { font-size: 21px; }
  .people { grid-template-columns: minmax(0, 1fr); }
  .shots { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .card { padding: 14px; }
}

@media print {
  .side, .top, .toolbar, .burger { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
