:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;

  --primary: #1e40af;
  --primary-dark: #1e3a8a;
  --primary-soft: #eff6ff;
  --primary-soft-2: #dbeafe;

  --success: #047857;
  --success-soft: #ecfdf5;
  --success-border: #a7f3d0;

  --sidebar: 272px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-hover:
    0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
a,
a:hover {
  text-decoration: none;
  color: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar);
  height: 100%;
  height: 100dvh;
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow: hidden;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1040;
  backdrop-filter: blur(2px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 26px;
}
.brand-logo-img,
.brand img {
  height: 38px;
  object-fit: contain;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.brand-name {
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
}
.brand-sub {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.menu-label {
  padding: 0 12px;
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

.menu-item {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: #334155;
  background: transparent;
  transition: 0.15s ease;
  text-align: left;
}
.menu-item:hover {
  background: var(--surface-soft);
  color: var(--text);
}
.menu-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent transparent transparent var(--primary);
  border-width: 1px 1px 1px 3px;
  padding-left: 10px;
  border-radius: 4px 8px 8px 4px;
}

.menu-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.menu-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2px;
}
.menu-item.active .menu-icon {
  color: var(--primary);
}

.menu-text {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
}
.menu-item.active .menu-text {
  font-weight: 600;
}
.menu-chevron {
  font-size: 14px;
  opacity: 0.4;
}
.menu-item.active .menu-chevron {
  opacity: 1;
  color: var(--primary);
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 18px;
}
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.login-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.login-btn svg {
  width: 18px;
  height: 18px;
}

/* MAIN */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar);
  flex: 1;
}
.content {
  padding: 32px 40px;
  width: 100%;
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.mobile-menu {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}
.mobile-menu svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

.main-heading {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--text);
}

.search-and-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.search-container {
  flex: 1;
}
.search {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  position: relative;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}
.search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.search-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 10px;
  color: var(--text);
  font-size: 13px;
  background: transparent;
}
.search input::placeholder {
  color: #94a3b8;
}
.shortcut-badge {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}
.stat-badge svg {
  width: 14px;
  height: 14px;
  color: var(--success);
}
.stat-badge.outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 36px 0 16px;
}
.section-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}
.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.view-controls {
  display: flex;
  gap: 6px;
}
.view-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.view-btn svg {
  width: 16px;
  height: 16px;
}
.view-btn:hover {
  background: var(--surface-soft);
}
.view-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-soft-2);
}
.view-btn.active svg {
  color: var(--primary);
}

#grid {
  margin-top: 0;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.07);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  border: none;
  padding: 0;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-icon-wrapper {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.app-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.app-title {
  margin: 0;
  color: #0f172a;
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.card-header-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex-shrink: 0;
}

.version-highlight {
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.updated-time {
  color: #64748b;
  font-size: 11.5px;
  margin-top: 2px;
  font-weight: 500;
  white-space: nowrap;
}

.card-desc-row {
  position: relative;
  margin: 20px 0 16px 0;
}

.card-desc {
  margin: 0;
  color: #475569;
  font-size: 14px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
}

.card-dots {
  color: #124bb7;
  font-weight: 800;
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
  position: absolute;
  bottom: 0;
  right: 0;
  background: #ffffff;
  padding-left: 6px;
  box-shadow: -15px 0 15px 5px #ffffff;
}
.card-dots:hover {
  color: #0e3b91;
  text-decoration: underline;
}

.card-divider {
  width: 100%;
  height: 1px;
  background: #e2e8f0;
  margin-bottom: 20px;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
  position: relative;
  z-index: 2;
}

.card-actions .btn {
  width: 100%;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer !important;
  font-size: 13px;
  font-weight: 700;
  border-radius: 50px !important;
  transition: all 0.2s ease;
  position: relative;
  z-index: 3;
  text-decoration: none;
  border: none;
  padding: 0 8px;
  white-space: nowrap;
}

.card-actions .btn-primary {
  background-color: #124bb7 !important;
  color: #ffffff !important;
  box-shadow: 0 2px 5px rgba(18, 75, 183, 0.25);
}

.card-actions .btn-primary:hover {
  background-color: #0e3b91 !important;
  box-shadow: 0 4px 14px rgba(18, 75, 183, 0.4);
  transform: translateY(-1px);
}

.card-actions .btn-secondary {
  background-color: transparent !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #475569 !important;
  box-shadow: none;
}

.card-actions .btn-secondary:hover {
  background-color: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

.card-actions .btn *,
.btn * {
  pointer-events: none;
}

.empty {
  display: none;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  margin-top: 16px;
  font-size: 13px;
}

@media (max-width: 1100px) {
  .search-and-stats {
    flex-direction: column;
    align-items: flex-start;
  }
  .search-container {
    width: 100%;
    flex: auto;
  }
}
@media (max-width: 768px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 85vw);
    transform: translateX(-100%);
    transition: 0.25s ease;
    box-shadow: 10px 0 24px rgba(0, 0, 0, 0.1);
    z-index: 1050;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-backdrop.active {
    display: block;
  }
  .main {
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }
  .content {
    padding: 28px 16px 32px;
    width: 100%;
  }
  .mobile-menu {
    display: inline-grid;
    place-items: center;
  }
  .page-heading {
    margin-top: 8px;
    margin-bottom: 20px;
  }
  .search-and-stats {
    row-gap: 6px !important;
  }
  .section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .card-header-meta {
    align-items: flex-start;
    text-align: left;
    margin-top: 2px;
  }
}

.app-footer {
  margin-top: auto;
  padding: 8px 16px;
  background: transparent;
  border-top: 1px solid var(--border);
  text-align: center;
  color: #64748b;
  font-size: 11px;
}
.app-footer p {
  margin: 2px 0;
  line-height: 1.4;
  letter-spacing: 0.02em;
}
/* Modal CSS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none !important;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}
.modal-overlay.active {
  display: flex !important;
}
.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  position: relative;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  padding: 32px;
  border: none;
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
  pointer-events: auto !important;
}
.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  cursor: pointer;
  z-index: 10;
}
.modal-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; padding: 0; border: none; }
.modal-icon { width: 56px; height: 56px; border-radius: 12px; background: var(--surface-soft); display: grid; place-items: center; }
.modal-icon svg, .modal-icon img { width: 32px; height: 32px; border-radius: 6px; }
.modal-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.modal-category { font-size: 13px; color: var(--primary); font-weight: 500; }
.modal-body {
  border-top: 1px solid var(--border);
  padding: 24px 0 0 0;
  max-height: 50vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.modal-desc { 
  font-size: 14px; 
  line-height: 1.6; 
  color: #475569; 
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: break-word;
}
