/* =====================================================================
   IPG Orders — International Printing Group
   Brand: orange #EA7C28 · teal #299CB7 · purple #6F3A92 · green #16B24B
   ===================================================================== */

:root {
  --ipg-orange: #EA7C28;
  --ipg-teal:   #299CB7;
  --ipg-purple: #6F3A92;
  --ipg-green:  #16B24B;
  --ipg-red:    #D64545;
  --ipg-grey:   #9AA0A6;

  --ink:        #1e2430;
  --ink-soft:   #5b6472;
  --ink-faint:  #8a929e;
  --line:       #e3e7ed;
  --bg:         #f4f6f9;
  --panel:      #ffffff;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,28,44,.06), 0 4px 12px rgba(20,28,44,.05);
  --font: "Source Sans 3", "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 700; margin: 0 0 14px; }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 10px; }

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

.sidebar {
  width: 220px; flex: 0 0 220px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; grid-template-columns: 9px 9px; grid-gap: 2px;
}
.brand-mark span { width: 9px; height: 9px; border-radius: 2px; display: block; }
.brand-text strong { display: block; font-size: 17px; font-weight: 700; line-height: 1.1; letter-spacing: .02em; }
.brand-text em { display: block; font-style: normal; font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .1em; }

.sidebar nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: block; padding: 8px 12px; margin-bottom: 2px;
  border-radius: 7px; color: var(--ink-soft);
  font-weight: 600; font-size: 14px; text-decoration: none;
}
.sidebar nav a:hover { background: #f2f5f9; color: var(--ink); text-decoration: none; }
.sidebar nav a.active { background: rgba(41,156,183,.12); color: #17708a; }
.nav-sep {
  margin: 16px 12px 6px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em; color: var(--ink-faint);
}

.sidebar-user { padding: 14px 18px; border-top: 1px solid var(--line); }
.su-name { font-weight: 600; font-size: 14px; }
.su-role { font-size: 12px; color: var(--ink-faint); margin-bottom: 6px; }
.su-out { font-size: 13px; }

.main { flex: 1; padding: 26px 30px 60px; min-width: 0; }

/* ---- page header ---------------------------------------------------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-head .sub { color: var(--ink-soft); font-size: 14px; }

/* ---- panels --------------------------------------------------------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.panel-flush { padding: 0; overflow: hidden; }
.panel-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.panel-head h2 { margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---- stats ---------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
  border-top: 3px solid var(--ipg-teal);
}
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-top: 2px; }

/* ---- tables --------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint);
  border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
.t-right { text-align: right; }
.t-num { font-variant-numeric: tabular-nums; }

.empty { padding: 40px 20px; text-align: center; color: var(--ink-faint); }

/* ---- badges --------------------------------------------------------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 700; line-height: 1.5;
  background: #eef1f5; color: var(--ink-soft); white-space: nowrap;
}
.badge-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.badge-soft { background: rgba(0,0,0,.05); }
.pill-status { color: #fff; }

.chip {
  display: inline-block; padding: 2px 8px; margin: 2px 3px 2px 0;
  background: #eef4f7; color: #1d7a92; border-radius: 5px;
  font-size: 12px; font-weight: 600;
}

.tag-overdue { color: var(--ipg-red); font-weight: 700; }
.tag-soon    { color: var(--ipg-orange); font-weight: 700; }
.muted { color: var(--ink-faint); }
.small { font-size: 13px; }

/* ---- buttons -------------------------------------------------------- */
.btn {
  display: inline-block; padding: 9px 16px; border-radius: 7px;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  background: #fff; color: var(--ink); border-color: var(--line);
  line-height: 1.35;
}
.btn:hover { text-decoration: none; background: #f6f8fa; }
.btn-primary { background: var(--ipg-orange); color: #fff; border-color: var(--ipg-orange); }
.btn-primary:hover { background: #d76d1c; border-color: #d76d1c; }
.btn-teal { background: var(--ipg-teal); color: #fff; border-color: var(--ipg-teal); }
.btn-teal:hover { background: #22869e; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-danger { color: var(--ipg-red); border-color: #f0cfcf; background: #fff; }
.btn-danger:hover { background: #fdf4f4; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- forms ---------------------------------------------------------- */
.field { margin-bottom: 14px; }
label.lbl {
  display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px;
}
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; font-family: var(--font); font-size: 14px;
  border: 1px solid #d6dbe3; border-radius: 7px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ipg-teal); box-shadow: 0 0 0 3px rgba(41,156,183,.15);
}
textarea { min-height: 78px; resize: vertical; }
select[multiple] { min-height: 120px; padding: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: auto; }
.help { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }
.err { font-size: 12px; color: var(--ipg-red); margin-top: 4px; font-weight: 600; }
.field-err input, .field-err select { border-color: var(--ipg-red); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { margin-bottom: 0; }
.toolbar input[type=search], .toolbar select { min-width: 190px; }

/* ---- flash ---------------------------------------------------------- */
.flash {
  padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px;
  font-weight: 600; font-size: 14px; border: 1px solid;
  word-break: break-word;
}
.flash-success { background: #edfaf1; border-color: #bde9cb; color: #12723a; }
.flash-error   { background: #fdf1f1; border-color: #f3cccc; color: #a32b2b; }

/* ---- pipeline board -------------------------------------------------- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr);
  gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: start;
}
.col {
  background: #eef1f5; border-radius: var(--radius); min-height: 160px;
  display: flex; flex-direction: column;
}
.col-head {
  padding: 11px 13px; border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center;
  letter-spacing: .02em;
}
.col-count { background: rgba(255,255,255,.28); border-radius: 20px; padding: 1px 9px; font-size: 12px; }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; flex: 1; min-height: 60px; }
.col.drag-over .col-body { background: rgba(41,156,183,.09); border-radius: 8px; outline: 2px dashed var(--ipg-teal); outline-offset: -4px; }

.card {
  background: #fff; border-radius: 8px; padding: 11px 12px;
  box-shadow: 0 1px 2px rgba(20,28,44,.08); cursor: grab;
  border-left: 3px solid transparent; font-size: 13px;
}
.card:active { cursor: grabbing; }
.card.dragging { opacity: .45; }
.card-num { font-weight: 700; font-size: 13px; }
.card-num a { color: var(--ink); }
.card-cust { color: var(--ink-soft); margin: 3px 0 5px; line-height: 1.35; }
.card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--ink-faint); gap: 8px; }
.card-priority { border-left-color: var(--ipg-orange); }

/* ---- timeline ------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid #eef1f5; font-size: 13px; }
.timeline li:last-child { border-bottom: none; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: 0 0 9px; }

/* ---- line items ----------------------------------------------------- */
.item-row {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; background: #fbfcfd;
}
.item-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.item-row-head strong { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.item-grid { display: grid; grid-template-columns: 2fr 90px 1.5fr 1.2fr; gap: 10px; }
@media (max-width: 1000px) { .item-grid { grid-template-columns: 1fr 1fr; } }

/* ---- dimension inputs ------------------------------------------------ */
.dim-row { display: flex; align-items: center; gap: 7px; }
.dim-row input { flex: 1 1 0; min-width: 0; }
.dim-row select { flex: 0 0 74px; }
.dim-x { color: var(--ink-faint); font-weight: 700; flex: 0 0 auto; }

/* ---- auth screens --------------------------------------------------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background:
    radial-gradient(1100px 500px at 12% -10%, rgba(234,124,40,.10), transparent 60%),
    radial-gradient(900px 480px at 108% 108%, rgba(111,58,146,.12), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 14px;
  padding: 30px; box-shadow: 0 8px 34px rgba(20,28,44,.10); border: 1px solid var(--line);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .bars { display: flex; gap: 4px; justify-content: center; margin-bottom: 12px; }
.auth-brand .bars span { width: 26px; height: 5px; border-radius: 3px; }
.auth-brand h1 { font-size: 22px; margin-bottom: 2px; }
.auth-brand p { margin: 0; color: var(--ink-faint); font-size: 13px; }

/* ---- pagination ----------------------------------------------------- */
.pager { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-soft); }
.pager .links { display: flex; gap: 6px; }
.pager a, .pager span.cur {
  padding: 5px 10px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; font-weight: 600; font-size: 13px;
}
.pager span.cur { background: var(--ipg-teal); color: #fff; border-color: var(--ipg-teal); }

/* ---- small screens (shop-floor tablets / phones) --------------------- */
@media (max-width: 780px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .sidebar nav a { padding: 7px 12px; }
  .nav-sep { width: 100%; margin: 6px 4px 2px; }
  .sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-top: 1px solid var(--line);
  }
  .su-role { margin-bottom: 0; }
  .su-out { margin-left: auto; }
  .main { padding: 18px 16px 40px; }
  .item-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dt { padding-top: 8px; }
  .page-head { flex-direction: column; align-items: stretch; }
}

/* ---- misc ----------------------------------------------------------- */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; }
.dl dt { color: var(--ink-faint); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
.dl dd { margin: 0; }
code.tok { background: #f2f5f9; padding: 3px 7px; border-radius: 5px; font-size: 13px; word-break: break-all; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
