:root {
  color-scheme: light;
  --color-primary: #1a1a1a;
  --color-accent: #e0292e;
  --color-accent-dark: #b81f23;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #111827; background: #f7f7fb; height: 100vh; overflow: hidden;
}

.login-screen { height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-box { display: flex; flex-direction: column; gap: 10px; width: 280px; }
.login-box h1 { font-size: 20px; margin: 0 0 8px; text-align: center; }
.login-box input {
  padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.login-box button {
  padding: 10px; border: none; border-radius: 8px; background: var(--color-primary); color: #fff;
  font-size: 14px; cursor: pointer;
}
.login-box button:hover { background: var(--color-accent); }
.error { color: var(--color-accent-dark); font-size: 13px; min-height: 16px; margin: 0; }

.app-screen { height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: var(--color-primary); color: #fff;
}
.topbar h1 { font-size: 16px; margin: 0; flex: 1; }
.icon-btn {
  background: transparent; border: none; color: #fff; font-size: 18px; cursor: pointer; padding: 4px 8px;
}

.notif-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: #fff;
  border-bottom: 1px solid #e5e7eb; font-size: 12px;
}
.notif-bar:empty, .notif-bar.hidden { display: none; }
.notif-status { color: #6b7280; flex: 1; }
.notif-btn {
  border: 1px solid var(--color-primary); border-radius: 999px; background: #fff;
  color: var(--color-primary); padding: 4px 12px; font-size: 12px; cursor: pointer;
}
.notif-btn:hover { background: var(--color-primary); color: #fff; }
.notif-btn.primary { background: var(--color-primary); color: #fff; }
.notif-btn.primary:hover { background: var(--color-accent); border-color: var(--color-accent); }

.layout { flex: 1; display: flex; min-height: 0; }
.conv-list { width: 320px; overflow-y: auto; border-right: 1px solid #e5e7eb; background: #fff; }
.conv-thread { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.conv-item {
  display: block; width: 100%; text-align: left; padding: 12px 14px; border: none; background: none;
  border-bottom: 1px solid #f0f0f3; cursor: pointer;
}
.conv-item.active { background: #f5f5f5; }
.conv-item .row1 { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
.conv-item .lang { text-transform: uppercase; color: #6b7280; font-weight: 500; }
.conv-item .meta { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.conv-item .snippet { font-size: 13px; color: #4b5563; margin-top: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.conv-item .badge {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-accent); margin-right: 6px;
}

.empty-hint { margin: auto; color: #9ca3af; font-size: 14px; }

.thread-header { padding: 10px 14px; border-bottom: 1px solid #e5e7eb; background: #fff; font-size: 13px; color: #4b5563; }
.thread-messages { flex: 1; overflow-y: auto; padding: 14px; background: #f7f7fb; }
.msg { max-width: 75%; margin-bottom: 10px; padding: 8px 12px; border-radius: 12px; font-size: 14px;
  line-height: 1.35; white-space: pre-wrap; word-wrap: break-word; }
.msg.visitor { background: #e5e7eb; color: #111827; margin-right: auto; border-bottom-left-radius: 2px; }
.msg.admin { background: var(--color-primary); color: #fff; margin-left: auto; border-bottom-right-radius: 2px; }
.msg-time { font-size: 11px; margin-top: 3px; opacity: .65; }

.reply-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e5e7eb; background: #fff; }
.reply-form textarea {
  flex: 1; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; font-size: 14px;
  resize: none; font-family: inherit;
}
.reply-form button {
  border: none; border-radius: 8px; background: var(--color-primary); color: #fff; padding: 0 16px;
  font-size: 14px; cursor: pointer;
}
.reply-form button:hover:not(:disabled) { background: var(--color-accent); }
.reply-form button:disabled { opacity: .5; cursor: default; }

@media (max-width: 720px) {
  .conv-list { width: 100%; }
  .layout.show-thread .conv-list { display: none; }
  .layout:not(.show-thread) .conv-thread { display: none; }
}
