/* ==========================================================================
   Kolhapur CRM — admin stylesheet

   Visual direction: the engineering drawing. This is an internal tool for an
   engineering business, used all day by people entering real production and
   supply data. So: dense, high-contrast, precise. Numbers set in a monospaced
   face so columns of quantities align and can be scanned. Page headers built
   like the title block of a drawing sheet — small uppercase labels over hard
   values, boxed and ruled.

   Palette:  ink #0D141A · steel #0B4F6C · oxide #A63D00
             works #14603F · amber #8A5A00 · paper #EDF0F3
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --ink:        #0D141A;
  --ink-2:      #3A4652;
  --muted:      #5B6773;
  --line:       #C9D3DC;
  --line-soft:  #DFE6EC;
  --paper:      #EDF0F3;
  --surface:    #FFFFFF;

  --steel:      #0B4F6C;
  --steel-dark: #073A50;
  --steel-tint: #E4EEF3;

  --oxide:      #A63D00;
  --oxide-tint: #FBEDE5;
  --works:      #14603F;
  --works-tint: #E4F1EA;
  --amber:      #8A5A00;
  --amber-tint: #FBF0DC;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --rail: 232px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
}

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

:focus-visible {
  outline: 2px solid var(--steel);
  outline-offset: 2px;
}

/* --------------------------------------------------------- shell + nav rail */

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

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--ink);
  color: #B8C4CE;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail-brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid #24313D;
}
.rail-brand .mark {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6E8091;
}
.rail-brand .name {
  color: #FFF;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 3px;
}

.rail-nav { padding: 12px 0; flex: 1; overflow-y: auto; }

.rail-group {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5D6E7E;
  padding: 14px 18px 6px;
}

.rail-nav a {
  display: block;
  padding: 8px 18px;
  color: #B8C4CE;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.rail-nav a:hover {
  background: #16202A;
  color: #FFF;
  text-decoration: none;
}
.rail-nav a[aria-current='page'] {
  background: #16202A;
  color: #FFF;
  border-left-color: var(--oxide);
  font-weight: 500;
}
.rail-nav .pending {
  display: block;
  color: #4E5E6D;
  padding: 8px 18px;
  font-size: 13.5px;
  line-height: 1.35;
  cursor: default;
}
.rail-nav .pending::after {
  content: 'not built';
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #3E4C59;
  margin-top: 1px;
}

