:root {
  --brand-start: #4f7cff;
  --brand-end: #2d4dd6;
  --bg: #f5f6fa;
  --border: #e5e7ef;
}

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

/* Auth pages */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
}
.auth-card {
  background: #fff;
  border-radius: 14px;
  padding: 32px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.auth-brand h1 {
  font-size: 20px;
  margin: 0;
}
.auth-switch {
  margin-top: 16px;
  font-size: 14px;
  text-align: center;
}

/* App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1b1f30;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  font-weight: bold;
  font-size: 18px;
}
.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.app-sidebar-nav a {
  color: #c4c8dc;
  text-decoration: none;
  padding: 10px 20px;
}
.app-sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.app-sidebar-nav a.active {
  background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
  color: #fff;
}
.app-sidebar-logout {
  padding: 16px 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 10px;
}
.app-sidebar-account {
  display: block;
  text-decoration: none;
  margin-bottom: 10px;
  padding: 6px 8px;
  margin-left: -8px;
  margin-right: -8px;
  border-radius: 6px;
}
.app-sidebar-account:hover {
  background: rgba(255, 255, 255, 0.06);
}
.app-sidebar-account.active {
  background: rgba(255, 255, 255, 0.1);
}
.app-sidebar-user {
  font-size: 13px;
  color: #fff;
}
.app-sidebar-account-label {
  font-size: 11px;
  color: #9ba0bd;
}
.app-sidebar-logout button {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
}
.app-content {
  flex: 1;
  padding: 30px 36px;
  overflow-x: hidden;
}
.page-header {
  margin-bottom: 24px;
}

/* Account */
.account-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 24px;
  max-width: 480px;
}

/* Dashboard */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border-left: 5px solid var(--brand-start);
}
.stat-value {
  font-size: 32px;
  font-weight: bold;
}
.stat-label {
  color: #666;
  font-size: 13px;
}
.stat-waiting { border-left-color: #f2994a; }
.stat-open { border-left-color: #2d4dd6; }
.stat-done { border-left-color: #27ae60; }
.stat-total { border-left-color: #9b51e0; }

/* Chat kanban */
.chat-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.chat-columns {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 300px;
  flex-shrink: 0;
  height: 75vh;
  min-height: 600px;
}
.chat-column {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.chat-column-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-column-list {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}
.chat-column-empty {
  color: #999;
  font-size: 13px;
  padding: 12px;
  text-align: center;
}
.chat-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.chat-card-title {
  font-weight: 600;
  font-size: 14px;
}
.chat-card-email {
  font-size: 11px;
  color: #999;
  margin-bottom: 4px;
}
.chat-card-widget {
  font-size: 11px;
  color: var(--brand-end);
  margin-bottom: 4px;
}
.chat-card-sub {
  font-size: 12px;
  color: #777;
  margin-bottom: 8px;
}
.chat-panel {
  width: 460px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  height: 75vh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-panel-empty {
  margin: auto;
  color: #999;
  font-size: 13px;
  padding: 20px;
  text-align: center;
}
.chat-panel-header {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-panel-header-email {
  font-size: 11px;
  font-weight: 400;
  color: #999;
}
.chat-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.chat-msg {
  max-width: 82%;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
}
.chat-msg-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.65;
  margin-bottom: 2px;
}
.chat-msg-body {
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.visitor {
  background: var(--bg);
  border-bottom-left-radius: 2px;
}
.chat-msg.agent {
  background: var(--brand-start);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 2px;
}
.chat-msg img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin-top: 2px;
}
.chat-msg a.chat-file {
  color: inherit;
  text-decoration: underline;
}
#chat-panel-form {
  display: flex;
  align-items: center;
  border-top: 1px solid var(--border);
}
#chat-panel-attach {
  border: none;
  background: transparent;
  color: #777;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 16px;
}
#chat-panel-input {
  flex: 1;
  border: none;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}
#chat-panel-form button[type="submit"] {
  border: none;
  background: var(--brand-end);
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
}

/* Integration */
.widget-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 640px;
  margin-bottom: 20px;
}
.widget-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  padding: 16px;
}
.widget-card-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.widget-rename-form {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}
.widget-card-key {
  margin-top: 10px;
  font-size: 12px;
  color: #888;
}
.widget-add-form {
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin-bottom: 10px;
}
.widget-add-form input {
  flex: 1;
}
.code-block {
  position: relative;
  background: #1b1f30;
  color: #e5e7ef;
  padding: 16px;
  border-radius: 10px;
  max-width: 640px;
}
.code-block pre {
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  font-size: 13px;
}
.code-block button {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* Integration preview */
.browser-mockup {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  max-width: 900px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.browser-mockup-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e9ebf2;
  padding: 8px 12px;
}
.browser-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.browser-mockup-url {
  margin-left: 8px;
  background: #fff;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 12px;
  color: #777;
  flex: 1;
}
.browser-mockup-open {
  font-size: 12px;
  text-decoration: none;
  color: #2d4dd6;
  white-space: nowrap;
}
.browser-mockup-frame {
  width: 100%;
  height: 560px;
  border: none;
  display: block;
}
