:root {
  --slate: #6E95A5;        /* VisionIT dashboard primary slate-blue */
  --slate-dark: #364152;   /* dashboard heading / deep slate */
  --green: #6CC067;        /* VisionIT dashboard green accent */
  --green-dark: #57aa52;
  --teal: #5A9B7E;         /* dashboard secondary teal-green */
  --blue: #4A6DF4;         /* dashboard secondary blue accent */
  --amber: #F0AD4E;        /* dashboard warning amber */
  --brand-pink: #EE3F5B;   /* VisionIT logo mark (the red "V") */
  --ink: #272727;          /* primary text */
  --muted: #89868d;        /* secondary text */
  --line: #e6e8ec;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(54,65,82,.08), 0 6px 24px rgba(54,65,82,.06);
  font-family: 'Roboto', system-ui, -apple-system, Segoe UI, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.fineprint { color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.error { color: #c0392b; }
h1, h2, h3 { color: var(--slate-dark); font-weight: 500; }

/* ---- brand logo + wordmark ---- */
.brand-logo { height: 34px; width: auto; display: block; }
.brand-logo-lg { height: 52px; margin: 2px auto 8px; }
.brand { font-weight: 700; font-size: 22px; letter-spacing: -.5px; line-height: 1; }
.brand-vision { color: var(--slate-dark); }
.brand-it {
  color: #fff; background: var(--green); padding: 1px 6px; border-radius: 5px; margin-left: 1px;
}
.brand-lg { font-size: 34px; }

/* ---- buttons ---- */
.btn { border: 0; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 500;
  cursor: pointer; font-family: inherit; transition: filter .15s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--slate); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn-accent { background: var(--green); color: #fff; }
.btn-accent:hover { background: var(--green-dark); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--slate); }

/* attribution line on Knowledge results */
.res-meta { font-size: 12.5px; color: var(--slate-dark); margin: 2px 0 6px; font-weight: 500; }

/* collapsible "Sources used" record under an AI answer */
.sources { margin-top: 12px; }
.src-toggle { background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; }
.src-toggle:hover { color: var(--ink); border-color: var(--slate); }
.src-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.src-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fafbfc; }
.src-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.src-text { font-size: 13px; color: var(--ink); white-space: pre-wrap; max-height: 140px; overflow: auto; }
.cite { color: var(--slate); font-weight: 600; }

/* rendered markdown inside an AI answer */
.ans-h { font-weight: 600; color: var(--slate-dark); margin: 10px 0 3px; font-size: 15px; }
.ans-li { margin: 2px 0 2px 6px; }
.ai-body code { background: #eef3f7; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.ans-table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 13px; }
.ans-table th, .ans-table td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.ans-table th { background: #eef3f7; color: var(--slate-dark); font-weight: 600; }
.ans-table tr:nth-child(even) td { background: #fafbfc; }

/* SharePoint library file tree */
.filetree { margin-top: 12px; }
.ft-dir { margin: 2px 0; }
.ft-dir > summary { cursor: pointer; padding: 6px 8px; border-radius: 6px; font-weight: 500;
  color: var(--slate-dark); list-style: none; }
.ft-dir > summary::-webkit-details-marker { display: none; }
.ft-dir > summary:hover { background: #f0f3f6; }
.ft-count { color: var(--muted); font-weight: 400; font-size: 12px; }
.ft-body { margin-left: 16px; padding-left: 8px; border-left: 1px solid var(--line); }
.ft-file { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 5px 8px; border-radius: 6px; font-size: 13.5px; }
.ft-file:hover { background: #f7faf2; }
.ft-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-size { color: var(--muted); font-size: 11.5px; }
.ft-in { color: var(--green-dark); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.ft-na { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ft-add { padding: 4px 12px; font-size: 12.5px; white-space: nowrap; }
.ft-err { flex-basis: 100%; font-size: 12px; margin-top: 2px; }

/* "Install app" prompt (PWA) */
.install-bar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 1000; display: flex; align-items: center; gap: 10px; max-width: 92vw;
  background: var(--surface); border: 1px solid var(--line); border-radius: 30px;
  box-shadow: var(--shadow); padding: 8px 10px 8px 16px; }
.install-bar .ib-icon { font-size: 18px; }
.install-bar .ib-msg { font-size: 13.5px; color: var(--ink); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.install-bar .btn-primary { padding: 7px 16px; border-radius: 20px; }
.install-bar .ib-x { background: transparent; border: 0; color: var(--muted); font-size: 20px;
  line-height: 1; cursor: pointer; padding: 0 6px; }
.install-bar .ib-x:hover { color: var(--ink); }
@media (max-width: 480px) { .install-bar .ib-msg { white-space: normal; } }

/* ---- Capture screen (default landing) ---- */
.capture-screen { max-width: 440px; margin: 10px auto 0; text-align: center;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 24px 26px; }
.cap-title { margin: 0 0 4px; }
.cap-sub { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.cap-mic { width: 138px; height: 138px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 2px solid var(--brand-pink); box-shadow: 0 0 0 12px rgba(238,63,91,.10);
  display: inline-flex; align-items: center; justify-content: center; transition: transform .15s; margin: 0 auto; }
.cap-mic .v-mark { width: 76px; height: 76px; }
.cap-mic:hover { transform: scale(1.04); }
.cap-mic.recording { background: #fff; animation: pulse 1.3s infinite; }
.cap-status { font-weight: 500; color: var(--slate-dark); margin: 22px 0 4px; }
.cap-timer { font-variant-numeric: tabular-nums; color: var(--brand-pink); font-weight: 600; font-size: 15px; margin-bottom: 10px; }
.cap-controls { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 14px 0 4px; }
.cap-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 16px; padding: 5px 12px; cursor: pointer; background: #fff; }
.cap-chip select { border: 0; background: transparent; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.cap-maxnote { text-align: center; margin-top: 10px; }
.cap-type-box { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.cap-type-box textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-family: inherit; font-size: 14px; resize: vertical; }
.cap-review { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; max-width: 440px; margin: 14px auto 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px)); font-family: inherit;
  font-size: 15px; color: var(--ink); }
.cap-review:hover { border-color: var(--slate); background: #f7faf2; }
.cap-review-ic { color: var(--brand-pink); margin-right: 6px; }
.cap-review-count { background: var(--brand-pink); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 1px 8px; min-width: 18px; text-align: center; }

/* Capture = the PHONE screen; Record (dictation) = the BROWSER screen.
   Each platform shows only its own primary capture entry. */
.nav .tab[data-view="capture"] { display: none; }
@media (max-width: 640px) {
  .nav .tab[data-view="capture"] { display: flex; }
  .nav .tab[data-view="record"] { display: none; }
}

/* ---- mobile nav (hamburger) ---- */
.nav-toggle { display: none; background: transparent; border: 0; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--slate-dark); padding: 4px 10px; margin-right: auto; }
/* phone-drawer layout (≤640) is defined at the END of this file, after the base
   .sidebar rule, so it wins the cascade. */

/* "similar notes already exist" hint under the Record textarea */
.similar-hint { margin: 10px 0 0; padding: 10px 12px; border: 1px solid var(--line);
  border-left: 3px solid var(--green); border-radius: 8px; background: #f7faf2; font-size: 13px; }
.similar-hint .sh-title { color: var(--green-dark); font-weight: 600; margin-bottom: 6px; }
.similar-hint .sh-item { padding: 4px 0; border-top: 1px solid var(--line); cursor: pointer; color: var(--ink); }
.similar-hint .sh-item:first-of-type { border-top: 0; }
.similar-hint .sh-item:hover { color: var(--slate); }
.similar-hint .sh-meta { color: var(--muted); font-size: 11.5px; }

/* "Sign in with Microsoft" — Microsoft brand guidance: white button, grey border,
   the four-square logo, dark text. */
.btn-microsoft { display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; background: #fff; color: #5e5e5e; border: 1px solid #8c8c8c; border-radius: 8px;
  padding: 12px 16px; font-size: 15px; font-weight: 600; }
.btn-microsoft:hover { background: #f5f5f5; }
.ms-logo { display: grid; grid-template-columns: 9px 9px; grid-template-rows: 9px 9px; gap: 2px; }
.ms-logo i { display: block; width: 9px; height: 9px; }
.ms-logo i:nth-child(1) { background: #f25022; }
.ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; }
.ms-logo i:nth-child(4) { background: #ffb900; }

/* ---- login ---- */
.login-view { min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 500px at 50% -10%, #e8eef3, var(--bg)); }
.login-card { background: var(--surface); padding: 40px 38px; border-radius: 16px;
  box-shadow: var(--shadow); width: 360px; max-width: 92vw; text-align: center; }
.login-card h1 { margin: 18px 0 4px; }
.login-card label { display: block; text-align: left; margin: 22px 0 6px; font-size: 13px; color: var(--muted); }
.login-card select, .login-card button { width: 100%; }
.login-card select { padding: 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; margin-bottom: 16px; background: #fff; }

/* ---- app shell: left sidebar + main area ---- */
#app-view { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar { width: 216px; flex: 0 0 216px; background: var(--surface);
  border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0;
  height: 100vh; display: flex; flex-direction: column; }
.sidebar-brand { padding: 4px 8px 16px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.sidebar-brand .app-name { display: block; color: var(--muted); font-weight: 500; font-size: 13px; margin-top: 8px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav .tab { display: flex; align-items: center; gap: 10px; text-align: left; width: 100%;
  background: transparent; border: 0; padding: 11px 12px; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 14.5px; color: var(--muted); font-weight: 500; }
.nav .tab .ic { width: 20px; text-align: center; }
.nav .tab:hover { background: #f0f3f6; color: var(--ink); }
.nav .tab.active { background: #eef3f7; color: var(--slate); }

/* expandable "Upload" parent + its sub-items */
.nav-parent { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 11px 12px; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 14.5px; color: var(--muted); font-weight: 500; }
.nav-parent .ic { width: 20px; text-align: center; }
.nav-parent:hover { background: #f0f3f6; color: var(--ink); }
.nav-parent.active { background: #eef3f7; color: var(--slate); }
.nav-parent .caret { margin-left: auto; font-size: 11px; transition: transform .15s; }
.nav-parent.open .caret { transform: rotate(90deg); }
.subnav { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 2px 15px;
  padding-left: 8px; border-left: 2px solid var(--line); }
.subnav .subtab { font-size: 13.5px; padding: 9px 10px; }
.draft-count { margin-left: auto; background: var(--green); color: #fff; font-size: 11px;
  font-weight: 700; border-radius: 10px; padding: 1px 7px; min-width: 18px; text-align: center; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 0 22px; height: 60px; position: sticky; top: 0; z-index: 10; }

/* centered Ask VIT button in the top bar */
.askvit-top { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 8px; background: var(--brand-pink); color: #fff;
  border: 0; border-radius: 22px; padding: 9px 20px; font-family: inherit; font-size: 14px;
  font-weight: 600; cursor: pointer; box-shadow: var(--shadow); transition: filter .15s; }
.askvit-top:hover { filter: brightness(1.08); }
.askvit-top:active { transform: translate(-50%, -50%) translateY(1px); }
.askvit-mark { background: #fff; color: var(--brand-pink); font-weight: 700; font-size: 11.5px;
  letter-spacing: .5px; padding: 2px 7px; border-radius: 6px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { background: #eef3f7; color: var(--slate-dark); padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 500; }

.content { max-width: 880px; width: 100%; margin: 26px auto; padding: 0 22px; }
.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card h2 { margin: 0 0 2px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }

/* ---- record ---- */
.badge { font-size: 12px; color: var(--green-dark); background: #eef6e6; padding: 4px 10px; border-radius: 12px; }
.badge.warn { color: #b8860b; background: #fdf6e3; }
.record-row { display: flex; flex-direction: row; align-items: center; gap: 20px; margin: 18px 0; }
/* Record / capture buttons — white circle with the VisionIT "V" logo mark */
.mic-btn { width: 88px; height: 88px; border-radius: 50%; cursor: pointer;
  background: #fff; border: 2px solid var(--brand-pink);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); transition: transform .15s; }
.mic-btn .v-mark { width: 50px; height: 50px; }
.mic-btn:hover { transform: scale(1.04); }
.mic-btn.recording { background: #fff; animation: pulse 1.3s infinite; }
/* Desktop Record button: circle, a touch bigger than the upload one */
#mic-btn { width: 96px; height: 96px; }
#mic-btn .v-mark { width: 54px; height: 54px; }
.v-mark { display: block; object-fit: contain; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(217,83,79,.45);} 70% { box-shadow: 0 0 0 16px rgba(217,83,79,0);} 100% { box-shadow: 0 0 0 0 rgba(217,83,79,0);} }
.mic-status { font-weight: 500; color: var(--slate-dark); margin-bottom: 8px; }
.inline { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.inline select { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); }

textarea, .tag-grid input, .search-bar input, .login-card select, .block input {
  font-family: inherit; font-size: 15px; }
#entry-text { width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; line-height: 1.5; }
#entry-text:focus, .tag-grid input:focus, .search-bar input:focus { outline: 2px solid var(--slate); border-color: transparent; }

.tag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.tag-grid label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 5px; }
.tag-grid input { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.save-as { font-size: 13px; color: var(--muted); margin-right: 2px; }
.save-status { font-size: 13px; color: var(--green-dark); }

/* typed save buttons */
.btn-type { color: #fff; }
.btn-todo { background: var(--slate); }
.btn-todo:hover { filter: brightness(1.07); }
.btn-idea { background: var(--green); }
.btn-idea:hover { background: var(--green-dark); }
.btn-knowledge { background: var(--teal); }
.btn-knowledge:hover { filter: brightness(1.07); }
.btn-personal { background: #6b7280; }
.btn-personal:hover { filter: brightness(1.1); }

/* Azure DevOps action */
.azure-actions { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.btn-azure { background: var(--slate-dark); color: #fff; }
.btn-azure:hover { filter: brightness(1.18); }
#azure-status a, #azure-hint a { color: var(--slate); }
.sep { border: 0; border-top: 1px solid var(--line); margin: 24px 0 18px; }

/* source chips (Knowledge results) */
.chip.src { font-weight: 500; }
.chip.s-journal { background: #eef3f7; color: var(--slate); }
.chip.s-note { background: #fff3e0; color: #b06f00; }
.chip.s-training { background: #e7f1ff; color: #2563a8; }
.chip.s-presentation { background: #f0e9fb; color: #6b46c1; }

/* calendar lock marker for days with private notes */
.cal-lock { position: absolute; bottom: 5px; right: 7px; font-size: 11px; opacity: .8; }

/* manage knowledge filter */
.manage-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 14px; }
.mf-btn { background: #f0f3f6; border: 1px solid var(--line); color: var(--muted); cursor: pointer;
  font-family: inherit; font-size: 13px; padding: 6px 12px; border-radius: 16px; }
.mf-btn:hover { color: var(--ink); }
.mf-btn.active { background: var(--slate); color: #fff; border-color: var(--slate); }

/* compact one-line rows in Manage (expand to editor on edit) */
.entry.mk-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.entry.mk-row .chip.src { flex: 0 0 auto; }
.mk-ref { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--slate-dark);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry.mk-row .entry-actions { flex: 0 0 auto; margin-left: auto; }
.mk-edit-head { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; word-break: break-word; }

/* drafts / voice capture */
.rec-row { display: flex; align-items: center; gap: 20px; margin: 18px 0; flex-wrap: wrap; }
.rec-upload { font-size: 13px; color: var(--muted); }
.entry.draft { border-left: 3px solid var(--green); }
.draft-text, #transcript-text { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 14px; line-height: 1.5; resize: vertical; margin-bottom: 8px; }
.draft-when { margin-left: auto; font-size: 12px; }

/* upload section */
.up-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 12px 0 6px; }
.up-row input[type=file] { font-size: 13px; }
.up-row .inline input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; width: 130px; }
.up-list { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.up-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.up-card.saved { background: #f7faf3; border-color: #dcecca; }
.up-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; font-size: 14px; }
.up-stat { font-size: 12.5px; color: var(--muted); }
.up-text { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 14px; line-height: 1.5; resize: vertical; }
.up-actions { margin-top: 8px; }

/* collapsible "subfolders" under Upload */
.upfolder { border: 1px solid var(--line); border-radius: 10px; margin: 14px 0; overflow: hidden; }
.upfolder > summary { cursor: pointer; padding: 14px 16px; font-weight: 600; color: var(--slate-dark);
  background: #f7fafc; list-style: none; display: flex; align-items: center; gap: 8px; }
.upfolder > summary::-webkit-details-marker { display: none; }
.upfolder > summary::before { content: "\25B8"; color: var(--slate); transition: transform .15s; }
.upfolder[open] > summary::before { transform: rotate(90deg); }
.upfolder > summary:hover { background: #eef3f7; }
.upfolder-body { padding: 16px; border-top: 1px solid var(--line); }

/* type chips on entry cards */
.chip.type { font-weight: 500; }
.chip.t-todo { background: #eef3f7; color: var(--slate); }
.chip.t-idea { background: #eef6e6; color: var(--green-dark); }
.chip.t-knowledge { background: #e6f4f6; color: #2f7c88; }
.chip.t-personal { background: #ececef; color: #555a63; }

/* mine cards: edit / delete actions + inline edit form */
.entry-actions { margin-left: auto; display: flex; gap: 4px; }
.entry-actions button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 6px; }
.entry-actions .edit:hover { color: var(--slate); background: #eef3f7; }
.entry-actions .del:hover { color: #c0392b; background: #fbecec; }
.edit-form .edit-text { width: 100%; padding: 11px 12px; border: 1px solid var(--slate); border-radius: 8px;
  font-family: inherit; font-size: 14px; line-height: 1.5; resize: vertical; }
.edit-row { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0 4px; }
.edit-row label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 5px; }
.edit-row select, .edit-row input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 14px; }
.edit-row input { width: 130px; }
.edit-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.edit-actions .btn { padding: 8px 16px; }
.edit-status { font-size: 13px; }

/* ---- entries / results ---- */
.entry-list { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.entry { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.entry-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.entry-date { font-weight: 500; color: var(--slate-dark); font-size: 13px; }
.entry-text { line-height: 1.55; white-space: pre-wrap; }
.entry-text mark, .entry-text b { background: #eef6e6; padding: 0 2px; border-radius: 3px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 11.5px; background: #eef3f7; color: var(--slate); padding: 3px 9px; border-radius: 11px; }
.chip.green { background: #eef6e6; color: var(--green-dark); }
.entry .del { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.entry .del:hover { color: #c0392b; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

/* expandable search results (Ask VIT) */
.entry.result .open-toggle { margin-left: auto; background: none; border: 1px solid var(--line);
  border-radius: 6px; color: var(--slate); cursor: pointer; font-size: 12px; padding: 3px 10px; white-space: nowrap; }
.entry.result .open-toggle:hover { background: #eef3f7; border-color: var(--slate); }
.entry.result .res-snippet { cursor: pointer; }
.entry.result .res-full { white-space: pre-wrap; line-height: 1.5; background: #fafbfc;
  border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 8px;
  max-height: 60vh; overflow: auto; font-size: 13.5px; }

/* Ask VIT — three result sections */
.result-section { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.result-section:first-of-type { border-top: 0; }
.result-head { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 14px; font-weight: 500; }
.result-count { color: var(--muted); font-size: 12.5px; }
.result-section .entry-list { margin-top: 12px; }
.chip.ai-chip { background: var(--green); color: #fff; font-weight: 600; font-size: 12px; }
#res-ai .empty { padding: 14px; }

/* ---- search ---- */
.search-bar { display: flex; gap: 8px; margin: 14px 0; }
.search-bar input { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.ai-answer { background: linear-gradient(180deg,#f6faf2,#fff); border: 1px solid #dcecca;
  border-left: 4px solid var(--green); border-radius: 10px; padding: 16px 18px; margin: 8px 0 16px; line-height: 1.6; }
.ai-answer .cite { color: var(--slate); font-weight: 500; }
.ai-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--green-dark);
  font-weight: 500; margin-bottom: 10px; flex-wrap: wrap; }
.ai-badge { background: var(--green); color: #fff; padding: 2px 9px; border-radius: 11px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.ai-body { line-height: 1.6; }
.ai-foot { margin-top: 12px; font-size: 12px; color: var(--muted); border-top: 1px dashed #d7e4c8; padding-top: 9px; }

/* company-knowledge section header (real entries, not AI) */
.src-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; color: var(--slate-dark); font-weight: 500; margin: 6px 0 12px; }
.src-badge { background: #eef3f7; color: var(--slate); padding: 2px 9px; border-radius: 11px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line);
  border-top-color: var(--slate); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

.block { display: block; margin: 16px 0 6px; font-size: 13px; color: var(--muted); }
.block input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
code { background: #f0f3f6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }

/* ---- calendar (My Journal) ---- */
.cal-controls { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; flex-wrap: wrap; }
.cal-nav { width: 34px; height: 34px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  font-size: 18px; line-height: 1; cursor: pointer; color: var(--slate-dark); }
.cal-nav:hover { border-color: var(--slate); color: var(--slate); }
.cal-label { font-weight: 500; color: var(--slate-dark); min-width: 150px; text-align: center; font-size: 16px; }
#cal-today { padding: 8px 12px; }
.cal-legend { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cal-legend .dot { margin-left: 8px; }

.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 12px; color: var(--muted); font-weight: 500; padding: 2px 0 6px; }
.cal-day { min-height: 66px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 7px;
  background: #fff; position: relative; }
.cal-day.blank { border: 0; background: transparent; }
.cal-day .dnum { font-size: 12.5px; color: var(--muted); }
.cal-day.today { border-color: var(--slate); }
.cal-day.today .dnum { color: var(--slate); font-weight: 700; }
.cal-day.has { cursor: pointer; background: #f7fafc; }
.cal-day.has:hover { border-color: var(--slate); }
.cal-day.sel { outline: 2px solid var(--slate); background: #eef3f7; }
.cal-count { position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--slate); font-weight: 600; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.t-todo { background: var(--slate); }
.dot.t-idea { background: var(--green); }
.dot.t-knowledge { background: var(--teal); }
.day-head { margin: 20px 0 2px; color: var(--slate-dark); }

@media (min-width: 641px) and (max-width: 760px) {
  #app-view { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: static; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; }
  .sidebar-brand .app-name { margin-top: 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .tab .ic { width: auto; }
  .tag-grid { grid-template-columns: 1fr 1fr; }
  .cal-day { min-height: 52px; }
  .cal-legend { width: 100%; margin-left: 0; }
  .topbar { flex-wrap: wrap; justify-content: center; height: auto; padding: 8px 12px; gap: 8px; }
  .askvit-top { position: static; transform: none; order: -1; }
  .askvit-top:active { transform: translateY(1px); }
}

/* ---- trainings sync counter ---- */
.sync-head { font-size: 15px; color: var(--slate-dark); margin: 4px 0 12px;
  padding: 10px 14px; background: #f0f4f8; border-radius: 8px; border-left: 4px solid var(--slate); }
.sync-head.ok { background: #f0f7e9; border-left-color: var(--green); }
.sync-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sync-table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12.5px;
  padding: 6px 10px; border-bottom: 1px solid var(--line); }
.sync-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.sync-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.sync-table th.num { text-align: right; }
.sync-table .barcell { width: 140px; }
.syncbar { background: var(--line); border-radius: 6px; height: 8px; overflow: hidden; }
.syncbar-fill { display: block; height: 100%; background: var(--slate); transition: width .3s; }
.syncbar-fill.part { background: var(--teal); }
.syncbar-fill.full { background: var(--green); }
.sync-orphan { margin-top: 12px; padding: 8px 12px; font-size: 13px; color: #8a6d1a;
  background: #fdf6e3; border-radius: 8px; border-left: 4px solid #e0b84d; }
.miss-details { margin-top: 14px; }
.miss-details summary { cursor: pointer; color: var(--slate-dark); padding: 8px 0; }
.miss-group { margin: 8px 0 4px; }
.miss-group-h { font-size: 13px; font-weight: 600; color: var(--slate); margin: 6px 0 2px; }
.miss-list { margin: 0 0 6px; padding-left: 18px; }
.miss-list li { font-size: 13px; color: var(--ink); padding: 2px 0; word-break: break-word; }
.miss-tag { font-size: 11px; color: var(--muted); background: var(--line);
  border-radius: 4px; padding: 1px 6px; margin-left: 6px; white-space: nowrap; }
.miss-tag.conv { color: var(--green-dark); background: #eef6e3; }
.sync-actions { display: flex; gap: 8px; align-items: center; }
.sync-scan { margin: 0 0 12px; padding: 10px 14px; font-size: 14px; border-radius: 8px;
  background: #eef4f9; color: var(--slate-dark); border-left: 4px solid var(--teal); }
.sync-scan.new { background: #f0f7e9; border-left-color: var(--green); }
.sync-scan .miss-list { margin-top: 6px; }

/* ===== Phone layout (≤640): off-canvas sidebar drawer, capture-first =====
   Placed last so it overrides the base .sidebar rule and the 641–760 tablet block. */
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  #app-view { flex-direction: row; }
  .sidebar { position: fixed; top: 0; left: 0; width: 240px; flex: none; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease; z-index: 50;
    box-shadow: var(--shadow); border-right: 1px solid var(--line); border-bottom: 0; }
  #app-view.nav-open .sidebar { transform: translateX(0); }
  #app-view.nav-open::before { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40; }
  .nav { flex-direction: column; }
  .main-area { width: 100%; min-width: 0; }
  .content { padding: 0 12px; margin: 16px auto; }
  /* topbar: ☰ left · ASK VIT centered (keep absolute centering) · Logout right */
  .topbar { height: 60px; padding: 0 12px; }
  .user-chip { display: none; }
  .tag-grid { grid-template-columns: 1fr 1fr; }
  .cal-legend { width: 100%; margin-left: 0; }
}
