:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f6f8fa;
  --border: #d0d7de;
  --text: #181c21;
  --muted: #5b6167;
  --muted-2: #747c84;
  --primary: #2f7cd6;
  --primary-hover: #1f6feb;
  --primary-light-2: #79b8ff;
  --danger: #cf222e;
  --success: #1a7f37;
  --warning: #d29922;
  --footer: #f6f7fa;
  --radius: 6px;
  --color-nav-bg: #f6f7fa;
  --color-nav-text: var(--text);
  --color-nav-hover-bg: #dee5ec;
  --color-secondary: var(--border);
  --font-weight-semibold: 600;
  --page-margin-x: 32px;
  --page-spacing: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
@media (max-width: 991.98px) { :root { --page-margin-x: 16px; } }
@media (max-width: 767.98px) { :root { --page-margin-x: 8px; } }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font); background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  background: var(--primary); color: white; border: 1px solid transparent;
  padding: 6px 14px; border-radius: var(--radius); cursor: pointer; font: inherit;
}
button:hover { background: var(--primary-hover); }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.secondary:hover { background: var(--panel-2); }
button.danger { background: var(--danger); }
input, select, textarea {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 7px 10px; font: inherit; width: 100%;
}
textarea { min-height: 100px; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
label { display: block; margin-bottom: 4px; font-size: 13px; color: var(--muted); }
.form-row { margin-bottom: 12px; }
.container { max-width: 1100px; margin: 0 auto; padding: 16px 24px; }

/* ===== Navbar (ported 1:1 from DFGIT web_src/css/modules/navbar.css) ===== */
#navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-nav-bg);
  border-bottom: 1px solid var(--color-secondary);
  padding: 0 10px;
}
#navbar .navbar-left,
#navbar .navbar-right {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 49px;
}
.navbar-left > .item,
.navbar-right > .item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  color: var(--color-nav-text);
  position: relative;
  text-decoration: none;
  min-height: 36px;
  min-width: 36px;
  padding: 3px 13px;
  border-radius: 4px;
}
#navbar a.item:hover,
#navbar button.item:hover { background: var(--color-nav-hover-bg); text-decoration: none; }
#navbar-logo { padding: 3px 8px; }
#navbar-logo img { display: block; width: 30px; height: 30px; }
.tw-font-semibold { font-weight: var(--font-weight-semibold); }
.tw-no-underline:hover { text-decoration: none; }
/* User dropdown in navbar — equal-sized hover hotspot for every nav button */
.user-menu-trigger { position: relative; padding: 0 2px !important; }
.user-menu-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; min-width: 56px; padding: 0 8px;
  background: transparent; color: var(--color-nav-text);
  border: none; cursor: pointer;
  border-radius: 4px;
  box-sizing: border-box;
}
.user-menu-btn:hover { background: var(--color-nav-hover-bg); }
.user-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-menu-btn .caret { color: var(--muted-2); flex-shrink: 0; }

.user-menu {
  position: absolute; top: 100%; right: 0;
  min-width: 220px; padding: 4px 0;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
}
.user-menu[hidden] { display: none; }
.user-menu .menu-header {
  padding: 8px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.user-menu .menu-header strong { color: var(--text); font-weight: var(--font-weight-semibold); }
.user-menu .menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  color: var(--text); font-size: 14px;
  text-decoration: none;
  background: transparent; border: none; width: 100%;
  text-align: left; cursor: pointer;
}
.user-menu .menu-item:hover { background: var(--color-nav-hover-bg); text-decoration: none; }
.user-menu .menu-item svg { color: var(--muted-2); flex-shrink: 0; }
.user-menu .menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

@media (max-width: 767.98px) {
  .not-mobile { display: none; }
  #navbar .navbar-left > .item,
  #navbar .navbar-right > .item { padding: 3px 8px; }
}

