/* =====================================================================
   Lion Power — Work Instruction Library
   Sidebar + cards layout, matched to the APM Warranty Admin skin:
   charcoal sidebar, amber accent, Montserrat, white content cards.
   Brand tokens mirror the warranty admin styles.css — keep in sync if
   the brand refreshes.
====================================================================== */

:root {
  --ink:        #111412;
  --ink-2:      #3A3F38;
  --ink-3:      #6B7069;
  --page-bg:    #EFEFEF;
  --off-white:  #F7F8F6;
  --section-bg: #F2F4F0;
  --white:      #FFFFFF;
  --border:     #E2E5DF;
  --border-dk:  #C8CCC5;
  --yellow:     #F0A500;
  --yellow-mid: #D99500;
  --yellow-lt:  #FEF6E0;
  --yellow-acc: #F0C040;
  --green:      #1F6A33;
  --green-lt:   #E7F8EC;
  --green-bd:   #A9DFB7;
  --amber:      #B86305;
  --amber-lt:   #FDF4E1;
  --amber-bd:   #F1D894;
  --red:        #C13E2C;
  --red-lt:     #FCEBE7;
  --red-bd:     #E5B6AC;

  --side-bg:     #111412;
  --side-text:   rgba(255, 255, 255, 0.62);
  --side-text-2: rgba(255, 255, 255, 0.40);
  --side-hover:  rgba(255, 255, 255, 0.06);
  --side-line:   rgba(255, 255, 255, 0.09);

  --font-sans: "Montserrat", system-ui, "Segoe UI", sans-serif;

  --radius-btn: 8px;
  --radius-card: 14px;
  --radius-input: 8px;

  --shadow-sm:   0 1px 2px rgba(17, 20, 18, 0.06);
  --shadow-card: 0 1px 2px rgba(17, 20, 18, 0.04), 0 6px 20px rgba(17, 20, 18, 0.05);
  --sidebar-w:   248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--section-bg);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--yellow-mid); text-decoration: none; }
a:hover { color: var(--ink); text-decoration: underline; }
h1, h2, h3 { color: var(--ink); margin: 0; }
.muted { color: var(--ink-3); font-size: 13px; }
.small { font-size: 12px; }

