/* pkgcache — interface styled after Apple Human Interface Guidelines:
   system font, system colours, grouped inset lists, translucent sidebar,
   automatic light/dark appearance. No external assets. */
:root {
  --bg: #f2f2f7; --bg-elev: #ffffff; --bg-group: #ffffff; --bg-fill: rgba(118,118,128,.12);
  --label: #000000; --label2: rgba(60,60,67,.6); --label3: rgba(60,60,67,.3);
  --sep: rgba(60,60,67,.18); --blue: #007aff; --green: #34c759; --orange: #ff9500; --red: #ff3b30;
  --yellow: #ffcc00; --purple: #af52de; --gray: #8e8e93; --teal: #30b0c7;
  --sidebar: rgba(246,246,248,.78); --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --bg-elev: #1c1c1e; --bg-group: #1c1c1e; --bg-fill: rgba(118,118,128,.24);
    --label: #ffffff; --label2: rgba(235,235,245,.6); --label3: rgba(235,235,245,.3);
    --sep: rgba(84,84,88,.6); --blue: #0a84ff; --green: #30d158; --orange: #ff9f0a; --red: #ff453a;
    --yellow: #ffd60a; --purple: #bf5af2; --gray: #8e8e93; --teal: #40c8e0;
    --sidebar: rgba(28,28,30,.72); --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue",
        "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; letter-spacing: -0.01em;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* layout */
/* minmax(0, …): wide tables and code blocks scroll inside their box instead of widening the page */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; align-self: start; padding: 20px 12px; background: var(--sidebar);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 0.5px solid var(--sep); display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 600; font-size: 17px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 16px;
  background: linear-gradient(135deg, #5ac8fa, #007aff 55%, #5856d6);
}
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--label);
  font-size: 14px; font-weight: 500;
}
.nav a:hover { background: var(--bg-fill); text-decoration: none; }
.nav a.active { background: var(--blue); color: #fff; }
.nav .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--label2); }
.nav-toggle { display: none; }
.linklike { font: inherit; color: var(--blue); background: none; border: 0; padding: 0; cursor: pointer; }
.linklike:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, .seg a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.main { padding: 28px 40px 60px; max-width: 1280px; width: 100%; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
h1 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.015em; margin: 30px 0 10px; }
h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--label2);
     margin: 22px 0 8px 16px; }
.sub { color: var(--label2); font-size: 15px; margin-top: 4px; }

/* cards & grouped lists */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.card { background: var(--bg-group); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { font-size: 13px; color: var(--label2); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12.5px; color: var(--label2); margin-top: 2px; }
.meter { height: 6px; border-radius: 3px; background: var(--bg-fill); overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.meter.warn > span { background: var(--orange); } .meter.crit > span { background: var(--red); }

.group { background: var(--bg-group); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--label2); padding: 10px 14px;
     border-bottom: 0.5px solid var(--sep); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 0.5px solid var(--sep); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-fill); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 220px 1fr; }
.kv > div { padding: 10px 16px; border-bottom: 0.5px solid var(--sep); word-break: break-all; }
.kv > div:nth-child(odd) { color: var(--label2); word-break: normal; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.muted { color: var(--label2); } .small { font-size: 12.5px; }
.empty { padding: 28px; text-align: center; color: var(--label2); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
         font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--bg-fill); color: var(--label2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-green { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.b-red { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.b-orange { color: var(--orange); background: color-mix(in srgb, var(--orange) 16%, transparent); }
.b-yellow { color: #b38f00; background: color-mix(in srgb, var(--yellow) 22%, transparent); }
.b-blue { color: var(--blue); background: color-mix(in srgb, var(--blue) 14%, transparent); }
.b-gray { color: var(--gray); background: var(--bg-fill); }
.b-purple { color: var(--purple); background: color-mix(in srgb, var(--purple) 14%, transparent); }
.sev-CRITICAL { color: #fff; background: var(--red); } .sev-CRITICAL::before { background: #fff; }
.sev-HIGH { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.sev-MEDIUM { color: var(--orange); background: color-mix(in srgb, var(--orange) 16%, transparent); }
.sev-LOW { color: var(--teal); background: color-mix(in srgb, var(--teal) 14%, transparent); }
.sev-UNKNOWN { color: var(--gray); }

/* forms & buttons */
form.inline { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
input[type=text], input[type=search], input[type=password], input[type=date], select, textarea {
  font: inherit; color: var(--label); background: var(--bg-elev); border: 0.5px solid var(--sep);
  border-radius: 10px; padding: 8px 12px; min-height: 36px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 30%, transparent); }
input[type=search] { min-width: 260px; }
.btn { font: inherit; font-size: 14px; font-weight: 600; border: 0; border-radius: 10px; padding: 8px 16px;
       min-height: 36px; cursor: pointer; background: var(--blue); color: #fff; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary { background: var(--bg-fill); color: var(--blue); }
.btn.danger { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.btn.small { font-size: 13px; padding: 5px 12px; min-height: 30px; }
.seg { display: inline-flex; background: var(--bg-fill); border-radius: 9px; padding: 2px; }
.seg a { padding: 5px 14px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--label); }
.seg a.on { background: var(--bg-elev); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg a:hover { text-decoration: none; }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.actions .card p { color: var(--label2); font-size: 13px; margin: 4px 0 12px; }
.actions .card h4 { margin: 0; font-size: 15px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.toast { background: var(--bg-elev); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px;
         box-shadow: var(--shadow); border-left: 4px solid var(--blue); }
.toast.err { border-left-color: var(--red); }
form.ack { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.ack input[type=text] { min-width: 180px; flex: 1; padding: 5px 10px; min-height: 30px; font-size: 13px; }
.banner { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.banner.warn { background: color-mix(in srgb, var(--orange) 14%, var(--bg-group)); }
.banner.err { background: color-mix(in srgb, var(--red) 12%, var(--bg-group)); }
.code { position: relative; margin: 8px 0 14px; }
.code pre { background: var(--bg-group); border-radius: var(--radius); box-shadow: var(--shadow); margin: 0;
            padding: 14px 16px; overflow-x: auto; white-space: pre; line-height: 1.5; }
.code .copy { position: absolute; top: 8px; right: 8px; }
.filters label { font-size: 14px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.login { max-width: 380px; margin: 12vh auto; }
.login .card { padding: 28px; }
.login input { width: 100%; margin: 12px 0; }
.trunc { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block;
         vertical-align: bottom; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
             padding: 10px 16px; gap: 8px; }
  .brand { padding: 0; flex: 1; }
  .sidebar .foot { display: none; }
  /* with JS the menu folds behind the "Меню" button; without JS it stays open */
  .sidebar.js .nav-toggle { display: inline-flex; align-items: center; }
  .sidebar.js .nav { display: none; }
  .sidebar.js.open .nav, .sidebar.js.open .foot { display: flex; }
  .nav { flex-direction: column; width: 100%; }
  .sidebar.open .foot { width: 100%; flex-direction: column; margin: 0; }
  .main { padding: 20px 16px; }
  h1 { font-size: 28px; }
  .top { flex-wrap: wrap; align-items: flex-start; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { padding-bottom: 0; border-bottom: 0; font-size: 13px; }
  input[type=search] { min-width: 0; width: 100%; }
  .filters > * { max-width: 100%; }
}
