/* ============================================================
   МОНХОРУС — Медиа төв
   Фонт: Inter (100–700). Italic хэзээ ч ашиглахгүй.
   Байршуулалт: бүтэн өргөнтэй гүн цэнхэр туузууд + гэрэл агуулга.
   ============================================================ */

:root {
  --navy: #00205c;
  --navy-hover: #002a74;
  --aqua: #009dba;

  --paper: #ffffff;
  --grey: #f2f4f7;
  --grey-2: #e7eaf0;

  --ink: #10182b;
  --ink-soft: #4a5468;
  --ink-faint: #7a8496;

  --line: #dde2ea;
  --line-dark: rgba(255, 255, 255, 0.18);

  --radius: 2px;
  --header-h: 88px;
  --maxw: 1240px;
  --gutter: 40px;
}

* { box-sizing: border-box; }

/* Компонентууд display:flex/grid тавьдаг тул [hidden]-г хүчээр дийлэх */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* Брэндбүүк: аливаа тохиолдолд italic ашиглахыг хориглоно. */
i, em, cite, address, var { font-style: normal; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

img { max-width: 100%; }

::selection { background: var(--navy); color: #fff; }

*:focus-visible { outline: 2px solid var(--aqua); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- дүрснүүд */

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
  color: inherit;
}

/* ------------------------------------------------------------------ толгой */

.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--navy);
  color: #fff;
}

.masthead__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  gap: 24px;
}

.brandlock { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

.brandlock__logo { height: 44px; width: auto; display: block; }

.brandlock__rule { width: 1px; height: 30px; background: var(--line-dark); }

.brandlock__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
}

.masthead__nav { display: flex; margin-left: auto; align-items: center; height: 100%; }

/* Гар утасны цэсний товч — зөвхөн нарийн дэлгэцэд. */
.navtoggle {
  display: none;
  margin-left: auto;
  appearance: none;
  border: 1px solid var(--line-dark);
  background: transparent;
  color: #fff;
  border-radius: var(--radius);
  width: 42px;
  height: 42px;
  cursor: pointer;
  place-items: center;
}

.navtoggle .i { width: 22px; height: 22px; }

.navtoggle__close { display: none; }

.navlink {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
  font-weight: 500;
  padding: 0 16px;
  height: 100%;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}

.navlink:hover { color: #fff; }

.navlink[aria-current='true'] { color: #fff; font-weight: 600; border-bottom-color: var(--aqua); }

/* --------------------------------------------------- гарчгийн тууз ба бүс */

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }

.titleband {
  background: var(--navy);
  color: #fff;
  padding: 44px 0 46px;
}

.titleband h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 300; letter-spacing: -0.015em; }

.band { background: var(--paper); padding: 52px 0 56px; }

.band--grey { background: var(--grey); }

/* Airbus-маягийн хэсгийн гарчиг: том нимгэн бичиг + доор нь богино зузаан зураас */
.sec { font-size: clamp(22px, 2.4vw, 30px); font-weight: 400; color: var(--navy); }

.rule {
  display: block;
  width: 34px;
  height: 5px;
  background: var(--navy);
  margin: 16px 0 22px;
}

.lead { margin: 0; max-width: 74ch; color: var(--ink-soft); font-size: 15.5px; }

/* ---------------------------------------------------------------- товчлуур */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: 0.13s;
  white-space: nowrap;
  text-align: center;
}

.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-hover); }

.btn--outline { background: transparent; border-color: var(--navy); color: var(--navy); }
.btn--outline:hover { background: var(--navy); color: #fff; }

/* Гүн цэнхэр хавтан дээр сууна */
.btn--light { background: #fff; color: var(--navy); }
.btn--light:hover { background: var(--grey-2); }

.btn--quiet { background: transparent; color: var(--ink-soft); }
.btn--quiet:hover { background: var(--grey); color: var(--ink); }

.btn--sm { padding: 8px 13px; font-size: 13px; gap: 7px; }
.btn--sm .i { width: 16px; height: 16px; }

.btn--block { width: 100%; }

.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------------------------ хавтан */

.tilegrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2px;
}

.tile {
  background: var(--navy);
  color: #fff;
  padding: 32px 28px 30px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 176px;
}

.tile h3 { font-size: 21px; font-weight: 400; }

.tile .btn { align-self: flex-start; margin-top: auto; }

/* ----------------------------------------------------------------- toolbar */

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 26px; }