.rail-foot {
  border-top: 1px solid #24313D;
  padding: 13px 18px;
  font-size: 13px;
}
.rail-foot .who { color: #FFF; font-weight: 500; }
.rail-foot .role {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6E8091;
  margin-top: 1px;
}
.rail-foot a { color: #8FA0AF; font-size: 13px; display: inline-block; margin-top: 7px; }

/* ------------------------------------------------------------------- main */

.main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.wrap { max-width: 1180px; }

/* Signature element: the title block, borrowed from an engineering drawing. */
.titleblock {
  display: flex;
  flex-wrap: wrap;
  border: 1.5px solid var(--ink);
  background: var(--surface);
  margin-bottom: 20px;
}
.titleblock .cell {
  padding: 9px 15px;
  border-right: 1px solid var(--line);
  min-width: 120px;
}
.titleblock .cell:last-child { border-right: 0; }
.titleblock .cell.grow { flex: 1; min-width: 200px; }
.titleblock .lbl {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.titleblock .val {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.titleblock .val.num { font-family: var(--mono); font-weight: 500; }
.titleblock .cell.act { display: flex; align-items: center; }

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.card-head {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-head h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.card-body { padding: 16px; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.stat .n {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.stat .k {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* ----------------------------------------------------------------- tables */

/* Tables scroll sideways rather than clipping their last column. */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 9px 13px;
  border-bottom: 1.5px solid var(--ink);
  white-space: nowrap;
}
tbody td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #F6F9FB; }
td.num, th.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
td.id { font-family: var(--mono); color: var(--muted); font-size: 13px; }

.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

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

.field { margin-bottom: 15px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

input[type=text], input[type=email], input[type=password],
input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 8px 11px;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--steel);
  box-shadow: inset 0 0 0 1px var(--steel);
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-block;
  padding: 8px 16px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: #FFF;
  background: var(--steel);
  border: 1px solid var(--steel);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--steel-dark); border-color: var(--steel-dark); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--steel); }
.btn.ghost:hover { background: var(--steel-tint); }
.btn.danger { background: var(--oxide); border-color: var(--oxide); }
.btn.danger:hover { background: #8A3300; border-color: #8A3300; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.btn.block { display: block; width: 100%; text-align: center; }

.actions { display: flex; gap: 9px; align-items: center; margin-top: 20px; }

/* ------------------------------------------------------------- tags/flash */

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border: 1px solid;
}
.tag.admin      { color: var(--oxide); border-color: var(--oxide); background: var(--oxide-tint); }
.tag.supervisor { color: var(--steel); border-color: var(--steel); background: var(--steel-tint); }
.tag.employee   { color: var(--ink-2); border-color: var(--line); background: var(--paper); }
.tag.customer   { color: var(--amber); border-color: var(--amber); background: var(--amber-tint); }
.tag.on      { color: var(--works); border-color: var(--works); background: var(--works-tint); }
.tag.off     { color: var(--muted); border-color: var(--line); background: var(--paper); }

.flash {
  padding: 10px 15px;
  margin-bottom: 16px;
  border-left: 4px solid;
  font-size: 14px;
}
.flash.ok    { border-color: var(--works); background: var(--works-tint); color: #0E4630; }
.flash.err   { border-color: var(--oxide); background: var(--oxide-tint); color: #7A2D00; }
.flash.warn  { border-color: var(--amber); background: var(--amber-tint); color: #6B4600; }

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

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(var(--line-soft) 1px, transparent 1px) 0 0 / 100% 26px,
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px) 0 0 / 26px 100%,
    var(--paper);
}
.gate-box { width: 100%; max-width: 372px; }
.gate-head {
  background: var(--ink);
  color: #FFF;
  padding: 20px 22px;
}
.gate-head .mark {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7B8C9B;
}
.gate-head h1 { font-size: 22px; font-weight: 600; margin-top: 4px; letter-spacing: -0.01em; }
.gate-body { background: var(--surface); border: 1px solid var(--line); border-top: 0; padding: 22px; }
.gate-foot {
  text-align: center;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 14px;
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail { width: 100%; flex: none; height: auto; position: static; }
  .rail-nav { display: flex; flex-wrap: wrap; padding: 6px 8px; }
  .rail-group { display: none; }
  .rail-nav a { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 12px; }
  .rail-nav a[aria-current='page'] { border-left: 0; border-bottom-color: var(--oxide); }
  .rail-nav .pending { display: none; }
  .main { padding: 16px 14px 40px; }
  .row2 { grid-template-columns: 1fr; }
  .titleblock .cell { min-width: 50%; border-bottom: 1px solid var(--line); }
  table { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

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

.filters { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.chip {
  display: inline-block;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
}
.chip:hover { border-color: var(--steel); color: var(--steel); text-decoration: none; }
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: #FFF;
  font-weight: 500;
}

.lede { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }

textarea { resize: vertical; min-height: 62px; font-family: var(--sans); }

.opt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

.hint.good { color: var(--works); font-weight: 500; }
.hint.bad  { color: var(--oxide); font-weight: 500; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--steel); border-color: var(--steel); }
input:disabled { background: var(--paper); color: var(--muted); cursor: not-allowed; }

/* ---------------------------------------------- login / register extras */

.gate-box.wide { max-width: 440px; }

.gate-or {
  position: relative;
  text-align: center;
  margin: 18px 0 14px;
}
.gate-or::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px solid var(--line);
}
.gate-or span {
  position: relative;
  background: var(--surface);
  padding: 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.gate-alt {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
}

.tag.pending { color: var(--amber); border-color: var(--amber); background: var(--amber-tint); }

.tag.vendor { color: #5B3A8E; border-color: #5B3A8E; background: #EFE9F7; }
