/* ITeam127 Design System — LegalBot Panel */

:root {
  --primary: #1B365D;
  --accent: #0D7377;
  --surface: #FFFFFF;
  --surface-alt: #FAFBFC;
  --bg: #F5F3EF;
  --border: #E5E0D8;
  --border-input: #D1D5DB;
  --text: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --error: #B91C1C;
  --success: #1A7A3A;
  --warning: #C27803;
  --info: #2D5F8A;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --sidebar-width: 260px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* --- Layout --- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 30;
}

.sidebar-logo {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo h1 { font-size: 16px; font-weight: 600; }
.sidebar-logo span { font-size: 12px; color: rgba(255,255,255,0.6); }

.sidebar-nav { flex: 1; padding: 16px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; color: rgba(255,255,255,0.7);
  text-decoration: none; font-size: 14px; transition: all .15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-nav a.active {
  color: #fff; background: rgba(255,255,255,0.08);
  border-left-color: var(--accent);
}
.sidebar-nav .separator { border-top: 1px solid rgba(255,255,255,0.1); margin: 8px 0; }

.sidebar-metrics {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 12px; color: rgba(255,255,255,0.6);
}
.sidebar-metrics .metric-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px; font-weight: 600; color: #fff;
}

.main { margin-left: var(--sidebar-width); flex: 1; }

.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.header h2 { font-size: 18px; font-weight: 600; }
.header .user { font-size: 13px; color: var(--text-secondary); }

.content { padding: 24px 32px; }

/* --- Cards --- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.card-value { font-family: 'JetBrains Mono', monospace; font-size: 28px; font-weight: 700; }
.card-value.success { color: var(--success); }
.card-value.error { color: var(--error); }
.card-value.accent { color: var(--accent); }

/* --- Tables --- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #F5F3EF; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-align: left;
  padding: 10px 16px; position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 12px 16px; border-top: 1px solid #F0EDE8; font-size: 13px; }
tbody tr:nth-child(even) { background: var(--surface-alt); }
tbody tr:hover { box-shadow: inset 0 0 0 1px var(--border); }

/* --- Badges --- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 500;
}
.badge-max { background: #D1FAE5; color: #065F46; }
.badge-tg { background: #DBEAFE; color: #1E40AF; }
.badge-vk { background: #EDE9FE; color: #5B21B6; }
.badge-phone { background: #FEF3C7; color: #92400E; }
.badge-success { background: #D1FAE5; color: var(--success); }
.badge-error { background: #FEE2E2; color: var(--error); }
.badge-pending { background: #FEF3C7; color: var(--warning); }

/* --- Chat view --- */
.chat { max-width: 700px; }
.chat-msg { margin-bottom: 12px; display: flex; }
.chat-msg.client { justify-content: flex-start; }
.chat-msg.agent { justify-content: flex-end; }
.chat-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 12px;
  font-size: 13px; line-height: 1.5;
}
.chat-msg.client .chat-bubble { background: #F3F4F6; color: var(--text); border-bottom-left-radius: 4px; }
.chat-msg.agent .chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.chat-meta { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; border: 1px solid var(--border-input); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,115,119,0.15);
}
.form-group textarea { min-height: 120px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #152C4E; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #0A5F62; }
.btn-outline { background: transparent; border-color: var(--border-input); color: var(--text); }
.btn-outline:hover { background: var(--surface-alt); }

/* --- Login --- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.login-card .subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 24px; }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; }

/* --- Prompt editor --- */
.prompt-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.prompt-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.prompt-card .prompt-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }

/* --- Vibe sliders --- */
.vibe-option { display: flex; gap: 12px; align-items: center; padding: 8px 0; }
.vibe-option input[type="radio"] { accent-color: var(--accent); }
.vibe-option label { font-size: 14px; cursor: pointer; }

/* --- Toast --- */
.toast {
  position: fixed; top: 24px; right: 24px; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  box-shadow: var(--shadow-lg); z-index: 100;
  display: none; animation: slideIn .2s ease-out;
}
.toast.show { display: block; }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--error); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Responsive --- */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}
