:root{
  --bg:#0f1116;
  --panel:#151924;
  --panel2:#10131b;
  --text:#e9eef6;
  --muted:#aab6c5;
  --border:#2a3142;
  --accent:#7aa2ff;
  --danger:#ff6b6b;
  --ok:#2bd576;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans";
  background:linear-gradient(180deg, var(--bg), #0b0d12);
  color:var(--text);
}
body.auth-locked{
  overflow:hidden;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  background:rgba(10,12,18,0.7);
  position:sticky;
  top:0;
  z-index:5;
  backdrop-filter: blur(8px);
}
.brand{display:flex; align-items:center; gap:12px;}
.logo{
  width:40px;height:40px;border-radius:12px;
  display:grid;place-items:center;
  background:linear-gradient(135deg, #25304b, #1b2240);
  border:1px solid var(--border);
  color:var(--accent);
  font-weight:800;
}
.title .h1{font-weight:800;letter-spacing:0.2px}
.title .h2{font-size:12px;color:var(--muted);margin-top:2px}
.topbar-actions{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
.status{font-size:12px;color:var(--muted)}

.section-controls{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:10px 14px 0 14px;
}
.panel-toggle-btn{
  font-size:12px;
  border-radius:10px;
  padding:6px 10px;
}
.panel-toggle-btn.is-hidden{
  opacity:0.7;
  border-style:dashed;
}

.layout{
  display:grid;
  grid-template-columns: 280px 8px 1fr 8px 1.2fr;
  gap:14px;
  padding:14px;
  align-items:stretch;
}
.layout-resizer{
  width:8px;
  min-height:120px;
  border:1px solid var(--border);
  border-radius:10px;
  background:rgba(12,15,22,0.65);
  cursor:col-resize;
  position:relative;
}
.layout-resizer::before{
  content:'';
  position:absolute;
  top:50%;
  left:50%;
  width:2px;
  height:42px;
  transform:translate(-50%, -50%);
  border-radius:999px;
  background:rgba(122,162,255,0.42);
}
.layout-resizer:hover{
  border-color:rgba(122,162,255,0.65);
  background:rgba(16,22,34,0.78);
}
.layout-resizer.hidden{
  display:none;
}
body.is-resizing-layout{
  cursor:col-resize;
  user-select:none;
}
@media (max-width: 1200px){
  .layout{grid-template-columns: 1fr;}
  .layout-resizer{display:none !important;}
}

.panel{
  background:linear-gradient(180deg, var(--panel), var(--panel2));
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
  min-width:0;
}
.panel.hidden-panel{
  display:none;
}
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:10px;
}
.panel-head h3{
  margin:0;
}
h3{margin:0 0 10px 0}
h4{margin:12px 0 8px 0; color:#d8e2f1}
.panel-hide-btn{
  width:20px;
  height:20px;
  padding:0;
  border:1px solid var(--border);
  border-radius:6px;
  background:#0c0f16;
  color:var(--muted);
  cursor:pointer;
  display:grid;
  place-items:center;
  line-height:1;
  font-size:12px;
}
.panel-hide-btn:hover{
  color:var(--text);
  border-color:rgba(122,162,255,0.55);
}
.divider{height:1px;background:var(--border); margin:12px 0}
.hint{font-size:12px;color:var(--muted); margin:6px 0 10px 0; line-height:1.3}

.row{display:flex;align-items:center}
.gap{gap:10px}
.wrap{flex-wrap:wrap}
.dictation-field{
  position:relative;
  margin:6px 0 8px 0;
}
.dictation-field .textarea{
  padding-right:58px;
  padding-bottom:38px;
}
.mic-btn{
  font-size:18px;
  line-height:1;
}
.mic-fab{
  position:absolute;
  right:10px;
  bottom:10px;
  width:36px;
  height:36px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.24);
  background:linear-gradient(180deg, rgba(18,22,30,0.95), rgba(10,13,19,0.95));
  color:#f4f8ff;
  display:grid;
  place-items:center;
  padding:0;
  box-shadow:0 8px 18px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08);
}
.mic-fab:hover{
  border-color:rgba(122,162,255,0.72);
  box-shadow:0 10px 22px rgba(0,0,0,0.42), 0 0 0 3px rgba(122,162,255,0.18);
}
.mic-btn.is-recording{
  border-color:rgba(255,107,107,0.85);
  background:linear-gradient(180deg, rgba(151,35,35,0.92), rgba(98,22,22,0.92));
  box-shadow:0 10px 24px rgba(90,14,14,0.45), 0 0 0 3px rgba(255,107,107,0.18);
}

.module-checkbox-list{
  border:1px solid var(--border);
  border-radius:12px;
  background:#0c0f16;
  padding:8px;
  max-height:420px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.module-checkbox-list label{
  display:flex;
  align-items:center;
  gap:8px;
  padding:5px 8px;
  border-radius:10px;
  cursor:pointer;
  user-select:none;
  transition: background 0.2s;
}
.module-checkbox-list label:hover{
  background:rgba(122,162,255,0.08);
}
.module-checkbox-list label.selected{
  background:rgba(43,213,118,0.08);
}
.module-checkbox-list label.active{
  background:rgba(122,162,255,0.16);
}
.module-checkbox-list label input{
  width:18px;
  height:18px;
  margin:0;
  cursor:pointer;
  border-radius:4px;
  border:1px solid rgba(255,255,255,0.35);
  background:#0f1523;
  appearance:auto;
  accent-color:#72a0ff;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,0.4);
  transition:border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.module-checkbox-list label span{
  flex:1;
}

.module-switch-list{
  border:1px solid var(--border);
  border-radius:12px;
  background:#0c0f16;
  padding:8px;
  max-height:280px;
  overflow:auto;
  display:flex;
  flex-direction:column;
  gap:4px;
}
.quick-module-switch-list{
  max-height:180px;
}

.mini-card{
  margin-top:10px;
  border:1px solid rgba(122,162,255,0.25);
  border-radius:12px;
  background:rgba(12,15,22,0.55);
  padding:8px;
}
.mini-card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.mini-card-title{
  margin:0;
  color:#d8e2f1;
  font-size:14px;
}
.mini-card-body{
  margin-top:8px;
}
.mini-card.is-collapsed .mini-card-body{
  display:none;
}
.mini-card-toggle{
  width:22px;
  height:22px;
  padding:0;
  border:1px solid var(--border);
  border-radius:7px;
  background:#0c0f16;
  color:var(--muted);
  cursor:pointer;
  line-height:1;
  font-size:12px;
  display:grid;
  place-items:center;
}
.mini-card-toggle:hover{
  border-color:rgba(122,162,255,0.55);
  color:var(--text);
}
.mini-card-toggle:focus-visible{
  outline:none;
  border-color:rgba(122,162,255,0.75);
  box-shadow:0 0 0 3px rgba(122,162,255,0.18);
}
.switch-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:6px 10px;
  border-radius:10px;
  cursor:pointer;
  border:1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.switch-label{
  flex:1;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.switch-item:hover{
  background:rgba(122,162,255,0.08);
}
.switch-item.active{
  background:rgba(122,162,255,0.18);
  border-color:rgba(122,162,255,0.5);
}
.switch-item.quick-picked{
  border-color:rgba(122,162,255,0.35);
}
.quick-pick-btn{
  width:22px;
  height:22px;
  border:1px solid var(--border);
  border-radius:7px;
  background:#0f1523;
  color:#f5d37a;
  cursor:pointer;
  display:grid;
  place-items:center;
  font-size:12px;
  line-height:1;
  padding:0;
}
.quick-pick-btn:hover{
  border-color:rgba(122,162,255,0.55);
}
.quick-empty{
  font-size:12px;
  color:var(--muted);
  padding:6px 8px;
}

.constant-texts-list{
  border:1px solid var(--border);
  border-radius:12px;
  background:#0c0f16;
  padding:8px;
  max-height:220px;
  overflow:auto;
  display:flex;
  flex-direction:row;
  flex-wrap:wrap;
  gap:6px;
  align-items:flex-start;
}
.task-groups-box{
  margin-top:10px;
  padding:10px;
  border:1px solid rgba(122,162,255,0.2);
  border-radius:12px;
  background:rgba(12,15,22,0.45);
}
.copy-tasks-form{
  margin-top:10px;
  padding:10px;
  border:1px solid rgba(43,213,118,0.28);
  border-radius:12px;
  background:rgba(11,20,18,0.45);
}
.copy-tasks-form-title{
  margin-bottom:8px;
  font-size:13px;
  font-weight:600;
  color:#d8e2f1;
}
.copy-tasks-form-row .select{
  width:auto;
  flex:1 1 220px;
  min-width:180px;
}
.task-groups-box h4{
  margin:0 0 8px 0;
}
.task-group-empty{
  font-size:12px;
  color:var(--muted);
  padding:4px 6px;
}
.assistant-log{
  margin-top:10px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#0b0f18;
  min-height:40px;
  max-height:200px;
  overflow:auto;
  padding:8px 10px;
  font-size:12px;
  color:var(--muted);
  line-height:1.35;
  white-space:pre-wrap;
}
.assistant-speech-toggle{
  gap:6px;
  font-size:12px;
  padding:5px 8px;
  border:1px solid var(--border);
  border-radius:10px;
  background:rgba(20,27,45,0.72);
}
.assistant-launcher{
  position:fixed;
  left:16px;
  bottom:16px;
  z-index:70;
  width:68px;
  height:68px;
  border:1px solid rgba(122,162,255,0.62);
  border-radius:999px;
  padding:0;
  background:radial-gradient(circle at 35% 28%, #6fb0ff 0%, #2f67f2 48%, #1a3e9f 100%);
  color:#eaf3ff;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  box-shadow:0 10px 24px rgba(0,0,0,0.38);
  user-select:none;
  touch-action:none;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:visible;
  animation:assistantLauncherFloat 3.2s ease-in-out infinite;
}
.assistant-launcher:hover{
  border-color:rgba(122,162,255,0.9);
  box-shadow:0 12px 26px rgba(0,0,0,0.44), 0 0 0 3px rgba(122,162,255,0.22);
}
.assistant-launcher::before{
  content:'';
  position:absolute;
  inset:-8px;
  border-radius:999px;
  border:2px solid rgba(140,182,255,0.22);
  animation:assistantPulseRing 2.6s ease-out infinite;
  pointer-events:none;
}
.assistant-launcher-caption{
  position:absolute;
  left:78px;
  top:50%;
  transform:translateY(-50%);
  background:rgba(13,22,46,0.9);
  border:1px solid rgba(95,154,255,0.5);
  border-radius:10px;
  padding:6px 10px;
  font-size:12px;
  white-space:nowrap;
  pointer-events:none;
}
.assistant-launcher-robot{
  width:38px;
  height:38px;
  border-radius:11px;
  border:1px solid rgba(255,255,255,0.55);
  background:linear-gradient(180deg, #e9f5ff, #9fc7ff);
  position:relative;
  box-shadow:inset 0 -2px 0 rgba(0,0,0,0.08), 0 4px 12px rgba(7,18,48,0.35);
  transform-origin:50% 72%;
  overflow:visible;
  animation:
    assistantRobotBob 2.2s ease-in-out infinite,
    assistantRobotStunt 8.5s ease-in-out infinite;
}
.assistant-robot-eye{
  position:absolute;
  top:11px;
  width:5px;
  height:5px;
  border-radius:50%;
  background:#1f468f;
  animation:assistantRobotBlink 3.8s infinite;
}
.assistant-robot-eye.left{left:9px;}
.assistant-robot-eye.right{right:9px;}
.assistant-robot-mouth{
  position:absolute;
  left:50%;
  top:21px;
  width:13px;
  height:5px;
  margin-left:-6.5px;
  border-radius:0 0 8px 8px;
  border:2px solid #1d4b9f;
  border-top:none;
  animation:assistantRobotTalk 1.8s ease-in-out infinite;
}
.assistant-robot-arm{
  position:absolute;
  top:15px;
  width:8px;
  height:2px;
  background:#1f4b9f;
  border-radius:2px;
  transform-origin:center;
}
.assistant-robot-arm.left{
  left:-7px;
  animation:assistantRobotArmLeft 2.6s ease-in-out infinite;
}
.assistant-robot-arm.right{
  right:-7px;
  animation:assistantRobotArmRight 2.1s ease-in-out infinite;
}

@keyframes assistantLauncherFloat{
  0%,100%{transform:translateY(0);}
  50%{transform:translateY(-3px);}
}

@keyframes assistantRobotBob{
  0%,100%{transform:translateY(0) rotate(0deg);}
  25%{transform:translateY(-2px) rotate(-2deg);}
  50%{transform:translateY(-3px) rotate(0deg);}
  75%{transform:translateY(-1px) rotate(2deg);}
}
@keyframes assistantRobotStunt{
  0%,84%,100%{transform:translateY(0) rotate(0deg);}
  88%{transform:translateY(-4px) rotate(25deg);}
  92%{transform:translateY(-2px) rotate(-340deg);}
  96%{transform:translateY(0) rotate(-360deg);}
}
@keyframes assistantRobotBlink{
  0%,42%,44%,100%{transform:scaleY(1);}
  43%{transform:scaleY(.15);}
}
@keyframes assistantRobotTalk{
  0%,100%{height:5px;border-radius:0 0 8px 8px;}
  50%{height:2px;border-radius:10px;}
}
@keyframes assistantRobotArmLeft{
  0%,100%{transform:rotate(0deg);}
  30%{transform:rotate(18deg);}
  60%{transform:rotate(-12deg);}
}
@keyframes assistantRobotArmRight{
  0%,100%{transform:rotate(0deg);}
  25%{transform:rotate(-22deg);}
  55%{transform:rotate(14deg);}
}
@keyframes assistantPulseRing{
  0%{transform:scale(0.92);opacity:.7;}
  70%{transform:scale(1.08);opacity:.15;}
  100%{transform:scale(1.12);opacity:0;}
}
.assistant-compliment{
  position:fixed;
  z-index:121;
  max-width:260px;
  background:rgba(16,24,48,0.94);
  color:#eaf3ff;
  border:1px solid rgba(108,153,255,0.55);
  border-radius:14px;
  padding:10px 12px;
  font-size:13px;
  line-height:1.35;
  box-shadow:0 12px 30px rgba(6,12,28,0.45);
  opacity:0;
  transform:translateY(6px);
  transition:opacity .22s ease, transform .22s ease;
  pointer-events:none;
}
.assistant-compliment.visible{
  opacity:1;
  transform:translateY(0);
}
.assistant-compliment::after{
  content:'';
  position:absolute;
  left:18px;
  bottom:-7px;
  width:12px;
  height:12px;
  transform:rotate(45deg);
  background:rgba(16,24,48,0.94);
  border-right:1px solid rgba(108,153,255,0.55);
  border-bottom:1px solid rgba(108,153,255,0.55);
}
.const-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 8px;
  border-radius:10px;
  cursor:pointer;
  border:1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
  min-width:170px;
  max-width:100%;
}
.const-item:hover{
  background:rgba(122,162,255,0.08);
}
.const-item input{
  width:18px;
  height:18px;
  margin:0;
  cursor:pointer;
  border-radius:4px;
  border:1px solid rgba(255,255,255,0.35);
  background:#0f1523;
  appearance:auto;
  accent-color:#72a0ff;
}
.const-title{
  flex:1;
  font-size:13px;
  color:var(--text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.input, .textarea, .select{
  width:100%;
  border:1px solid var(--border);
  background:#0c0f16;
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  outline:none;
}
.input:focus, .textarea:focus, .select:focus{
  border-color:rgba(122,162,255,0.75);
  box-shadow:0 0 0 3px rgba(122,162,255,0.15);
}
.textarea{
  resize:vertical; overflow-wrap:anywhere;
  min-width:100%; white-space:pre-wrap;
  max-width:100%; word-break:break-word;
}
.textarea-resize-y-only{
  resize:vertical;
  min-width:100%;
  max-width:100%;
}

.select{padding:8px}
.select option{
  padding:6px 8px;
}

.btn{
  border:1px solid var(--border);
  background:#0c0f16;
  color:var(--text);
  border-radius:12px;
  padding:10px 12px;
  cursor:pointer;
}
.btn.icon{
  width:42px;
  height:42px;
  padding:0;
  display:grid;
  place-items:center;
  font-size:18px;
}
.btn:hover{border-color:rgba(122,162,255,0.55)}
.btn.primary{
  background:linear-gradient(135deg, rgba(122,162,255,0.22), rgba(122,162,255,0.08));
  border-color:rgba(122,162,255,0.5);
}
.btn.danger{
  background:linear-gradient(135deg, rgba(255,107,107,0.20), rgba(255,107,107,0.08));
  border-color:rgba(255,107,107,0.55);
}
.chk{display:flex;align-items:center;gap:8px; font-size:13px; color:var(--muted)}
.chk input{transform: translateY(1px);}

.twoCols{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.toast{
  position:fixed;
  right:14px;
  bottom:14px;
  background:rgba(15,19,28,0.95);
  border:1px solid var(--border);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  max-width:520px;
  box-shadow:0 12px 40px rgba(0,0,0,0.45);
  z-index:30;
}
.context-menu{
  position:fixed;
  z-index:60;
  min-width:190px;
  background:rgba(11,15,24,0.98);
  border:1px solid var(--border);
  border-radius:10px;
  padding:6px;
  box-shadow:0 14px 34px rgba(0,0,0,0.45);
}
.context-menu-item{
  display:block;
  width:100%;
  text-align:left;
  border:1px solid transparent;
  background:transparent;
  color:var(--text);
  border-radius:8px;
  padding:8px 10px;
  cursor:pointer;
  font-size:13px;
}
.context-menu-item:hover{
  background:rgba(122,162,255,0.13);
  border-color:rgba(122,162,255,0.35);
}
.context-menu-item:disabled{
  opacity:0.5;
  cursor:not-allowed;
}
.reorder-source{
  border-color:rgba(43,213,118,0.75) !important;
  background:rgba(43,213,118,0.12) !important;
}

.auth-modal{
  position:fixed;
  inset:0;
  z-index:40;
  background:rgba(4,6,10,0.8);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
}
.auth-modal[hidden]{
  display:none !important;
}
.auth-card{
  width:min(460px, 100%);
  background:linear-gradient(180deg, var(--panel), var(--panel2));
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  box-shadow:0 20px 60px rgba(0,0,0,0.45);
}
.auth-instructions{
  font-size:12px;
  color:var(--muted);
  line-height:1.45;
  border:1px solid rgba(122,162,255,0.22);
  background:rgba(12,15,22,0.55);
  border-radius:10px;
  padding:8px 10px;
  margin-bottom:10px;
}
.auth-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:10px;
}
.auth-tab{
  padding:7px 10px;
  font-size:12px;
}
.auth-tab.is-active{
  border-color:rgba(122,162,255,0.6);
  background:rgba(122,162,255,0.18);
}
.auth-tab-exit{
  margin-left:auto;
  border-color:rgba(255,107,107,0.4);
  color:#ffd1d1;
}
.auth-tab-exit:hover{
  border-color:rgba(255,107,107,0.65);
}
.auth-form{
  display:block;
}
.auth-form[hidden]{
  display:none !important;
}

.modal{
  position:fixed;
  inset:0;
  background:rgba(4,6,10,0.65);
  display:flex;
  justify-content:flex-end;
  align-items:flex-start;
  padding:60px 20px;
  z-index:20;
}
.modal-card{
  width:360px;
  background:linear-gradient(180deg, var(--panel), var(--panel2));
  border:1px solid var(--border);
  border-radius:16px;
  padding:14px;
  box-shadow:0 20px 60px rgba(0,0,0,0.45);
}
.settings-modal-card{
  width:min(760px, calc(100vw - 40px));
}
.modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.modal-title{
  font-weight:700;
}
.setting-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin:10px 0;
}
.settings-stt-context-row{
  display:block;
}
.settings-stt-context-row .setting-label{
  display:block;
  min-width:0;
  margin-bottom:8px;
}
.settings-stt-context-row .textarea{
  display:block;
  width:100%;
  max-width:100%;
  min-height:120px;
  line-height:1.35;
  overflow:auto;
}
.setting-label{
  font-size:13px;
  color:var(--muted);
  min-width:170px;
}
.setting-link{
  color:inherit;
  text-decoration:underline;
  text-underline-offset:2px;
}
.setting-link:hover{
  color:#c8dcff;
}
.small-input{
  width:120px;
}
