:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --lock: #0284c7;
  --unk: #6b7280;
  --line: #e2e8f0;
  --accent: #2563eb;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --page-padding: 28px;
  --page-gap: 12px;
  --page-header-height: 40px;
  --title-size: 28px;
  --surface-padding: 16px;
  --surface-radius: 8px;
}

* { box-sizing: border-box; }

[v-cloak] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(180deg, #f8fafc 0%, #eef4fb 100%);
}

.login-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.1);
}

.login-card-loading {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.login-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.login-card-top h2 {
  font-size: 20px;
  margin-bottom: 3px;
}

.login-card-top .sub {
  margin-top: 0;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field label {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.login-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.login-input-wrap:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
  transform: translateY(-1px);
}

.login-input-wrap svg {
  width: 18px;
  height: 18px;
  color: #94a3b8;
  flex: 0 0 auto;
}

.login-input-wrap input {
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  min-width: 0;
  padding: 14px 0;
  box-shadow: none;
}

.login-input-wrap input::placeholder {
  color: #94a3b8;
}

.login-error {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.18);
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
}

.login-submit {
  margin-top: 4px;
  min-height: 48px;
  border-radius: 14px;
  font-size: 15px;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.18);
}

.login-submit:disabled {
  opacity: 0.75;
  cursor: wait;
}

.login-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.auth-loading {
  color: var(--muted);
  font-size: 14px;
}

.app-shell { min-height: 100vh; }
.mobile-header,
.sidebar-backdrop,
.sidebar-close { display: none; }
.sidebar { display: none; }

