:root {
  --primary: #4f46e5;
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2330;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: var(--card);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  width: 360px;
}

.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p { color: var(--muted); font-size: 13px; margin-top: 0; margin-bottom: 24px; }

input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}

label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}

input:focus, select:focus, textarea:focus { border-color: var(--primary); }

button.primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
button.primary:hover { opacity: 0.92; }

button.secondary {
  background: white;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}

button.danger { color: var(--danger); border-color: var(--danger); background: white; border: 1px solid var(--danger); border-radius: 8px; padding: 6px 10px; cursor: pointer; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 16px; }

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

.sidebar {
  width: 220px;
  background: #171a2b;
  color: #cfd3ea;
  padding: 20px 0;
  flex-shrink: 0;
}
.sidebar .brand { padding: 0 20px 20px; font-weight: 700; color: white; font-size: 16px; }
.sidebar nav a {
  display: block;
  padding: 10px 20px;
  color: #cfd3ea;
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}
.sidebar nav a.active, .sidebar nav a:hover { background: #262b45; color: white; }
.sidebar .who { padding: 16px 20px; font-size: 12px; color: #8b90b3; border-top: 1px solid #2a2e47; margin-top: 16px; }
.sidebar .logout { padding: 10px 20px; color: #f99; cursor: pointer; font-size: 13px; }

.main { flex: 1; padding: 28px 36px; max-width: 1100px; }
.main h2 { margin-top: 0; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 20px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.public { background: #dbeafe; color: #1d4ed8; }
.badge.internal { background: #fef3c7; color: #92400e; }
.badge.open { background: #fee2e2; color: #991b1b; }
.badge.resolved { background: #dcfce7; color: #166534; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.hint { color: var(--muted); font-size: 12px; }

.chat-box { border: 1px solid var(--border); border-radius: 10px; height: 360px; overflow-y: auto; padding: 14px; background: #fafafa; }
.chat-msg { margin-bottom: 12px; max-width: 80%; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.chat-msg.user { background: var(--primary); color: white; margin-left: auto; }
.chat-msg.assistant { background: white; border: 1px solid var(--border); }
.chat-sources { margin-top: 6px; font-size: 12px; }
.chat-sources a { color: var(--primary); cursor: pointer; margin-right: 8px; }

.copy-box { background: #f1f2f6; border: 1px solid var(--border); border-radius: 8px; padding: 10px; font-family: monospace; font-size: 12px; word-break: break-all; }

.select-client { margin-bottom: 16px; }
