* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', sans-serif; background: #f0f2f5; color: #1a1a2e; }

.login-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: linear-gradient(135deg, #1a1a2e, #16213e);
}
.login-box {
  background: #fff; padding: 2.5rem; border-radius: 16px;
  text-align: center; width: 340px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-box h1 { font-size: 1.8rem; margin-bottom: .3rem; }
.login-box p { color: #666; margin-bottom: 1.5rem; }
.login-box input {
  width: 100%; padding: .8rem; border: 1px solid #ddd; border-radius: 8px;
  font-size: 1rem; margin-bottom: 1rem;
}
.login-box button {
  width: 100%; padding: .8rem; background: #2563eb; color: #fff;
  border: none; border-radius: 8px; font-size: 1rem; cursor: pointer;
}
.login-box button:hover { background: #1d4ed8; }

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

.sidebar {
  width: 220px; background: #1a1a2e; color: #fff;
  display: flex; flex-direction: column; padding: 1.5rem 0;
  position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo {
  font-size: 1.2rem; font-weight: 700; padding: 0 1.2rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 1rem;
}
.nav-item {
  display: block; padding: .7rem 1.2rem; color: rgba(255,255,255,.7);
  text-decoration: none; border-radius: 8px; margin: 0 .5rem;
  transition: all .2s;
}
.nav-item:hover, .nav-item.active {
  background: rgba(37,99,235,.4); color: #fff;
}

.content {
  margin-left: 220px; padding: 2rem; flex: 1;
}

.page h2 { font-size: 1.5rem; margin-bottom: 1.5rem; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h2 { margin-bottom: 0; }

.card {
  background: #fff; border-radius: 12px; padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 1.5rem;
}
.card h3 { margin-bottom: 1rem; font-size: 1rem; color: #444; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff; border-radius: 12px; padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: #2563eb; }
.stat-label { font-size: .85rem; color: #888; margin-top: .3rem; }

.section-row { display: flex; gap: 1rem; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

.btn-primary {
  background: #2563eb; color: #fff; border: none;
  padding: .6rem 1.2rem; border-radius: 8px; cursor: pointer;
  font-size: .9rem; transition: background .2s;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
  background: #f0f2f5; color: #333; border: none;
  padding: .6rem 1.2rem; border-radius: 8px; cursor: pointer;
  font-size: .9rem;
}
.btn-secondary:hover { background: #e2e5ea; }
.btn-danger {
  background: #ef4444; color: #fff; border: none;
  padding: .5rem 1rem; border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.btn-danger:hover { background: #dc2626; }
.btn-warn {
  background: #f59e0b; color: #fff; border: none;
  padding: .5rem 1rem; border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.btn-warn:hover { background: #d97706; }
.btn-success {
  background: #10b981; color: #fff; border: none;
  padding: .5rem 1rem; border-radius: 8px; cursor: pointer; font-size: .85rem;
}
.btn-success:hover { background: #059669; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }

.modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,.5); display: flex; align-items: center;
  justify-content: center; z-index: 1000;
}
.modal-content {
  background: #fff; border-radius: 16px; padding: 2rem;
  width: 480px; max-width: 95vw;
}
.modal-large { width: 680px; max-height: 85vh; overflow-y: auto; }
.modal-content h3 { margin-bottom: 1.5rem; }
.modal-content label { display: block; font-size: .85rem; color: #666; margin-bottom: .3rem; }
.modal-content input, .modal-content select, .modal-content textarea {
  width: 100%; padding: .7rem; border: 1px solid #ddd; border-radius: 8px;
  font-size: .95rem; margin-bottom: 1rem;
}
.modal-content textarea { resize: vertical; }
.modal-buttons { display: flex; gap: .8rem; margin-top: .5rem; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; padding: .7rem 1rem; background: #f8f9fb; border-bottom: 1px solid #eee; color: #666; font-size: .8rem; text-transform: uppercase; }
td { padding: .7rem 1rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }

.status-badge {
  display: inline-block; padding: .25rem .7rem; border-radius: 20px;
  font-size: .78rem; font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-available { background: #dbeafe; color: #1e40af; }
.badge-used { background: #f3f4f6; color: #6b7280; }

.product-card {
  background: #fff; border-radius: 12px; padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 1rem;
}
.product-card h4 { font-size: 1.1rem; margin-bottom: .5rem; }
.product-actions { display: flex; gap: .5rem; margin-bottom: 1rem; }
.plans-table { margin-top: 1rem; }

.conv-card {
  background: #fff; border-radius: 10px; padding: 1rem 1.2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: .7rem;
  display: flex; align-items: center; justify-content: space-between; cursor: pointer;
}
.conv-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.conv-info strong { display: block; }
.conv-info small { color: #888; }
.conv-badges { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.conv-badge-human { background: #fef3c7; color: #92400e; padding: .2rem .6rem; border-radius: 12px; font-size: .75rem; }
.conv-badge-paused { background: #fee2e2; color: #991b1b; padding: .2rem .6rem; border-radius: 12px; font-size: .75rem; }

.conv-modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1rem; }
.conv-modal-header h3 { margin-bottom: 0; }
.conv-modal-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.messages-container {
  max-height: 400px; overflow-y: auto; border: 1px solid #eee;
  border-radius: 8px; padding: 1rem; background: #f8f9fb;
}
.message { margin-bottom: .8rem; }
.message-user { text-align: right; }
.message-bubble {
  display: inline-block; padding: .6rem 1rem; border-radius: 12px;
  max-width: 75%; font-size: .9rem; white-space: pre-wrap; word-break: break-word;
}
.message-user .message-bubble { background: #dcf8c6; }
.message-assistant .message-bubble { background: #fff; border: 1px solid #eee; }
.message-time { font-size: .7rem; color: #aaa; margin-top: .2rem; }

.tags-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.tag-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem 1rem; border-radius: 20px; font-size: .9rem; font-weight: 600;
  color: #fff;
}
.tag-item button {
  background: rgba(255,255,255,.3); border: none; color: #fff;
  border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: .75rem;
}

.filters { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.filters input[type=text] {
  padding: .5rem .8rem; border: 1px solid #ddd; border-radius: 8px; font-size: .9rem;
}
.filters label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; cursor: pointer; }

.inventory-header { display: flex; justify-content: space-between; align-items: center; }

.hint { font-size: .85rem; color: #888; margin-bottom: 1rem; }

.low-stock-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: .5rem 0; border-bottom: 1px solid #f0f0f0;
}
.low-stock-item:last-child { border-bottom: none; }

select, input[type=text], input[type=number], input[type=password] {
  padding: .6rem .8rem; border: 1px solid #ddd; border-radius: 8px; font-size: .9rem;
}

.actions-row { display: flex; gap: .4rem; }

.hidden { display: none !important; }
.error { color: #ef4444; }