.page-content {
  flex: 1;
  width: 1280px;
  max-width: calc(100% - 2 * var(--page-margin-x));
  margin-left: auto; margin-right: auto;
  padding: var(--page-spacing) 0;
}
.page-content.home { width: 100%; max-width: none; padding: 0; }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .card-row { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px;
  background: var(--panel-2); border: 1px solid var(--border);
}
.tag.public { background: rgba(26, 127, 55, 0.12); color: var(--success); border-color: var(--success); }
.tag.private { background: rgba(207, 34, 46, 0.12); color: var(--danger); border-color: var(--danger); }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.row .meta { color: var(--muted); font-size: 13px; }
pre {
  background: var(--panel-2); border: 1px solid var(--border); padding: 12px;
  border-radius: var(--radius); overflow-x: auto; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
}
.notice { background: rgba(47, 129, 247, 0.15); border-left: 3px solid var(--primary); padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; }
.error { background: rgba(207, 34, 46, 0.12); border-left: 3px solid var(--danger); padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; }
.success { background: rgba(26, 127, 55, 0.12); border-left: 3px solid var(--success); padding: 12px 16px; border-radius: 4px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.flex { display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }

/* ===== Landing Page Layout (port of DFGIT home.css) ===== */
.landing-layout {
  display: flex;
  gap: 2rem;
  width: 1280px;
  max-width: calc(100% - 2 * var(--page-margin-x));
  margin: 0 auto;
  padding: 2rem 0;
  min-height: calc(100vh - 120px);
}

.landing-sidebar {
  flex-shrink: 0;
  width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-top: 0.5rem;
}

/* Square avatar in landing sidebar — port of DFGIT shared/user/profile_big_avatar (ui card). */
.landing-avatar {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.landing-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.landing-avatar.initials {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white; font-size: 72px; font-weight: 700; letter-spacing: -2px;
  display: flex; align-items: center; justify-content: center;
}

.landing-name {
  font-size: 1.4rem;
  font-weight: 600;
  text-align: center;
  margin: 0;
}

.landing-bio {
  text-align: left;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}
.landing-bio p { margin: 0 0 0.6em; }
.landing-bio p:last-child { margin-bottom: 0; }

.landing-cta {
  font-weight: 500;
  color: var(--text);
}

.landing-resources { margin-top: 0.5rem; }
.landing-resources-title { font-weight: 600; color: var(--text); margin: 0 0 4px; }
.landing-resources ul { margin: 0; padding-left: 18px; }

.landing-main { flex: 1; min-width: 0; }

.landing-heading {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Карточка-список как в settings-sidebar: рамка, скруглённые углы,
   header с серым фоном, элементы разделены тонкими линиями.
   Используется внутри searchableList(enableNamespaceFilter) как правая колонка. */
.landing-ns-list {
  flex-shrink: 0;
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 1rem;
}

.landing-ns-title {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.landing-ns-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 14px;
  width: 100%;
}
.landing-ns-item:last-child { border-bottom: none; }
.landing-ns-item:hover { background: var(--panel-2); }
.landing-ns-item.active { color: var(--primary); font-weight: 600; background: transparent; }

.landing-ns-item .landing-ns-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.landing-ns-item .count {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted-2);
  background: var(--border);
  border-radius: 10px;
  padding: 0 6px;
  min-width: 22px;
  text-align: center;
  font-weight: 600;
}
.landing-ns-item.active .count {
  background: var(--primary);
  color: white;
}

/* Мобильный layout: ns-list растягивается на всю ширину и встаёт
   над списком. Sticky отключаем, карточный вид сохраняем. */
@media (max-width: 768px) {
  .landing-ns-list { width: 100%; position: static; }
}

/* Список + namespace-фильтр справа (на профиле и главной для зарегистрированных
   пользователей). Используется внутри .profile-content; sidebar справа
   переиспользует стили .landing-ns-*. */
.list-with-ns {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}
.list-with-ns > .list-main {
  flex: 1;
  min-width: 0;
}
@media (max-width: 768px) {
  .list-with-ns { flex-direction: column; }
}

.landing-repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  flex: 1;
  min-width: 0;
}


.landing-repo-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
  color: inherit;
  text-decoration: none;
}
.landing-repo-card:hover {
  border-color: var(--primary-light-2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: inherit;
}

.landing-repo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
}

.landing-repo-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.3em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.landing-repo-card:hover .landing-repo-name { text-decoration: underline; }

