:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: rgba(255, 255, 255, .86);
  --surface-solid: #ffffff;
  --surface-soft: #f7f9fc;
  --text: #172033;
  --muted: #65728a;
  --line: rgba(23, 32, 51, .10);
  --shadow: 0 18px 55px rgba(28, 45, 80, .10);
  --brand: #2354d8;
  --brand-soft: #eaf0ff;
  --success: #0c9d72;
  --warning: #c47b0a;
  --danger: #bd3d4b;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --header-h: 78px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: rgba(19, 29, 48, .86);
  --surface-solid: #131d30;
  --surface-soft: #18243a;
  --text: #edf3ff;
  --muted: #9eabc1;
  --line: rgba(226, 235, 255, .10);
  --shadow: 0 20px 65px rgba(0, 0, 0, .30);
  --brand: #7ea2ff;
  --brand-soft: rgba(92, 133, 255, .15);
  --success: #53d8ad;
  --warning: #ffc568;
  --danger: #ff8b97;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(45, 96, 255, .12), transparent 26%),
    radial-gradient(circle at 96% 10%, rgba(0, 194, 168, .08), transparent 24%),
    var(--bg);
  color: var(--text);
  transition: background .25s ease, color .25s ease;
}

button, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--brand), #10bca9);
  color: white; font-weight: 900; letter-spacing: -.03em;
  box-shadow: 0 10px 28px rgba(35, 84, 216, .24);
}
.brand-copy { min-width: 0; }
.brand-title { font-weight: 820; font-size: 17px; letter-spacing: -.02em; }
.brand-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.actions { display: flex; align-items: center; gap: 9px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-solid);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.icon-btn:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 32%, var(--line)); }
.icon-btn img { width: 18px; height: 18px; filter: var(--icon-filter, none); }
html[data-theme="dark"] .icon-btn img { filter: invert(1) brightness(1.35); }

main { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 64px; flex: 1; }
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; align-items: end; margin-bottom: 34px; }
.eyebrow { color: var(--brand); font-weight: 800; text-transform: uppercase; letter-spacing: .16em; font-size: 11px; }
h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.04; letter-spacing: -.045em; margin: 10px 0 12px; }
.hero-copy { color: var(--muted); font-size: 15px; line-height: 1.7; max-width: 690px; margin: 0; }
.search-wrap { position: relative; align-self: end; }
.search-wrap img { position: absolute; left: 17px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); opacity: .62; }
html[data-theme="dark"] .search-wrap img { filter: invert(1); }
.search-wrap input {
  width: 100%; height: 52px; border-radius: 17px; border: 1px solid var(--line);
  background: var(--surface-solid); color: var(--text); outline: none;
  padding: 0 16px 0 46px; box-shadow: 0 8px 28px rgba(24, 42, 80, .05);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.search-wrap input:focus { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: 0 0 0 4px var(--brand-soft); }

.app-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.app-card {
  appearance: none; width: 100%; min-height: 214px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface-solid) 96%, transparent), var(--surface));
  box-shadow: 0 14px 40px rgba(27, 47, 89, .06);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  animation: cardIn .42s both;
}
.app-card::after {
  content: ""; position: absolute; inset: auto -40px -62px auto; width: 120px; height: 120px;
  border-radius: 50%; background: var(--brand-soft); opacity: .85; pointer-events: none;
}
.app-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 28%, var(--line)); }
.app-card:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 3px; }
.app-card.disabled { cursor: default; }
.app-card.disabled:hover { transform: translateY(-2px); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.app-icon {
  width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center;
  background: var(--brand-soft); position: relative; z-index: 1;
}
.app-icon img { width: 27px; height: 27px; filter: var(--app-icon-filter, none); }
html[data-theme="dark"] .app-icon img { filter: invert(1) brightness(1.3); }
.open-icon { width: 14px; height: 14px; opacity: .45; }
html[data-theme="dark"] .open-icon { filter: invert(1); }
.app-name { margin-top: 26px; font-weight: 850; font-size: 20px; letter-spacing: -.03em; }
.app-desc { margin-top: 7px; color: var(--muted); line-height: 1.45; font-size: 13px; min-height: 38px; }
.status { margin-top: auto; padding-top: 18px; display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 11%, transparent); }
.status.active { color: var(--success); }
.status.active::before { background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 11%, transparent); }
.empty-state { display: none; padding: 44px 20px; text-align: center; color: var(--muted); }

.footer { text-align: center; padding: 0 20px 30px; color: var(--muted); font-size: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 18px);
  padding: 12px 16px; border-radius: 13px; background: #111827; color: white;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .22s ease; z-index: 50;
  box-shadow: 0 12px 34px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes cardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1000px) { .app-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) {
  .topbar { padding-inline: 16px; }
  .brand-subtitle { display: none; }
  main { width: min(100% - 24px, 1180px); padding-top: 34px; }
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .app-card { min-height: 190px; padding: 18px; border-radius: 19px; }
  .app-icon { width: 52px; height: 52px; border-radius: 16px; }
  .app-name { margin-top: 22px; font-size: 18px; }
}
@media (max-width: 430px) {
  .app-grid { grid-template-columns: 1fr; }
  .app-card { min-height: 168px; }
  .actions { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
}
