/* ============================================================
   2Serviceweb — design tokens & base styles
   Type: IBM Plex Sans + IBM Plex Mono
   Color: trustworthy blue, cool neutrals
   ============================================================ */

:root {
  /* Blue ramp (oklch) */
  --blue-800: oklch(0.34 0.10 250);
  --blue-700: oklch(0.42 0.13 252);
  --blue-600: oklch(0.50 0.15 253);
  --blue-500: oklch(0.58 0.15 254);
  --blue-300: oklch(0.78 0.09 254);
  --blue-100: oklch(0.93 0.035 254);
  --blue-50:  oklch(0.972 0.014 254);

  /* Cool neutrals */
  --ink:        oklch(0.26 0.018 258);
  --ink-soft:   oklch(0.45 0.016 258);
  --ink-faint:  oklch(0.60 0.012 258);
  --ink-ghost:  oklch(0.72 0.010 258);
  --line:       oklch(0.915 0.006 258);
  --line-soft:  oklch(0.955 0.004 258);
  --bg:         oklch(0.975 0.004 258);
  --bg-deep:    oklch(0.955 0.006 258);
  --surface:    #ffffff;

  /* Status (kept low-saturation, shared chroma family) */
  --ok:    oklch(0.60 0.12 155);
  --ok-bg: oklch(0.95 0.04 155);
  --warn:    oklch(0.72 0.12 70);
  --warn-bg: oklch(0.96 0.05 80);
  --alert:    oklch(0.58 0.16 25);
  --alert-bg: oklch(0.955 0.035 25);

  /* Radii */
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Shadow */
  --sh-1: 0 1px 2px rgba(20,35,70,.06), 0 1px 3px rgba(20,35,70,.05);
  --sh-2: 0 2px 4px rgba(20,35,70,.06), 0 6px 16px rgba(20,35,70,.07);
  --sh-3: 0 8px 24px rgba(20,35,70,.10), 0 24px 48px rgba(20,35,70,.10);
  --sh-focus: 0 0 0 3px oklch(0.58 0.15 254 / 0.22);

  --topbar-h: 60px;
  --side-w: 256px;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}

#root { height: 100%; }

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

::selection { background: var(--blue-100); }

/* Scrollbars */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb {
  background: oklch(0.85 0.01 258);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.012 258); background-clip: padding-box; border: 3px solid transparent; }

/* mono label */
.mono-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

/* ============================================================
   App shell
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "topbar topbar"
    "side   main";
  height: 100%;
  overflow: hidden;
}

/* Topbar */
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  width: calc(var(--side-w) - 20px);
  flex-shrink: 0;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(150deg, var(--blue-500), var(--blue-700));
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: var(--sh-1);
}
.brand-name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.brand-name b { color: var(--blue-600); font-weight: 700; }

.topbar-search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 12px;
  background: var(--bg-deep);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--ink-faint);
  transition: .15s;
}
.topbar-search:hover { background: oklch(0.94 0.006 258); }
.topbar-search .ph { flex: 1; text-align: left; font-size: 14px; }
.topbar-search kbd {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 5px; padding: 2px 6px; color: var(--ink-faint);
  box-shadow: 0 1px 0 var(--line);
}

.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px; border-radius: 9px;
  border: none; background: transparent; color: var(--ink-soft);
  display: grid; place-items: center; transition: .14s;
}
.icon-btn:hover { background: var(--bg-deep); color: var(--ink); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--alert); border: 2px solid var(--surface);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px; color: #fff;
  flex-shrink: 0; user-select: none;
}
.topbar .avatar { margin-left: 6px; cursor: pointer; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); }

/* Sidebar */
.sidebar {
  grid-area: side;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow-y: auto;
  z-index: 30;
}
.side-scroll { flex: 1; padding: 14px 12px; overflow-y: auto; }
.side-section { margin-bottom: 18px; }
.side-section-label { padding: 4px 10px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--r-sm);
  border: none; background: transparent;
  color: var(--ink-soft); font-size: 14px; font-weight: 500;
  transition: .13s; position: relative;
}
.nav-item:hover { background: var(--bg-deep); color: var(--ink); }
.nav-item.active { background: var(--blue-50); color: var(--blue-700); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--blue-600);
}
.nav-item .nav-ic { color: currentColor; flex-shrink: 0; opacity: .85; }
.nav-item .ni-label { flex: 1; min-width: 0; }
.nav-item .cat-dot { flex-shrink: 0; }
.nav-item.active .nav-ic { opacity: 1; }
.nav-item .nav-count {
  margin-left: auto; flex-shrink: 0; font-family: var(--font-mono); font-size: 11px;
  background: var(--bg-deep); color: var(--ink-faint);
  padding: 1px 7px; border-radius: 99px; font-weight: 500;
}
.nav-item.active .nav-count { background: var(--blue-100); color: var(--blue-700); }

