/* huvaari.uvsdaam.com — Хичээлийн хуваарь (Google Calendar маягийн) */
:root {
  --bg: #ffffff;
  --line: #dadce0;
  --line-soft: #e8eaed;
  --text: #202124;
  --text2: #3c4043;
  --muted: #70757a;
  --blue: #1a73e8;
  --blue-dark: #174ea6;
  --blue-soft: #e8f0fe;
  --hover: #f1f3f4;
  --red: #ea4335;
  --shadow: 0 1px 3px rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .15);
  --sidebar: 264px;
  --topbar: 64px;
  --gutter: 56px;
  --hour: 48px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 'Roboto', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.spacer { flex: 1; }

/* ---------- Товчнууд ---------- */
.icon-btn {
  width: 40px; height: 40px; flex: none;
  border: 0; border-radius: 50%; background: transparent;
  display: inline-grid; place-items: center;
  color: var(--text2); position: relative;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 18px; height: 18px; }

.btn-outline {
  height: 36px; padding: 0 16px; flex: none;
  border: 1px solid var(--line); border-radius: 18px;
  background: #fff; font-weight: 500; color: var(--text2);
}
.btn-outline:hover { background: var(--hover); }

.btn-primary {
  height: 36px; padding: 0 22px; border: 0; border-radius: 18px;
  background: var(--blue); color: #fff; font-weight: 500;
}
.btn-primary:hover { background: #1b66c9; box-shadow: 0 1px 2px rgba(60,64,67,.3); }
.btn-primary.sm { height: 32px; padding: 0 16px; font-size: 13px; }

.btn-text {
  height: 36px; padding: 0 14px; border: 0; border-radius: 18px;
  background: transparent; color: var(--blue); font-weight: 500;
}
.btn-text:hover { background: var(--blue-soft); }
.btn-text.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-text.danger { color: #d93025; }
.btn-text.danger:hover { background: #fce8e6; }

/* ---------- Дээд мөр ---------- */
.topbar {
  height: var(--topbar);
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px 0 8px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; margin: 0 20px 0 4px; min-width: 0; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden;
  background: transparent; color: #fff;
  display: grid; place-items: center; font-size: 24px; line-height: 1;
}
/* Багшийн мэдээлэл: зүүн самбарт, шүүлтүүрийн дээр */
.t-card { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; margin-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.t-card-av { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; flex: none; }
.t-card-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-card-text { flex: 1; min-width: 0; }
.t-card-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-card-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-arrows { display: flex; flex: none; }
.period-title {
  margin: 0 0 0 6px; font-size: 22px; font-weight: 400; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.view-switch {
  display: flex; flex: none;
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
}
.view-switch button {
  height: 36px; padding: 0 14px; border: 0; background: #fff;
  font-weight: 500; color: var(--text2);
}
.view-switch button + button { border-left: 1px solid var(--line); }
.view-switch button:hover { background: var(--hover); }
.view-switch button.active { background: var(--blue-soft); color: var(--blue-dark); }
.dirty-dot {
  position: absolute; top: 7px; right: 7px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--red); border: 2px solid #fff; display: none;
}
.is-dirty .dirty-dot { display: block; }

/* ---------- Үндсэн бүтэц ---------- */
.layout { display: flex; height: calc(100% - var(--topbar)); }
.sidebar {
  width: var(--sidebar); flex: none;
  overflow-y: auto; padding: 12px 12px 32px;
  background: #fff;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scrim { display: none; }

.create-btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 24px 0 16px; margin: 4px 0 18px 4px;
  border: 0; border-radius: 16px; background: #fff;
  box-shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  font-weight: 500; color: var(--text2);
  transition: box-shadow .15s, background .15s;
}
.create-btn:hover { box-shadow: var(--shadow); background: #f8fbff; }
.create-btn svg { width: 28px; height: 28px; fill: var(--blue); }

/* Жижиг календарь */
.mini-cal { padding: 0 4px 0 8px; margin-bottom: 18px; user-select: none; }
.mc-head { display: flex; align-items: center; justify-content: space-between; padding-left: 4px; margin-bottom: 4px; }
.mc-head span { font-weight: 500; font-size: 14px; color: var(--text2); }
.mc-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.mc-dow { text-align: center; font-size: 10px; font-weight: 500; color: var(--muted); height: 22px; line-height: 22px; }
.mc-day {
  position: relative; width: 28px; height: 28px; margin: 0 auto;
  border: 0; border-radius: 50%; background: transparent;
  font-size: 11px; font-weight: 500; color: var(--text2);
}
.mc-day:hover { background: var(--hover); }
.mc-day.out { color: #a0a4a8; }
.mc-day.inrange { background: var(--blue-soft); color: var(--blue-dark); }
.mc-day.sel { background: #d2e3fc; color: var(--blue-dark); }
.mc-day.today { background: var(--blue); color: #fff; }
.mc-day.has::after {
  content: ''; position: absolute; bottom: 2px; left: 50%;
  width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; opacity: .55;
}

/* Шүүлтүүр */
.side-title { font-size: 14px; font-weight: 500; color: var(--text2); padding: 0 8px 6px; }
.filters { padding: 0 4px 12px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.filters .field { padding: 0 4px; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; min-width: 0; }
.field > span, .field-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.field-label { margin-bottom: 6px; }
select, input[type="date"], input[type="time"], input[type="text"], textarea, .sp-form input {
  width: 100%; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
select:focus, input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
select:disabled { background: #f8f9fa; color: var(--muted); }
#clearFilter { margin-left: 2px; }

/* Ангийн жагсаалт (My calendars шиг) */
.legend { border-top: 1px solid var(--line-soft); padding: 14px 4px 6px; }
.lg-group { margin-bottom: 10px; }
.lg-head { font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 8px 4px; }
.lg-item {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text2);
}
.lg-item:hover { background: var(--hover); }
.lg-item input { position: absolute; opacity: 0; pointer-events: none; }
.lg-box {
  width: 18px; height: 18px; flex: none; border-radius: 3px;
  border: 2px solid var(--c); background: var(--c);
  display: grid; place-items: center;
}
.lg-box svg { width: 14px; height: 14px; fill: #fff; }
.lg-item.off .lg-box { background: transparent; }
.lg-item.off .lg-box svg { display: none; }
.lg-item.focus { font-weight: 500; color: var(--text); }
.lg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Мэдэгдэл */
.notes { padding: 4px 4px 0; }
.note-card {
  border-left: 4px solid var(--c, var(--blue)); background: #f8f9fa;
  border-radius: 6px; padding: 8px 10px; margin-bottom: 8px;
  font-size: 12.5px; color: var(--text2); white-space: pre-line;
}
.note-card b { display: block; font-size: 12px; color: var(--text); margin-bottom: 2px; white-space: normal; }

/* ---------- 7 хоног / өдрийн харагдац ---------- */
.tg { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.tg-head, .tg-allday { display: flex; flex: none; overflow: hidden; scrollbar-gutter: stable; }
.tg-allday { border-bottom: 1px solid var(--line); box-shadow: 0 2px 2px -2px rgba(60,64,67,.25); position: relative; z-index: 2; }
.tg-gutter { width: var(--gutter); flex: none; font-size: 10px; color: var(--muted); text-align: right; padding: 6px 8px 0 0; }
.tg-row { flex: 1; display: grid; min-width: 0; }
.tg-dayhead { text-align: center; padding: 8px 0 6px; cursor: pointer; min-width: 0; }
.tg-dayhead .dow { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .5px; }
.tg-dayhead .dnum {
  width: 46px; height: 46px; margin: 2px auto 0; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px; color: var(--text2);
}
.tg-dayhead:hover .dnum { background: var(--hover); }
.tg-dayhead.today .dow { color: var(--blue); }
.tg-dayhead.today .dnum { background: var(--blue); color: #fff; }
.tg-adcell {
  border-left: 1px solid var(--line); min-height: 26px; min-width: 0;
  padding: 2px 3px 4px; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
}
.tg-scroll { flex: 1; overflow-y: auto; scrollbar-gutter: stable; min-height: 0; }
.tg-body { position: relative; display: flex; }
.tg-hours { width: var(--gutter); flex: none; position: relative; }
.tg-hour {
  position: absolute; right: 8px; transform: translateY(-50%);
  font-size: 10px; color: var(--muted); white-space: nowrap;
}
.tg-cols {
  flex: 1; display: grid; position: relative; min-width: 0;
  background-image: linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 100% var(--hour);
}
.tg-col { position: relative; border-left: 1px solid var(--line); min-width: 0; cursor: pointer; }
.tg-col.today { background: rgba(26, 115, 232, .035); }

.ev {
  position: absolute; z-index: 1;
  border-radius: 6px; border: 1px solid #fff;
  background: var(--c); color: var(--t, #fff);
  border-left: 4px solid color-mix(in srgb, var(--c) 65%, #000);
  padding: 2px 6px; font-size: 12px; line-height: 1.3;
  overflow: hidden; cursor: pointer;
  transition: box-shadow .12s;
}
.ev:hover { box-shadow: 0 2px 6px rgba(0,0,0,.28); z-index: 5; }
.ev-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-time, .ev-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .95; }
.ev.short { display: flex; align-items: center; gap: 6px; padding-top: 0; }
.ev.short .ev-sub { display: none; }
.ev.short .ev-time { flex: none; }
.ev.ghost { background: var(--blue); opacity: .75; pointer-events: none; }

.now-line {
  position: absolute; left: -1px; right: 0; height: 2px;
  background: var(--red); z-index: 6; pointer-events: none;
}
.now-line::before {
  content: ''; position: absolute; left: -6px; top: -5px;
  width: 12px; height: 12px; border-radius: 50%; background: var(--red);
}

/* ---------- Сарын харагдац ---------- */
.mv { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.mv-dows { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); flex: none; }
.mv-dow {
  text-align: center; font-size: 11px; font-weight: 500; color: var(--muted);
  padding: 8px 0 2px; border-left: 1px solid var(--line);
}
.mv-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 0; }
.mv-cell {
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 2px 4px 4px; min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 1px; cursor: pointer;
}
.mv-cell.out { background: #fafafa; }
.mv-cell.out .mv-num { color: #a0a4a8; }
.mv-num {
  align-self: center; flex: none;
  min-width: 24px; height: 24px; padding: 0 4px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 500; color: var(--text2); margin: 2px 0;
}
.mv-num:hover { background: var(--hover); }
.mv-num.today { background: var(--blue); color: #fff; }
.mv-more {
  border: 0; background: none; text-align: left; flex: none;
  font-size: 12px; font-weight: 500; color: var(--text2);
  padding: 1px 6px; border-radius: 4px;
}
.mv-more:hover { background: var(--hover); }

.chip {
  display: flex; align-items: center; gap: 5px; flex: none;
  font-size: 12px; line-height: 18px; padding: 1px 6px; border-radius: 4px;
  white-space: nowrap; overflow: hidden; cursor: pointer; min-width: 0;
}
.chip:hover { background: var(--hover); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.chip-time { color: var(--muted); flex: none; }
.chip-txt { overflow: hidden; text-overflow: ellipsis; color: var(--text2); }
.chip.fill { background: var(--c); color: var(--t, #fff); font-weight: 500; border-left: 3px solid color-mix(in srgb, var(--c) 65%, #000); }
.chip.fill .chip-txt, .chip.fill .chip-time { color: var(--t, #fff); }
.chip.fill .dot { display: none; }
.chip.fill:hover { filter: brightness(.94); }

/* ---------- Popover ---------- */
.popover {
  position: fixed; z-index: 40; width: 400px; max-width: calc(100vw - 24px);
  background: #fff; border-radius: 12px; box-shadow: 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12), 0 11px 15px -7px rgba(0,0,0,.2);
  padding: 8px 8px 16px;
  max-height: calc(100vh - 24px); overflow-y: auto;
}
.pop-actions { display: flex; justify-content: flex-end; gap: 2px; }
.pop-row { display: flex; gap: 16px; padding: 4px 16px 4px 12px; align-items: flex-start; }
.pop-icon { width: 24px; flex: none; display: grid; place-items: center; padding-top: 1px; }
.pop-icon svg { width: 20px; height: 20px; fill: var(--muted); }
.pop-swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--c); margin-top: 6px; }
.pop-title { font-size: 22px; line-height: 1.3; color: var(--text); word-break: break-word; }
.pop-sub { color: var(--text2); margin-top: 2px; }
.pop-text { color: var(--text2); font-size: 14px; padding-top: 2px; white-space: pre-line; word-break: break-word; }
.pop-text small { color: var(--muted); font-size: 12px; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 10px;
  background: var(--hover); color: var(--text2); margin-right: 4px;
}
.pop-foot { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px 0 48px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(32, 33, 36, .45);
  display: grid; place-items: center; padding: 16px;
}
.modal-card {
  width: 560px; max-width: 100%; max-height: calc(100vh - 32px);
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-card.wide { width: 1000px; }
.modal-head { display: flex; align-items: center; padding: 12px 12px 4px 24px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 500; }
.modal-body { padding: 8px 24px 12px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 6px; padding: 12px 16px 14px; border-top: 1px solid var(--line-soft); }
.title-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  font-size: 22px; padding: 6px 0 8px; margin-bottom: 16px; outline: none; height: auto;
}
.title-input:focus { border-bottom: 2px solid var(--blue); box-shadow: none; padding-bottom: 7px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin: 4px 0 14px; }
.seg button { border: 0; background: #fff; height: 34px; padding: 0 14px; font-weight: 500; color: var(--text2); font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--blue-soft); color: var(--blue-dark); }
.day-toggles { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.day-toggles button {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; font-size: 12px; font-weight: 500; color: var(--text2);
}
.day-toggles button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.check { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--text2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.form-error { color: #d93025; font-size: 13px; min-height: 18px; margin: 0; }

/* ---------- Тохиргоо ---------- */
.sp-wrap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.sp { border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; min-height: 360px; overflow: hidden; }
.sp-head {
  display: flex; align-items: center; gap: 6px; padding: 10px 8px 10px 14px;
  border-bottom: 1px solid var(--line-soft); background: #f8f9fa;
}
.sp-head b { flex: 1; font-weight: 500; }
.sp-head small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.sp-list { list-style: none; margin: 0; padding: 6px; flex: 1; overflow-y: auto; max-height: 260px; }
.sp-list li {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.sp-list li:hover { background: var(--hover); }
.sp-list li.sel { background: var(--blue-soft); color: var(--blue-dark); font-weight: 500; }
.sp-list li .cnt { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.sp-list .sw { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.sp-empty { color: var(--muted); font-size: 13px; padding: 12px; }
.sp-form { border-top: 1px solid var(--line-soft); padding: 12px 14px 14px; }
.sp-form-title { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 8px; }
.sp-form .field { margin-bottom: 8px; }
.sp-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.swatches label { position: relative; cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 22px; height: 22px; border-radius: 50%; background: var(--c); }
.swatches input:checked + span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }
.swatches .none span { background: #fff; border: 2px dashed #9aa0a6; box-sizing: border-box; }

/* ---------- Горим: багш засна / нийтийн хуваарь харна ---------- */
.mode-view .edit-only, .mode-edit .view-only { display: none !important; }
.mode-view .tg-col, .mode-view .tg-adcell, .mode-view .mv-cell { cursor: default; }
.is-loading .layout .sidebar > * { visibility: hidden; }
.loading { margin: auto; padding: 48px 16px; color: var(--muted); text-align: center; }
a.brand { color: inherit; text-decoration: none; }
a.btn-share, a.btn-text { text-decoration: none; display: inline-flex; align-items: center; }

.btn-share {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 36px; padding: 0 16px 0 12px; margin-left: 6px;
  border: 0; border-radius: 18px; background: var(--blue-soft); color: var(--blue-dark); font-weight: 500;
}
.btn-share:hover { background: #d2e3fc; }
.btn-share svg { width: 18px; height: 18px; fill: currentColor; }

.pick-btn {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0;
  height: 36px; padding: 0 8px 0 14px; margin-right: 6px;
  border: 1px solid var(--line); border-radius: 18px; background: #fff; color: var(--text2); font-weight: 500;
}
.pick-btn:hover { background: var(--hover); }
.pick-btn #pickLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-btn svg { width: 20px; height: 20px; fill: var(--muted); flex: none; }
.pick-btn .sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* Бүртгэлийн цэс */
.account { position: relative; margin-left: 2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; border: 0; margin: 0 4px;
  background: #7b1fa2; color: #fff; font-weight: 500; font-size: 15px;
}
.avatar:hover { box-shadow: 0 0 0 4px var(--hover); }
.menu {
  position: absolute; right: 0; top: 44px; z-index: 45; min-width: 240px;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 6px 0;
}
.menu-head { padding: 10px 16px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 4px; }
.menu-head b { display: block; font-weight: 500; }
.menu-head small { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 9px 16px; border: 0; background: none;
  color: var(--text2); text-decoration: none; font-size: 14px;
}
.menu a:hover, .menu button:hover { background: var(--hover); }
.menu .danger { color: #d93025; }

/* Хуваалцах */
.share-card { width: 440px; }
.share-lead { margin: 0 0 14px; color: var(--text2); font-size: 13.5px; }
.qr-wrap {
  display: grid; place-items: center; padding: 12px; margin-bottom: 14px;
  border: 1px solid var(--line-soft); border-radius: 12px; background: #fff;
}
.qr-wrap img { width: 240px; height: 240px; max-width: 100%; image-rendering: pixelated; }
.link-row { display: flex; gap: 8px; align-items: center; }
.link-row input { flex: 1; min-width: 0; font-size: 13px; background: #f8f9fa; }
.link-row .btn-primary { height: 38px; flex: none; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.share-actions .btn-outline { display: inline-flex; align-items: center; text-decoration: none; color: var(--blue); }

/* Нийтийн хуваарь: сонголт */
.pick-card { width: 480px; }
.pick-step { font-size: 12px; font-weight: 500; color: var(--muted); margin: 6px 0 8px; }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 14px; }
.pick-item {
  display: flex; align-items: center; gap: 10px; text-align: left; min-height: 48px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.pick-item:hover { background: var(--hover); }
.pick-item b { font-weight: 500; }
.pick-item small { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.pick-item .sw { width: 14px; height: 14px; border-radius: 50%; background: var(--c); flex: none; }
.pick-item.ghost { color: var(--muted); justify-content: center; }
.pick-item.sel { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 1px var(--blue); }
.pick-foot { display: flex; align-items: center; gap: 8px; padding: 8px 0 4px; border-top: 1px solid var(--line-soft); }
.btn-primary:disabled { background: #8ab4f8; cursor: not-allowed; box-shadow: none; }

/* Профайл */
.profile-box {
  display: flex; align-items: flex-end; gap: 10px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 2px;
}
.profile-box .field { flex: 1; }
.pf-photo { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pf-img {
  width: 56px; height: 56px; border-radius: 50%; border: 0; padding: 0; overflow: hidden; flex: none;
  background: #7b1fa2; color: #fff; font-size: 22px; font-weight: 500; cursor: pointer;
}
.pf-img img, .avatar img, .brand-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-btns { display: flex; flex-direction: column; align-items: flex-start; }
.avatar.has-img { padding: 0; overflow: hidden; background: #e8eaed; }
.profile-box input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; outline: none; }
.profile-box .btn-primary { margin-bottom: 10px; }
.sp-wrap.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-card.wide { width: 860px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 24px; bottom: 24px; z-index: 60;
  background: #323232; color: #fff; padding: 12px 18px; border-radius: 6px;
  font-size: 14px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 48px);
}
.toast.show { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .brand { margin-right: 8px; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: var(--topbar); bottom: 0; left: 0; z-index: 30;
    transform: translateX(-105%); transition: transform .2s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: var(--topbar) 0 0 0; z-index: 25; background: rgba(32,33,36,.3); }
  .sp-wrap, .sp-wrap.two { grid-template-columns: 1fr; }
  .btn-share span { display: none; }
  .btn-share { padding: 0; width: 36px; justify-content: center; }
  .sp { min-height: 0; }
  .sp-list { max-height: 180px; }
}
@media (min-width: 901px) {
  .sidebar.collapsed { display: none; }
}
@media (max-width: 720px) {
  :root { --gutter: 40px; --topbar: 56px; }
  .topbar { gap: 2px; padding: 0 6px 0 2px; }
  .brand { display: none; }
  .period-title { font-size: 17px; margin-left: 2px; }
  .btn-outline { padding: 0 10px; height: 32px; font-size: 13px; }
  .view-switch button { padding: 0 9px; height: 32px; font-size: 12px; }
  .nav-arrows .icon-btn { width: 32px; height: 32px; }
  #settingsBtn { display: none; } /* утсан дээр бүртгэлийн цэснээс нээнэ */
  .btn-share { width: 32px; height: 32px; margin-left: 2px; }
  .avatar { width: 30px; height: 30px; margin: 0 2px; font-size: 13px; }
  .pick-btn { height: 32px; padding: 0 4px 0 10px; font-size: 12.5px; max-width: 42vw; }
  .mode-view .view-switch button { padding: 0 7px; }
  .tg-dayhead .dnum { width: 32px; height: 32px; font-size: 16px; }
  .tg-dayhead .dow { font-size: 10px; }
  .ev { padding: 1px 3px; font-size: 10.5px; border-radius: 4px; }
  .chip { font-size: 10.5px; padding: 0 3px; gap: 3px; line-height: 16px; }
  .chip .chip-time { display: none; }
  .mv-cell { padding: 1px 1px 2px; }
  .grid3 { grid-template-columns: 1fr; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-card { max-height: 92vh; border-radius: 16px 16px 0 0; width: 100%; }
  .modal-body { padding: 8px 16px 12px; }
  .popover { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; max-width: none; max-height: 75vh; }
}
@media (max-width: 420px) {
  #todayBtn { display: none; }
}

/* ---------- Админ: нэгдсэн хуудас ---------- */
.adm-wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.adm-form { min-height: 0; }
.adm-fields { padding: 12px 14px 14px; }
.adm-search { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; outline: none; }
.adm-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 10px; padding: 4px; }
.adm-t { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.adm-t:hover { background: var(--hover); }
.adm-t input { width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.adm-t b { display: block; font-weight: 500; font-size: 14px; }
.adm-t small { display: block; color: var(--muted); font-size: 12px; }
.adm-av { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex: none; background: #7b1fa2; color: #fff; display: grid; place-items: center; font-weight: 500; }
.adm-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adm-share { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line-soft); }
.adm-share > div { flex: 1; min-width: 0; }
.adm-share img { flex: none; border: 1px solid var(--line-soft); border-radius: 8px; }
@media (max-width: 720px) {
  .adm-wrap { grid-template-columns: 1fr; }
  .adm-share { flex-direction: column; align-items: stretch; }
  .adm-share img { align-self: center; }
}
.btn-outline.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.adm-sec { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.adm-fields.adm-sec { margin-top: 0; }
.adm-hint { color: var(--muted); font-size: 13px; margin: 4px 0; }
.adm-logo { display: flex; gap: 14px; align-items: center; }
.adm-logo img { width: 72px; height: 72px; object-fit: contain; border: 1px solid var(--line-soft); border-radius: 12px; background: #faf8f6; flex: none; }
.adm-logo > div { display: flex; gap: 6px; flex-wrap: wrap; }
.adm-map { height: 260px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; cursor: crosshair; z-index: 0; position: relative; }
.adm-loc { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.adm-loc small { color: var(--muted); font-size: 12px; }
.adm-post-form { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fafafa; }
.adm-post-form .field { margin-bottom: 8px; }
.adm-posts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.adm-post { display: flex; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--line-soft); border-radius: 10px; }
.adm-post > img, .adm-post-noimg { width: 56px; height: 42px; border-radius: 6px; object-fit: cover; flex: none; display: grid; place-items: center; background: #f1f3f4; }
.adm-post > div { flex: 1; min-width: 0; }
.adm-post b { display: block; font-weight: 500; font-size: 14px; }
.adm-post small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Нийтлэл, зарлал ---------- */
.posts-btn { position: relative; background: #fef7e0; color: #8a5a00; }
.posts-btn:hover { background: #feefc3; }
.posts-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; border: 2px solid #fff; box-sizing: content-box;
}
.pv-list { display: flex; flex-direction: column; gap: 14px; }
.pv { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pv > div { padding: 12px 14px; }
.pv b { display: block; font-size: 16px; font-weight: 500; }
.pv p { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; color: var(--text2); }
.pv time { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.post-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.post-thumb { position: relative; width: 84px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-soft); }
.post-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-thumb button {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(0,0,0,.65); color: #fff; font-size: 12px; line-height: 22px; cursor: pointer;
}
.post-add {
  width: 84px; height: 64px; border-radius: 8px; border: 2px dashed var(--line); background: #fff; color: var(--blue);
  font-size: 22px; line-height: 1; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.post-add small { font-size: 10.5px; color: var(--muted); }
.post-add:hover { border-color: var(--blue); }
.adm-post-pic { position: relative; flex: none; }
.adm-post-pic img { width: 56px; height: 42px; border-radius: 6px; object-fit: cover; display: block; }
.adm-post-pic i {
  position: absolute; right: 2px; bottom: 2px; font-style: normal; font-size: 10px; color: #fff; background: rgba(0,0,0,.65);
  border-radius: 6px; padding: 0 4px; line-height: 14px;
}
.adm-picked { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line-soft); border-radius: 10px; padding: 4px; margin-bottom: 8px; }
.adm-picked .adm-t { cursor: default; }
.adm-picked .adm-t > span:not(.adm-av) { flex: 1; min-width: 0; }
.adm-picked small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-add { display: flex; gap: 8px; }
.adm-add input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; outline: none; }
.adm-add input:focus { border-color: var(--blue); }
.adm-add .btn-primary { height: 36px; }