/* App shell ----------------------------------------------------------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--side-bg); color: var(--side-text);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--side-line);
}
.sb-brand { display: flex; flex-direction: column; gap: 5px; padding: 4px 8px 20px; }
.sb-brand-row { display: flex; align-items: center; gap: 11px; }
.sb-logo { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.sb-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sb-brand-name { font-size: 18px; font-weight: 700; color: var(--white); letter-spacing: 0.01em; line-height: 1; }
.sb-brand-name span { color: var(--yellow); }
.sb-brand-sub {
  display: block; font-size: 10.5px; font-weight: 600; color: var(--side-text-2);
  letter-spacing: 0.08em; text-transform: uppercase; padding-left: 45px;
}
.sb-navlabel { font-size: 10px; text-transform: uppercase; letter-spacing: 0.10em; color: var(--side-text-2); padding: 16px 10px 6px; font-weight: 700; }
.sb-nav {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 9px;
  color: var(--side-text); font-weight: 600; font-size: 13px; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sb-nav:hover { background: var(--side-hover); color: var(--white); text-decoration: none; }
.sb-nav svg { width: 17px; height: 17px; opacity: 0.9; flex: 0 0 auto; }
.sb-nav.active {
  background: linear-gradient(135deg, rgba(240, 165, 0, 0.22), rgba(240, 165, 0, 0.10));
  color: var(--white); box-shadow: inset 2px 0 0 var(--yellow);
}
.sb-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: var(--side-hover); }
.sb-foot .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--yellow), var(--yellow-mid));
  color: var(--ink); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex: 0 0 auto;
}
.sb-foot b { color: var(--white); font-weight: 600; font-size: 13px; display: block; }
.sb-foot small { color: var(--side-text-2); font-size: 11px; display: block; }

/* Main column --------------------------------------------------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 16px 30px;
  background: var(--white); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; }
.topbar .spacer { flex: 1; }
.content { padding: 26px 30px 80px; overflow: auto; }
.content-narrow { max-width: 1400px; }

/* Stat cards ---------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat-k { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 600; font-size: 12.5px; }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.stat-v { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin-top: 8px; line-height: 1; }
.stat-d { font-size: 12px; margin-top: 6px; color: var(--ink-3); font-weight: 500; }

/* Toolbar (search + filter) ------------------------------------------- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.search {
  flex: 1; min-width: 220px; font: inherit; font-size: 13px; color: var(--ink);
  padding: 9px 13px; border: 1px solid var(--border-dk); border-radius: var(--radius-input); background: var(--white);
}
.search:focus, .dash-filter:focus { outline: none; border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.18); }
.dash-filter { font: inherit; font-size: 13px; color: var(--ink); padding: 8px 12px; border: 1px solid var(--border-dk); border-radius: var(--radius-input); background: var(--white); }

/* Table card (one per category) --------------------------------------- */
.table-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); overflow: hidden; margin-bottom: 18px; }
.table-card-head { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.table-card-head h2 { font-size: 15px; font-weight: 700; }
.table-card-head .count { color: var(--ink-3); font-weight: 500; font-size: 12.5px; }

.wi-table { width: 100%; border-collapse: collapse; background: var(--white); }
.wi-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 700; padding: 11px 20px; background: var(--off-white); border-bottom: 1px solid var(--border);
}
.wi-table td { padding: 13px 20px; border-top: 1px solid var(--border); vertical-align: middle; }
.wi-table tbody tr:first-child td { border-top: 0; }
.wi-table tbody tr { transition: background 80ms; cursor: pointer; }
.wi-table tbody tr:hover { background: var(--yellow-lt); }
.wi-num { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.wi-title { font-weight: 600; color: var(--ink); }
.wi-sub { color: var(--ink-3); font-size: 12px; }

/* Folder management (table-card header actions) */
.folder-actions { display: flex; gap: 14px; }
.folder-act { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.folder-act:hover { color: var(--ink); text-decoration: none; }
.folder-empty { padding: 16px 20px; color: var(--ink-3); font-size: 13px; }

/* Status pills -------------------------------------------------------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
  background: var(--off-white); color: var(--ink-3); border: 1px solid var(--border);
}
.status-pill.s-draft    { background: var(--section-bg); color: var(--ink-3); border-color: var(--border-dk); }
.status-pill.s-inreview { background: var(--yellow-lt);  color: #7A4B00;      border-color: var(--yellow-acc); }
.status-pill.s-released { background: var(--green-lt);   color: var(--green); border-color: var(--green-bd); }
.status-pill.s-obsolete { background: var(--section-bg); color: var(--ink-3); border-color: var(--border-dk); text-decoration: line-through; }

/* Buttons ------------------------------------------------------------- */
.btn {
  font: inherit; font-weight: 600; letter-spacing: 0.01em; border-radius: var(--radius-btn);
  border: 1px solid transparent; padding: 10px 18px; cursor: pointer; background: var(--white); color: var(--ink);
  transition: background 120ms, border-color 120ms, transform 80ms, box-shadow 120ms; text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
}
.btn:active { transform: translateY(1px); }
.btn:hover:not(:disabled) { box-shadow: var(--shadow-card); text-decoration: none; }
.btn-primary { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.btn-primary:hover:not(:disabled) { background: var(--yellow-mid); border-color: var(--yellow-mid); color: var(--ink); }
.btn-closed { background: var(--white); color: var(--ink); border-color: var(--border-dk); }
.btn-closed:hover:not(:disabled) { background: var(--off-white); border-color: var(--ink-3); }

/* States -------------------------------------------------------------- */
.state-card {
  max-width: 720px; margin: 48px auto; padding: 24px 28px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card);
  text-align: center; color: var(--ink-3);
}
.state-card h2 { font-size: 18px; margin-bottom: 8px; }
.state-card.error { border-color: var(--red-bd); background: var(--red-lt); color: #7A2615; text-align: left; }

/* Responsive ---------------------------------------------------------- */
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); }
  .topbar, .content { padding-left: 18px; padding-right: 18px; }
  .wi-table th:nth-child(4), .wi-table td:nth-child(4) { display: none; }
}