.landing-repo-shields {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  min-height: 20px;
}
.landing-repo-shields .shield {
  height: 20px; line-height: 20px; font-size: 11px;
  border-radius: 3px; overflow: hidden; display: inline-flex;
  font-family: -apple-system, "Segoe UI", sans-serif;
}
.landing-repo-shields .shield .k { background: #555; color: #fff; padding: 0 6px; }
.landing-repo-shields .shield .v { padding: 0 6px; color: #fff; }
.shield.version .v { background: #007ec6; }
.shield.langs .v { background: #4c1; }
.shield.license .v { background: #007ec6; }

.landing-repo-desc {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.landing-repo-langs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.landing-lang-badge { display: inline-flex; align-items: center; gap: 0.25em; font-size: 0.78rem; color: var(--muted); }
.landing-lang-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.landing-repo-topics { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.landing-repo-meta {
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  font-size: 0.78rem; color: var(--muted-2);
  margin-top: auto; padding-top: 0.5rem;
}
.landing-meta-item { display: inline-flex; align-items: center; gap: 0.2em; }

.landing-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: 1rem;
}

@media (max-width: 991.98px) {
  .landing-layout { gap: 1.5rem; }
  .landing-sidebar { width: 240px; }
  .landing-avatar img, .landing-avatar.initials { width: 160px; height: 160px; font-size: 56px; }
}
@media (max-width: 767.98px) {
  .landing-layout { flex-direction: column; padding: 1rem 16px; gap: 1rem; }
  .landing-sidebar { width: 100%; align-items: center; }
  .landing-avatar img, .landing-avatar.initials { width: 120px; height: 120px; font-size: 40px; }
  .landing-bio { text-align: center; }
  .landing-repo-grid { grid-template-columns: 1fr; }
}

/* ===== Home page (tabs-only layout for both anonymous and signed-in users) ===== */
.home-page {
  width: 1280px;
  max-width: calc(100% - 2 * var(--page-margin-x));
  margin: var(--page-spacing) auto;
}

/* ===== Dashboard (legacy: signed-in home with sidebar + heatmap + activity feed) ===== */
.dashboard-page {
  width: 1280px;
  max-width: calc(100% - 2 * var(--page-margin-x));
  margin: var(--page-spacing) auto;
}
.dashboard-layout { display: flex; gap: var(--page-spacing); align-items: flex-start; }
.dashboard-sidebar { width: 360px; flex-shrink: 0; order: 2; }
.dashboard-main { flex: 1; min-width: 0; order: 1; }
@media (max-width: 900px) {
  .dashboard-layout { flex-direction: column; }
  .dashboard-sidebar { width: 100%; order: -1; }
}

/* Sidebar combobox: switch between Containers / Packages / Scripts */
.sidebar-toptabs { margin-bottom: 12px; }
.sidebar-combobox {
  display: flex; width: 100%; align-items: center; gap: 10px;
  padding: 9px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit; font-size: 14px; font-weight: 600;
  color: var(--text); cursor: pointer; text-align: left;
}
.sidebar-combobox:hover { background: var(--panel-2); }
.sidebar-combobox .icon { color: var(--muted-2); flex-shrink: 0; display: inline-flex; }
.sidebar-combobox .label { flex: 1; }
.sidebar-combobox .caret { color: var(--muted-2); flex-shrink: 0; }

/* Repo list widget (port of Gitea's dashboard-repo-list, simplified) */
.repolist-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.repolist-header {
  display: flex; align-items: center;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  font-weight: 600;
  gap: 8px;
}
.repolist-header .count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 6px;
  font-size: 12px; font-weight: 600;
  background: var(--border); color: var(--text);
  border-radius: 10px;
}
.repolist-header .spacer { flex: 1; }
.repolist-header .icon-btn {
  background: transparent; color: var(--muted-2);
  border: 1px solid transparent; padding: 2px 8px; cursor: pointer;
  font-size: 20px; line-height: 1;
}
.repolist-header .icon-btn:hover { color: var(--text); background: var(--color-nav-hover-bg); border-radius: 4px; }

/* Combined search input (port of Fomantic "ui small fluid action left icon input") */
.repolist-search { padding: 10px 14px; }
.repolist-search .ui-input {
  display: flex; align-items: stretch;
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.repolist-search .ui-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 124, 214, 0.18);
}
.repolist-search .ui-input .icon-left {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 10px;
  color: var(--muted);
  pointer-events: none;
}
.repolist-search .ui-input input {
  flex: 1; min-width: 0;
  height: 36px; padding: 0 8px 0 0;
  background: transparent; color: var(--text);
  border: none; outline: none;
  font: inherit; font-size: 14px;
}
.repolist-search .ui-input input::placeholder { color: var(--muted); }
.repolist-search .ui-input .filter-btn {
  flex-shrink: 0; width: 40px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted-2);
  border: none; border-left: 1px solid var(--border);
  cursor: pointer;
}
.repolist-search .ui-input .filter-btn:hover { background: var(--color-nav-hover-bg); color: var(--text); }

.repolist-tabs {
  display: flex; gap: 4px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--muted-2);
}
.repolist-tabs .tab {
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--muted-2);
}
.repolist-tabs .tab:hover { color: var(--text); }
.repolist-tabs .tab.active { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
.repolist-tabs .tab .count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 5px; font-size: 11px;
  background: var(--border); color: var(--text); border-radius: 9px;
}

.repolist-items { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto; }
.repolist-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.repolist-item:last-child { border-bottom: none; }
.repolist-item .vis-icon { color: var(--muted-2); flex-shrink: 0; display: inline-flex; }
.repolist-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--primary); }
.repolist-item .status-icon { flex-shrink: 0; display: inline-flex; }
.repolist-item .status-icon.ok { color: var(--success); }
.repolist-item .status-icon.err { color: var(--danger); }
.repolist-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 13px; }
.repolist-empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 32px 16px;
  color: var(--muted);
  text-align: center;
}
.repolist-empty-state .icon {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--panel-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-2);
}
.repolist-empty-state .icon svg { width: 22px; height: 22px; }
.repolist-empty-state .text { font-size: 13px; color: var(--muted); }