.side-foot {
  border-top: 1px solid var(--line); padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
}
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who .nm { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who .rl { font-size: 12px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main */
.main { grid-area: main; overflow-y: auto; overflow-x: hidden; }
.main-inner { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }

/* mobile chrome */
.mobile-topbar { display: none; }
.scrim { display: none; }

/* ============================================================
   Generic UI bits
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; border: 1px solid transparent;
  transition: .14s; white-space: nowrap;
}
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-deep); border-color: var(--ink-ghost); }
.btn-subtle { background: var(--bg-deep); color: var(--ink-soft); }
.btn-subtle:hover { background: oklch(0.93 0.006 258); color: var(--ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 13px; border-radius: 99px;
  font-size: 13px; font-weight: 500; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); transition: .13s;
}
.chip:hover { border-color: var(--ink-ghost); color: var(--ink); }
.chip.on { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  font-family: var(--font-mono); letter-spacing: .01em;
}
.badge-new   { background: var(--blue-100); color: var(--blue-700); }
.badge-ok    { background: var(--ok-bg); color: var(--ok); }
.badge-warn  { background: var(--warn-bg); color: oklch(0.50 0.10 65); }
.badge-alert { background: var(--alert-bg); color: var(--alert); }
.badge-soft  { background: var(--bg-deep); color: var(--ink-faint); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
/* Padding-utility: een kale .card heeft bewust geen padding (panels bepalen dat zelf). */
.card-pad { padding: 22px 24px; }

.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 0 0 14px;
}
.section-head h2 { font-size: 16px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.section-head .more {
  margin-left: auto; font-size: 13px; font-weight: 600; color: var(--blue-600);
  background: none; border: none; display: inline-flex; align-items: center; gap: 4px;
}
.section-head .more:hover { color: var(--blue-700); }

/* tool icon tile */
.tool-ic {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; flex-shrink: 0;
}

/* page header (inside tool screens) */
.page-head { margin-bottom: 22px; }
.crumbs { display: flex; align-items: center; gap: 7px; margin-bottom: 12px; font-size: 13px; color: var(--ink-faint); }
.crumbs button { background: none; border: none; color: var(--ink-faint); font-size: 13px; padding: 0; }
.crumbs button:hover { color: var(--blue-600); }
.crumbs .sep { color: var(--ink-ghost); }
.page-title-row { display: flex; align-items: flex-start; gap: 16px; }
.page-title-row h1 { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.page-title-row p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14.5px; max-width: 60ch; }
.page-head-actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }

/* empty / placeholder canvas */
.tool-canvas {
  background:
    repeating-linear-gradient(135deg, transparent, transparent 9px, oklch(0.95 0.006 258) 9px, oklch(0.95 0.006 258) 10px),
    var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  min-height: 280px;
  display: grid; place-items: center; text-align: center; padding: 40px;
}
.tool-canvas .pc { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); }

.anim-in { animation: fadeUp .42s cubic-bezier(.2,.7,.3,1); }
@keyframes fadeUp { from { transform: translateY(7px); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .anim-in { animation: none; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .topbar { display: none; }
  .mobile-topbar {
    grid-area: topbar;
    display: flex; align-items: center; gap: 12px;
    padding: 0 14px; background: var(--surface);
    border-bottom: 1px solid var(--line); z-index: 40;
  }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 290px;
    transform: translateX(-102%); transition: transform .26s cubic-bezier(.2,.7,.3,1);
    box-shadow: var(--sh-3);
  }
  .sidebar.open { transform: none; }
  .scrim {
    display: block; position: fixed; inset: 0; background: rgba(15,25,50,.34);
    opacity: 0; pointer-events: none; transition: opacity .26s; z-index: 35;
  }
  .scrim.show { opacity: 1; pointer-events: auto; }
  .main-inner { padding: 20px 16px 80px; }
  .page-title-row { flex-wrap: wrap; }
  .page-head-actions { margin-left: 0; width: 100%; }
}
