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

:root {
  --bg: #000000;
  --bg-raised: #0a0a0a;
  --bg-subtle: #111111;
  --bg-hover: #1a1a1a;
  --text: #fafafa;
  --text-secondary: #a0a0a0;
  --text-muted: #c4c4c4;
  --accent: #d4a574;
  --accent-hover: #e0b68a;
  --danger: #ff6b6b;
  --success: #6bcb77;
  --warning: #ffd93d;
  --info: #6b9fff;
  --border: #1a1a1a;
  --shadow: rgba(0, 0, 0, 0.4);
  --danger-bg: rgba(255, 107, 107, 0.12);
  --font: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-raised: #f8f8f8;
  --bg-subtle: #f0f0f0;
  --bg-hover: #e8e8e8;
  --text: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --accent: #b08860;
  --accent-hover: #9a7550;
  --danger: #dc3545;
  --success: #28a745;
  --warning: #e6a817;
  --info: #0d6efd;
  --border: #e0e0e0;
  --shadow: rgba(0, 0, 0, 0.1);
  --danger-bg: rgba(220, 53, 69, 0.1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.header-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge {
  font-size: 0.625rem;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  background: var(--warning);
  color: var(--bg);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.15s var(--ease);
}

.btn-icon:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

/* Navigation */
.nav {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--bg);
  padding: 0 2rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.nav-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 400;
  padding: 1rem 1.25rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s var(--ease);
  letter-spacing: 0.01em;
}

.nav-tab:hover {
  color: var(--text-secondary);
}

.nav-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Main */
.main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  margin-bottom: 3rem;
}

