/* NALQIVO ERP — Executive Command Centre (dashboard app).
   One read-only surface: frosted toolbar, navy identity banner, dense KPI
   cards that open a side drawer, and an alert feed. Every colour comes from
   tokens.css so the app follows the active theme; nothing here paints over
   another app's styles. */

/* The drawer and its backdrop are siblings of the shell, so the tokens have to
   be declared on all three — otherwise the drawer header inherits nothing. */
.cc-shell,
.cc-drawer,
.cc-drawer-backdrop {
  /* Navy stays the identity colour but lifted enough that white text reads
     without effort on dim screens: the darkest stop is a deep slate blue,
     not near-black. */
  --cc-navy-1: #21365e;
  --cc-navy-2: #2e4d84;
  --cc-navy-3: #3d629f;
  --cc-line: var(--line, #e3e7ef);
  --cc-ink: var(--ink, #16213a);
  --cc-muted: var(--muted, #6a7690);
  --cc-radius: 14px;
}

.cc-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ---------------------------------------------------------------- toolbar */
.cc-toolbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius);
  background: color-mix(in srgb, var(--nq-bg, #f6f7fb) 82%, transparent);
  backdrop-filter: blur(10px);
}

.cc-toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cc-toolbar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--cc-muted);
  white-space: nowrap;
}

.cc-seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--cc-line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.cc-seg button {
  border: 0;
  background: transparent;
  color: var(--cc-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.cc-seg button[aria-pressed="true"] {
  background: var(--nq-primary, #6c4cf1);
  color: #fff;
  box-shadow: 0 2px 8px rgba(108, 76, 241, .28);
}

.cc-toolbar select,
.cc-toolbar input[type="search"] {
  height: 32px;
  font-size: 12px;
  border-radius: 9px;
  border: 1px solid var(--cc-line);
  background: #fff;
  padding: 0 8px;
  min-width: 0;
}

.cc-toolbar input[type="search"] {
  width: 190px;
  max-width: 44vw;
}

.cc-toolbar-spacer { flex: 1 1 auto; }

.cc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--cc-line);
  background: #fff;
  color: var(--cc-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.cc-btn:hover { border-color: var(--nq-primary, #6c4cf1); color: var(--nq-primary, #6c4cf1); }
.cc-btn.primary { background: var(--nq-primary, #6c4cf1); border-color: transparent; color: #fff; }
.cc-btn.ghost { background: transparent; }
.cc-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ------------------------------------------------------------------- hero */
.cc-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  padding: 20px 22px;
  border-radius: 18px;
  color: #f4f7ff;
  background:
    radial-gradient(680px 220px at 88% -40%, rgba(18, 184, 166, .32), transparent 70%),
    radial-gradient(520px 240px at 8% 120%, rgba(108, 76, 241, .38), transparent 72%),
    linear-gradient(135deg, var(--cc-navy-1), var(--cc-navy-2) 58%, var(--cc-navy-3));
  box-shadow: 0 16px 38px -22px rgba(14, 26, 49, .75);
}

.cc-hero::after {
  content: "";
  position: absolute;
  inset-inline-end: -60px;
  top: -70px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .12);
  pointer-events: none;
}

.cc-hero-num {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .32);
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: .04em;
}

.cc-hero-main { min-width: 0; flex: 1 1 320px; }

.cc-hero-title {
  margin: 0;
  /* Headings carry an ink colour from app.css; on the banner the title is
     always white. */
  color: #ffffff;
  font-size: clamp(18px, 2vw, 23px);
  font-weight: 800;
  letter-spacing: -.01em;
}

.cc-hero-sub {
  margin-top: 3px;
  font-size: 12px;
  color: rgba(240, 246, 255, .9);
}

.cc-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .26);
  color: #ffffff;
}

.cc-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: #9fe9de; }
.cc-chip.ready .dot { background: #46e0b6; box-shadow: 0 0 0 3px rgba(70, 224, 182, .18); }
.cc-chip.partial .dot { background: #ffd166; box-shadow: 0 0 0 3px rgba(255, 209, 102, .18); }
.cc-chip.pending .dot { background: #ff9a9a; box-shadow: 0 0 0 3px rgba(255, 154, 154, .18); }
.cc-chip.stale .dot { background: #ffb36b; }

.cc-hero-actions { display: flex; gap: 8px; align-items: center; }
.cc-hero .cc-btn {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
  color: #eef3ff;
}
.cc-hero .cc-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }

@media (max-width: 760px) {
  .cc-hero { padding: 16px; border-radius: 15px; }
  .cc-hero-num { width: 38px; height: 38px; font-size: 13px; }
}

/* ------------------------------------------------------------------- grid */
.cc-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 4px 2px 0;
}

.cc-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--cc-ink);
  letter-spacing: .01em;
}

.cc-section-sub { font-size: 11.5px; color: var(--cc-muted); }

.cc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 12px;
}

.cc-card {
  --accent: #8b9bb0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: start;
  padding: 14px 14px 12px;
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius);
  background: #fff;
  color: var(--cc-ink);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  min-height: 118px;
}

.cc-card::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: .9;
}

