/* =====================================================================================
   е-Портал ПУ · дизайн система „Ръкопис · приложение“ (pu3)
   Един файл за целия портал: токени, основа, обвивка, компоненти.
   ===================================================================================== */

/* ---------- Токени ---------- */
:root {
  --ink: #0a2036;          /* мастило: менюто, заглавията */
  --blue: #123f66;         /* синьо ПУ: основни бутони, линкове */
  --blue-2: #1b4a76;
  --blue-50: #eef2f7;
  --brass: #a97c3c;        /* месинг: акценти */
  --brass-ink: #7d5a22;
  --brass-soft: #e1c48f;
  --paper: #f7f4ec;        /* фон */
  --paper-2: #fbfaf6;
  --surface: #ffffff;
  --text: #15202c;
  --muted: #586474;
  --line: #e3dccb;
  --line-2: #efe9db;
  --field: #cbc3b0;

  --ok: #2e6a43;   --ok-bg: #e7f1ea;   --ok-ink: #1f4a2e;
  --warn: #8a5a00; --warn-bg: #fbf0dc; --warn-ink: #5c3c00;
  --bad: #a1322b;  --bad-bg: #f8e5e2;  --bad-ink: #6e1f1a;
  --info: #123f66; --info-bg: #e6edf5; --info-ink: #0a2036;
  --neutral-bg: #efe9db; --neutral-ink: #4a4434;

  --nav-text: #d3dbe5;
  --nav-muted: #8fa0b5;
  --nav-hover: #12304f;
  --nav-active: #1b4a76;

  --serif: 'PT Serif', Georgia, serif;
  --sans: 'PT Sans', 'Segoe UI', Arial, sans-serif;
  --mono: 'PT Mono', Consolas, monospace;

  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(10, 32, 54, .10);
  --shadow-lg: 0 24px 60px rgba(10, 32, 54, .28);

  --sidebar-w: 260px;
  --topbar-h: 73px;
  --bottombar-h: 64px;
  --content-max: 1200px;
}

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: hidden; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); }
a:hover { color: var(--ink); }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); line-height: 1.2; margin: 0; }
h1 { font-size: 32px; }
h2 { font-size: 22px; }
h3 { font-size: 19px; }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: 3px solid #6b9bd1; outline-offset: 2px; }
.pu-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pu-mono { font-family: var(--mono); }
.pu-muted { color: var(--muted); font-size: 14px; }
.pu-skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; }
.pu-skip:focus { left: 8px; }