.toolbar__spacer { flex: 1 1 auto; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--paper);
  min-width: 280px;
  color: var(--ink-faint);
}

.search:focus-within { border-color: var(--navy); color: var(--navy); }

.search input {
  border: 0;
  outline: none;
  background: transparent;
  padding: 11px 0;
  width: 100%;
  color: var(--ink);
  border-radius: 0;
}

.search input::placeholder { color: var(--ink-faint); }

/* ------------------------------------------------- салбар компанийн картууд */

.subgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 20px; }

.subcard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  transition: border-color 0.13s, box-shadow 0.13s;
}

.subcard:hover { border-color: var(--navy); box-shadow: 0 2px 14px rgba(0, 32, 92, 0.1); }

.subcard__preview {
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 32px;
  background: var(--grey);
  border-bottom: 1px solid var(--line);
}

.subcard__preview--dark { background: var(--navy); }

/* Тогтмол өндөртэй эцэг дотор зураг хэзээ ч халихгүй (Safari-д ч мөн). */
.subcard__preview img { width: 100%; height: 100%; object-fit: contain; }

.subcard__body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }

.subcard__name { font-size: 18px; font-weight: 500; color: var(--navy); }

.subcard__en { font-size: 13px; color: var(--ink-faint); }

.subcard__meta {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}

.subcard__count { font-size: 12.5px; color: var(--ink-faint); margin-right: auto; }

/* ------------------------------------------------------------------ зургууд */

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }

.photo {
  position: relative;
  border: 1px solid var(--line);
  background: var(--grey);
  aspect-ratio: 4 / 3;
  cursor: zoom-in;
  overflow: hidden;
}

.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo__bar {
  position: absolute;
  inset: auto 0 0 0;
  padding: 34px 12px 12px;
  background: linear-gradient(transparent, rgba(0, 22, 64, 0.9));
  display: flex;
  align-items: flex-end;
  gap: 10px;
  opacity: 0;
  transition: opacity 0.14s;
  color: #fff;
}

.photo:hover .photo__bar, .photo:focus-within .photo__bar { opacity: 1; }

.photo__name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.photo__dl {
  appearance: none;
  border: 0;
  background: #fff;
  color: var(--navy);
  border-radius: var(--radius);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.photo__dl:hover { background: var(--aqua); color: #fff; }

/* ---------------------------------------------------------------- материал */

.filelist { border: 1px solid var(--line); border-radius: var(--radius); }

.filerow {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  background: var(--paper);
  transition: background 0.12s;
}

.filerow + .filerow { border-top: 1px solid var(--line); }

.filerow:hover { background: var(--grey); }

.filerow__ext {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--navy);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.filerow__main { flex: 1; min-width: 0; }

.filerow__title { font-size: 15.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filerow__meta { font-size: 12.5px; color: var(--ink-faint); }

/* ------------------------------------------------------------ хоосон төлөв */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 64px 30px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--grey);
}

.empty h3 { font-size: 17px; font-weight: 500; margin-bottom: 8px; color: var(--ink); }

.empty p { margin: 0; }

.empty code {
  background: #fff;
  border: 1px solid var(--line);
  padding: 2px 7px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--navy);
}

/* -------------------------------------------------------------- лого нэмэгч */

.stamper { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; align-items: start; }

.stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 540px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--paper);
}

.dropzone {
  flex: 1;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 30px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: 0.14s;
  background: var(--grey);
  gap: 6px;
}

.dropzone__icon { width: 30px; height: 30px; color: var(--ink-faint); margin-bottom: 10px; }

.dropzone:hover, .dropzone.is-over { border-color: var(--navy); background: #eaeef5; }

.dropzone:hover .dropzone__icon, .dropzone.is-over .dropzone__icon { color: var(--navy); }

.dropzone strong { font-size: 16px; font-weight: 600; color: var(--ink); }

.dropzone span { max-width: 44ch; font-size: 13.5px; }

.canvas-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  background: var(--grey);
  border: 1px solid var(--line);
  overflow: hidden;
  min-height: 420px;
  padding: 16px;
}

#stampCanvas { max-width: 100%; max-height: 60vh; display: block; cursor: grab; touch-action: none; }

#stampCanvas.is-dragging { cursor: grabbing; }

.filmstrip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }

.filmstrip__item {
  position: relative;
  width: 62px;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex-shrink: 0;
  cursor: pointer;
  background: var(--grey);
}

.filmstrip__item img { width: 100%; height: 100%; object-fit: cover; }

.filmstrip__item[aria-current='true'] { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }

.filmstrip__x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 17px;
  height: 17px;
  border: 0;
  background: rgba(0, 22, 64, 0.85);
  color: #fff;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}

.filmstrip__x .i { width: 11px; height: 11px; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 22px;
  position: sticky;
  top: calc(var(--header-h) + 20px);
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
}

.panel h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h3 .i { width: 15px; height: 15px; }

.panel section + section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }

.field { margin-bottom: 16px; }

.field > label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.field > label b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.fieldlabel {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 10px;
}

.fieldlabel b { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink-faint); margin-left: 6px; }

/* Бүх текстэн оролт, сонголтыг нэг загвараар. Шинэ төрөл нэмэхэд
   (email, search, tel …) тусад нь дүрэм бичих шаардлагагүй. */
/* :where() нь тусгаарлалт (specificity) нэмэхгүй тул .search input зэрэг
   тодорхой дүрмүүд үүнийг чөлөөтэй дарж бичиж чадна. */
select,
input:where(:not([type='range'], [type='checkbox'], [type='radio'], [type='file'])) {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--paper);
  outline: none;
  font: inherit;
  color: inherit;
}

select:focus,
input:where(:not([type='range'], [type='checkbox'], [type='radio'])):focus {
  border-color: var(--navy);
}

input[type='range'] {
  width: 100%;
  appearance: none;
  height: 3px;
  background: var(--grey-2);
  outline: none;
}

input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--navy);
  cursor: pointer;
}

.anchorgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; aspect-ratio: 3 / 2; max-width: 150px; }

.anchorgrid button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--grey);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.anchorgrid button::after { content: ''; width: 12px; height: 4px; background: var(--ink-faint); }

.anchorgrid button:hover { border-color: var(--navy); }

.anchorgrid button[aria-pressed='true'] { background: var(--navy); border-color: var(--navy); }
.anchorgrid button[aria-pressed='true']::after { background: #fff; }

.logopicker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; max-height: 196px; overflow-y: auto; padding-right: 3px; }

.logopicker button {
  appearance: none;
  border: 1px solid var(--line);
  padding: 9px 8px;
  cursor: pointer;
  background: var(--grey);
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logopicker button.on-dark { background: var(--navy); }

.logopicker button img { width: 100%; height: 100%; object-fit: contain; }

.logopicker button[aria-pressed='true'] { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }

.switch { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; margin-bottom: 12px; color: var(--ink-soft); }

.switch input { width: 15px; height: 15px; accent-color: var(--navy); margin: 0; }

.hint { font-size: 12px; color: var(--ink-faint); line-height: 1.5; margin: 14px 0 0; padding-left: 12px; border-left: 2px solid var(--line); }

.stack { display: flex; flex-direction: column; gap: 8px; }

/* ------------------------------------------------------------------- диалог */

dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  width: min(580px, 94vw);
  background: var(--paper);
  color: var(--ink);
  max-height: 92vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 22, 64, 0.3);
}

dialog::backdrop { background: rgba(0, 22, 64, 0.62); }

