/*
 * Ranking Rozwoju Sieci w identyfikacji Majster Plus (BI 2019):
 * granatowa belka z logo w lewym górnym rogu, kolory podstawowe biały / niebieski / czerwony / szary,
 * żółty tylko jako akcent wyróżnienia, czcionka Titillium Web, wartości liczbowe kursywą.
 * Jeden, jasny motyw zgodny z materiałami marki.
 */
:root {
  --mp-blue: #1f419a;        /* CMYK 100/89/0/0 */
  --mp-blue-dark: #17327a;
  --mp-blue-soft: #e6ebf6;
  --mp-red: #ed1c24;         /* CMYK 0/100/100/0 */
  --mp-red-dark: #c8141b;
  --mp-red-soft: #fde4e5;
  --mp-grey: #bcbec0;        /* CMYK 0/0/0/30 */
  --mp-grey-soft: #f1f2f2;
  --mp-yellow: #fff200;      /* CMYK 0/0/100/0, tylko akcent */
  --mp-yellow-soft: #fffbcc;
  --ink: #231f20;
  --muted: #5f6266;
  --line: #dcddde;
  --surface: #ffffff;
  --radius: 6px;
  --font: "Titillium Web", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--mp-grey-soft); color: var(--ink); font: 400 16px/1.5 var(--font); }
a { color: var(--mp-blue); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 700; color: var(--mp-blue); text-wrap: balance; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
ul { margin: 6px 0 0; padding-left: 1.2rem; }

/* Granatowa belka z logo (format poziomy: logo w lewym górnym rogu, belka od krawędzi do krawędzi) */
.brandbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: var(--mp-blue); color: #ffffff;
}
.brandbar .logo { display: block; flex: none; line-height: 0; }
.brandbar .logo img { height: 44px; width: auto; display: block; }
.app-name { font-weight: 700; font-size: 1rem; letter-spacing: 0.01em; margin-right: auto; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 0.88rem; }
.userbox .who { opacity: 0.85; }
.logout { margin: 0; }
.btn-link { background: none; border: 0; padding: 4px 0; color: #ffffff; font: 600 0.88rem var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.nav {
  display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px;
  background: var(--surface); border-bottom: 3px solid var(--mp-red);
  scrollbar-width: none; position: sticky; top: 0; z-index: 5;
}
.nav::-webkit-scrollbar { display: none; }
.nav a { white-space: nowrap; padding: 7px 14px; border-radius: 99px; color: var(--mp-blue); text-decoration: none; font-weight: 600; font-size: 0.95rem; }
.nav a:hover { background: var(--mp-blue-soft); }
.nav a.active { background: var(--mp-blue); color: #ffffff; }
.count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 99px; background: var(--mp-yellow); color: var(--mp-blue); font-size: 0.78rem; font-weight: 700; text-align: center; }

.main { max-width: 980px; margin: 0 auto; padding: 22px 16px calc(64px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 16px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; min-width: 0; }
.card.highlight { border: 2px solid var(--mp-blue); }
.eyebrow { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mp-red); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; overflow-wrap: anywhere; }
.lead { font-size: 1.1rem; }
.pre { white-space: pre-wrap; }
.text-warn { color: var(--mp-red); font-weight: 600; }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stack { display: grid; gap: 14px; }
.stack-sm { display: grid; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 9px 18px; border-radius: var(--radius);
  border: 2px solid var(--mp-blue); background: var(--surface); color: var(--mp-blue);
  font: 700 0.98rem var(--font); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--mp-blue-soft); }
.btn-primary { background: var(--mp-red); border-color: var(--mp-red); color: #ffffff; }
.btn-primary:hover { background: var(--mp-red-dark); border-color: var(--mp-red-dark); }
.btn-danger { color: var(--mp-red); border-color: var(--mp-red); }
.btn-danger:hover { background: var(--mp-red-soft); }
.btn-small { min-height: 36px; padding: 5px 12px; font-size: 0.88rem; }
a:focus-visible, .btn:focus-visible, .btn-link:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--mp-yellow); outline-offset: 2px; box-shadow: 0 0 0 5px var(--mp-blue);
}