.stat {
  background: var(--bg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stat-danger {
  color: var(--danger);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

/* Section Head */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-head h2 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.section-actions {
  display: flex;
  gap: 0.625rem;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
  font-family: var(--font);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-subtle);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: var(--bg);
}

.btn-danger:hover {
  opacity: 0.9;
}

/* Select */
.select {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.875rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: var(--font);
}

.select:focus {
  outline: none;
  border-color: var(--accent);
}

/* List */
.list {
  display: flex;
  flex-direction: column;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.list-item:has(.list-item-checkbox) {
  grid-template-columns: auto 1fr auto auto;
  gap: 0.75rem 1rem;
}

.list-item:first-child {
  padding-top: 0;
}

.list-item:hover {
  padding-left: 0.75rem;
}

.list-item-main {
  min-width: 0;
}

.list-item-title {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 500;
  font-size: 0.9375rem;
}

.list-item-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  font-family: var(--mono);
}

.list-item-amount {
  font-weight: 600;
  font-family: var(--mono);
  font-size: 0.9375rem;
  text-align: right;
}

.list-item-actions {
  display: flex;
  gap: 0.25rem;
}

/* Status Dot */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-draft .status-dot {
  background: var(--info);
}

.status-sent .status-dot {
  background: var(--warning);
}

.status-paid .status-dot {
  background: var(--success);
}

.status-overdue .status-dot {
  background: var(--danger);
}

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

.card {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
}

.card.card:nth-child(3n) {
  border-right: none;
}

.card:hover {
  background: var(--bg-raised);
}

.card-delete {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.375rem;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s var(--ease);
}

.card:hover .card-delete {
  opacity: 1;
}

.card-delete:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-header-text {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-weight: 500;
  font-size: 0.9375rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.125rem;
}

.card-details {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.card-detail {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-detail svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-stat {
  font-family: var(--mono);
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-amount {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.card-amount-badge {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.card-items-preview {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  background: var(--bg-subtle);
  border-radius: 6px;
  padding: 0.625rem 0.75rem;
}

.card-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.card-item-desc {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.card-item-qty {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  margin-left: 0.5rem;
}

.card-item-more {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 0.375rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 440px;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
}

.modal-lg {
  max-width: 680px;
}

.modal-sm {
  max-width: 360px;
}

#template-select-modal {
  z-index: 1100;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-head h2 {
  font-size: 1rem;
  font-weight: 500;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s var(--ease);
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Fields */
.field {
  margin-bottom: 0.875rem;
}

.field label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.875rem;
  padding: 0.625rem 0.875rem;
  font-family: var(--font);
  transition: all 0.15s var(--ease);
  line-height: 1.4;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-hover);
}

.field input[readonly] {
  opacity: 0.5;
  cursor: default;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.field-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
}

.backup-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.backup-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.backup-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Items */
.items-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.items-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.625rem;
}

.items-head h3 {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.items-table {
  background: var(--bg-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.items-header {
  display: grid;
  grid-template-columns: 1fr 55px 70px 70px 32px;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-hover);
}

.item-row {
  display: grid;
  grid-template-columns: 1fr 55px 70px 70px 32px;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border);
  align-items: center;
}

.item-row input {
  width: 100%;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  transition: all 0.15s var(--ease);
}

.item-row input:focus {
  outline: none;
  border-color: var(--accent);
}

.item-row input[type="number"] {
  text-align: right;
  font-family: var(--mono);
}

.item-amount {
  font-family: var(--mono);
  font-size: 0.875rem;
  text-align: right;
  color: var(--text-secondary);
}

.items-total {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.items-total .subtotal-line {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-muted);
}

.items-total .tax-line {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.items-total .total-line {
  font-weight: 600;
  color: var(--text);
}

/* Dropzone */
.dropzone {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--bg-subtle);
}

.dropzone svg {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

.dropzone p {
  margin-bottom: 0.375rem;
  font-size: 0.9375rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.import-preview {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.import-preview-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.5rem;
  background: var(--bg-subtle);
  border-radius: 6px;
  font-size: 0.85rem;
}

.import-preview-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.import-preview-more {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.25rem;
}

/* Toasts */
.toasts {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(250, 250, 250, 0.95);
  color: #1a1a1a;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 8px;
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  animation: toast-enter 0.2s var(--ease);
  max-width: 280px;
  pointer-events: auto;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  cursor: default;
  line-height: 1.4;
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
}

[data-theme="dark"] .toast {
  background: rgba(30, 30, 30, 0.95);
  color: #fafafa;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.toast.removing {
  opacity: 0;
  transform: translateY(-4px);
}

.toast-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.toast-success .toast-icon {
  color: var(--success);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-info .toast-icon {
  color: var(--info);
}

.toast-warning .toast-icon {
  color: var(--warning);
}

.toast-message {
  flex: 1;
  min-width: 0;
  color: var(--text);
}

@keyframes toast-enter {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Modal Description */
.modal-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Template Selection Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.template-card {
  background: var(--bg-subtle);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.template-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.template-card.selected {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.template-card-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.375rem;
  color: var(--text);
}

.template-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.template-card-preview {
  margin-top: 0.75rem;
  height: 80px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
}

.template-card-preview img {
  width: 100%;
  height: auto;
}

/* Template Preview Area */
.template-preview {
  margin-top: 1rem;
}

.template-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.template-preview-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.template-preview-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.template-preview-frame {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  height: 400px;
}

.template-preview-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Checkbox Label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

/* Settings Template Picker */
.settings-template-grid {
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
  margin-top: 0.375rem;
}

.settings-template-grid .template-card {
  padding: 0.75rem;
  border-width: 1.5px;
}

.settings-template-grid .template-card-name {
  font-size: 0.875rem;
  margin-bottom: 0.2rem;
}

.settings-template-grid .template-card-desc {
  font-size: 0.7rem;
  margin-bottom: 0;
}

.settings-template-grid .template-card.active-default {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.settings-template-preview {
  margin-top: 0.75rem;
}

.settings-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.settings-preview-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.settings-preview-frame {
  height: 280px;
  border-radius: 6px;
}

.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  accent-color: var(--accent);
}

/* Empty */
.empty {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Search Bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.search-input {
  flex: 1;
  max-width: 320px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  padding-left: 2rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  transition: all 0.15s var(--ease);
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.625rem center;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--bg-hover);
}

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

/* Bulk Actions */
.bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bulk-actions.hidden {
  display: none;
}

.bulk-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

/* Select All */
.select-all-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.select-all-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.select-all-label:hover {
  color: var(--text);
}

/* List Item Checkbox */
.list-item {
  position: relative;
}

.list-item-checkbox {
  display: flex;
  align-items: center;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.list-item-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.list-item.selected {
  background: var(--bg-subtle);
}

/* Grid Item Checkbox */
.card {
  position: relative;
}

.card-checkbox {
  position: absolute;
  top: 0;
  left: 0.75rem;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
  z-index: 2;
}

.card:hover .card-checkbox,
.card.selected .card-checkbox {
  opacity: 1;
}

.card-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.card.selected {
  background: var(--bg-subtle);
  border-color: var(--accent);
}

.card.selected .card-delete {
  opacity: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .header-content,
  .nav,
  .main {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

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

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

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .section-actions {
    justify-content: stretch;
  }

  .section-actions .select {
    flex: 1;
  }

  .modal-content {
    max-height: 95vh;
  }

  .items-header,
  .item-row {
    grid-template-columns: 1fr 45px 60px 60px 28px;
  }

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

  .list-item {
    grid-template-columns: 1fr auto;
    gap: 1rem;
  }

  .list-item:has(.list-item-checkbox) {
    grid-template-columns: auto 1fr auto;
    gap: 0.5rem 0.75rem;
  }
}

@media (max-width: 380px) {
  .items-header,
  .item-row {
    grid-template-columns: 1fr 40px 55px 55px 24px;
    font-size: 0.75rem;
  }

  .stat-value {
    font-size: 1.375rem;
  }
}

.export-dropdown {
  position: relative;
}

.export-menu {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 4px;
  z-index: 100;
  min-width: 120px;
  margin-bottom: 4px;
}

.export-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 4px;
  text-align: left;
}

.export-menu-item:hover {
  background: var(--bg-hover);
}

.export-menu-item svg {
  opacity: 0.7;
}