/* Northwind Retail Analytics: presentation only. Nothing here is part of the
   demonstration; the vulnerabilities all live in app.js and components.js. */

:root {
  --ink:      #16323d;
  --body:     #3c4a52;
  --muted:    #7b8792;
  --line:     #dde4e8;
  --bg:       #f2f5f7;
  --panel:    #ffffff;
  --accent:   #1d6b70;
  --accent-d: #14504f;
  --warn-bg:  #fff4d6;
  --warn-ink: #6a4c07;
  --warn-line:#e8cf8f;
  --up:       #1f7a4d;
  --down:     #a8442a;
}

* { box-sizing: border-box; }

/* An author display rule beats the UA sheet's [hidden] { display: none }, so
   any element this app hides with the hidden attribute needs this. Without it
   the resume strip is visible and empty on a clean load. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 400 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--body);
  background: var(--bg);
}

a { color: var(--accent); }

/* ------------------------------------------------------------- the banner -- */

#demo-banner {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-bottom: 1px solid #e8cf8f;
  padding: 9px 20px;
  font-size: 13px;
}
#demo-banner a { color: #6a4c07; }
.banner-link { margin-left: 10px; font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------------- top -- */

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark {
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--accent); display: inline-block; align-self: center;
}
.brand-name { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.brand-sub  { font-size: 12px; color: var(--muted); }

.search { flex: 1; max-width: 420px; }
.search input {
  width: 100%; padding: 7px 11px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 6px; background: #fbfcfd;
  color: var(--body);
}
.search input:focus { outline: 2px solid #a8ccce; border-color: var(--accent); }

.account { margin-left: auto; display: grid; grid-template-columns: auto 34px;
           gap: 0 10px; align-items: center; flex: 0 0 auto; }
.acct-name { font-weight: 600; color: var(--ink); font-size: 13px; text-align: right;
             white-space: nowrap; }
.acct-role { font-size: 11px; color: var(--muted); text-align: right;
             white-space: nowrap; }
/* The column is explicit on purpose. An item with a definite row position is
   placed before the auto-placed ones, so without this the avatar claims
   column 1 and the name is squeezed into the 34px avatar column. */
.avatar { grid-row: 1 / 3; grid-column: 2; width: 34px; height: 34px;
          border-radius: 50%; object-fit: cover; background: #d7dee3; }

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

.shell { display: grid; grid-template-columns: 200px 1fr; align-items: start; }

.sidebar {
  padding: 16px 10px; border-right: 1px solid var(--line);
  background: var(--panel); min-height: calc(100vh - 120px);
}
.nav-item {
  display: block; padding: 7px 11px; border-radius: 6px;
  color: var(--body); text-decoration: none; font-size: 13px;
}
.nav-item:hover { background: #eef3f4; }
.nav-item.is-current { background: #e4eeee; color: var(--accent-d); font-weight: 600; }
.nav-sep { height: 1px; background: var(--line); margin: 12px 10px; }

.content { padding: 22px 26px 40px; max-width: 1180px; }

/* ------------------------------------------------------------- page head -- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between;
             gap: 20px; margin-bottom: 18px; }
.view-title { margin: 0; font-size: 24px; line-height: 1.2; color: var(--ink);
              font-weight: 700; letter-spacing: -.015em; }
.view-note  { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 8px; }

.btn {
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  color: var(--body);
}
.btn:hover { border-color: #c3ced4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); border-color: var(--accent-d); }

/* ----------------------------------------------------------------- strip -- */

.strip {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #e9f1f1; border: 1px solid #cfe0e0; border-radius: 7px;
  padding: 9px 13px; margin-bottom: 16px; font-size: 13px;
}
.strip-label { font-weight: 600; color: var(--accent-d); }
.strip-time  { margin-left: auto; color: var(--muted); font-size: 12px; }
.share-note {
  background: #eef3f4; border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 13px; margin-bottom: 16px; font-size: 13px;
}

/* ----------------------------------------------------------------- tiles -- */

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
         margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
        padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.tile-label { font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
              color: var(--muted); }
.tile-value { font-size: 25px; font-weight: 700; color: var(--ink);
              font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile-delta { font-size: 12px; color: var(--muted); }
.tile-delta.up   { color: var(--up); }
.tile-delta.down { color: var(--down); }
.tile-computed { border-color: #cfe0e0; background: #fbfdfd; }

/* ---------------------------------------------------------------- panels -- */

.grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; margin-bottom: 18px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
         padding: 14px 16px; margin-bottom: 18px; }
.grid .panel { margin-bottom: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between;
              gap: 12px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.panel-meta { font-size: 12px; color: var(--muted); }

.result-list { margin: 0; padding-left: 18px; }
.result-list li { margin: 3px 0; }

.widget-title { font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.widget-body  { min-height: 20px; }
.widget-frame { width: 100%; height: 116px; border: 1px solid var(--line);
                border-radius: 6px; margin-top: 10px; background: #f7f9fa; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; letter-spacing: .06em;
            text-transform: uppercase; color: var(--muted); font-weight: 600;
            padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 7px 8px; border-bottom: 1px solid #eef2f4; }
.table td:nth-child(3), .table td:nth-child(4) { font-variant-numeric: tabular-nums; }

.draft-slot { border: 1px dashed var(--line); border-radius: 6px; padding: 9px 12px;
              color: var(--muted); margin-bottom: 8px; }
.draft-input { width: 100%; padding: 8px 10px; font: inherit; color: var(--body);
               border: 1px solid var(--line); border-radius: 6px; resize: vertical; }

.export-panel { background: var(--panel); border: 1px solid var(--line);
                border-radius: 8px; padding: 14px 16px; margin: 0 26px 24px; }
.export-head h1 { font-size: 18px; margin: 0 0 8px; color: var(--ink); }
.print-frame { width: 100%; height: 160px; border: 1px solid var(--line);
               border-radius: 6px; background: #fff; }

.foot { padding: 18px 26px 28px; color: var(--muted); font-size: 12px;
        border-top: 1px solid var(--line); background: var(--panel); }

/* -------------------------------------------------------- standalone pages -- */

body.plain { background: var(--bg); }
.card { max-width: 620px; margin: 40px auto; background: var(--panel);
        border: 1px solid var(--line); border-radius: 8px; padding: 24px 26px; }
.card h1 { margin: 0 0 10px; font-size: 20px; color: var(--ink); letter-spacing: -.015em; }
.card label { display: block; font-size: 12px; font-weight: 600; color: var(--ink);
              margin: 16px 0 5px; }
.card input[type=text] { width: 100%; padding: 8px 11px; font: inherit;
                         border: 1px solid var(--line); border-radius: 6px; }
.card .row { margin: 14px 0 18px; }
.plain-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }
code { background: #eef2f4; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* -------------------------------------------------------------- catalogue -- */

.cat-wrap { max-width: 1120px; margin: 0 auto; padding: 24px 26px 48px; }
.cat-wrap h1 { font-size: 24px; color: var(--ink); margin: 0 0 6px; letter-spacing: -.015em; }
.cat-intro { color: var(--body); max-width: 70ch; margin: 0 0 22px; }
.cat-table { width: 100%; border-collapse: collapse; font-size: 13px;
             background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.cat-table th { text-align: left; font-size: 11px; letter-spacing: .06em;
                text-transform: uppercase; color: var(--muted); font-weight: 600;
                padding: 9px 10px; border-bottom: 1px solid var(--line); }
.cat-table td { padding: 10px; border-bottom: 1px solid #eef2f4; vertical-align: top; }
.cat-table tr:last-child td { border-bottom: 0; }
.cat-feature { font-weight: 600; color: var(--ink); }
.cat-note { color: var(--muted); font-size: 12px; margin-top: 3px; max-width: 46ch; }
.cat-safe { color: var(--up); font-size: 12px; margin-top: 3px; max-width: 46ch; }
.pill { display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: 11px;
        font-weight: 600; background: #eef3f4; color: var(--accent-d);
        border: 1px solid #d5e3e3; white-space: nowrap; }
.cat-id { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px;
          color: var(--muted); }

/* ---------------------------------------------------------------- narrow -- */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { min-height: 0; border-right: 0; border-bottom: 1px solid var(--line);
             display: flex; flex-wrap: wrap; gap: 4px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .grid  { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .search { order: 3; max-width: none; flex-basis: 100%; }
  .content { padding: 18px 16px 32px; }
}

@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .cat-table, .cat-table tbody, .cat-table tr, .cat-table td { display: block; width: 100%; }
  .cat-table thead { display: none; }
  .cat-table tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .cat-table td { border: 0; padding: 4px 10px; }
}
