:root {
  --bg: #eef3f8;
  --panel: #ffffff;
  --panel-2: #f7fafc;
  --border: #d8e1ea;
  --text: #102033;
  --muted: #728197;
  --primary: #0f7a4a;
  --primary-dark: #095b37;
  --primary-soft: #e8f6ef;
  --gold: #d7aa45;
  --danger: #c83f49;
  --agent: #dcf6e8;
  --client: #ffffff;
  --shadow: 0 18px 45px rgba(15, 32, 51, .12);
  --shadow-soft: 0 10px 24px rgba(15, 32, 51, .08);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 12%, rgba(215,170,69,.24), transparent 26%),
    radial-gradient(circle at 82% 22%, rgba(22,138,87,.25), transparent 28%),
    linear-gradient(135deg, #071d15 0%, #0b3b28 48%, #edf3f8 48%, #f7fafc 100%);
}
.login-card {
  width: min(430px, calc(100vw - 32px));
  background: rgba(255,255,255,.94);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 34px;
  border: 1px solid rgba(255,255,255,.78);
  backdrop-filter: blur(10px);
}
.brand-block { text-align: center; margin-bottom: 24px; }
.brand-logo { width: 88px; height: 88px; object-fit: contain; margin-bottom: 10px; filter: drop-shadow(0 10px 18px rgba(15,122,74,.18)); }
h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
p { margin: 0; color: var(--muted); }
.form-panel { display: grid; gap: 15px; }
label span { display: block; margin-bottom: 7px; font-size: 14px; color: var(--muted); }
.input, .top-select {
  width: 100%; border: 1px solid var(--border); border-radius: 14px; padding: 12px 13px;
  font-size: 15px; outline: none; background: #fff; color: var(--text); transition: .18s ease;
}
.input:focus, textarea:focus, .top-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15,122,74,.12); }
.primary-btn {
  border: 0; border-radius: 14px; padding: 12px 18px; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  font-weight: 700; cursor: pointer; box-shadow: 0 10px 18px rgba(15,122,74,.2); transition: .18s ease;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 24px rgba(15,122,74,.24); }
.error-msg { min-height: 20px; color: var(--danger); font-size: 14px; text-align: center; }