.field { display: grid; gap: 6px; min-width: 0; }
.field-end { align-content: end; }
label, legend { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
fieldset { border: 0; margin: 0; padding: 0; }
legend { margin-bottom: 8px; padding: 0; }
.hint { color: var(--muted); font-size: 0.85rem; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="date"],
input[type="number"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  border: 1px solid var(--mp-grey); border-radius: var(--radius);
  background: #ffffff; color: var(--ink); font: 400 16px var(--font);
}
input:disabled { background: var(--mp-grey-soft); color: var(--muted); }
textarea { resize: vertical; }
.input-num { max-width: 130px; text-align: right; font-style: italic; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--mp-blue); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.filters { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }

.alert { padding: 12px 14px; border-radius: var(--radius); border-left: 5px solid; }
.alert-ok { background: var(--mp-blue-soft); border-color: var(--mp-blue); color: var(--mp-blue-dark); }
.alert-warn { background: var(--mp-yellow-soft); border-color: var(--mp-yellow); color: var(--ink); }
.alert-error { background: var(--mp-red-soft); border-color: var(--mp-red); color: var(--mp-red-dark); }

.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; background: var(--mp-blue-soft); color: var(--mp-blue); }
.pill.s-dodane { background: var(--mp-yellow); color: var(--mp-blue); }
.pill.s-umowa_podpisana { background: var(--mp-blue); color: #ffffff; }
.pill.s-odrzucone { background: var(--mp-grey); color: var(--ink); }

/* Wynik: liczby kursywą jak wartości w komunikatach marki */
.score { border-top: 5px solid var(--mp-red); }
.score-row { display: flex; flex-wrap: wrap; gap: 32px; align-items: baseline; }
.score-num { font-size: 3rem; font-weight: 700; font-style: italic; line-height: 1; color: var(--mp-blue); font-variant-numeric: tabular-nums; }
.score-num.red { color: var(--mp-red); }
.unit { margin-left: 6px; color: var(--muted); font-weight: 600; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.stat { display: grid; gap: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.stat:hover { border-color: var(--mp-blue); }
.stat strong { font-size: 1.6rem; font-weight: 700; font-style: italic; color: var(--mp-blue); font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--mp-blue); }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.place { width: 56px; font-size: 1.15rem; font-weight: 700; font-style: italic; color: var(--mp-blue); }
td.place.podium { color: var(--mp-red); }
td.pts { font-weight: 700; font-style: italic; font-size: 1.05rem; color: var(--mp-blue); }
td .name { font-weight: 600; }
td .sub { color: var(--muted); font-size: 0.84rem; }
tr.me td { background: var(--mp-yellow-soft); }
tr.hidden-row td { color: var(--muted); font-style: italic; }
tr.inactive td { color: var(--muted); }
.you { display: inline-block; padding: 0 8px; border-radius: 99px; background: var(--mp-yellow); color: var(--mp-blue); font-size: 0.75rem; font-weight: 700; font-style: normal; vertical-align: 1px; }

.paste-box { padding: 14px; border: 2px dashed var(--mp-blue); border-radius: var(--radius); background: var(--mp-blue-soft); }
.list { display: grid; gap: 8px; }
.growth-points { font-weight: 700; font-style: italic; color: var(--mp-red); white-space: nowrap; font-size: 1.1rem; }
.item { display: grid; gap: 4px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--mp-blue); border-radius: var(--radius); color: var(--ink); text-decoration: none; min-width: 0; }
.item:hover { border-color: var(--mp-blue); }
.item-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.item-title { font-weight: 700; color: var(--mp-blue); min-width: 0; overflow-wrap: anywhere; }

dl.details { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 6px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.photo img { display: block; max-width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--line); }
.points-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.points-list li { display: flex; justify-content: space-between; gap: 12px; }
.points-list li strong { font-style: italic; color: var(--mp-blue); white-space: nowrap; font-variant-numeric: tabular-nums; }
.points-list .total { border-top: 2px solid var(--mp-blue); padding-top: 6px; }
.points-list .total strong { color: var(--mp-red); font-size: 1.1rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { border-left: 3px solid var(--mp-red); padding-left: 12px; }

/* Logowanie: niebieskie tło z logo w białej ramce, jak strona tytułowa w materiałach marki */
body.login-page { background: var(--mp-blue); }
.login { max-width: 420px; margin: 0 auto; padding: calc(8vh + env(safe-area-inset-top, 0px)) 16px 48px; display: grid; gap: 20px; }
.login .logo-frame { justify-self: center; background: #ffffff; padding: 6px; border-radius: 3px; line-height: 0; }
.login .logo-frame img { width: min(300px, 70vw); height: auto; display: block; }
.login .intro { text-align: center; color: #ffffff; display: grid; gap: 4px; }
.login .intro h1 { color: #ffffff; font-size: 1.7rem; }
.login .intro p { opacity: 0.9; }
.login .card { padding: 22px; }
.login .note { color: #ffffff; opacity: 0.85; text-align: center; font-size: 0.9rem; }
.login .alert { margin: 0; }

.password-box { padding: 12px; border-radius: var(--radius); background: var(--mp-yellow-soft); border: 2px dashed var(--mp-blue); font: 700 1.3rem ui-monospace, Consolas, monospace; letter-spacing: 0.04em; user-select: all; overflow-wrap: anywhere; color: var(--mp-blue); }

.show-sm { display: none; }
.card ul li + li { margin-top: 6px; }

@media (max-width: 600px) {
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .brandbar .logo img { height: 36px; }
  .app-name { font-size: 0.95rem; }
  .userbox { width: 100%; justify-content: space-between; }
  .score-num { font-size: 2.5rem; }
  dl.details { grid-template-columns: 1fr; gap: 0; }
  dl.details dd { margin-bottom: 8px; }
}

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