* { box-sizing: border-box; }

:root {
  --blue: #2563eb;
  --navy: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --background: #f1f5f9;
}

body {
  margin: 0;
  color: var(--navy);
  background: var(--background);
  font-family: Arial, Helvetica, sans-serif;
}

[hidden] { display: none !important; }

button, input { font: inherit; }

button { cursor: pointer; }

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 36px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 12px 35px #0f172a10;
}

.logo {
  display: grid;
  place-items: center;
  background: var(--blue);
  color: white;
  border-radius: 12px;
  width: 46px;
  height: 46px;
  font-weight: bold;
  flex-shrink: 0;
}

.login-card h1 { margin-bottom: 8px; }

.login-card p {
  color: var(--muted);
  margin-bottom: 30px;
}

label {
  display: block;
  font-weight: 600;
  margin: 16px 0 8px;
  font-size: 14px;
}

input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
}

.login-card button {
  background: var(--blue);
  border: 0;
  border-radius: 8px;
  color: white;
  padding: 14px;
  width: 100%;
  margin-top: 24px;
  font-weight: bold;
}

.error {
  color: #dc2626;
  margin-top: 14px;
  font-size: 14px;
}

.sidebar {
  width: 255px;
  position: fixed;
  height: 100vh;
  background: var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 35px;
}

.brand strong { font-size: 14px; }

.brand small {
  display: block;
  color: #94a3b8;
  margin-top: 5px;
}

nav button {
  width: 100%;
  text-align: left;
  padding: 14px 12px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  color: #cbd5e1;
  margin-bottom: 5px;
}

nav button:hover,
nav button.active {
  background: #1e40af;
  color: white;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  color: #94a3b8;
}

.online-dot {
  display: inline-block;
  background: #22c55e;
  border-radius: 100%;
  width: 8px;
  height: 8px;
  margin-right: 6px;
}

.main { margin-left: 255px; }

.topbar {
  background: white;
  padding: 20px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--border);
}

.topbar h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.topbar small { color: var(--muted); }

.account {
  display: flex;
  align-items: center;
  gap: 15px;
}

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

#content { padding: 30px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(210px,1fr));
  gap: 18px;
  margin-bottom: 25px;
}

.metric, .panel {
  background: white;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.metric-label {
  font-size: 14px;
  color: var(--muted);
}

.metric-value {
  font-size: 34px;
  font-weight: bold;
  margin-top: 12px;
}

.panel h3 { margin-top: 0; }

.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

td, th {
  text-align: left;
  padding: 13px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  background: #f8fafc;
}

.empty {
  padding: 40px 15px;
  text-align: center;
  color: var(--muted);
}

.message {
  padding: 14px;
  margin: 12px 0;
  background: #f1f5f9;
  border-radius: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.ai { background: #dbeafe; }

.message.operator { background: #dcfce7; }

.message small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

@media(max-width: 760px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .sidebar nav {
    display: flex;
    overflow-x: auto;
  }

  nav button {
    width: auto;
    white-space: nowrap;
  }

  .brand { margin-bottom: 15px; }

  .sidebar-footer { display: none; }

  .main { margin-left: 0; }

  .topbar { padding: 15px; }

  #content { padding: 15px; }

  .account { font-size: 12px; }
}

.reply-field {
  display: block;
  width: 100%;
  padding: 12px;
  margin: 18px 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
}

.panel > button {
  margin: 5px;
}

#content > .panel + .panel {
  margin-top:20px;
}

.panel > input {
  margin:10px 0;
}

.panel .panel {
  margin-top:15px;
}

.panel .message {
  max-height:500px;
  overflow:auto;
}
