/* Aamal Tyre WMS -- Infor SoHo-style dense UI.
   Rules (PROJECT.md 10): no rounded cards, no gradients, no soft shadows,
   no generous whitespace, no decorative colour. Density is the point. */

:root {
  --graphite:   #2b3034;
  --graphite-2: #363d42;
  --graphite-3: #454d54;
  --azure:      #2578a9;
  --azure-dk:   #1c5c82;
  --azure-lt:   #e5f1f9;
  --bg:         #eceef0;
  --panel:      #ffffff;
  --border:     #c8ccd0;
  --border-lt:  #dfe3e6;
  --head:       #f2f3f4;
  --text:       #2b2b2b;
  --dim:        #6b7278;
  --emerald:    #1e7b42;
  --amber:      #8a5d00;
  --ruby:       #b32b2b;
  --slate:      #5a6672;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Source Sans Pro", Roboto, Arial, sans-serif;
  font-size: 12px;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------- app frame */

.app { display: flex; flex-direction: column; height: 100vh; }

.hdr {
  height: 42px; flex: 0 0 42px;
  background: var(--graphite);
  display: flex; align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid #1c2124;
}
.hdr .brand {
  color: #fff; font-size: 13px; font-weight: 600;
  letter-spacing: .4px; margin-right: 4px;
}
.hdr .brand span { color: #8b959d; font-weight: 400; margin-left: 6px; }
.hdr .sp { flex: 1; }
.hdr .who { color: #c3cad0; font-size: 11px; margin-right: 10px; }
.hdr .who b { color: #fff; font-weight: 600; }
.hdr .role {
  display: inline-block; background: var(--graphite-3); color: #cfd6db;
  font-size: 9px; letter-spacing: .6px; text-transform: uppercase;
  padding: 2px 5px; margin-left: 6px;
}
.hdr a.out { color: #9aa4ab; font-size: 11px; }
.hdr a.out:hover { color: #fff; text-decoration: none; }

.body { flex: 1; display: flex; min-height: 0; }

/* ---------------------------------------------------------------- nav */

.nav {
  width: 176px; flex: 0 0 176px;
  background: var(--graphite-2);
  overflow-y: auto;
  border-right: 1px solid #1c2124;
}
.nav .grp {
  color: #79838b; font-size: 9px; text-transform: uppercase;
  letter-spacing: .9px; padding: 12px 12px 5px;
}
.nav a {
  display: block; padding: 0 12px; height: 30px; line-height: 30px;
  color: #c7cfd5; font-size: 12px;
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--graphite-3); color: #fff; text-decoration: none; }
.nav a.on {
  background: var(--graphite); color: #fff;
  border-left-color: var(--azure); font-weight: 600;
}
.nav a .ct { float: right; color: #79838b; font-size: 10px; }

/* ------------------------------------------------------------- content */

.main { flex: 1; overflow: auto; display: flex; flex-direction: column; }

.bar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 8px 14px;
  display: flex; align-items: center; gap: 10px;
  flex: 0 0 auto;
}
.bar h1 {
  margin: 0; font-size: 15px; font-weight: 600; color: var(--graphite);
}
.bar .sub { color: var(--dim); font-size: 11px; }
.bar .sp { flex: 1; }

.wrap { padding: 12px 14px; }

/* ------------------------------------------------------------ controls */

label.fl { font-size: 10px; color: var(--dim); text-transform: uppercase;
           letter-spacing: .5px; display: block; margin-bottom: 3px; }

select, input[type=text], input[type=date], input[type=password], input[type=file] {
  font-family: inherit; font-size: 12px;
  height: 26px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: 0;
  background: #fff; color: var(--text);
}
select:focus, input:focus { outline: 2px solid var(--azure-lt); border-color: var(--azure); }

.btn {
  font-family: inherit; font-size: 12px; height: 26px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 0;
  background: #fff; color: var(--text); cursor: pointer;
}
.btn:hover { background: var(--head); }
.btn.pri { background: var(--azure); border-color: var(--azure-dk); color: #fff; }
.btn.pri:hover { background: var(--azure-dk); }

.filters {
  background: var(--panel); border: 1px solid var(--border);
  border-bottom: none;
  padding: 8px 10px; display: flex; gap: 10px; align-items: flex-end;
  flex-wrap: wrap;
}
.filters .f { display: flex; flex-direction: column; }

/* --------------------------------------------------------------- grid */

.panel { background: var(--panel); border: 1px solid var(--border); }
.panel + .panel { margin-top: 12px; }
.panel > .ph {
  padding: 7px 10px; border-bottom: 1px solid var(--border);
  background: var(--head);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .6px; color: var(--slate);
  display: flex; align-items: center;
}
.panel > .ph .sp { flex: 1; }
.panel > .ph .note { font-weight: 400; text-transform: none;
                     letter-spacing: 0; color: var(--dim); font-size: 11px; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  background: var(--head);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border-lt);
  padding: 0 8px; height: 26px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--slate);
  text-align: left; white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
table.grid th a { color: var(--slate); }
table.grid th.n, table.grid td.n { text-align: right; }
table.grid th.c, table.grid td.c { text-align: center; }
table.grid td {
  height: 28px; padding: 0 8px;
  border-bottom: 1px solid var(--border-lt);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.grid tbody tr:nth-child(even) { background: #fafbfc; }
table.grid tbody tr:hover { background: var(--azure-lt); }
table.grid tfoot td {
  height: 28px; padding: 0 8px; font-weight: 600;
  background: var(--head); border-top: 1px solid var(--border);
}
td.mono, th.mono { font-family: Consolas, "Courier New", monospace; font-size: 11px; }
td.dim { color: var(--dim); }
.scroll { max-height: calc(100vh - 260px); overflow: auto; }

/* -------------------------------------------------------------- chips */

.chip {
  display: inline-block; padding: 1px 6px; border-radius: 2px;
  font-size: 10px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase; border: 1px solid;
}
.chip.SELLABLE       { color: var(--emerald); border-color: #b6d9c3; background: #eef7f1; }
.chip.NEAR          { color: var(--amber);   border-color: #e3d3a8; background: #fbf5e6; }
.chip.EXPIRED       { color: var(--ruby);    border-color: #e8bcbc; background: #fbeeee; }
.chip.NA            { color: var(--dim);     border-color: var(--border); background: var(--head); }
.chip.SPACE         { color: var(--slate);   border-color: var(--border); background: var(--head); }
.chip.WEIGHT        { color: var(--amber);   border-color: #e3d3a8; background: #fbf5e6; }
.chip.ARRIVED       { color: var(--emerald); border-color: #b6d9c3; background: #eef7f1; }

/* --------------------------------------------------------------- kpis */

.kpis { display: flex; gap: 1px; background: var(--border);
        border: 1px solid var(--border); margin-bottom: 12px; }
.kpi { background: var(--panel); flex: 1; padding: 9px 11px; }
.kpi .l {
  font-size: 9px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--dim); margin-bottom: 3px;
}
.kpi .v { font-size: 20px; font-weight: 600; color: var(--graphite); line-height: 1.1; }
.kpi .v.warn { color: var(--ruby); }
.kpi .v.ok { color: var(--emerald); }
/* Amber, not ruby, and the distinction is the point: this is stock we have
   no movement record for. It is missing data, not a loss. Colouring it red
   makes an unknown look like a bill. */
.kpi .v.amber { color: var(--amber); }
.kpi .s { font-size: 10px; color: var(--dim); margin-top: 2px; }
/* Same three colours as bare, non-.kpi-scoped classes -- e.g. a status
   word inside a table cell, not just the big KPI number. */
.warn  { color: var(--ruby); }
.ok    { color: var(--emerald); }
.amber { color: var(--amber); }
/* Only applies where a .kpi is an <a> (e.g. Documents page) -- plain div
   .kpi boxes elsewhere are untouched since this selector can't match them. */
a.kpi { cursor: pointer; transition: background .1s; }
a.kpi:hover { background: var(--bg); }

/* --------------------------------------------------------------- misc */

.cols { display: flex; gap: 12px; align-items: flex-start; }
.cols > * { flex: 1; min-width: 0; }

.bar-track { height: 12px; background: var(--head); border: 1px solid var(--border-lt);
             position: relative; min-width: 90px; }
.bar-fill { height: 100%; }
.bar-fill.SELLABLE { background: #4aa36c; }
.bar-fill.NEAR    { background: #d6a53a; }
.bar-fill.EXPIRED { background: #c25454; }
.bar-fill.NA      { background: #a9b1b8; }

.msg { padding: 8px 11px; border: 1px solid; font-size: 12px; margin-bottom: 12px; }
.msg.ok  { background: #eef7f1; border-color: #b6d9c3; color: var(--emerald); }
.msg.err { background: #fbeeee; border-color: #e8bcbc; color: var(--ruby); }
.msg.info{ background: var(--azure-lt); border-color: #b9d6e8; color: var(--azure-dk); }

.note-box {
  border-left: 3px solid var(--azure); background: #f5f8fa;
  padding: 8px 11px; font-size: 11px; color: #3f4a52; margin-bottom: 12px;
}
.note-box b { color: var(--graphite); }
.note-box.warn { border-left-color: var(--ruby); background: #fdf6f6; }

.empty { padding: 30px; text-align: center; color: var(--dim); }

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

.login-page {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--graphite);
}
.login {
  width: 320px; background: var(--panel);
  border: 1px solid #1c2124; padding: 26px 26px 22px;
}
.login .t { font-size: 17px; font-weight: 600; color: var(--graphite); }
.login .st { font-size: 11px; color: var(--dim); margin: 3px 0 20px;
             padding-bottom: 14px; border-bottom: 1px solid var(--border-lt); }
.login label.fl { margin-top: 11px; }
.login input { width: 100%; height: 30px; }
.login .btn { width: 100%; height: 32px; margin-top: 18px; }
.login .hint { margin-top: 14px; font-size: 10px; color: var(--dim);
               border-top: 1px solid var(--border-lt); padding-top: 10px; }
.login .hint code { font-family: Consolas, monospace; color: var(--slate); }

/* Trend direction. No arrows, no green-is-good: on this screen "up" is good
   for stock value and bad for expired value, so the colour says direction
   only and the label says which number it belongs to. */
.up   { color: var(--graphite); font-weight: 600; }
.down { color: var(--graphite); font-weight: 600; }
td.empty, .empty { color: var(--dim); text-align: center; padding: 18px; }

/* ---- rack map -------------------------------------------------------
   A grid, not a floor plan. Square cells, hairline gaps, no rounding and
   no shadow: this is a schematic of steel, and it has to print. Colour
   encodes fullness only -- expired is a red rule on the cell, not a red
   fill, so "full" and "expired" stay independently readable. */
.rackrow { display: flex; align-items: stretch; margin-bottom: 3px; }
.rlabel {
  width: 92px; flex: none; padding: 2px 8px 0 0; text-align: right;
  border-right: 2px solid var(--slate); margin-right: 7px;
}
.rlabel b { font-size: 13px; color: var(--graphite); display: block; line-height: 1.1; }
.rlabel span { font-size: 9px; color: var(--dim); }
.cells { display: flex; flex-wrap: wrap; gap: 2px; }
.cell {
  width: 40px; height: 32px; border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-decoration: none; position: relative;
}
.cell:hover { outline: 2px solid var(--azure); outline-offset: -1px; text-decoration: none; }
.cell .cn { font-size: 8px; color: var(--dim); line-height: 1; }
.cell .cq { font-size: 11px; font-weight: 600; color: var(--graphite); line-height: 1.2; }
.cell.e { background: var(--panel); border-style: dashed; }
.cell.l { background: #eaf3fa; }
.cell.h { background: #cfe4f2; }
.cell.f { background: #a9cde6; }
.cell.x { border-bottom: 3px solid var(--ruby); }
.legend { font-weight: 400; text-transform: none; font-size: 10px; color: var(--dim); }
.legend .sw {
  display: inline-block; width: 11px; height: 11px; border: 1px solid var(--border);
  margin: 0 4px 0 10px; vertical-align: -1px;
}
.legend .sw.e { background: var(--panel); border-style: dashed; }
.legend .sw.l { background: #eaf3fa; }
.legend .sw.h { background: #cfe4f2; }
.legend .sw.f { background: #a9cde6; }
.legend .sw.x { background: var(--panel); border-bottom: 3px solid var(--ruby); }
@media print {
  .nav, .hdr, .bar .btn, .note-box { display: none; }
  .cell { width: 34px; height: 26px; }
}

/* A KPI that drills down should look identical to one that does not --
   until you point at it. Underlining every clickable number turns the
   dashboard into a page of links and nothing stands out. */
.kpi .v a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--border); }
.kpi .v a:hover { color: var(--azure-dk); border-bottom-color: var(--azure); }
table.grid td a { color: var(--azure-dk); }