.dialog__head {
  padding: 22px 26px 20px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog__head h2 { font-size: 20px; font-weight: 500; }

.dialog__head p { margin: 4px 0 0; font-size: 12.5px; color: rgba(255, 255, 255, 0.62); }

.dialog__body { padding: 24px 26px; overflow-y: auto; max-height: 60vh; }

.dialog__foot {
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  background: var(--grey);
}

.dialog__foot-actions { display: flex; gap: 10px; }

.iconbtn {
  appearance: none;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #fff;
}

.iconbtn:hover { background: rgba(255, 255, 255, 0.28); }

/* Тогтмол өндөр + object-fit → зураг диалогоос хэзээ ч халихгүй */
.dl-preview {
  height: 124px;
  border: 1px solid var(--line);
  padding: 20px 26px;
  margin-bottom: 24px;
  background: var(--grey);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dl-preview--dark { background: var(--navy); }

.dl-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }

.optrow { margin-bottom: 22px; }

.optrow--split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.optgrid { display: flex; gap: 8px; flex-wrap: wrap; }

.opt {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 10px 16px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-soft);
  transition: 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.opt:hover { border-color: var(--navy); color: var(--navy); }

.opt[aria-pressed='true'] { border-color: var(--navy); background: var(--navy); color: #fff; font-weight: 500; }

.opt__dot { width: 13px; height: 13px; border-radius: 50%; border: 1px solid var(--line); display: block; }

.opt[aria-pressed='true'] .opt__dot { border-color: rgba(255, 255, 255, 0.5); }

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

.sizegrid .opt { display: block; text-align: center; padding: 11px 6px; font-weight: 600; color: var(--ink); }

.sizegrid .opt small { display: block; font-weight: 400; font-size: 10.5px; color: var(--ink-faint); margin-top: 3px; }

.sizegrid .opt[aria-pressed='true'] { color: #fff; }
.sizegrid .opt[aria-pressed='true'] small { color: rgba(255, 255, 255, 0.7); }

/* lightbox */

#lightbox { width: auto; max-width: 94vw; }

#lightbox img { display: block; max-width: 92vw; max-height: 76vh; }

#lightbox .dialog__foot { justify-content: space-between; align-items: center; }

#lbName { font-size: 13px; color: var(--ink-faint); }

/* ------------------------------------------------------------------ toasts */

.toasts { position: fixed; right: 26px; bottom: 26px; z-index: 100; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }

.toast {
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 22, 64, 0.28);
  animation: rise 0.18s ease-out;
}

@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

/* ---------------------------------------------------------------- хөл хэсэг */

.sitefoot { background: var(--navy); color: rgba(255, 255, 255, 0.55); padding: 34px 0; font-size: 13px; }

.sitefoot__inner { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }

.sitefoot img { height: 30px; width: auto; }

.sitefoot__motto { margin-left: auto; color: rgba(255, 255, 255, 0.75); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1040px) {
  .stamper { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
}

/* Толгой хэсэгт лого + 5 цэс багтахад дор хаяж 760px хэрэгтэй. Эвхдэг утас,
   жижиг таблет (~840px) дээр шахагдахгүйн тулд 900px-ээс доош цэсийг
   бүрэн хэмжээний жагсаалт болгоно. */
@media (max-width: 900px) {
  .brandlock__rule, .brandlock__label { display: none; }
  .navtoggle { display: grid; }

  .masthead { position: relative; }
  .masthead__inner { position: static; }

  .masthead__nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    height: auto;
    background: var(--navy);
    border-top: 1px solid var(--line-dark);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
    padding: 6px 0 10px;
    z-index: 50;
  }

  body.menu-open .masthead__nav { display: flex; }
  body.menu-open .navtoggle .i { display: none; }
  body.menu-open .navtoggle .navtoggle__close { display: block; }

  .masthead__nav .navlink {
    height: auto;
    padding: 14px var(--gutter);
    text-align: left;
    font-size: 16px;
    border-bottom: 0;
    border-left: 3px solid transparent;
  }

  .masthead__nav .navlink[aria-current='true'] {
    border-left-color: var(--aqua);
    background: rgba(255, 255, 255, 0.06);
  }

  /* Админы хэрэглэгчийн нэр ба гарах товч цэс дотор орно. */
  .masthead__user {
    border-left: 0;
    border-top: 1px solid var(--line-dark);
    margin: 6px 0 0;
    padding: 12px var(--gutter) 4px;
  }
}

@media (max-width: 760px) {
  :root { --gutter: 20px; --header-h: 70px; }
  .brandlock__logo { height: 34px; }
  .band { padding: 36px 0 40px; }
  .titleband { padding: 32px 0 34px; }
  .sizegrid, .optrow--split { grid-template-columns: repeat(2, 1fr); }
  .search { min-width: 0; width: 100%; }
}

/* ============================================================
   Админ самбар
   ============================================================ */

.masthead__user {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
  padding: 0 14px 0 20px;
  border-left: 1px solid var(--line-dark);
  margin-left: 12px;
  white-space: nowrap;
}

.btn--danger { background: #b3261e; color: #fff; }
.btn--danger:hover { background: #8f1d17; }

.btn--danger-quiet { background: transparent; color: #b3261e; border-color: transparent; }
.btn--danger-quiet:hover { background: #fdecea; }

/* ---- нэвтрэх хэсэг ---- */

.loginbox {
  max-width: 420px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 34px 34px;
  background: var(--paper);
}

.loginbox__icon { width: 28px; height: 28px; color: var(--navy); margin-bottom: 18px; }

.loginbox h2 { font-size: 21px; font-weight: 500; color: var(--navy); }

.loginbox > p { margin: 8px 0 26px; color: var(--ink-soft); font-size: 14px; }

.loginbox .field > label { display: block; font-size: 12.5px; margin-bottom: 7px; }

.loginbox input { padding: 11px 13px; }

.loginbox__error {
  margin: 0 0 16px;
  padding: 10px 13px;
  background: #fdecea;
  border-left: 3px solid #b3261e;
  color: #8f1d17;
  font-size: 13.5px;
}

.loginbox .hint { margin-top: 18px; }

.loginbox__note {
  margin: 0 0 16px;
  padding: 10px 13px;
  background: #e8f4ea;
  border-left: 3px solid #1e7a35;
  color: #14571f;
  font-size: 13.5px;
}

#toggleMode { margin-top: 10px; }

.userrow__badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
  flex-shrink: 0;
}

.userrow__badge--admin { background: var(--navy); color: #fff; }
.userrow__badge--viewer { background: var(--grey); color: var(--ink-faint); border: 1px solid var(--line); }
.userrow__badge--pending { background: #fff8e1; color: #7a5a00; border: 1px solid #e0a800; }

.loginbox code {
  background: var(--grey);
  border: 1px solid var(--line);
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
}

/* ---- самбарын блокууд ---- */

.adminbox { margin-bottom: 52px; }

.adminbox:last-child { margin-bottom: 0; }

.counter {
  font-size: 14px;
  color: var(--ink-faint);
  font-weight: 400;
  margin-left: 6px;
}

.adminform {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.adminform .field { margin: 0; }

.adminform .field > label { display: block; font-size: 12.5px; margin-bottom: 7px; }

.filename-preview {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--ink-soft);
}

.filename-preview b {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--grey);
  border: 1px solid var(--line);
  padding: 3px 8px;
  color: var(--navy);
}

.filename-preview b.is-replacing {
  border-color: #e0a800;
  background: #fff8e1;
  color: #7a5a00;
}

.dropzone--sm { flex: none; padding: 34px 26px; }

.filerow__thumb {
  width: 64px;
  height: 46px;
  flex-shrink: 0;
  background: var(--grey);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
}

.filerow__thumb img { width: 100%; height: 100%; object-fit: contain; }

.sitefoot__motto[href]:hover { color: #fff; }

/* ============================================================
   Шүүлтүүр, шошго, төрөл
   ============================================================ */

.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 16px;
}

.filterbar--tags { margin-bottom: 26px; }

.filterbar__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-right: 6px;
}

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 7px 13px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: 0.12s;
  white-space: nowrap;
}

.chip b { font-weight: 500; color: var(--ink-faint); margin-left: 5px; }

.chip:hover { border-color: var(--navy); color: var(--navy); }

.chip[aria-pressed='true'] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip[aria-pressed='true'] b { color: rgba(255, 255, 255, 0.65); }

/* Зураг дээрх шошго */
.photo__tags {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  max-width: calc(100% - 16px);
  opacity: 0;
  transition: opacity 0.14s;
}

.photo:hover .photo__tags { opacity: 1; }

.photo__tags span {
  background: rgba(0, 22, 64, 0.82);
  color: #fff;
  font-size: 10.5px;
  padding: 3px 7px;
  border-radius: var(--radius);
  white-space: nowrap;
}

/* Материалын төрөл */
.typetag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--navy);
  border: 1px solid var(--line);
  background: var(--grey);
  padding: 5px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Админ мөрийн хавтас / шошго */
.rowmeta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }

.foldertag, .tagchip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--radius);
  white-space: nowrap;
}

.foldertag { background: var(--navy); color: #fff; }

.tagchip { background: var(--grey); border: 1px solid var(--line); color: var(--ink-soft); }

.field--wide { grid-column: 1 / -1; }

/* Товч нь шошгогүй тул бусад талбартай доороо эгнэнэ. */
.field--submit { display: flex; align-items: flex-end; }
.field--submit .btn { width: 100%; }

.inline-add { display: flex; gap: 8px; }

.inline-add input { flex: 1; min-width: 0; }

.muted { color: var(--ink-faint); font-weight: 400; }