/* ---------- Обвивка (влезли потребители) ---------- */
.pu-app { min-height: 100vh; }
.pu-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--ink); color: var(--nav-text);
  display: flex; flex-direction: column; z-index: 40;
}
.pu-sidebar__brand {
  display: flex; align-items: center; gap: 12px; padding: 24px 22px 14px;
  text-decoration: none; color: #fff; flex: none;
}
.pu-seal {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  box-shadow: inset 0 0 0 2px var(--brass);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; color: #f7f4ec; font-size: 15px;
  background: #fff; overflow: hidden;
}
/* логото на ПУ (Паисий) в кръгчето – върху бяло, с месингов кант */
.pu-seal img { width: 66%; height: auto; display: block; margin-top: 4%; }
.pu-sidebar__brand b { display: block; font-family: var(--serif); font-size: 19px; color: #fff; }
.pu-sidebar__brand small { display: block; font-size: 12.5px; color: #9fb0c4; }
.pu-nav { flex: 1; overflow-y: auto; padding: 0 14px 24px; scrollbar-width: thin; scrollbar-color: #2c4a6b transparent; }
.pu-nav__title {
  font-size: 11.5px; letter-spacing: .09em; text-transform: uppercase; font-weight: 700;
  color: var(--nav-muted); padding: 18px 12px 6px;
}
.pu-nav ul { list-style: none; margin: 0; padding: 0; }
.pu-nav__link, .pu-nav__toggle {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 40px; padding: 0 12px; border-radius: 8px; border: 0; background: none;
  color: var(--nav-text); text-decoration: none; font: 15px/1.25 var(--sans); text-align: left; cursor: pointer;
}
.pu-nav__link:hover, .pu-nav__toggle:hover { background: var(--nav-hover); color: #fff; }
.pu-nav__link[aria-current="page"], .pu-nav__toggle.is-current { background: var(--nav-active); color: #fff; font-weight: 700; }
.pu-nav__link svg, .pu-nav__toggle svg { flex: none; }
.pu-nav__label { min-width: 0; }
/* брояч като в макета (.nv .c): месингова значка вдясно */
.pu-nav__count { margin-left: auto; flex: none; font-size: 12px; font-weight: 700; line-height: 1.5; background: var(--brass-soft); color: var(--ink); border-radius: 99px; padding: 1px 8px; }
.pu-nav__count + .pu-nav__chev { margin-left: 6px; }
.pu-nav__ext { margin-left: auto; opacity: .7; font-size: 13px; }
.pu-nav__chev { margin-left: auto; display: inline-flex; transition: transform .15s; opacity: .7; }
.pu-nav__toggle[aria-expanded="true"] .pu-nav__chev { transform: rotate(90deg); }
.pu-nav__toggle[aria-expanded="true"] .pu-nav__count { display: none; }
.pu-nav__toggle[aria-expanded="true"] .pu-nav__count + .pu-nav__chev { margin-left: auto; }
.pu-nav__sub { padding: 0 !important; }
.pu-nav__sub[hidden] { display: none; }
.pu-nav__sub .pu-nav__link { min-height: 36px; padding-left: 44px; font-size: 14.5px; color: #b9c4d2; }
.pu-nav__sub .pu-nav__link:hover { background: none; color: #fff; }
.pu-nav__sub .pu-nav__link[aria-current="page"] { background: var(--nav-hover); color: #fff; font-weight: 700; }
.pu-sidebar__foot { padding: 18px 26px 22px; border-top: 1px solid #1d3a5a; font-size: 13px; line-height: 1.5; color: #9fb0c4; flex: none; }
.pu-sidebar__foot a { color: var(--brass-soft); }
.pu-more-only { display: none !important; }

.pu-main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }
.pu-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--topbar-h); padding: 14px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.pu-topbar__brand { display: none; }
.pu-search {
  flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--muted); cursor: text; font: 15px var(--sans); text-align: left;
}
.pu-search span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pu-kbd { font: 12px var(--mono); border: 1px solid #d6cfbd; border-radius: 6px; padding: 1px 6px; color: var(--muted); }
.pu-topbar__spacer { flex: 1; }
.pu-iconbtn {
  width: 44px; height: 44px; flex: none; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative; text-decoration: none;
}
.pu-iconbtn:hover { border-color: var(--blue); color: var(--blue); }
.pu-iconbtn__dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px #fff; }
.pu-user { position: relative; }
.pu-user__btn {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 10px 4px 4px;
  border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left; font: inherit; color: var(--text);
}
.pu-user__btn:hover { background: var(--blue-50); }
.pu-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--blue); color: #fff; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; overflow: hidden;
}
.pu-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pu-app--employee .pu-avatar { background: var(--brass-ink); }
.pu-avatar--md { width: 52px; height: 52px; font-size: 18px; }
.pu-avatar--lg { width: 88px; height: 88px; font-size: 30px; font-family: var(--serif); box-shadow: 0 0 0 4px #fff, 0 0 0 6px var(--brass); }
.pu-user__name { display: flex; flex-direction: column; line-height: 1.2; }
.pu-user__name b { font-size: 15px; }
.pu-user__name small { font-size: 13px; color: var(--muted); }

/* Съдържанието ползва цялата ширина (изискване на потребителя) – без max-width */
.pu-main { flex: 1; width: 100%; min-width: 0; padding: 32px; }
.pu-footer { padding: 4px 32px 28px; font-size: 13px; color: var(--muted); }

/* Падащи менюта (потребител, Google приложения) */
.pu-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 50;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 6px;
}
.pu-menu[hidden] { display: none; }
.pu-menu a, .pu-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px; border-radius: 8px;
  color: var(--text); text-decoration: none; font: 15px var(--sans); border: 0; background: none; cursor: pointer; text-align: left;
}
.pu-menu a:hover, .pu-menu button:hover { background: var(--blue-50); }
.pu-menu hr { margin: 6px 0; }
.pu-apps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; width: 300px; }
.pu-apps a { flex-direction: column; justify-content: center; min-height: 76px; gap: 6px; font-size: 13px; text-align: center; }
.pu-apps a span:first-child {
  width: 36px; height: 36px; border-radius: 10px; background: var(--blue-50); color: var(--blue);
  display: inline-flex; align-items: center; justify-content: center;
}

/* Мобилна долна лента */
.pu-bottombar { display: none; }

/* Мобилно меню „Още“ (фонът не се ползва – „Още“ е цял екран над долната лента) */
.pu-sheet-backdrop { display: none !important; }

/* ---------- Страница ---------- */
.pu-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.pu-stack > .pu-page-head { margin-bottom: 0; }
.pu-page-head__text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pu-page-head__text h1 { font-size: 34px; line-height: 1.15; }
.pu-page-head__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pu-crumbs { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.pu-crumbs a { color: var(--muted); }
.pu-crumbs a:hover { color: var(--blue); }
.pu-lead { font-size: 15px; color: var(--muted); max-width: 900px; }
.pu-stack { display: flex; flex-direction: column; gap: 24px; }
.pu-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.pu-col-main { flex: 3 1 460px; min-width: 0; }
.pu-col-side { flex: 2 1 300px; min-width: 0; }
.pu-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(var(--pu-min, 220px), 1fr)); }

/* ---------- Карти ---------- */
.pu-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.pu-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line-2); }
.pu-card__head h2, .pu-card__head h3 { font-size: 19px; }
.pu-card__head > a { font-size: 14.5px; font-weight: 700; }
.pu-card__body { padding: 20px; }
.pu-card__foot { padding: 14px 20px; border-top: 1px solid var(--line-2); background: var(--paper-2); border-radius: 0 0 var(--radius) var(--radius); }
.pu-card--accent { border-color: var(--brass); }
.pu-rows > * { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); font-size: 15px; }
.pu-rows > *:last-child { border-bottom: 0; }
a.pu-card, .pu-rows > a { color: var(--text); text-decoration: none; }
a.pu-card:hover { border-color: var(--blue); }
.pu-rows > a:hover { background: #fcfbf8; }

.pu-stat { padding: 18px 20px; }
.pu-stat__label { font-size: 14px; color: var(--muted); }
.pu-stat__value { font-family: var(--serif); font-weight: 700; font-size: 32px; color: var(--ink); line-height: 1.2; }
.pu-stat__value small { font-size: 17px; color: var(--muted); font-family: var(--serif); font-weight: 700; }
.pu-stat__link { font-size: 14px; font-weight: 700; color: var(--blue); }
.pu-stat__note { font-size: 13px; color: var(--muted); }
.pu-progress { height: 6px; background: var(--line-2); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.pu-progress > span { display: block; height: 100%; background: var(--brass); border-radius: 99px; }

/* Бързи действия / каталог */
.pu-tile {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; min-height: 44px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.pu-tile:hover { border-color: var(--blue); color: var(--text); }
.pu-tile__icon { width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--blue-50); color: var(--blue); display: flex; align-items: center; justify-content: center; }
.pu-tile b { font-size: 16.5px; }
/* Бързо действие (макет: .qa) – иконка и надпис на един ред */
.pu-tile--row { flex-direction: row; align-items: center; gap: 12px; padding: 14px 16px; font-weight: 700; }
.pu-tile--row .pu-tile__icon { width: 36px; height: 36px; border-radius: 9px; }
.pu-tile--row b { font-size: 16px; }
.pu-tile--off { background: var(--paper-2); }
.pu-tile--off .pu-tile__icon { background: var(--line-2); color: var(--muted); }

/* Мрежа от приложения/системи (табло) */
.pu-systems { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; }
.pu-systems a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font-size: 13.5px; font-weight: 700; text-align: center; min-height: 44px; }
.pu-systems a:hover { background: var(--blue-50); color: var(--ink); }
.pu-systems img { width: 36px; height: 36px; object-fit: contain; }
.pu-systems .pu-tile__icon { width: 36px; height: 36px; }
/* университетските системи: логата са широки – повече място (Google иконите остават 36px) */
.pu-systems--logos { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.pu-systems--logos img { width: 112px; height: 44px; }
.pu-systems--logos .pu-tile__icon { height: 44px; }

/* ---------- Бутони ---------- */
.pu-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 700 15px/1.2 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
  background: var(--blue); color: #fff;
}
.pu-btn:hover { background: var(--ink); color: #fff; }
.pu-btn--secondary { background: var(--surface); color: var(--blue); border-color: #c9d3df; }
.pu-btn--secondary:hover { background: var(--blue-50); color: var(--ink); }
.pu-btn--ghost { background: transparent; color: var(--blue); }
.pu-btn--ghost:hover { background: var(--blue-50); color: var(--ink); }
.pu-btn--danger { background: var(--bad); }
.pu-btn--danger:hover { background: #7f2620; }
.pu-btn--danger-outline { background: var(--surface); color: var(--bad); border-color: #e0b3ad; }
.pu-btn--sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.pu-btn--lg { min-height: 52px; padding: 0 26px; font-size: 16px; }
.pu-btn--block { width: 100%; }
.pu-btn[disabled], .pu-btn[aria-disabled="true"] { background: #9aa9bb; border-color: transparent; color: #fff; cursor: not-allowed; }

/* ---------- Форми ---------- */
.pu-form { display: flex; flex-direction: column; gap: 18px; }
.pu-field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pu-field > label, .pu-label { font-weight: 700; font-size: 15px; color: var(--text); }
.pu-req { color: var(--bad); }
.pu-input, .pu-select, .pu-textarea,
.pu-field input[type=text], .pu-field input[type=email], .pu-field input[type=password], .pu-field input[type=number],
.pu-field input[type=date], .pu-field input[type=tel], .pu-field input[type=search], .pu-field select, .pu-field textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--field); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: 16px var(--sans);
}
/* в прозорец полетата са по-сбити (макет Popups: 44px, 15px) */
.pu-dialog .pu-field input[type=text], .pu-dialog .pu-field input[type=email], .pu-dialog .pu-field input[type=password], .pu-dialog .pu-field input[type=number],
.pu-dialog .pu-field input[type=date], .pu-dialog .pu-field input[type=tel], .pu-dialog .pu-field input[type=search], .pu-dialog .pu-field select,
.pu-dialog .pu-input, .pu-dialog .pu-select { min-height: 44px; padding: 0 12px; font-size: 15px; }
.pu-dialog .pu-field > label, .pu-dialog .pu-label { font-size: 14px; }
.pu-dialog .pu-field { gap: 6px; }
.pu-textarea, .pu-field textarea { padding: 12px 14px; min-height: 104px; resize: vertical; }
.pu-input:focus, .pu-select:focus, .pu-textarea:focus, .pu-field input:focus, .pu-field select:focus, .pu-field textarea:focus { border-color: var(--blue); outline: 3px solid rgba(18, 63, 102, .18); outline-offset: 0; }
.pu-hint { font-size: 13.5px; color: var(--muted); }
.pu-field--error input, .pu-field--error select, .pu-field--error textarea { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.pu-field__error { font-size: 13.5px; color: var(--bad); font-weight: 700; }
.pu-fields { display: flex; flex-wrap: wrap; gap: 16px; }
.pu-fields > .pu-field { flex: 1 1 220px; }
.pu-option {
  display: flex; gap: 14px; align-items: flex-start; padding: 15px 16px; flex: 1 1 220px;
  border: 1px solid var(--field); border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.pu-option:has(input:checked) { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: #f3f6fa; }
.pu-option input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--blue); flex: none; }
.pu-check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; min-height: 44px; }
.pu-check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--blue); flex: none; }
.pu-upload {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px; text-align: center; cursor: pointer;
  border: 2px dashed var(--field); border-radius: var(--radius); background: var(--paper-2);
}
.pu-upload input[type=file] { max-width: 100%; }
.pu-section { display: flex; flex-direction: column; gap: 18px; padding: 24px; }
.pu-section > h2 { font-size: 20px; }
.pu-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Статуси, бележки ---------- */
.pu-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; border-radius: 99px; padding: 3px 10px; white-space: nowrap; background: var(--neutral-bg); color: var(--neutral-ink); }
.pu-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pu-badge--ok { background: var(--ok-bg); color: var(--ok); }
.pu-badge--warn { background: var(--warn-bg); color: var(--warn); }
.pu-badge--bad { background: var(--bad-bg); color: var(--bad); }
.pu-badge--info { background: var(--info-bg); color: var(--info); }
.pu-badge--plain::before { display: none; }

.pu-alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-sm); font-size: 14.5px; line-height: 1.45; background: var(--info-bg); color: var(--info-ink); }
.pu-alert > svg { flex: none; margin-top: 1px; }
.pu-alert--ok { background: var(--ok-bg); color: var(--ok-ink); }
.pu-alert--warn { background: var(--warn-bg); color: var(--warn-ink); }
.pu-alert--bad { background: var(--bad-bg); color: var(--bad-ink); }
.pu-alert a { color: inherit; font-weight: 700; }

