:root {
  --bg: #14161a;
  --panel: #1d2026;
  --panel-2: #262a31;
  --fg: #e9ecf1;
  --muted: #9aa3af;
  --accent: #5dadec;
  --radius: 10px;
  --left-w: 240px;
  --right-w: 290px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.4;
}

.layout {
  display: grid;
  grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w);
  align-items: start;
  gap: 0;
  max-width: 1500px;
  margin: 0 auto;
}

/* --- Sidebars (sticky, full height) --- */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 16px;
  background: var(--panel);
}
.sidebar-left { border-right: 1px solid #2c313a; }
.sidebar-right { border-left: 1px solid #2c313a; }

.brand h1 { margin: 0; font-size: 20px; letter-spacing: 0.3px; }
.brand .tagline { margin: 2px 0 16px; color: var(--muted); font-size: 12px; }

/* --- Library list --- */
.library-list { display: flex; flex-direction: column; gap: 2px; }
.lib-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--fg);
  border: 0;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 14px;
  cursor: pointer;
}
.lib-item:hover { background: var(--panel-2); }
.lib-item.active { background: var(--accent); color: #0d1116; font-weight: 600; }
.lib-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 6px;
  background: #5a3a1a;
  color: #f0c79a;
  vertical-align: middle;
}
.lib-item.active .lib-badge { background: rgba(0,0,0,0.25); color: #2a1c0a; }
.lib-item .lib-count { font-size: 11px; opacity: 0.7; }
.lib-item.active .lib-count { opacity: 0.85; }
.lib-sep { height: 1px; background: #2c313a; margin: 6px 4px; }

/* --- Center content --- */
.content { padding: 16px 20px 40px; min-width: 0; }

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  margin-bottom: 4px;
  background: linear-gradient(var(--bg) 78%, rgba(20,22,26,0));
}
.toolbar input,
.toolbar select {
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid #353b45;
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 14px;
}
.toolbar input { flex: 1 1 auto; min-width: 0; }
.toolbar select { flex: 0 0 auto; }
.toolbar input:focus,
.toolbar select:focus { outline: 2px solid var(--accent); outline-offset: 0; }

.status { margin: 0 0 14px; color: var(--muted); font-size: 12px; min-height: 1em; }

.group { margin-bottom: 26px; }
.group h2 {
  font-size: 15px;
  margin: 0 0 10px;
  color: var(--fg);
  border-left: 3px solid var(--accent);
  padding-left: 8px;
}
.group .count { color: var(--muted); font-weight: normal; font-size: 12px; margin-left: 6px; }

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

.swatch {
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
}
.swatch .code { font-weight: 700; font-size: 13px; }
.swatch .name { font-size: 12px; opacity: 0.92; }
.swatch .meta { font-size: 10px; opacity: 0.7; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.4px; }
.swatch .hex { font-size: 10px; opacity: 0.7; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

.empty { color: var(--muted); padding: 40px 0; text-align: center; }

footer { padding: 24px 0 0; color: var(--muted); font-size: 12px; border-top: 1px solid #2c313a; margin-top: 24px; }

/* --- App promo (right) --- */
.promo { display: flex; flex-direction: column; gap: 10px; }
.promo-icon { width: 72px; height: 72px; border-radius: 16px; display: block; }
.promo h2 { margin: 2px 0 0; font-size: 18px; }
.promo-lead { margin: 0; color: var(--accent); font-weight: 600; font-size: 14px; }
.promo-features { margin: 6px 0 8px; padding-left: 18px; color: var(--muted); font-size: 12.5px; }
.promo-features li { margin-bottom: 6px; }
.promo-features strong { color: var(--fg); }

.store-btn {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--fg);
  background: var(--panel-2);
  border: 1px solid #353b45;
  border-radius: var(--radius);
  padding: 8px 14px;
}
.store-btn:hover { border-color: var(--accent); }
.store-btn .store-sub { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.store-btn .store-name { font-size: 16px; font-weight: 600; }

/* --- Responsive: stack columns --- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border: 0;
    border-bottom: 1px solid #2c313a;
  }
  .library-list { flex-direction: row; flex-wrap: wrap; }
  .lib-item { width: auto; }
  .lib-item .lib-count { display: none; }
  .lib-sep { display: none; }
  .sidebar-right { order: 3; }
  .promo { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .promo-features { display: none; }
  .store-btn { flex: 0 0 auto; }
}
