/* sabahkk — launcher · flat, professional design system */
:root,
:root[data-theme="dark"] {
  --bg: #0a0a0b;
  --surface: #141416;
  --surface-2: #1b1b1f;
  --inset: #0e0e10;
  --border: #27272a;
  --border-strong: #3f3f46;
  --text: #fafafa;
  --muted: #a1a1aa;
  --accent: #4f46e5;        /* fills */
  --accent-ink: #818cf8;    /* accent text on dark bg */
  --accent-text: #ffffff;   /* text on accent fills */
  --good: #4ade80;
  --bad: #f87171;
  --warn: #fbbf24;
  --track: #26262b;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --inset: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --muted: #71717a;
  --accent: #4f46e5;
  --accent-ink: #4338ca;
  --accent-text: #ffffff;
  --good: #16a34a;
  --bad: #dc2626;
  --warn: #d97706;
  --track: #e4e4e7;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px clamp(18px, 5vw, 56px) 6px;
  gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  font-size: 1.5rem; line-height: 1;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 10px 12px;
}
.brand h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.tagline { color: var(--muted); font-size: 0.86rem; }

.actions { display: flex; align-items: center; gap: 10px; }
.clock {
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 9px 15px; border-radius: 10px;
  /* hidden until the client mounts it: no "--:--" flash, no layout shift */
  visibility: hidden; min-width: 5.4em;
}
.clock.ready { visibility: visible; }

/* theme toggle (shared w/ apps) */
.theme-btn {
  width: 40px; height: 40px; padding: 0;
  display: inline-grid; place-items: center;
  font-size: 1.05rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.theme-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

/* ---------- toolbar ---------- */
main {
  flex: 1; width: 100%; max-width: 1240px; margin: 0 auto;
  padding: 16px clamp(18px, 5vw, 56px) 44px;
  /* min-width:0 — as a flex item the automatic minimum size would let the
     scrollable pill row stretch the page on narrow screens */
  min-width: 0;
}
.toolbar {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; margin-bottom: 16px;
}
/* the one search launcher — opens the command palette (/ or ⌘K) */
.search-launcher {
  width: min(560px, 100%);
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-family: inherit; font-size: 0.95rem;
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-launcher:hover { border-color: var(--border-strong); background: var(--surface-2); }
.search-launcher:focus-visible {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.search-ico {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round;
}
.search-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-keys { display: inline-flex; gap: 4px; flex: none; }
.toolbar-meta { display: flex; align-items: center; gap: 10px; min-height: 1.2em; }
.count { color: var(--muted); font-size: 0.85rem; }
.clear-btn {
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  color: var(--muted); background: transparent;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 11px; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.clear-btn:hover { border-color: var(--border-strong); color: var(--text); }

/* category pills */
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.pill {
  font-family: inherit; font-size: 0.84rem; font-weight: 600;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 16px; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.pill:hover { border-color: var(--border-strong); color: var(--text); }
/* ---------- grid & app cards ---------- */
/* the grid columns come from Tailwind (auto-fill / minmax(280px,1fr)) in dash.css */
.app-card {
  display: flex; flex-direction: column; gap: 9px;
  color: var(--text); text-decoration: none;
  /* "backwards" (not "both"): if animations are disabled the cards stay visible */
  animation: rise .4s ease backwards;
}
.app-icon { flex: none; align-self: flex-start; }
.app-icon svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.app-title {
  margin-top: 3px;
  font-size: 1rem; font-weight: 650; letter-spacing: -0.01em;
  transition: color .15s;
}
.app-desc { color: var(--muted); font-size: 0.86rem; line-height: 1.5; flex: 1; }
.app-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 4px;
}
.app-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  background: var(--inset); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 999px;
}
.app-chip svg {
  width: 12px; height: 12px;
  fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
}
/* favorite / pin toggle */
.fav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  position: relative; z-index: 2;
  color: var(--muted); background: transparent;
  border: 1px solid transparent; border-radius: 9px;
  cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.fav-btn svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.fav-btn:hover { color: #f59e0b; background: var(--inset); border-color: var(--border); }
.fav-btn[aria-pressed="true"] { color: #f59e0b; }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }
.fav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* the whole card is the click target */
.app-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.app-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-card:hover .app-title { color: var(--accent-ink); }

.empty { color: var(--muted); text-align: center; padding: 44px 0; font-size: 0.92rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.app-card:nth-child(odd)  { animation-delay: .03s; }
.app-card:nth-child(even) { animation-delay: .07s; }

/* ---------- footer ---------- */
footer {
  padding: 16px clamp(18px, 5vw, 56px) 24px;
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.82rem;
}
footer a { color: var(--accent-ink); text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .toolbar { gap: 10px; }
  .search-launcher { width: 100%; }
  .pills { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .pill { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.pill.sel {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-text);
}
/* ---------- sectioned layout (28 apps) ---------- */
.sec { margin-bottom: 30px; }
.sec-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 14px;
}
.sec-head h2 {
  font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em;
}
.sec-head .sec-n { color: var(--muted); font-size: 0.8rem; }
.sec-head::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
  align-self: center;
}

/* recently opened */
.recent { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; align-items: center; }
.recent .lbl {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin-right: 4px;
}
.recent-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px 6px 10px;
  font-size: 0.84rem; font-weight: 600; color: var(--text);
  text-decoration: none; transition: border-color .15s, background .15s;
}
.recent-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.recent-chip .ico {
  width: 15px; height: 15px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* hero stat row */
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 4px; }
.stats span { color: var(--muted); font-size: 0.84rem; }
.stats b { color: var(--text); font-weight: 700; }

/* ---------- command palette (⌘K) ---------- */
.palette-wrap {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 16px 16px;
}
.palette-wrap[hidden] { display: none; }
.palette {
  width: min(560px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  overflow: hidden;
  animation: palIn .14s ease both;
}
@keyframes palIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.palette input {
  width: 100%; border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; background: transparent; padding: 16px 18px;
  font-size: 1rem; color: var(--text); outline: none;
}
.palette input:focus { box-shadow: none; border-color: var(--border); border-bottom-color: var(--accent); }
.pal-list { max-height: 320px; overflow-y: auto; padding: 8px; }
.pal-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px; cursor: pointer;
  font-size: 0.92rem; color: var(--text);
}
.pal-item .ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.pal-item .sub { margin-left: auto; color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: .05em; }
.pal-item.sel { background: var(--accent); color: var(--accent-text); }
.pal-item.sel .sub { color: color-mix(in srgb, var(--accent-text) 75%, transparent); }
.pal-empty { padding: 22px; text-align: center; color: var(--muted); font-size: .88rem; }
.pal-hint {
  border-top: 1px solid var(--border); padding: 9px 14px;
  color: var(--muted); font-size: 0.74rem;
  display: flex; gap: 14px;
}
kbd {
  font-family: inherit; background: var(--inset); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 6px; font-size: 0.7rem; color: var(--text);
}