.cc-card:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 46%, var(--cc-line));
  box-shadow: 0 12px 26px -20px rgba(22, 33, 58, .45);
}
.cc-card:focus-visible { outline: 2px solid var(--nq-primary, #6c4cf1); outline-offset: 2px; }

.cc-card.tone-blue { --accent: #2f6fe4; }
.cc-card.tone-green { --accent: #0aa88f; }
.cc-card.tone-amber { --accent: #e6a220; }
.cc-card.tone-red { --accent: #d94455; }
.cc-card.tone-purple { --accent: #704de7; }
.cc-card.tone-slate { --accent: #8b9bb0; }

.cc-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.cc-card-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  color: var(--accent);
  flex: 0 0 auto;
}

.cc-card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--cc-muted);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cc-card-value {
  font-size: clamp(21px, 2.1vw, 26px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.cc-card-value small {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--cc-muted);
  margin-inline-start: 3px;
}

.cc-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  font-size: 10.5px;
  color: var(--cc-muted);
}

.cc-delta { font-weight: 800; }
.cc-delta.up { color: #0a9c7d; }
.cc-delta.down { color: #cf3d4f; }

.cc-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--cc-line);
  background: #f7f8fc;
  font-size: 10px;
  font-weight: 700;
  color: var(--cc-muted);
  white-space: nowrap;
}

.cc-card.critical { box-shadow: inset 0 0 0 1px rgba(217, 68, 85, .22); }

.cc-card.is-pending {
  cursor: default;
  border-style: dashed;
  background: repeating-linear-gradient(135deg, #fbfbfe, #fbfbfe 10px, #f6f7fc 10px, #f6f7fc 20px);
}
.cc-card.is-pending .cc-card-value { font-size: 14px; font-weight: 800; color: #a26a1d; }
.cc-card.is-pending::before { background: #c9a56a; }
.cc-card-reason {
  font-size: 11px;
  line-height: 1.5;
  color: #8a6a34;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------------ notes */
.cc-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--nq-accent, #12b8a6) 30%, var(--cc-line));
  background: color-mix(in srgb, var(--nq-accent, #12b8a6) 7%, #fff);
  font-size: 12px;
  line-height: 1.6;
  color: #255a54;
}

.cc-note svg { flex: 0 0 auto; margin-top: 1px; }

/* ---------------------------------------------------------------- alerts */
.cc-panel {
  border: 1px solid var(--cc-line);
  border-radius: var(--cc-radius);
  background: #fff;
  overflow: hidden;
}

.cc-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cc-line);
  background: #fbfcfe;
}

.cc-panel-title { font-size: 13px; font-weight: 800; }
.cc-panel-sub { font-size: 11px; color: var(--cc-muted); }
.cc-panel-head .cc-toolbar-spacer { flex: 1; }

.cc-alert-list { display: flex; flex-direction: column; }

.cc-alert {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #f0f2f7;
  font-size: 12px;
}
.cc-alert:last-child { border-bottom: 0; }
.cc-alert-sev { width: 8px; height: 8px; border-radius: 50%; background: #9fb0c9; }
.cc-alert.sev-high .cc-alert-sev { background: #d94455; box-shadow: 0 0 0 3px rgba(217, 68, 85, .14); }
.cc-alert.sev-medium .cc-alert-sev { background: #e6a220; box-shadow: 0 0 0 3px rgba(230, 162, 32, .14); }
.cc-alert.sev-low .cc-alert-sev { background: #2f6fe4; box-shadow: 0 0 0 3px rgba(47, 111, 228, .12); }
.cc-alert-title { font-weight: 700; color: var(--cc-ink); line-height: 1.45; }
.cc-alert-meta { margin-top: 2px; font-size: 10.5px; color: var(--cc-muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.cc-alert-end { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.cc-alert-link {
  color: var(--nq-primary, #6c4cf1);
  font-weight: 700;
  font-size: 11px;
  text-decoration: none;
}

/* ---------------------------------------------------------------- drawer */
.cc-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 18, 34, .38);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .18s ease;
}
.cc-drawer-backdrop.open { opacity: 1; }

.cc-drawer {
  position: fixed;
  z-index: 61;
  top: 0;
  bottom: 0;
  inset-inline-end: 0;
  width: min(680px, 100vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -24px 0 60px -30px rgba(10, 18, 34, .5);
  transform: translateX(-102%);
  transition: transform .22s cubic-bezier(.2, .7, .2, 1);
}
[dir="ltr"] .cc-drawer { transform: translateX(102%); box-shadow: 24px 0 60px -30px rgba(10, 18, 34, .5); }
.cc-drawer.open { transform: translateX(0); }

.cc-drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 14px;
  color: #f4f7ff;
  background: linear-gradient(135deg, var(--cc-navy-1), var(--cc-navy-2));
}
.cc-drawer-head h3 { margin: 0; color: #ffffff; font-size: 15px; font-weight: 800; }
.cc-drawer-head .sub { margin-top: 3px; font-size: 11px; color: rgba(240, 246, 255, .88); }
.cc-drawer-head .cc-btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); color: #fff; }
.cc-drawer-body { flex: 1; overflow: auto; padding: 14px 16px 20px; }

.cc-drawer-total {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--cc-line);
  background: #f8f9fd;
  margin-bottom: 12px;
}
.cc-drawer-total b { font-size: 20px; font-variant-numeric: tabular-nums; }
.cc-drawer-total span { font-size: 11px; color: var(--cc-muted); font-weight: 700; }

.cc-table-wrap { overflow: auto; border: 1px solid var(--cc-line); border-radius: 11px; }
.cc-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.cc-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f6fb;
  text-align: start;
  font-size: 10.5px;
  font-weight: 800;
  color: #56627c;
  padding: 8px 9px;
  border-bottom: 1px solid var(--cc-line);
  white-space: nowrap;
}
.cc-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #f1f3f8;
  color: var(--cc-ink);
  vertical-align: top;
}
.cc-table tr:last-child td { border-bottom: 0; }
.cc-table td.num { text-align: end; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.cc-table td.money { text-align: end; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }

.cc-drawer-note {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--cc-muted);
}
.cc-drawer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--cc-line);
  background: #fbfcfe;
}

/* -------------------------------------------------------------- customize */
.cc-custom-list { display: flex; flex-direction: column; gap: 6px; max-height: min(58vh, 460px); overflow: auto; padding: 2px; }
.cc-custom-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--cc-line);
  border-radius: 10px;
  background: #fff;
  font-size: 12px;
}
.cc-custom-row .label { font-weight: 700; color: var(--cc-ink); }
.cc-custom-row .sub { font-size: 10.5px; color: var(--cc-muted); }
.cc-custom-move { display: flex; gap: 4px; }
.cc-custom-move button {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--cc-line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  color: var(--cc-muted);
}
.cc-custom-move button[disabled] { opacity: .4; cursor: default; }
.cc-custom-row.is-hidden { opacity: .55; }
.cc-custom-row.is-hidden .label { text-decoration: line-through; }

/* Bar-order modal: the leading tile shows the position the screen will take. */
.cc-order-num {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #eef2fa;
  color: #2e4d84;
  font-weight: 700;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .cc-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 760px) {
  .cc-shell { gap: 10px; }
  .cc-toolbar { position: static; padding: 8px; }
  .cc-toolbar input[type="search"] { width: 100%; max-width: none; }
  .cc-toolbar-spacer { display: none; }
  .cc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .cc-card { min-height: 104px; padding: 11px 11px 10px; }
  .cc-card-value { font-size: 19px; }
  .cc-card-foot { display: none; }
  .cc-alert { grid-template-columns: 8px 1fr; }
  .cc-alert-end { grid-column: 2; justify-content: flex-start; }
  .cc-drawer { width: 100vw; }
}

@media (max-width: 420px) {
  .cc-grid { grid-template-columns: 1fr; }
  .cc-hero-actions { width: 100%; }
  .cc-hero-actions .cc-btn { flex: 1; justify-content: center; }
}

@media print {
  .cc-toolbar, .cc-hero-actions, .cc-drawer-backdrop, .cc-drawer { display: none !important; }
  .cc-card { break-inside: avoid; box-shadow: none; }
}
