* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; background: #0f1219; color: #e8e8e8; min-height: 100vh; }
.app { max-width: 1400px; margin: 0 auto; padding: 20px; }
header { text-align: center; margin-bottom: 24px; }
header h1 { font-size: 1.6rem; color: #fff; }
header p { color: #888; font-size: 0.9rem; margin-top: 4px; }

.panel { background: #1a1f2e; border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.panel h2 { font-size: 1.1rem; margin-bottom: 14px; color: #ccc; }
.hidden { display: none; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: #999; }
.form-grid input,
.form-grid select { padding: 8px 12px; border-radius: 6px; border: 1px solid #333; background: #252b3b; color: #fff; font-size: 0.9rem; }
.form-grid input:focus,
.form-grid select:focus { outline: none; border-color: #4a6cf7; }

.btn-primary { background: #4a6cf7; color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: #5b7df8; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-success { background: #22c55e; color: #fff; border: none; padding: 10px 20px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.btn-success:hover { background: #16a34a; }
.btn-success:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { background: #333; color: #ccc; border: none; padding: 6px 12px; border-radius: 5px; font-size: 0.75rem; cursor: pointer; }
.btn-sm:hover { background: #444; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.badge { background: #4a6cf7; color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 0.75rem; }
.status { margin-top: 10px; font-size: 0.85rem; color: #888; }
.status.error { color: #f87171; }
.status.success { color: #4ade80; }

.categories-grid { display: flex; flex-direction: column; gap: 20px; }
.category-section { border: 1px solid #2a2f3e; border-radius: 10px; padding: 14px; }
.category-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.category-header h3 { font-size: 0.95rem; color: #ddd; }
.category-header .cat-count { font-size: 0.75rem; color: #888; }

.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.item-card { position: relative; border-radius: 8px; overflow: hidden; border: 2px solid transparent; cursor: pointer; transition: all 0.15s; background: #252b3b; }
.item-card:hover { border-color: #4a6cf7; transform: translateY(-2px); }
.item-card.selected { border-color: #4ade80; box-shadow: 0 0 12px rgba(74, 222, 128, 0.3); }
.item-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #1a1f2e; }
.item-card .item-name { padding: 6px 8px; font-size: 0.72rem; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-card .check-mark { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; background: #4ade80; border-radius: 50%; display: none; align-items: center; justify-content: center; font-size: 12px; color: #000; font-weight: bold; }
.item-card.selected .check-mark { display: flex; }

.btn-row { display: flex; gap: 10px; align-items: center; }
.auth-row { display: flex; align-items: center; gap: 12px; }
.btn-login { background: #6366f1; color: #fff; border: none; padding: 10px 18px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.btn-login:hover { background: #4f46e5; }
.btn-login.logged-in { background: #22c55e; cursor: default; }
.user-info { font-size: 0.85rem; color: #4ade80; }
.user-info.hidden { display: none; }
.action-buttons { display: flex; gap: 10px; margin-bottom: 14px; }
.log-output { background: #111; border-radius: 8px; padding: 12px; font-size: 0.8rem; color: #aaa; max-height: 300px; overflow-y: auto; white-space: pre-wrap; font-family: 'SF Mono', Monaco, monospace; }

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .items-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
