:root {
  --primary: #204DA7;
  --primary-dark: #123575;
  --primary-soft: #eaf1ff;
  --text: #172033;
  --muted: #697386;
  --border: #e5e9f0;
  --background: #f5f7fb;
  --white: #ffffff;
  --shadow: 0 10px 30px rgba(22, 48, 91, 0.08);
  --radius: 18px;
  --nav-height: 76px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--background);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  position: relative;
  padding-bottom: var(--nav-height);
}

/* -----------------------------
   Header
----------------------------- */

.top-header {
  height: 86px;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: linear-gradient(145deg, var(--primary-dark), var(--primary));
}

.brand {
  text-align: center;
  line-height: 1;
}

.brand strong {
  display: block;
  font-size: 25px;
  letter-spacing: 0.5px;
}

.brand span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.9;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-size: 24px;
}

.icon-button:active {
  transform: scale(0.95);
}

.icon-button.dark {
  color: var(--text);
  background: var(--primary-soft);
  font-size: 18px;
}

/* -----------------------------
   Main
----------------------------- */

.main-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 26px 16px 30px;
}

.welcome-section {
  margin: 0 2px 20px;
}

.welcome-section h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.welcome-section h1 span {
  font-size: 23px;
}

.welcome-section p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.search-box {
  height: 58px;
  padding: 0 17px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--white);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.search-box i {
  color: #6f7b8f;
  font-size: 21px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 15px;
}

.search-box input::placeholder {
  color: #9aa3b1;
}

/* -----------------------------
   Tool list
----------------------------- */

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 3px 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
}

.section-heading span {
  color: var(--muted);
  font-size: 12px;
}

.tool-list {
  display: grid;
  gap: 8px;
}

.tool-card {
  min-height: 76px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 54px 1fr 22px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 3px 12px rgba(20, 35, 60, 0.035);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.tool-card:hover {
  transform: translateY(-1px);
  border-color: #d6deed;
  box-shadow: var(--shadow);
}

.tool-card:active {
  transform: scale(0.99);
}

.tool-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 21px;
}

.tool-icon.blue {
  background: #1677e8;
}

.tool-icon.green {
  background: #38c779;
}

.tool-icon.yellow {
  background: #f4ae16;
}

.tool-icon.orange {
  background: #ef7943;
}

.tool-icon.purple {
  background: #7957d5;
}

.tool-info {
  min-width: 0;
}

.tool-info strong {
  display: block;
  font-size: 15px;
  line-height: 1.25;
}

.tool-info small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-arrow {
  color: #8a94a4;
  font-size: 16px;
}

.empty-state {
  min-height: 180px;
  padding: 30px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  text-align: center;
  border: 1px dashed #ccd4e1;
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.empty-state i {
  margin-bottom: 4px;
  font-size: 30px;
  color: var(--primary);
}

.empty-state strong {
  color: var(--text);
}

/* -----------------------------
   Bottom navigation
----------------------------- */

.bottom-nav {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 7px 8px env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(22, 48, 91, 0.08);
  backdrop-filter: blur(14px);
}

.nav-item {
  min-width: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: #8a94a4;
  font-size: 11px;
  font-weight: 600;
}

.nav-item i {
  font-size: 21px;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active i {
  font-weight: 900;
}

/* -----------------------------
   Side menu
----------------------------- */

.menu-overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(4, 15, 35, 0.42);
  backdrop-filter: blur(2px);
}

.side-menu {
  position: fixed;
  z-index: 31;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(310px, 84vw);
  padding: 22px 18px;
  background: var(--white);
  box-shadow: 18px 0 50px rgba(0, 0, 0, 0.16);
  transform: translateX(-105%);
  transition: transform 0.22s ease;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu-header {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.side-menu-header strong,
.side-menu-header small {
  display: block;
}

.side-menu-header strong {
  color: var(--primary);
  font-size: 20px;
}

.side-menu-header small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
}

.side-menu-links {
  display: grid;
  gap: 5px;
  margin-top: 18px;
}

.side-menu-links a {
  padding: 14px 13px;
  display: flex;
  align-items: center;
  gap: 13px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 600;
}

.side-menu-links a:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.side-menu-links i {
  width: 22px;
  color: var(--primary);
  font-size: 18px;
}

/* -----------------------------
   Desktop
----------------------------- */

@media (min-width: 800px) {
  body {
    padding: 24px;
  }

  .app-shell {
    max-width: 720px;
    min-height: calc(100vh - 48px);
    margin: 0 auto;
    overflow: hidden;
    border-radius: 28px;
    background: var(--background);
    box-shadow: 0 20px 70px rgba(21, 44, 80, 0.14);
  }

  .top-header {
    border-radius: 28px 28px 0 0;
  }

  .bottom-nav {
    position: absolute;
    border-radius: 0 0 28px 28px;
  }
}

@media (max-width: 380px) {
  .top-header {
    grid-template-columns: 42px 1fr 42px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand strong {
    font-size: 21px;
  }

  .tool-card {
    grid-template-columns: 48px 1fr 18px;
  }

  .tool-icon {
    width: 42px;
    height: 42px;
  }
}
