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

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --border: #e5e5e2;
  --text: #1a1a1a;
  --text-muted: #888880;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.10);
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.logo {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text);
}

.header-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

/* Main */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}

.search {
  flex: 1;
  max-width: 360px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.search:focus {
  border-color: var(--accent);
}

.search::placeholder {
  color: var(--text-muted);
}

.count {
  font-size: 13px;
  color: var(--text-muted);
}

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

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  user-select: none;
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

.card-filename {
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, 'SF Mono', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 4px;
}

/* Empty / Loading */
.empty, .loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 80px 24px;
  color: var(--text-muted);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 600px) {
  .main {
    padding: 24px 16px 48px;
  }

  .modal {
    inset: 0;
    border-radius: 0;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}
