:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --line: #d8e0ea;
  --accent: #17406d;
  --accent-2: #275f98;
  --soft: #eaf2fb;
  --success: #0f766e;
  --warning: #9a6700;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #123456, #1d4f82);
  color: #fff;
  padding: 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand-badge,
.pill,
.mini-status,
.pill-row .pill {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.brand-badge, .pill-row .pill {
  background: rgba(255,255,255,0.14);
}

.sidebar h1 { margin: 10px 0 8px; font-size: 1.8rem; }
.sidebar-text { color: rgba(255,255,255,0.88); line-height: 1.5; }

.side-nav { display: grid; gap: 10px; }
.nav-link {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #fff;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
}
.nav-link:hover { background: rgba(255,255,255,0.16); }

.sidebar-actions { display: grid; gap: 10px; }
.status-box {
  margin-top: auto;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.14);
  padding: 14px;
  border-radius: 14px;
  line-height: 1.7;
}

.main-content {
  padding: 24px;
  display: grid;
  gap: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.hero-card { background: linear-gradient(180deg, #ffffff, #f8fbff); }
.notice {
  margin-top: 14px;
  background: #fff7e6;
  border: 1px solid #f2d18b;
  padding: 14px;
  border-radius: 14px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  gap: 16px;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 110px;
  resize: vertical;
  font-weight: 400;
}

.output-box {
  min-height: 360px;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

.toggle-group,
.action-grid,
.pill-row,
.chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle,
.btn,
.chip {
  border: none;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font: inherit;
}

.toggle {
  background: var(--soft);
  color: var(--accent);
  border: 1px solid #cfe0f3;
}
.toggle.active,
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-secondary {
  background: #eef3f8;
  color: var(--accent);
  border: 1px solid #d7e2ee;
}
.btn:hover, .toggle:hover, .chip:hover { opacity: 0.92; }

.helper-text { color: var(--muted); margin-top: 4px; }
.field-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 18px;
  background: #fcfdff;
}

.section-set { display: none; }
.section-set.active-set { display: block; }
.quick-picks-grid, .tips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.quick-box, .tip-box {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fcfdff;
}

.chip {
  background: #eaf2fb;
  color: var(--accent);
  border: 1px solid #cde0f4;
}

.action-card { position: sticky; top: 12px; z-index: 5; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.mini-status { background: #eef6ff; color: var(--accent); }
.quality-results {
  background: #f8fbff;
  border: 1px solid #dce8f5;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
}
.quality-results.good { border-color: #a7e0cb; background: #effcf7; }
.quality-results.warn { border-color: #f2d18b; background: #fff8ea; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .grid-3, .quick-picks-grid, .tips-grid, .action-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .main-content { padding: 16px; }
  .grid-3, .quick-picks-grid, .tips-grid, .action-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .action-card, #teachingCard, #toolsCard, #welcomeCard, #sessionCard, #builderCard {
    display: none !important;
  }
  .main-content { display: block; padding: 0; }
  #previewCard { box-shadow: none; border: none; padding: 0; }
  #generatedNote {
    border: none;
    min-height: auto;
    height: auto;
    overflow: visible;
  }
}


.mode-line { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.status-dot { width:10px; height:10px; border-radius:50%; background:#f59e0b; display:inline-block; }
.status-dot.connected { background:#10b981; }
.quick-box-wide { grid-column: 1 / -1; }
.chip.selected { outline: 2px solid #1d4ed8; background: #dbeafe; }


.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.mse-box { background: #f9fbff; }
.mse-header { margin-bottom: 8px; }
.mse-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.mse-group { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: #fff; }
.mse-group h4 { margin: 0 0 10px; font-size: 0.98rem; color: var(--accent); }

@media (max-width: 760px) {
  .mse-groups { grid-template-columns: 1fr; }
}

.quick-grid { display:grid; grid-template-columns: repeat(2, 1fr); gap:16px; }
.mse-groups { display:grid; grid-template-columns: repeat(2, 1fr); gap:16px; }
.mse-group { border:1px solid var(--line); border-radius:14px; padding:14px; background:#fff; }
.mse-group h4, .quick-box h3 { margin-top:0; }
input:focus, textarea:focus, select:focus { outline: 2px solid #bfd7f2; border-color:#7da7d9; }
textarea[spellcheck="true"], input[spellcheck="true"] { background-image: linear-gradient(to bottom, rgba(255,255,255,0.98), rgba(255,255,255,0.98)); }
@media (max-width: 760px) { .quick-grid, .mse-groups { grid-template-columns:1fr; } }


.phrase-bank { margin-top: 8px; }