.main-content {
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.container {
  width: 100%;
  margin: 0;
  padding: var(--page-padding);
}

.brand {
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 22px;
}

.brand span {
  display: block;
  color: #93a4b8;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  padding: 9px 10px;
}

.nav-link:hover { background: rgba(148, 163, 184, 0.12); color: #fff; }
.nav-link.active { background: #1d4ed8; color: #fff; }

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  flex: 0 0 auto;
}

.sidebar-profile {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #1e293b;
}

.profile-button {
  width: 100%;
  min-height: 52px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid transparent;
  color: #fff;
  text-align: left;
}

.profile-button:hover { background: #172033; border-color: #29364d; }

.profile-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.profile-name {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-role {
  display: block;
  margin-top: 2px;
  color: #93a4b8;
  font-size: 11px;
  text-transform: capitalize;
}

.profile-caret { color: #93a4b8; font-size: 14px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  min-height: var(--page-header-height);
  margin-bottom: var(--page-gap);
}

h1, h2 {
  margin: 0;
  font-size: var(--title-size);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0;
}

.subtitle { color: var(--muted); margin-top: 6px; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.breadcrumb a { font-size: 13px; }
.breadcrumb-current { color: var(--text); }
.view { display: none; }

.view.active {
  display: block;
  width: 100%;
}

.overview-view.active {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: calc(100vh - (var(--page-padding) * 2));
  overflow: visible;
  overscroll-behavior: contain;
  padding-right: 4px;
  padding-bottom: 8px;
}

.data-view.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - (var(--page-padding) * 2));
  min-height: 0;
  overflow: hidden;
}

.cards {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: var(--page-gap);
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  min-height: 88px;
  border-radius: var(--surface-radius);
  padding: var(--surface-padding);
  box-shadow: var(--shadow);
  overflow: auto;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

.card .label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.card .value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.panel {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--surface-radius);
  padding: var(--surface-padding);
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.panel:hover {
  border-color: #d6deea;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

.data-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.overview-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
}

.panel-head {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.overview-line {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.overview-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 10px;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.legend-desc {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  padding-top: 2px;
}

.compact-table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-table {
  font-size: 12px;
}

.compact-table th,
.compact-table td {
  padding: 9px 10px;
}

.compact-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.compact-table tbody tr,
table tbody tr {
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.compact-table tbody tr:hover,
table tbody tr:hover {
  background: #f8fbff;
}

.compact-table tbody tr:hover td,
table tbody tr:hover td {
  box-shadow: inset 0 0 0 9999px rgba(37, 99, 235, 0.02);
}

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

.panel-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
}

.form-panel {
  margin-bottom: 14px;
  box-shadow: none;
  background: #f8fafc;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.form-grid input,
.form-grid select {
  width: 100%;
  min-width: 0;
}

.form-grid select,
.styled-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
  min-height: 42px;
  padding: 10px 40px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
  color: var(--text);
  font: inherit;
  line-height: 1.2;
  cursor: pointer;
}

.form-grid select:focus,
.styled-select:focus {
  outline: 2px solid #bfdbfe;
  border-color: #93c5fd;
}

.form-grid select::-ms-expand,
.styled-select::-ms-expand {
  display: none;
}

.panel-form-actions {
  margin-top: 12px;
}

.toolbar-right { display: flex; align-items: center; gap: 10px; }

.refresh-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.refresh-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #2563eb;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12);
  animation: refresh-pulse 1.2s ease-in-out infinite;
}

@keyframes refresh-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

.table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--card);
  font-size: 12px;
  color: var(--muted);
  box-shadow: 0 1px 0 var(--line);
}

#instanceRows tr,
#repoRows tr { transition: background-color 0.16s ease; }
#instanceRows tr:hover,
#repoRows tr:hover { background: #f8fafc; }

.data-panel .table-wrap tbody tr {
  cursor: default;
}

.data-panel .table-wrap tbody tr:hover,
.overview-panel .compact-table-wrap tbody tr:hover {
  background: #f8fbff;
}

.data-panel .table-wrap tbody tr:hover td,
.overview-panel .compact-table-wrap tbody tr:hover td {
  background: transparent;
}

.data-panel .table-wrap tbody tr td:first-child,
.overview-panel .compact-table-wrap tbody tr td:first-child {
  position: relative;
}

.data-panel .table-wrap tbody tr:hover td:first-child::before,
.overview-panel .compact-table-wrap tbody tr:hover td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}

.SYNC { background: var(--ok); }
.BEHIND, .AHEAD { background: var(--warn); }
.DIVERGED, .ERROR { background: var(--bad); }
.LOCKED { background: var(--lock); }
.UNKNOWN { background: var(--unk); }
.user { background: #475569; }
.superadmin { background: #7c3aed; }

.status-icons {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
}

.status-icon {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
  box-shadow: 0 0 0 2px #fff;
}

.status-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 5;
}

.status-icon:hover::after { opacity: 1; }
.small { color: var(--muted); font-size: 12px; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }

.dirty-tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dirty-tooltip-trigger {
  width: auto;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: help;
}

.dirty-tooltip-trigger:hover,
.dirty-tooltip-trigger:focus-visible {
  border-color: #93c5fd;
  background: #f8fbff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dirty-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 10px;
  width: max-content;
  min-width: 260px;
  max-width: min(520px, 70vw);
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.dirty-tooltip::before {
  content: '';
  position: absolute;
  left: 18px;
  top: -6px;
  width: 10px;
  height: 10px;
  background: #0f172a;
  border-left: 1px solid #1e293b;
  border-top: 1px solid #1e293b;
  transform: rotate(45deg);
}

.dirty-tooltip-wrap:hover .dirty-tooltip,
.dirty-tooltip-wrap:focus-within .dirty-tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dirty-tooltip-section {
  display: grid;
  gap: 5px;
}

.dirty-tooltip-section strong {
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.3;
}

.dirty-tooltip-item {
  display: block;
  color: #cbd5e1;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: normal;
}

.app-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.app-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid #dbe4f0;
  border-radius: 999px;
  background: #f8fafc;
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 250px;
  background: #fff;
  color: var(--text);
}

input:focus { outline: 2px solid #bfdbfe; border-color: #93c5fd; }

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

button:hover { filter: brightness(0.95); }

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: var(--text);
  filter: none;
  transform: translateY(-1px);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.danger-btn { background: var(--bad); }

.danger-icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: #fff;
  color: var(--bad);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.danger-icon-btn:hover {
  background: rgba(239, 68, 68, 0.07);
  border-color: rgba(239, 68, 68, 0.34);
  color: #dc2626;
  transform: translateY(-1px);
  filter: none;
}

.danger-icon-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.action-cell { width: 1%; white-space: nowrap; }

.text-wrap {
  max-width: 280px;
  word-break: break-word;
  white-space: normal;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  white-space: normal;
  line-height: 1.35;
}

.error-text {
  max-width: 320px;
}

.skeleton-block {
  display: grid;
  gap: 10px;
}

.skeleton-table-row {
  display: grid;
  grid-template-columns: 2.2fr 0.8fr 1fr 0.8fr 1fr 1fr 0.7fr;
  gap: 10px;
  align-items: center;
  min-height: 30px;
}

.skeleton-table-row.detail-row {
  grid-template-columns: 2.2fr 1fr 0.9fr 0.7fr 0.7fr 0.7fr 1.8fr 0.8fr 1.8fr 1fr 1fr;
}

.skeleton-card {
  min-height: 88px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg, #e5e7eb 0%, #f3f4f6 45%, #e5e7eb 100%);
  background-size: 200% 100%;
  border-radius: 10px;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.skeleton-label {
  width: 52%;
  height: 12px;
  margin-bottom: 12px;
}

.skeleton-value {
  width: 38%;
  height: 28px;
}

.skeleton-line {
  width: 100%;
  height: 12px;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-cell {
  height: 14px;
}

.skeleton-cell.wide { width: 100%; }
.skeleton-cell.short { width: 70%; }
.skeleton-cell.status { width: 72px; }
.skeleton-cell.date { width: 120px; }
.skeleton-cell.device { width: 90%; }
.skeleton-cell.action { width: 36px; height: 36px; border-radius: 10px; }
.skeleton-cell.badge { width: 64px; height: 22px; border-radius: 999px; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.modal {
  width: min(900px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
}

.repo-modal {
  width: min(1040px, 100%);
  padding: 0;
}

.account-modal { width: min(420px, 100%); }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
}

.repo-modal .modal-head {
  margin: 0;
  padding: 16px 18px 14px;
}

.repo-modal-title {
  min-width: 0;
}

.repo-modal-title strong {
  display: block;
  font-size: 18px;
  line-height: 1.25;
}

.repo-modal-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.modal-close {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.modal-close:hover { background: #f3f7fb; color: var(--text); }

.modal-close svg,
.sidebar-close svg {
  width: 16px;
  height: 16px;
  display: block;
}

.user-modal {
  width: min(620px, 100%);
}

.user-modal .user-form-grid {
  margin-top: 4px;
}

.user-modal .account-actions {
  margin-bottom: 0;
}

.user-modal .form-message {
  margin-top: 14px;
}

.user-modal .panel-form-actions {
  margin-top: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 8px 12px;
  font-size: 13px;
}

.repo-health {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.repo-health.SYNC {
  border-color: rgba(5, 150, 105, 0.22);
  background: rgba(5, 150, 105, 0.08);
  color: #065f46;
}

.repo-health.BEHIND,
.repo-health.AHEAD {
  border-color: rgba(217, 119, 6, 0.24);
  background: rgba(217, 119, 6, 0.09);
  color: #92400e;
}

.repo-health.DIVERGED,
.repo-health.ERROR {
  border-color: rgba(220, 38, 38, 0.22);
  background: rgba(220, 38, 38, 0.08);
  color: #991b1b;
}

.repo-health.LOCKED {
  border-color: rgba(2, 132, 199, 0.22);
  background: rgba(2, 132, 199, 0.08);
  color: #075985;
}

.repo-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px 16px;
}

.repo-summary-card {
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.repo-summary-card.SYNC {
  border-color: rgba(5, 150, 105, 0.18);
  background: #f0fdf4;
}

.repo-summary-card.BEHIND,
.repo-summary-card.AHEAD {
  border-color: rgba(217, 119, 6, 0.24);
  background: #fffbeb;
}

.repo-summary-card.DIVERGED,
.repo-summary-card.ERROR {
  border-color: rgba(220, 38, 38, 0.22);
  background: #fef2f2;
}

.repo-summary-card.LOCKED {
  border-color: rgba(2, 132, 199, 0.22);
  background: #f0f9ff;
}

.repo-summary-card.UNKNOWN {
  border-color: rgba(107, 114, 128, 0.18);
  background: #f9fafb;
}

.repo-summary-card.attention {
  border-color: rgba(217, 119, 6, 0.28);
  background: #fffbeb;
}

.repo-summary-card.clean {
  border-color: rgba(5, 150, 105, 0.18);
  background: #f0fdf4;
}

.repo-summary-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.repo-summary-value {
  margin-top: 8px;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.repo-summary-hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.repo-info-sections {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 12px;
  padding: 0 18px 18px;
}

.repo-info-sections .repo-section:first-child {
  grid-row: span 2;
}

.repo-section,
.repo-error-panel,
.repo-clean-panel {
  margin: 0 18px 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.repo-info-sections .repo-section {
  margin: 0;
}

.repo-error-panel {
  border-color: rgba(220, 38, 38, 0.22);
  background: #fef2f2;
}

.repo-clean-panel {
  border-color: rgba(5, 150, 105, 0.18);
  background: #f0fdf4;
  color: #065f46;
  font-size: 13px;
  font-weight: 700;
}

.repo-section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.repo-section-title {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.repo-section-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.detail-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.detail-val {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.code-val,
.dirty-file-list code {
  display: inline-block;
  max-width: 100%;
  padding: 2px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
  color: #0f172a;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.dirty-file-groups {
  display: grid;
  gap: 12px;
}

.dirty-file-group {
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.dirty-file-title {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.dirty-file-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.dirty-file-list li {
  min-width: 0;
}

.account-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 14px;
}

.account-summary .profile-avatar {
  width: 42px;
  height: 42px;
}

.account-role {
  margin-top: 3px;
  text-transform: capitalize;
}

.account-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.secondary-btn {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.password-form {
  display: none;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.password-form.visible { display: block; }

.password-form label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.password-form input {
  width: 100%;
  min-width: 0;
  margin-bottom: 12px;
}

.form-message {
  min-height: 18px;
  margin-bottom: 8px;
  font-size: 12px;
}

.form-message.error { color: var(--bad); }
.form-message.success { color: var(--ok); }

@media (min-width: 900px) {
  html, body { height: 100%; overflow: hidden; }
  .app-shell {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: stretch;
  }
  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    width: 238px;
    min-height: 100vh;
    flex: 0 0 238px;
    flex-direction: column;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    padding: 22px 16px;
  }
  .main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .container {
    min-height: 100%;
    height: auto;
    overflow: visible;
  }
}

@media (max-width: 899px) {
  :root {
    --page-padding: 14px;
    --page-gap: 14px;
    --page-header-height: 56px;
    --title-size: 24px;
    --surface-padding: 12px;
  }

  body.drawer-open { overflow: hidden; }
  .app-shell { min-height: 100vh; }
  .login-screen {
    padding: 16px;
  }
  .login-card {
    border-radius: 18px;
    padding: 22px;
  }
  .login-card-top h2 {
    font-size: 18px;
  }
  .login-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 15px;
  }
  .data-view.active { height: calc(100dvh - 56px - (var(--page-padding) * 2)); }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
    min-height: 56px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid var(--line);
  }

  .mobile-menu-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
  }

  .mobile-menu-btn span {
    width: 17px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
  }

  .mobile-page-title {
    overflow: hidden;
    color: var(--text);
    font-size: 17px;
    font-weight: 700;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
  }

  .mobile-page-title.has-breadcrumb {
    text-align: center;
  }

  .mobile-page-main {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
  }

  .mobile-breadcrumb a {
    color: var(--accent);
    font-size: 11px;
  }

  .mobile-breadcrumb .breadcrumb-current {
    max-width: 48vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-header-spacer { width: 40px; height: 40px; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    display: flex;
    width: min(280px, 84vw);
    height: 100dvh;
    min-height: 100dvh;
    flex-direction: column;
    padding: 18px 14px;
    background: #0f172a;
    border-right: 1px solid #1e293b;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  body.drawer-open .sidebar { transform: translateX(0); }

  .sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
  }

  .sidebar-head .brand { margin-bottom: 0; }

  .nav-menu {
    flex: 0 0 auto;
  }

  .sidebar-close {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 22px;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: block;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.drawer-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-profile {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  }

  .page-head { display: none; }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }
  .overview-view.active {
    height: calc(100dvh - 56px - (var(--page-padding) * 2));
    padding-right: 0;
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .status-legend {
    grid-template-columns: 1fr;
  }
  .card { min-height: 80px; box-shadow: none; }
  .card .value { font-size: 20px; }
  .panel { box-shadow: none; }
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .panel-toolbar { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  input { min-width: 0; width: 100%; }
  button { width: 100%; }
  .dirty-tooltip-trigger { width: auto; }
  .dirty-tooltip {
    min-width: 240px;
    max-width: min(420px, 78vw);
  }
  .mobile-menu-btn,
  .sidebar-close,
  .icon-btn,
  .modal-close { width: 40px; }
  .danger-icon-btn {
    width: 36px;
    min-width: 36px;
  }
  table { min-width: 900px; font-size: 12px; }
  th, td { padding: 7px; white-space: nowrap; }
  .detail-grid { grid-template-columns: 1fr; gap: 4px; }
  .detail-key { margin-top: 6px; }
  .repo-modal {
    max-height: 92dvh;
  }
  .repo-modal .modal-head {
    padding: 14px;
    align-items: flex-start;
  }
  .repo-health {
    align-items: flex-start;
    margin: 14px;
  }
  .repo-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 14px 14px;
  }
  .repo-info-sections {
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }
  .repo-info-sections .repo-section:first-child {
    grid-row: auto;
  }
  .repo-section,
  .repo-error-panel,
  .repo-clean-panel {
    margin: 0 14px 14px;
  }
  .repo-info-sections .repo-section {
    margin: 0;
  }
  .detail-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .repo-summary-value {
    font-size: 21px;
  }
}