.pu-grade { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 34px; padding: 0 6px; border-radius: 8px; font: 700 17px var(--serif); background: var(--blue-50); color: var(--blue); }
.pu-grade--6, .pu-grade--5 { background: var(--ok-bg); color: var(--ok-ink); }
.pu-grade--2 { background: var(--bad-bg); color: var(--bad-ink); }

/* ---------- Таблици ---------- */
.pu-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.pu-table { width: 100%; border-collapse: collapse; }
.pu-table th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--line); font-weight: 700; white-space: nowrap; }
.pu-table td { padding: 13px 16px; border-bottom: 1px solid var(--line-2); font-size: 15px; vertical-align: middle; }
.pu-table tbody tr:last-child td { border-bottom: 0; }
.pu-table tbody tr:hover td { background: #fcfbf8; }
.pu-table .pu-num { text-align: right; white-space: nowrap; }

/* ---------- Табове, чипове, стъпки ---------- */
.pu-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.pu-tab { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); font: 700 15px var(--sans); color: var(--text); text-decoration: none; cursor: pointer; }
.pu-tab[aria-selected="true"], .pu-tab.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pu-underline-tabs { display: flex; flex-wrap: wrap; gap: 4px 22px; border-bottom: 1px solid var(--line); }
.pu-underline-tabs a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; }
.pu-underline-tabs a[aria-current="page"] { color: var(--ink); border-color: var(--brass); }
.pu-chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font: 700 14px var(--sans); color: var(--text); cursor: pointer; text-decoration: none; }
.pu-chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Стъпки (макет Components): <ol class="pu-steps"><li class="is-done|is-current"><span class="pu-steps__n">1</span><span class="pu-steps__label">Лични данни</span></li>… */
.pu-steps { display: flex; align-items: center; gap: 8px; list-style: none; margin: 0; padding: 0; counter-reset: pu-step; }
.pu-steps > li { display: flex; align-items: center; gap: 8px; flex: 1 1 0; min-width: 0; color: var(--muted); font-size: 14px; }
.pu-steps > li:last-child { flex: none; }
.pu-steps > li::after { content: ""; flex: 1 1 auto; min-width: 12px; height: 2px; background: var(--line); }
.pu-steps > li:last-child::after { display: none; }
.pu-steps > li.is-done::after { background: var(--ok); }
.pu-steps__n { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 2px solid var(--field); background: var(--surface); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.pu-steps > li.is-current .pu-steps__n { background: var(--blue); border-color: var(--blue); color: #fff; }
.pu-steps > li.is-done .pu-steps__n { background: var(--ok); border-color: var(--ok); color: #fff; font-size: 0; }
.pu-steps > li.is-done .pu-steps__n::before { content: "✓"; font-size: 15px; }
.pu-steps > li.is-current .pu-steps__label { color: var(--blue); font-weight: 700; }
.pu-steps__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pu-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 28px; margin: 0; padding: 20px; }
.pu-dl > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pu-dl dt { font-size: 13px; color: var(--muted); }
.pu-dl dd { margin: 0; font-size: 16px; overflow-wrap: anywhere; }

.pu-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; color: var(--muted); }
.pu-empty svg { color: var(--field); }

/* ---------- Прозорци (<dialog>), панели, известия ---------- */
.pu-dialog { border: 0; padding: 0; border-radius: 14px; box-shadow: 0 24px 60px rgba(10, 32, 54, .3); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); color: var(--text); background: var(--surface); overflow: auto; }
.pu-dialog[open] { display: flex; flex-direction: column; }
.pu-dialog[open] > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.pu-dialog::backdrop { background: rgba(10, 32, 54, .45); }
.pu-dialog__head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); flex: none; }
.pu-dialog__head h2, .pu-dialog__head h3 { font-size: 20px; flex: 1; }
/* затварящият бутон в прозорец е без рамка (макет: .x 40×40) */
.pu-dialog__head .pu-iconbtn, .pu-dialog__x { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.pu-dialog__head .pu-iconbtn:hover, .pu-dialog__x:hover { background: var(--blue-50); color: var(--ink); }
.pu-dialog__body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.pu-dialog__body > h2 { font-size: 21px; }
.pu-dialog__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line-2); background: var(--paper-2); flex: none; }
.pu-dialog--panel { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; border-radius: 0; width: min(440px, 100vw); }
.pu-dialog--panel .pu-dialog__foot { margin-top: auto; }
.pu-dialog--wide { width: min(880px, calc(100vw - 32px)); }
/* Потвърждение (pu3.confirm): иконка в кръг, заглавие, текст */
.pu-dialog--confirm { width: min(460px, calc(100vw - 32px)); }
.pu-dialog--confirm .pu-dialog__body { padding-top: 24px; }
.pu-dialog--confirm .pu-dialog__body p { margin: 0; font-size: 15px; line-height: 1.5; }
.pu-dialog__icon { width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--info-bg); color: var(--info); display: flex; align-items: center; justify-content: center; }
.pu-dialog__icon--bad { background: var(--bad-bg); color: var(--bad); }
.pu-dialog__icon--warn { background: var(--warn-bg); color: var(--warn); }