.app-body { height: 100vh; overflow: hidden; background: #edf3f7; }
.topbar {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(7,29,21,.98), rgba(10,66,43,.98)),
    radial-gradient(circle at 16% 50%, rgba(215,170,69,.22), transparent 34%);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 26px rgba(0,0,0,.16);
}
.top-logo-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.top-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 12px; background: rgba(255,255,255,.09); padding: 6px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.top-logo-soft { width: 38px; height: 38px; opacity: .76; }
.top-center-logo { justify-self: center; display: flex; align-items: center; justify-content: center; min-width: 56px; }
.top-brand-text { display: grid; gap: 2px; min-width: 0; }
.top-brand-text strong { font-size: 16px; letter-spacing: .01em; white-space: nowrap; }
.top-brand-text span { font-size: 12px; color: rgba(255,255,255,.65); white-space: nowrap; }
.user-area { justify-self: end; display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.top-select { width: 86px; padding: 8px 10px; border-radius: 12px; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.1); color: #fff; }
.top-select option { color: #102033; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 999px; background: rgba(255,255,255,.09); color: rgba(255,255,255,.88); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #36d76f; box-shadow: 0 0 0 4px rgba(54,215,111,.18), 0 0 14px rgba(54,215,111,.75); }
.agent-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.ghost-btn { color: #fff; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); padding: 9px 13px; border-radius: 12px; cursor: pointer; transition: .18s ease; }
.ghost-btn:hover { background: rgba(255,255,255,.16); }

.layout { display: grid; grid-template-columns: 350px 1fr; height: calc(100vh - 72px); padding: 14px; gap: 14px; }
.conversation-list { background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: 22px; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow-soft); overflow: hidden; }
.aside-title { min-height: 70px; display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, #fff, #f8fbfd); }
.aside-title strong { display: block; font-size: 16px; }
.aside-title span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.conversation-items { overflow: auto; padding: 12px; }
.conv-card {
  display: grid; grid-template-columns: 46px 1fr; gap: 11px; padding: 13px; border: 1px solid transparent;
  border-radius: 18px; cursor: pointer; margin-bottom: 10px; background: #fff; box-shadow: 0 6px 16px rgba(16,32,51,.04); transition: .18s ease;
}
.conv-card:hover { transform: translateY(-1px); border-color: #cae9d8; background: #fbfffd; box-shadow: 0 10px 20px rgba(16,32,51,.07); }
.conv-card.active { background: linear-gradient(135deg, #effaf4, #ffffff); border-color: #b7e3ca; box-shadow: inset 3px 0 0 var(--primary), 0 10px 22px rgba(15,122,74,.09); }
.conv-card.flash { animation: flashCard 1s ease; }
@keyframes flashCard { 0%, 100% { background: #fff; } 25%, 75% { background: #fff2bc; } }
.avatar, .active-avatar {
  width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, #e6edf5, #f8fbfd); font-weight: 800; color: #304967; overflow: hidden; border: 1px solid rgba(16,32,51,.05);
}
.conv-title { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 14px; }
.conv-preview { color: var(--muted); font-size: 13px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { color: var(--muted); font-size: 12px; font-weight: 400; }
.chat-panel { min-width: 0; border-radius: 22px; overflow: hidden; background: #f3f7fb; border: 1px solid var(--border); box-shadow: var(--shadow-soft); }
.empty-state { height: 100%; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); font-size: 15px; text-align: center; background: radial-gradient(circle at 50% 35%, #fff, #eef4f8 72%); }
.empty-state img { width: 80px; height: 80px; object-fit: contain; opacity: .72; filter: drop-shadow(0 10px 18px rgba(16,32,51,.10)); }
.empty-state strong { color: var(--text); font-size: 20px; }
.empty-state span { max-width: 420px; }
.hidden { display: none !important; }
.chat-view { height: 100%; display: grid; grid-template-rows: 70px 1fr 20%; }
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 0 20px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); }
.active-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-header strong { font-size: 16px; }
.chat-header small { display: block; margin-top: 4px; color: var(--muted); }
.pill { background: var(--primary-soft); color: var(--primary); padding: 7px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.message-area {
  overflow: auto; padding: 24px;
  background:
    linear-gradient(rgba(243,247,251,.88), rgba(243,247,251,.88)),
    radial-gradient(circle at 18% 18%, rgba(15,122,74,.08), transparent 26%),
    radial-gradient(circle at 82% 28%, rgba(215,170,69,.10), transparent 28%);
}
.msg-row { display: flex; margin-bottom: 17px; gap: 10px; align-items: flex-start; }
.msg-row.agent { justify-content: flex-end; }
.msg-row.agent .avatar { order: 2; background: linear-gradient(135deg, #cdebd7, #effaf4); color: #0b5d39; }
.bubble-wrap { max-width: min(680px, 72%); }
.meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.msg-row.agent .meta { text-align: right; }
.bubble { padding: 12px 14px; border-radius: 18px; line-height: 1.48; white-space: pre-wrap; word-break: break-word; background: var(--client); border: 1px solid #e1e8f0; box-shadow: 0 8px 18px rgba(16,32,51,.05); }
.msg-row.client .bubble { border-top-left-radius: 6px; }
.msg-row.agent .bubble { background: var(--agent); border-color: #bfe8d0; border-top-right-radius: 6px; }
.send-area { border-top: 1px solid var(--border); background: #fff; display: grid; grid-template-columns: 1fr 112px; gap: 12px; padding: 15px; }
textarea { width: 100%; resize: none; border: 1px solid var(--border); border-radius: 16px; padding: 13px 14px; font-size: 15px; outline: none; font-family: inherit; background: #fbfdff; }
.send-btn { align-self: stretch; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 300px 1fr; padding: 10px; gap: 10px; }
  .top-center-logo { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
}
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 72px; grid-template-columns: 1fr; align-items: start; padding: 12px; }
  .user-area { justify-self: stretch; flex-wrap: wrap; }
  .layout { grid-template-columns: 1fr; height: calc(100vh - 126px); }
  .conversation-list { height: 235px; }
  .chat-view { height: calc(100vh - 373px); grid-template-rows: 64px 1fr 150px; }
  .send-area { grid-template-columns: 1fr; }
  .send-btn { min-height: 44px; }
}

.schedule-status{margin:10px 12px 8px;padding:9px 10px;border:1px solid rgba(148,163,184,.22);border-radius:12px;background:rgba(15,23,42,.035);font-size:12px;color:#64748b;line-height:1.35}
.schedule-status.error{color:#b91c1c;background:rgba(254,226,226,.7);border-color:rgba(248,113,113,.35)}
.schedule-status.ok{color:#166534;background:rgba(220,252,231,.7);border-color:rgba(74,222,128,.35)}
.empty-list{margin:16px 12px;padding:18px 12px;border:1px dashed rgba(148,163,184,.55);border-radius:16px;color:#94a3b8;text-align:center;font-size:13px;background:rgba(248,250,252,.65)}
.schedule-tools{display:grid;grid-template-columns:1fr auto;gap:8px;margin:10px 12px 0;align-items:center}
.file-btn{position:relative;display:flex;align-items:center;justify-content:center;min-height:38px;padding:0 12px;border:1px solid rgba(15,122,74,.22);border-radius:12px;background:linear-gradient(180deg,#ffffff,#f4fbf7);color:#0f7a4a;font-size:13px;font-weight:800;cursor:pointer;box-shadow:0 6px 14px rgba(15,122,74,.06);overflow:hidden;white-space:nowrap}
.file-btn:hover{border-color:rgba(15,122,74,.42);background:#effaf4}
.file-btn input{position:absolute;inset:0;opacity:0;cursor:pointer}
.mini-btn{min-height:38px;padding:0 10px;border:1px solid rgba(148,163,184,.32);border-radius:12px;background:#fff;color:#64748b;font-size:12px;font-weight:700;cursor:pointer;white-space:nowrap}
.mini-btn:hover{background:#f8fafc;color:#334155}
.schedule-tools-static{grid-template-columns:1fr}
.static-config-note{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:40px;padding:8px 10px;border:1px solid rgba(15,122,74,.18);border-radius:13px;background:linear-gradient(180deg,#ffffff,#f4fbf7);box-shadow:0 6px 14px rgba(15,122,74,.05)}
.static-config-note strong{font-size:12px;color:#0f7a4a;letter-spacing:.02em}
.static-config-note span{font-size:11px;color:#64748b;text-align:right}