.repolist-paginate {
  display: flex; justify-content: center; align-items: center;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.repolist-paginate .pages {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.repolist-paginate .pages > * {
  min-width: 36px; height: 32px; padding: 0 10px;
  background: transparent; color: var(--text);
  border: none;
  border-left: 1px solid var(--border);
  font-size: 16px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.repolist-paginate .pages > *:first-child { border-left: none; }
.repolist-paginate .pages button:hover:not(:disabled) { background: var(--color-nav-hover-bg); }
.repolist-paginate .pages button:disabled { color: var(--muted-2); cursor: default; }
.repolist-paginate .pages .page.active { background: var(--panel-2); color: var(--text); font-weight: 600; cursor: default; }

.activity-heatmap-container { margin-bottom: 16px; container-type: inline-size; }
.user-heatmap {
  display: grid;
  grid-template-columns: 32px 1fr;
  grid-template-rows: 14px auto auto;
  column-gap: 4px;
  row-gap: 4px;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
}
.user-heatmap .hm-months {
  grid-column: 2; grid-row: 1;
  display: grid; align-items: end;
  grid-template-columns: repeat(53, minmax(0, 1fr));
  column-gap: 3px;
  min-width: 0;
}
.user-heatmap .hm-month {
  text-align: left; color: var(--muted); font-size: 11px;
  white-space: nowrap; overflow: hidden;
}
.user-heatmap .hm-days {
  grid-column: 1; grid-row: 2;
  display: grid; grid-template-rows: repeat(7, 1fr);
  row-gap: 3px;
  align-self: stretch;
}
.user-heatmap .hm-day {
  font-size: 10px; color: var(--muted);
  display: flex; align-items: center;
}
.user-heatmap .hm-grid {
  grid-column: 2; grid-row: 2;
  display: grid;
  grid-template-columns: repeat(53, minmax(0, 1fr));
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  column-gap: 3px; row-gap: 3px;
  min-width: 0;
}
.user-heatmap .hm-cell {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 2px;
  background: #ebedf0;
}
.user-heatmap .hm-cell[data-level="1"] { background: #cee5fb; }
.user-heatmap .hm-cell[data-level="2"] { background: #79b8ff; }
.user-heatmap .hm-cell[data-level="3"] { background: #4a8bf5; }
.user-heatmap .hm-cell[data-level="4"] { background: #1f6feb; }
.user-heatmap .hm-cell.empty { background: transparent; }

.user-heatmap .hm-footer {
  grid-column: 1 / span 2; grid-row: 3;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--muted);
  margin-top: 6px;
}
.user-heatmap .hm-legend { display: inline-flex; align-items: center; gap: 4px; }
.user-heatmap .hm-legend .hm-cell { width: 11px; height: 11px; display: inline-block; }

.heatmap-divider { height: 1px; background: var(--border); margin: 12px 0 16px; }

/* Activity feed (flex-list) — port of web_src/css/shared/flex-list.css */
.flex-list { list-style: none; margin: 0; padding: 0; }
.flex-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 0;
}
.flex-item + .flex-item { border-top: 1px solid var(--color-secondary); }
.flex-item .flex-item-leading { display: flex; align-items: flex-start; }
.flex-item .flex-item-main {
  display: flex; flex-direction: column; gap: 0.25em;
  flex-grow: 1; flex-basis: 60%; min-width: 0;
}
.flex-item .flex-item-title-row {
  display: flex; align-items: center; gap: 0.5rem;
  min-width: 0;
}
.flex-item .flex-item-trailing {
  display: flex; gap: 0.5rem; align-items: center;
  flex-grow: 0; justify-content: end; color: var(--muted);
}
.flex-item .flex-item-trailing .tag { white-space: nowrap; }
.flex-item a:not(.label, .button):hover { color: var(--primary); }
.flex-item .ui.avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.flex-item .ui.avatar.small { width: 16px; height: 16px; }
.flex-item .flex-text-block { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.flex-item .sha.label {
  display: inline-block; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 1px 6px; font-size: 12px; color: var(--text);
}
.flex-item .sha.label:hover { background: var(--color-nav-hover-bg); }
.flex-item .truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-msg { color: var(--text); }
.feed-time { color: var(--muted); }

/* Кликабельная плашка проекта в публичных списках (главная для гостей, обзор).
   Вся карточка-строка — это <a>, рамка/тень не нужны: список уже разделён border-top'ом. */
a.flex-item-link {
  text-decoration: none;
  color: inherit;
}
a.flex-item-link:hover { background: var(--panel-2); }
a.flex-item-link:hover .feed-msg { color: var(--primary); }
.flex-item .flex-item-meta-row {
  display: flex; flex-wrap: wrap;
  gap: 12px; align-items: center;
  color: var(--muted); font-size: 12px;
  margin-top: 2px;
}
.flex-item .flex-item-meta {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}

/* Пагинация: «Первая · Предыдущая · 1 2 3 · Следующая · Последняя».
   Кнопки идут одной строкой с одинаковыми зазорами, активная страница —
   светло-голубая подложка. */
.list-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.list-pager[hidden] { display: none; }
.list-pager-pages {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}
.list-pager-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  color: var(--muted);
}
.list-pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 1;
}
.list-pager-btn.list-pager-nav { font-weight: 500; }
.list-pager-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--panel-2);
}
.list-pager-btn.active {
  background: #cfe6ff;
  border-color: #cfe6ff;
  color: var(--primary);
  font-weight: 600;
  cursor: default;
}
.list-pager-btn:disabled {
  color: var(--muted-2);
  border-color: var(--border);
  background: var(--panel);
  cursor: default;
  opacity: 0.7;
}

/* ===== Repository page (project view) — DFGIT-style header + tabs ===== */
.repo-page { padding-top: var(--page-spacing); }
.repo-header {
  display: flex; align-items: center; gap: 10px;
  padding-bottom: 12px;
}
.repo-header .repo-title {
  font-size: 20px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.repo-header .repo-title .sep { color: var(--muted-2); margin: 0 2px; }
.repo-header .repo-title a { color: var(--primary); }
.repo-header .spacer { flex: 1; }

.repo-tabs {
  display: flex; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  gap: 4px;
}
.repo-tabs .tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  font-size: 14px; color: var(--muted-2);
  background: transparent;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer; text-decoration: none;
}
.repo-tabs .tab svg { color: inherit; }
.repo-tabs .tab:hover { color: var(--text); text-decoration: none; }
.repo-tabs .tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.repo-tabs .tab .count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 6px;
  font-size: 12px; font-weight: 600;
  background: var(--border); color: var(--text);
  border-radius: 10px;
}

.repo-section { display: flex; flex-direction: column; gap: var(--page-spacing); }

/* ===== Markdown editor + rendered output ===== */
.md-editor {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.md-editor-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.md-editor-tabs .md-tab {
  padding: 8px 14px;
  background: var(--panel-2);
  border: 1px solid transparent;
  border-bottom: none;
  margin-bottom: -1px;
  cursor: pointer;
  font-size: 13px; color: var(--muted-2);
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 0;
}
.md-editor-tabs .md-tab:hover { color: var(--text); }
.md-editor-tabs .md-tab.active {
  color: var(--text);
  font-weight: 600;
  background: var(--panel);
  border-color: var(--border);
  border-bottom: 1px solid var(--panel);
}
.md-editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.md-editor-toolbar button {
  background: transparent; color: var(--muted-2);
  border: 1px solid transparent; border-radius: 4px;
  width: 32px; height: 30px; padding: 0;
  cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.md-editor-toolbar button:hover { background: var(--color-nav-hover-bg); color: var(--text); border-color: var(--border); }
.md-editor-toolbar .sep { width: 1px; background: var(--border); margin: 4px 4px; }
.md-editor-body { position: relative; }
.md-editor-textarea {
  display: block; width: 100%;
  padding: 12px 14px;
  background: var(--panel); color: var(--text);
  border: none; outline: none;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 13px; line-height: 1.5;
  min-height: 220px; resize: vertical;
}
.md-editor-preview {
  display: none;
  padding: 12px 16px;
  min-height: 220px;
  background: var(--panel); color: var(--text);
  overflow: auto;
}
.md-editor.preview-active .md-editor-textarea { display: none; }
.md-editor.preview-active .md-editor-preview { display: block; }
.md-editor.preview-active .md-editor-toolbar { display: none; }

/* Rendered markdown */
.md-rendered { font-size: 14px; line-height: 1.6; color: var(--text); }
.md-rendered > *:first-child { margin-top: 0; }
.md-rendered > *:last-child  { margin-bottom: 0; }
.md-rendered h1, .md-rendered h2, .md-rendered h3, .md-rendered h4 {
  margin: 18px 0 10px; line-height: 1.25; font-weight: 600;
}
.md-rendered h1 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.md-rendered h2 { font-size: 18px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.md-rendered h3 { font-size: 16px; }
.md-rendered h4 { font-size: 14px; }
.md-rendered p { margin: 0 0 12px; }
.md-rendered ul, .md-rendered ol { margin: 0 0 12px; padding-left: 24px; }
.md-rendered li { margin: 2px 0; }
.md-rendered blockquote {
  margin: 0 0 12px; padding: 4px 12px;
  color: var(--muted); border-left: 3px solid var(--border); background: var(--panel-2);
}
.md-rendered code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.9em;
  background: var(--panel-2); padding: 1px 6px; border-radius: 4px;
}
.md-rendered pre {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  margin: 0 0 12px; overflow-x: auto; font-size: 13px;
}
.md-rendered pre code { background: transparent; padding: 0; }
.md-rendered a { color: var(--primary); }
.md-rendered hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md-rendered img { max-width: 100%; height: auto; }
.md-rendered table { border-collapse: collapse; margin: 0 0 12px; }
.md-rendered table th, .md-rendered table td { border: 1px solid var(--border); padding: 6px 10px; }

/* ===== Modal dialog ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  padding: 16px;
}
.modal-dialog {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 520px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.modal-header {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  font-weight: 600; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.modal-header .close-btn {
  background: transparent; color: var(--muted-2);
  border: none; cursor: pointer; padding: 0 6px;
  font-size: 18px; line-height: 1;
}
.modal-body { padding: 16px; }
.modal-footer {
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--panel-2);
}
.modal-status { margin-top: 12px; font-size: 13px; color: var(--muted); }
.modal-status.error { color: var(--danger); }
.modal-status.ok    { color: var(--success); }

.danger-zone {
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}
.danger-zone .settings-card-header {
  background: rgba(207, 34, 46, 0.08);
  color: var(--danger);
  border-bottom-color: var(--danger);
}

/* ===== User profile page (port of DFGIT templates/user/profile.tmpl) ===== */
.profile-page {
  display: flex;
  gap: 2rem;
  margin-top: var(--page-spacing);
  align-items: flex-start;
}
.profile-page .profile-side {
  flex-shrink: 0;
  width: 280px;
  display: flex; flex-direction: column;
  gap: 12px;
}
.profile-page .profile-avatar {
  width: 100%; aspect-ratio: 1 / 1;
  background: var(--panel-2);
  border-radius: var(--radius);
  overflow: hidden;
}
.profile-page .profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-page .profile-fullname { font-size: 22px; font-weight: 600; margin: 4px 0 0; line-height: 1.2; }
.profile-page .profile-login {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: 14px;
}
.profile-page .profile-login a { color: var(--muted); }
.profile-page .profile-login a:hover { color: var(--primary); }
.profile-page .profile-follow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--muted);
}
.profile-page .profile-follow a { color: var(--muted); }
.profile-page .profile-info {
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--border);
  padding-top: 10px; margin-top: 8px;
  font-size: 14px; color: var(--text);
}
.profile-page .profile-info-row {
  display: flex; align-items: center; gap: 8px;
}
.profile-page .profile-info-row svg { color: var(--muted-2); flex-shrink: 0; }
.profile-page .profile-info-row .lock { margin-left: auto; color: var(--muted-2); }