.pu-toasts { position: fixed; top: auto; left: auto; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.pu-toasts[popover] { margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; width: auto; height: auto; color: inherit; }
.pu-toasts[popover]:not(:popover-open) { display: none; }
.pu-toasts:empty { display: none; }
.pu-toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; width: min(380px, calc(100vw - 32px)); padding: 14px 14px 14px 16px; border-radius: 12px; background: var(--surface); box-shadow: 0 10px 30px rgba(10, 32, 54, .18); font-size: 14.5px; line-height: 1.4; animation: pu-toast-in .18s ease-out; }
.pu-toast__icon { width: 28px; height: 28px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; background: var(--info); font-weight: 700; font-size: 15px; }
.pu-toast__icon svg { width: 16px; height: 16px; }
.pu-toast--ok .pu-toast__icon { background: var(--ok); }
.pu-toast--warn .pu-toast__icon { background: var(--warn); }
.pu-toast--bad { box-shadow: 0 10px 30px rgba(10, 32, 54, .18), inset 0 0 0 1px #e0b3ad; }
.pu-toast--bad .pu-toast__icon { background: var(--bad); }
.pu-toast__text { flex: 1; min-width: 0; align-self: center; }
.pu-toast__text b { display: block; }
.pu-toast__text b + .pu-toast__msg { color: var(--muted); font-size: 14px; }
.pu-toast__text b:empty + .pu-toast__msg, .pu-toast__text b:only-child { color: inherit; font-size: inherit; }
.pu-toast__msg--solo { font-weight: 700; }
.pu-toast__close { border: 0; background: none; color: var(--muted); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center; margin: -4px -2px -4px 0; }
.pu-toast__close:hover { background: var(--blue-50); color: var(--ink); }
/* в макета само грешката има бутон „Затвори“ – другите изчезват сами */
.pu-toasts .pu-toast:not(.pu-toast--bad) .pu-toast__close { display: none; }
@keyframes pu-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Търсене на услуга (Ctrl K) */
.pu-palette { width: min(620px, calc(100vw - 24px)); margin-top: 10vh; }
.pu-palette__input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); color: var(--muted); }
.pu-palette__input input { flex: 1; border: 0; outline: none; font: 17px var(--sans); color: var(--text); min-height: 32px; }
.pu-palette__list { list-style: none; margin: 0; padding: 6px; max-height: 60vh; overflow: auto; }
.pu-palette__list a { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.pu-palette__list a small { margin-left: auto; color: var(--muted); font-size: 13px; }
.pu-palette__list a:hover, .pu-palette__list a.is-active { background: var(--blue-50); }
.pu-palette__empty { padding: 18px; color: var(--muted); }

/* ---------- Вход (layout auth) ---------- */
.pu-auth { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--paper); }
.pu-auth__brand { flex: 1 1 480px; background: var(--ink); color: #f7f4ec; padding: 56px 64px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.pu-auth__brand h1 { color: #f7f4ec; font-size: 42px; max-width: 540px; }
.pu-auth__brand p { color: #c9d3df; font-size: 17px; max-width: 520px; }
.pu-auth__uni-short { display: none; }
.pu-auth__panel { flex: 1 1 480px; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.pu-auth__box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.pu-auth__box h2 { font-size: 32px; }
.pu-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.pu-divider::before, .pu-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pu-pill { border: 1px solid #2c4a6b; border-radius: 99px; padding: 6px 14px; font-size: 14px; color: #dfe6ee; }

/* ---------- Документ за печат (прозорец / страница) ---------- */
.pu-doc { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 36px 34px; font: 14.5px/1.6 var(--serif); box-shadow: var(--shadow); }

/* =====================================================================================
   Мобилно (до 960px): менюто се скрива, появява се долна лента и „Още“
   ===================================================================================== */
@media (max-width: 960px) {
  :root { --radius: 14px; }

  /* „Още“ (макет MMenu): цял екран на хартиен фон над долната лента; групите са бели карти */
  .pu-sidebar {
    display: none; inset: 0 0 calc(var(--bottombar-h) + env(safe-area-inset-bottom)) 0; width: auto; z-index: 44;
    background: var(--paper); color: var(--text); overflow-y: auto; overscroll-behavior: contain;
  }
  .pu-app.is-nav-open .pu-sidebar { display: flex; }
  body.pu-nav-open { overflow: hidden; }
  .pu-more-only { display: flex !important; }
  .pu-sidebar__brand, .pu-sidebar__foot { display: none; }
  .pu-more__head {
    position: sticky; top: 0; z-index: 1; flex: none; align-items: center; min-height: 72px; padding: 14px 16px;
    background: var(--ink); color: #fff; font: 700 20px var(--serif);
  }
  .pu-nav { flex: none; overflow: visible; display: flex; flex-direction: column; gap: 20px; padding: 16px 16px 28px; }
  .pu-more__user {
    align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    color: var(--text); text-decoration: none;
  }
  .pu-more__user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .pu-more__user-text b { font-size: 17px; }
  .pu-more__user-text span { color: var(--muted); font-size: 13.5px; }
  .pu-more__arrow { color: #9a927f; }
  .pu-more__search {
    align-items: center; gap: 10px; height: 48px; padding: 0 14px; width: 100%; border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); color: var(--muted); font: 16px var(--sans); text-align: left; cursor: text;
  }
  .pu-nav__group.pu-more-only { display: block !important; }
  .pu-nav__title { padding: 0 4px 8px; font-size: 12px; letter-spacing: .08em; color: var(--brass-ink); }
  .pu-nav__group > ul { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
  .pu-nav__group > ul > li + li { border-top: 1px solid var(--line-2); }
  .pu-nav__link, .pu-nav__toggle { min-height: 52px; padding: 0 16px; gap: 14px; border-radius: 0; color: var(--text); font-size: 16px; }
  .pu-nav__link svg, .pu-nav__toggle svg { color: var(--blue); }
  .pu-nav__link:hover, .pu-nav__toggle:hover { background: var(--blue-50); color: var(--text); }
  .pu-nav__link[aria-current="page"], .pu-nav__toggle.is-current { background: var(--blue-50); color: var(--ink); }
  .pu-nav__link:not(.pu-nav__link--ext)::after { content: "›"; margin-left: auto; padding-left: 6px; color: #9a927f; font-size: 18px; line-height: 1; }
  .pu-nav__link:has(.pu-nav__count)::after { margin-left: 0; }
  .pu-nav__ext, .pu-nav__chev { color: #9a927f; opacity: 1; }
  .pu-nav__chev svg { color: #9a927f; }
  .pu-nav__sub { background: var(--paper-2); border-top: 1px solid var(--line-2); }
  .pu-nav__sub > li + li { border-top: 1px solid var(--line-2); }
  .pu-nav__sub .pu-nav__link { min-height: 48px; padding-left: 50px; font-size: 15px; color: var(--text); }
  .pu-nav__sub .pu-nav__link:hover { background: var(--blue-50); color: var(--text); }
  .pu-nav__sub .pu-nav__link[aria-current="page"] { background: var(--blue-50); color: var(--ink); }
  .pu-nav__group--account svg, .pu-nav__group--account .pu-nav__link::after { display: none; }
  .pu-nav__link--logout, .pu-nav__link--logout:hover { color: var(--bad); font-weight: 700; }
  .pu-more__apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; }
  .pu-more__apps a { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; color: var(--text); font-size: 12.5px; font-weight: 700; text-align: center; min-width: 0; }
  .pu-more__apps a > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pu-more__app-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--blue); }
  .pu-app.is-nav-open .pu-bottombar [aria-current="page"] { color: var(--muted); }
  .pu-bottombar [aria-expanded="true"] { color: var(--blue) !important; }

  .pu-main-wrap { margin-left: 0; padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); }
  /* горна лента (макет MDashboard): печат, „е-Портал“, търсене, известия */
  .pu-topbar { padding: 14px 16px; gap: 10px; background: var(--ink); border-bottom: 0; min-height: 72px; }
  .pu-topbar__brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 18px; }
  .pu-topbar__brand:hover { color: #fff; }
  .pu-topbar__brand .pu-seal { width: 36px; height: 36px; font-size: 14px; }
  .pu-topbar .pu-search, .pu-topbar .pu-user { display: none; }
  .pu-topbar .pu-iconbtn { background: transparent; border-color: transparent; color: #fff; }
  .pu-topbar .pu-iconbtn:hover { color: #fff; border-color: transparent; }
  .pu-topbar .pu-iconbtn__dot { top: 10px; right: 10px; background: var(--brass-soft); box-shadow: none; }
  .pu-topbar .pu-iconbtn--search { display: inline-flex; }
  .pu-main { padding: 18px 16px 24px; }
  .pu-stack { gap: 18px; }
  .pu-row { gap: 18px; }
  .pu-page-head { margin-bottom: 18px; }
  .pu-page-head__text h1 { font-size: 26px; }
  .pu-lead, .pu-muted { font-size: 13.5px; }
  .pu-card__head { padding: 14px 16px; }
  .pu-card__head h2, .pu-card__head h3 { font-size: 18px; }
  .pu-card__body { padding: 16px; }
  .pu-rows > * { padding: 13px 16px; }
  .pu-field input[type=text], .pu-field input[type=email], .pu-field input[type=password], .pu-field input[type=number],
  .pu-field input[type=date], .pu-field input[type=tel], .pu-field input[type=search], .pu-field select, .pu-input, .pu-select { min-height: 50px; font-size: 16px; }
  .pu-footer { padding: 12px 16px 20px; }

  .pu-bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .pu-bottombar a, .pu-bottombar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 56px; border: 0; background: none; color: var(--muted); font: 700 11.5px var(--sans); text-decoration: none; cursor: pointer; position: relative;
  }
  .pu-bottombar [aria-current="page"] { color: var(--blue); }
  .pu-bottombar a span, .pu-bottombar button span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  /* бутонът на чата с УИЦ – над долната лента */
  #lhc_status_container { bottom: calc(var(--bottombar-h) + 14px + env(safe-area-inset-bottom)) !important; }
  body.pu-nav-open #lhc_status_container { display: none !important; }
  .pu-grid--stats { --pu-min: 140px !important; gap: 10px; }
  .pu-grid--stats .pu-stat { padding: 14px; }
  .pu-grid--stats .pu-stat__value { font-size: 28px; }
  .pu-bottombar .pu-nav__count { position: absolute; top: 4px; left: 50%; margin-left: 6px; font-size: 11px; background: var(--bad); color: #fff; padding: 0 6px; line-height: 17px; }

  /* Таблиците стават карти: всеки ред е карта, клетките са етикет + стойност */
  .pu-table--cards thead { display: none; }
  .pu-table--cards, .pu-table--cards tbody, .pu-table--cards tr, .pu-table--cards td { display: block; width: 100%; }
  .pu-table--cards tr { border-bottom: 1px solid var(--line-2); padding: 10px 16px; }
  .pu-table--cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .pu-table--cards td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: none; max-width: 45%; }
  .pu-table--cards td[data-label=""]::before { display: none; }

  /* Прозорецът става долен панел (макет MSheet): дръжка, заглавие, полета 50px, бутони 52px */
  .pu-dialog:not(.pu-dialog--keep):not(.pu-dialog--confirm) {
    margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; max-height: 92vh;
    box-shadow: 0 -10px 40px rgba(10, 32, 54, .25);
  }
  .pu-dialog:not(.pu-dialog--keep):not(.pu-dialog--confirm)::before {
    content: ""; flex: none; align-self: center; width: 40px; height: 5px; margin: 10px auto 2px; border-radius: 99px; background: #d6cfbd;
  }
  .pu-dialog:not(.pu-dialog--keep):not(.pu-dialog--confirm) .pu-dialog__head { padding: 6px 8px 10px 20px; }
  .pu-dialog .pu-dialog__head .pu-iconbtn, .pu-dialog .pu-dialog__x { width: 44px; height: 44px; }
  .pu-dialog:not(.pu-dialog--keep):not(.pu-dialog--confirm) .pu-dialog__body { padding: 18px 20px; gap: 16px; }
  .pu-dialog:not(.pu-dialog--keep):not(.pu-dialog--confirm) .pu-dialog__foot {
    flex-wrap: nowrap; padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 0;
  }
  .pu-dialog__foot .pu-btn { flex: 1 1 0; min-height: 52px; border-radius: 12px; font-size: 16px; padding: 0 12px; }
  .pu-dialog:not(.pu-dialog--keep):not(.pu-dialog--confirm) .pu-dialog__foot .pu-btn:last-child:not(:first-child) { flex-grow: 2; }
  .pu-dialog .pu-field > label, .pu-dialog .pu-label { font-size: 15px; }
  .pu-dialog .pu-field input[type=text], .pu-dialog .pu-field input[type=email], .pu-dialog .pu-field input[type=password], .pu-dialog .pu-field input[type=number],
  .pu-dialog .pu-field input[type=date], .pu-dialog .pu-field input[type=tel], .pu-dialog .pu-field input[type=search], .pu-dialog .pu-field select,
  .pu-dialog .pu-input, .pu-dialog .pu-select { min-height: 50px; font-size: 16px; }
  .pu-dialog--panel { height: auto; }
  /* Потвърждение (макет MConfirm): в средата, бутоните един под друг, основният отгоре */
  .pu-dialog--confirm { width: calc(100vw - 40px); border-radius: 18px; box-shadow: 0 24px 60px rgba(10, 32, 54, .35); }
  .pu-dialog--confirm .pu-dialog__body { padding: 24px 22px 6px; gap: 12px; }
  .pu-dialog--confirm .pu-dialog__foot { flex-direction: column-reverse; gap: 8px; padding: 12px 22px 18px; border-top: 0; background: var(--surface); }
  .pu-dialog--confirm .pu-dialog__foot .pu-btn { flex: none; width: 100%; }
  /* Известия: горе, на цялата ширина (макет MConfirm) */
  .pu-toasts { left: 12px; right: 12px; top: 76px; bottom: auto; align-items: stretch; }
  .pu-toast { width: auto; padding: 12px 14px; align-items: center; font-size: 15px; box-shadow: 0 10px 30px rgba(10, 32, 54, .25); }
  /* на телефон – само лента 64px: печат 36px, „е-Портал“ и кратко име на университета на един ред */
  .pu-auth__brand { padding: 0 16px; height: 64px; flex: none; width: 100%; gap: 0; justify-content: center; }
  .pu-auth__logo { gap: 10px !important; }
  .pu-auth__logo .pu-seal { width: 36px !important; height: 36px !important; font-size: 13px !important; box-shadow: inset 0 0 0 1.5px var(--brass); }
  .pu-auth__logotext { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
  .pu-auth__logotext b { font-size: 17px !important; }
  .pu-auth__logotext > span { font-size: 11.5px !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pu-auth__uni-full { display: none; }
  .pu-auth__uni-short { display: inline !important; }
  .pu-auth__brand h1 { font-size: 28px; }
  .pu-auth__brand .pu-auth__hide-sm { display: none !important; }  /* има inline display:flex */
}
@media (min-width: 961px) {
  .pu-iconbtn--search, .pu-iconbtn--menu { display: none; }
}

/* Печат */
@media print {
  .pu-sidebar, .pu-topbar, .pu-bottombar, .pu-footer, .pu-no-print { display: none !important; }
  .pu-main-wrap { margin: 0; }
  .pu-main { padding: 0; max-width: none; }
  body { background: #fff; }
  .pu-card { border-color: #ccc; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
