:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #1c2533;
  --muted: #667085;
  --line: #d9e0ea;
  --brand: #1864ab;
  --brand-dark: #123f75;
  --green: #0f766e;
  --orange: #b45309;
  --shadow: 0 14px 36px rgba(32, 45, 70, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(245, 247, 251, 0.3)),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.top-bar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 14px;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(32px, 6vw, 54px);
  line-height: 1.02;
  letter-spacing: 0;
}

.tool-count {
  flex: 0 0 auto;
  min-width: 96px;
  padding: 10px 12px;
  color: var(--brand-dark);
  background: #eaf3ff;
  border: 1px solid #c9def5;
  border-radius: 8px;
  text-align: center;
  font-weight: 700;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.data-alert {
  margin-bottom: 20px;
  padding: 14px 16px;
  color: #7c2d12;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
}

.data-alert strong {
  display: block;
  margin-bottom: 4px;
}

.data-alert p {
  margin-bottom: 0;
  line-height: 1.6;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.search-icon::after {
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 7px;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
  content: "";
  transform: rotate(45deg);
}

.search-box input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px 0 40px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(24, 100, 171, 0.14);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tab-button {
  min-height: 42px;
  padding: 0 14px;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.tab-button:hover {
  color: var(--brand-dark);
  border-color: #b7cbe4;
}

.tab-button.active {
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.tools-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.featured-section,
.recent-section,
.tool-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.section-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.clear-recent-button {
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.clear-recent-button:hover {
  color: var(--green);
  border-color: #b7d7d2;
}

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

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

.quick-link {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 68px;
  padding: 10px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(32, 45, 70, 0.06);
  text-decoration: none;
}

.recent-section .quick-link {
  border-color: #cde3df;
}

.recent-section .quick-mark {
  background: var(--green);
}

.quick-link:hover {
  border-color: #b7cbe4;
  box-shadow: 0 10px 24px rgba(32, 45, 70, 0.09);
}

.quick-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  background: var(--brand);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
}

.quick-link strong,
.quick-link small {
  display: block;
}

.quick-link strong {
  margin-bottom: 4px;
  line-height: 1.25;
}

.quick-link small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tool-card {
  display: flex;
  min-height: 236px;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(32, 45, 70, 0.07);
  text-decoration: none;
}

.tool-card:hover {
  border-color: #b7cbe4;
  box-shadow: 0 14px 30px rgba(32, 45, 70, 0.11);
}

.card-head {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
}

.service-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  background: linear-gradient(135deg, var(--green), var(--brand));
  border-radius: 8px;
  font-weight: 800;
}

.service-mark img,
.quick-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mark-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.category-name {
  margin-bottom: 4px;
  color: var(--orange);
  font-size: 13px;
  font-weight: 800;
}

.tool-card h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.24;
  letter-spacing: 0;
}

.description {
  min-height: 48px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tag {
  padding: 5px 8px;
  color: #334155;
  background: #eef2f7;
  border: 1px solid #e0e6ee;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.open-link {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffffff;
  background: var(--brand-dark);
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.open-link:hover {
  background: var(--brand);
}

.empty-state {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.empty-state h2 {
  margin-bottom: 8px;
  font-size: 20px;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

.hidden {
  display: none;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1120px);
    padding-top: 22px;
  }

  .top-bar,
  .control-panel {
    grid-template-columns: 1fr;
  }

  .top-bar {
    align-items: stretch;
  }

  .tool-count {
    width: 100%;
  }

  .category-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  }

  .tab-button {
    padding: 0 8px;
  }
}