.profile-page .profile-main { flex: 1; min-width: 0; }

/* Tabs (port of ui secondary pointing tabular borderless menu) */
.profile-tabs {
  display: flex; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  gap: 4px;
}
.profile-tabs .tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  font-size: 14px; color: var(--muted-2);
  background: transparent;
  /* Сбрасываем дефолтные стили <button> (border, border-radius), иначе
     активная подсветка выглядит «с загнутыми краями» — border-radius
     закругляет border-box, и border-bottom загибается по углам. */
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  text-decoration: none;
}
.profile-tabs .tab svg { color: inherit; }
.profile-tabs .tab:hover { color: var(--text); text-decoration: none; }
.profile-tabs .tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.profile-tabs .tab .count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 6px;
  font-size: 12px; font-weight: 600;
  background: var(--border); color: var(--text);
  border-radius: 10px;
}
.profile-tabs .tab.active .count { background: var(--primary-light-2); color: white; }

/* Tab content reuses .flex-list / .flex-item already defined */
.profile-content .empty { padding: 32px 8px; color: var(--muted); }

/* Тонкий индикатор загрузки под табами — индетерминантная полоска,
   движется слева направо, пока контент дотягивается. Удаляется из DOM
   обработчиком после загрузки. */
.loading-bar {
  height: 2px;
  background: transparent;
  overflow: hidden;
  position: relative;
  margin-top: -16px;    /* совместить с нижней границей profile-tabs */
  margin-bottom: 14px;
}
.loading-bar::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 40%;
  background: var(--primary);
  border-radius: 2px;
  animation: loading-bar-slide 1.2s ease-in-out infinite;
}
@keyframes loading-bar-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

