* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Nav header ── */
.site-header {
  background: #16213e;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 56px;
}

.site-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

.site-logo:hover {
  color: #a8dadc;
}

.site-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}

.nav-item {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #a8b2c8;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active {
  color: #fff;
  background: #0f3460;
}

.admin-link {
  text-decoration: none;
  flex-shrink: 0;
}

.nav-user {
  color: #a8dadc;
  font-size: 0.8rem;
}

/* ── Layout ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #16213e;
  margin-bottom: 6px;
}

.page-subtitle {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ── Tool cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.tool-card-wrap {
  position: relative;
  height: 168px;
  z-index: 1;
}

.tool-card-wrap:hover {
  z-index: 5;
}

.tool-card-wrap.is-dragging {
  opacity: 0.45;
}

.tool-card-wrap.is-drag-over .tool-card {
  border-color: #0f3460;
  box-shadow: 0 0 0 2px rgba(15, 52, 96, 0.2);
}

.tool-card-wrap.is-pinned .tool-card {
  border-color: #a8dadc;
  background: linear-gradient(180deg, #f4fafc 0%, #fff 48%);
}

.tool-card-drag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: #8b949e;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: color 0.15s, background 0.15s;
}

.tool-card-drag:hover {
  color: #0f3460;
  background: #e8f4f8;
}

.tool-card-drag:active {
  cursor: grabbing;
}

.tool-card-pin {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #8b949e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: color 0.15s, background 0.15s, transform 0.15s;
}

.tool-card-pin:hover {
  color: #0f3460;
  background: #e8f4f8;
  transform: scale(1.05);
}

.tool-card-pin.pinned {
  color: #0f3460;
  background: #e8f4f8;
}

.tool-card-pin-icon {
  fill: currentColor;
}

.tool-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  padding-left: 36px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  border-color: #a8dadc;
}

.tool-card-icon {
  width: 40px;
  height: 40px;
  background: #e8f4f8;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f3460;
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
}

.tool-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: #16213e;
  flex-shrink: 0;
}

.tool-card-desc-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.tool-card-desc {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.tool-card-desc-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 30;
  min-width: 100%;
  max-width: 280px;
  padding: 8px 10px;
  background: #16213e;
  color: #e8f4f8;
  font-size: 0.8rem;
  line-height: 1.5;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  word-wrap: break-word;
}

.tool-card-desc-wrap:not(.no-tooltip):hover .tool-card-desc-tooltip {
  opacity: 1;
  visibility: visible;
}

.tool-card-tag {
  font-size: 0.75rem;
  color: #0f3460;
  background: #e8f4f8;
  padding: 2px 8px;
  border-radius: 4px;
  align-self: flex-start;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #999;
  font-size: 0.9rem;
}

.site-footer {
  text-align: center;
  color: #999;
  font-size: 0.8rem;
  padding: 24px 20px;
}

/* ── Shared buttons ── */
.btn-primary {
  background: #0f3460;
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #16213e;
}

.btn-link {
  background: none;
  border: none;
  color: #a8dadc;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
}

.btn-link:hover {
  color: #fff;
}

.error {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fff5f5;
  border: 1px solid #feb2b2;
  border-radius: 6px;
  color: #c53030;
  font-size: 0.875rem;
}