.profile-search {
  display: flex; gap: 8px; margin-bottom: 12px;
}
.profile-search .ui-input {
  display: flex; align-items: center;
  flex: 1; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.profile-search .ui-input input {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px;
  background: transparent; color: var(--text);
  border: none; outline: none; font: inherit; font-size: 14px;
}
.profile-search .ui-input .icon-right {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 34px; border-left: 1px solid var(--border);
  color: var(--muted-2);
}
.profile-search .filter-btn, .profile-search .sort-btn {
  height: 34px; padding: 0 12px; font-size: 13px;
  background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.profile-search .filter-btn:hover, .profile-search .sort-btn:hover { background: var(--panel-2); }
.dropdown-menu {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
  min-width: 200px;
}
.dropdown-item {
  background: transparent; border: none;
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 8px 14px; font-size: 13px; color: var(--text);
  cursor: pointer;
}
.dropdown-item:hover { background: var(--color-nav-hover-bg); }
.dropdown-item.active { font-weight: 600; }
.dropdown-item .check { width: 14px; color: var(--primary); font-weight: 700; }
.dropdown-item:not(.active) .check { visibility: hidden; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Custom <select> replacement — Fomantic-style dropdown */
.custom-select { position: relative; width: 100%; }
.custom-select-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px; min-height: 38px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: 14px; text-align: left;
  cursor: pointer;
}
.custom-select-btn:hover { background: var(--panel-2); }
.custom-select-btn.open,
.custom-select-btn:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 124, 214, 0.18);
}
.custom-select-btn .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-btn .caret { color: var(--muted-2); flex-shrink: 0; }
.dropdown-check {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  cursor: pointer; font-size: 13px; color: var(--text);
  background: transparent; border: none; width: 100%; text-align: left;
}
.dropdown-check:hover { background: var(--color-nav-hover-bg); }
.dropdown-check[disabled],
.dropdown-check[aria-disabled="true"] { color: var(--muted-2); cursor: not-allowed; }
.dropdown-check[disabled]:hover,
.dropdown-check[aria-disabled="true"]:hover { background: transparent; }
.dropdown-check .box {
  width: 16px; height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel);
  color: white; font-size: 11px; line-height: 1;
}
.dropdown-check.checked .box { background: var(--primary); border-color: var(--primary); }
.dropdown-check.checked .box::before { content: "✓"; }
.dropdown-check.indeterminate .box { background: var(--primary-light-2); border-color: var(--primary-light-2); }
.dropdown-check.indeterminate .box::before { content: "−"; color: white; font-weight: 700; }
.dropdown-check .label .hint { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }

@media (max-width: 900px) {
  .profile-page { flex-direction: column; }
  .profile-page .profile-side { width: 100%; }
  .profile-page .profile-avatar { aspect-ratio: auto; height: 200px; }
}

/* ===== Settings (user / admin) — DFGIT-style two-column layout
   Widths match DFGIT web_src/css/modules/flexcontainer.css:
   .flex-container-nav { width: 240px } + .flex-container-main { flex: 1 } */
.settings-layout {
  display: flex;
  gap: var(--page-spacing);
  align-items: flex-start;
  margin-top: var(--page-spacing);
}
.settings-sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.settings-sidebar-title {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  font-weight: 600;
}
.settings-sidebar-list { list-style: none; margin: 0; padding: 0; }
.settings-sidebar-item {
  display: block; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
  font-size: 14px;
}
.settings-sidebar-item:last-child { border-bottom: none; }
.settings-sidebar-item:hover { background: var(--panel-2); text-decoration: none; }
.settings-sidebar-item.active { color: var(--primary); font-weight: 600; background: transparent; }
.settings-sidebar-group {
  padding: 8px 14px 4px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted-2);
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
/* MCP tool docs — collapsible blocks */
.mcp-tool {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.mcp-tool:last-child { border-bottom: none; }
.mcp-tool summary {
  cursor: pointer;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px;
  list-style: none;
}
.mcp-tool summary::-webkit-details-marker { display: none; }
.mcp-tool summary::before {
  content: "▸";
  display: inline-block;
  width: 12px;
  color: var(--muted-2);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.mcp-tool[open] summary::before { transform: rotate(90deg); }
.mcp-tool-name {
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 14px; font-weight: 600;
  background: var(--panel-2); padding: 2px 8px; border-radius: 4px;
  color: var(--primary);
}
.mcp-tool-desc { color: var(--text); font-size: 14px; flex: 1; min-width: 200px; }
.mcp-tool-body { margin: 8px 0 4px 24px; }
.mcp-tool-body table th, .mcp-tool-body table td { padding: 4px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.mcp-tool-body table th { font-weight: 600; color: var(--text); font-size: 12px; text-transform: none; }
.mcp-tool-body pre { font-size: 12px; }

.grafana-frame {
  position: relative;
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 560px;
  background: var(--panel);
  overflow: hidden;
}
/* Растягиваем iframe на 40px выше границы родителя и сдвигаем вниз на -40px,
   обрезая «Powered by Grafana» в самом низу через overflow:hidden родителя. */
.grafana-frame iframe {
  width: 100%;
  height: calc(100% + 40px);
  margin-bottom: -40px;
  display: block; border: 0;
}

.settings-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--page-spacing); }

.admin-projects-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.admin-project-head {
  flex-wrap: wrap;
  row-gap: 0.35rem;
}
.admin-project-path {
  font-size: 1rem;
}
.admin-project-desc {
  font-size: 13px;
  line-height: 1.45;
}

.settings-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.settings-card-header {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  min-height: 42px;
}
.settings-card-header > :first-child { flex: 1; min-width: 0; }
.card-action-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted-2);
  cursor: pointer;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  padding: 0;
}
.card-action-btn:hover { background: var(--color-nav-hover-bg); color: var(--text); border-color: var(--border); }

/* Fullscreen overlay for dashboard cards */
.settings-card.fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  border-radius: 0;
  border: none;
  display: flex; flex-direction: column;
  background: var(--panel);
}
.settings-card.fullscreen > .settings-card-body { flex: 1; min-height: 0; }
.settings-card.fullscreen .grafana-frame {
  height: 100%;
  min-height: 0;
}
body.has-fullscreen { overflow: hidden; }
.settings-card-body { padding: 20px 24px; }
.settings-intro { color: var(--text); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }

.settings-field { margin-bottom: 18px; }
.settings-field label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 13px; color: var(--text); }
.settings-field .req { color: var(--danger); font-weight: 700; margin-left: 2px; }
.settings-field input[type="text"],
.settings-field input[type="email"],
.settings-field input[type="password"],
.settings-field input[type="date"],
.settings-field input[type="datetime-local"],
.settings-field select,
.settings-field textarea {
  display: block; width: 100%;
  padding: 9px 12px; font-size: 14px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.settings-field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  cursor: pointer;
}
.settings-field textarea { min-height: 84px; font-family: inherit; }
.settings-field input:focus, .settings-field select:focus, .settings-field textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 124, 214, 0.18);
}
.settings-field .readonly-value { padding: 4px 0; font-size: 14px; color: var(--text); }
.settings-field .hint { margin-top: 4px; font-size: 12px; color: var(--muted); }

.settings-submit {
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  background: var(--primary); color: white;
  border: 1px solid var(--primary); border-radius: var(--radius);
  cursor: pointer;
}
.settings-submit:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.settings-submit.danger { background: var(--danger); border-color: var(--danger); }
.settings-submit.danger:hover { background: #a4131c; border-color: #a4131c; }
.settings-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.settings-card-body .settings-submit + .settings-submit { margin-left: 8px; }
.settings-card-body .checkbox-field { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.settings-card-body .checkbox-field input { width: auto; }
.settings-card-body .checkbox-field label { margin-bottom: 0; font-weight: 600; font-size: 14px; color: var(--text); }
.hr-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

@media (max-width: 720px) {
  .settings-layout { flex-direction: column; }
  .settings-sidebar { width: 100%; }
}

/* ===== Sign-in page (DFGIT signin look) ===== */
.signin-page { display: flex; justify-content: center; padding: 48px 16px; }
.signin-container {
  width: 100%; max-width: 480px;
}
.signin-form .req { color: var(--danger); font-weight: 700; margin-left: 2px; }
.signin-header {
  margin: 0;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 14px 20px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.signin-segment {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 24px;
}
.signin-form .field { margin-bottom: 14px; }
.signin-form .field > label {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.signin-form .field input[type="text"],
.signin-form .field input[type="email"],
.signin-form .field input[type="password"] {
  display: block; width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.signin-form .field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 124, 214, 0.18); }
.signin-form .field.error input { border-color: var(--danger); }
.signin-form .password-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.signin-form .password-row label { margin-bottom: 0; font-weight: 700; font-size: 13px; color: var(--text); }
.signin-form .password-row a { font-size: 13px; }
.signin-form .checkbox-field { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.signin-form .checkbox-field input { width: auto; }
.signin-form .checkbox-field label { font-size: 13px; color: var(--text); margin: 0; }
.signin-submit {
  width: 100%; padding: 10px 14px;
  font-size: 14px; font-weight: 600;
  background: var(--primary); color: white;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  cursor: pointer;
}
.signin-submit:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

/* ===== Page Footer ===== */
.page-footer {
  display: flex;
  justify-content: space-between;
  background-color: var(--footer);
  border-top: 1px solid var(--border);
  padding: 8px 20px;
  color: var(--muted);
  font-size: 13px;
}
.page-footer .left-links, .page-footer .right-links {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25em;
  flex: 1 1 0;
}
.page-footer .right-links { justify-content: flex-end; }
.page-footer .center-links {
  flex: 1 1 0;
  text-align: center;
  white-space: nowrap;
}
.page-footer .center-links a { color: var(--muted); text-decoration: underline; }
.page-footer .center-links a:hover { color: var(--text); }
.page-footer .right-links > a {
  border-left: 1px solid var(--border);
  padding-left: 1em;
  color: var(--muted);
}
@media (max-width: 880px) {
  .page-footer { flex-direction: column; gap: 0.5em; align-items: center; }
  .page-footer .left-links, .page-footer .center-links, .page-footer .right-links { flex: none; justify-content: center; white-space: normal; }
  .page-footer .right-links > a { border-left: none; padding-left: 0; }
}
