/* FAZA Office v2 — design: czerń + pomarańcz + krem */
:root {
  --bg:        #F4ECDD;   /* jasny krem — tło strony */
  --surface:   #FFFFFF;   /* karty */
  --ink:       #171311;   /* czerń — elementy nieakcentowe */
  --ink-soft:  #3A322D;
  --accent:    #CF5F2F;   /* firmowy pomarańcz */
  --accent-d:  #B24E23;
  --danger:    #B3282F;
  --danger-d:  #991F25;
  --ok:        #3B8C4F;
  --line:      #E6DCC8;   /* delikatne obramowania */
  --muted:     #9A8C7C;
  --text:      #241E1A;
  --r-sm: 10px;
  --r-md: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ================= topbar ================= */
.topbar {
  background: var(--ink);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .brand { margin-right: 4px; }
.topbar .brand img { height: 34px; display: block; filter: brightness(0) invert(1); }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.topbar nav a {
  color: #EDE6DB; text-decoration: none; padding: 8px 13px; font-size: 15px;
  border-radius: 999px; transition: background .15s, color .15s;
}
.topbar nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.topbar nav a.active { background: var(--accent); color: #fff; }
.userbox { color: #B9AFA4; font-size: 13px; display: flex; align-items: center; gap: 10px; }
.userbox .logout {
  color: #fff; background: rgba(255,255,255,.14); padding: 7px 14px;
  text-decoration: none; font-weight: 600; border-radius: 999px;
}
.userbox .logout:hover { background: var(--danger); }

/* burger */
.nav-toggle { display: none; }
.burger { display: none; cursor: pointer; padding: 8px; margin-left: auto; border-radius: 8px; }
.burger span {
  display: block; width: 24px; height: 2.5px; background: #fff;
  margin: 5px 0; border-radius: 2px; transition: transform .2s, opacity .2s;
}

@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; }
  .burger { display: block; }
  .topbar nav, .userbox { display: none; }
  .nav-toggle:checked ~ nav {
    display: flex; flex-direction: column; width: 100%; gap: 4px; padding: 10px 0 4px;
  }
  .nav-toggle:checked ~ nav a { padding: 12px 14px; font-size: 16px; }
  .nav-toggle:checked ~ .userbox {
    display: flex; width: 100%; justify-content: space-between; padding: 10px 2px 6px;
    border-top: 1px solid rgba(255,255,255,.15); margin-top: 6px;
  }
  .nav-toggle:checked + .burger span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
  .nav-toggle:checked + .burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked + .burger span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
}

/* ================= layout ================= */
.container { max-width: 1100px; margin: 0 auto; padding: 22px 16px 70px; }
h1 { font-size: 23px; margin: 8px 0 20px; letter-spacing: -.2px; }
h2 { font-size: 17px; margin: 24px 0 10px; color: var(--ink-soft); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(23,19,17,.05);
}
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
@media (max-width: 380px) { .grid-2 { grid-template-columns: 1fr; } }

/* ================= formularze ================= */
input, select, textarea {
  font-family: inherit; font-size: 16px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--text);
  max-width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(207,95,47,.15);
}
input::placeholder { color: var(--muted); }
input[type=checkbox] { accent-color: var(--accent); }
label { font-size: 13px; color: var(--muted); display: block; margin: 8px 0 4px; font-weight: 600; }
form.inline { display: inline; }
.formrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.formrow > div { flex: 1; min-width: 130px; }
.formrow input, .formrow select { width: 100%; }

button, .btn {
  font-family: inherit; font-size: 15px;
  background: var(--ink); color: #fff; border: none; cursor: pointer;
  padding: 11px 18px; font-weight: 600; text-decoration: none; display: inline-block;
  border-radius: var(--r-sm);
  transition: background .15s, transform .05s;
}
button:hover, .btn:hover { background: var(--ink-soft); }
button:active, .btn:active { transform: scale(.98); }
.btn-accent { background: var(--accent); } .btn-accent:hover { background: var(--accent-d); }
.btn-danger { background: var(--danger); } .btn-danger:hover { background: var(--danger-d); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-muted { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-muted:hover { background: var(--bg); }

/* ================= tabele ================= */
.tablebox { overflow: hidden; border-radius: var(--r-sm); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
th { background: var(--ink); color: #fff; font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; }
tr.total td { font-weight: 700; background: var(--bg); }

/* mobile: tabele jako karty (bez przewijania poziomego) */
@media (max-width: 640px) {
  table.resp, table.resp tbody, table.resp tr, table.resp td { display: block; width: 100%; }
  table.resp tr.headrow { display: none; }
  table.resp tr {
    border: 1px solid var(--line); border-radius: var(--r-sm);
    margin-bottom: 10px; padding: 6px 0; background: var(--surface);
  }
  table.resp td {
    border: none; padding: 6px 14px; font-size: 15px;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
  }
  table.resp td.num { text-align: left; }
  table.resp td:empty { display: none; }
  table.resp td::before {
    content: attr(data-label);
    font-size: 12px; font-weight: 600; color: var(--muted);
    flex-shrink: 0;
  }
  table.resp td[data-label=""]::before { display: none; }
  .tablebox { border: none; }
  table.resp { background: none; }
}

/* ================= badge / statusy ================= */
.badge { display: inline-block; padding: 3px 10px; font-size: 12px; font-weight: 600; color: #fff; background: var(--muted); border-radius: 999px; }
.badge-ok { background: var(--ok); }
.badge-warn { background: var(--accent); }
.badge-due { background: var(--danger); }
.badge-role { background: var(--ink); }

/* ================= flash / bannery ================= */
.flash { padding: 12px 16px; margin-bottom: 16px; font-size: 14px; border-radius: var(--r-sm); }
.flash-ok { background: #E4F1E4; border: 1px solid var(--ok); color: #285836; }
.flash-error { background: #F8E2E3; border: 1px solid var(--danger); color: #7C1B20; }
.banner-reminder {
  background: var(--accent); color: #fff; padding: 14px 18px; margin-bottom: 18px;
  border-radius: var(--r-md);
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
}
.banner-reminder a { color: #fff; font-weight: bold; }
.banner-reminder .btn { background: #fff; border-radius: var(--r-sm); }

/* ================= login ================= */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; align-items: center; padding: 20px;
}
.login-wrap form {
  display: flex; flex-direction: column; width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 28px; box-shadow: 0 2px 10px rgba(23,19,17,.06);
}
.login-wrap img.logo { width: 180px; margin: 0 auto 30px; display: block; }
.login-wrap input { margin-bottom: 14px; }
.login-wrap button { background: var(--accent); }
.login-wrap button:hover { background: var(--accent-d); }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface); color: var(--text); border: 1.5px solid var(--line);
  padding: 12px; text-decoration: none; font-weight: 600; max-width: 380px; width: 100%;
  margin-top: 6px; border-radius: var(--r-sm);
}
.google-btn:hover { border-color: var(--ink); }
.login-sep { color: var(--muted); margin: 16px 0 10px; font-size: 13px; text-align: center; }

/* ================= menu kafelki ================= */
.menu { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.menu a {
  display: block; text-align: center; padding: 24px 14px; font-size: 17px; font-weight: 600;
  background: var(--ink); color: #fff; text-decoration: none; border-radius: var(--r-md);
  transition: background .15s, transform .1s;
}
.menu a:hover { background: var(--accent); transform: translateY(-2px); }

/* ================= obecność ================= */
.attendance-list { list-style: none; margin: 0; padding: 0; }
.attendance-list li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.attendance-list li:last-child { border-bottom: none; }
.attendance-list label {
  display: flex; align-items: center; gap: 12px; font-size: 16px;
  color: var(--text); margin: 0; cursor: pointer; font-weight: 400; padding: 8px 4px;
}
.attendance-list input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; }

/* ================= kalendarz obecności ================= */
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cal-nav h2 { margin: 0; }
table.calendar { table-layout: fixed; }
table.calendar th { padding: 6px 2px; text-align: center; font-size: 12px; }
table.calendar td {
  text-align: center; padding: 0; height: 44px; font-size: 14px;
  border: 1px solid var(--line);
}
td.cal-present { background: #CDE8CF; font-weight: 700; color: #1F5B2D; }
td.cal-absent  { background: #F5CCCE; font-weight: 700; color: #7C1B20; }
td.cal-class   { background: #FBEFE6; }
td.cal-off     { background: var(--surface); color: #C9BFAF; }
td.cal-future  { background: var(--surface); }
td.cal-today   { outline: 2px solid var(--accent); outline-offset: -2px; }
table.calendar td .cal-btn {
  display: block; width: 100%; height: 100%; min-height: 44px;
  border: none; border-radius: 0; padding: 0; margin: 0;
  background: none; color: inherit; font: inherit; font-weight: inherit;
  cursor: pointer; transition: none;
}
table.calendar td .cal-btn:hover { background: none; outline: 2px solid var(--accent); outline-offset: -2px; }
table.calendar td .cal-btn:active { transform: none; }
html { scroll-behavior: smooth; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.cal-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cal-legend .lg-present::before { background: #CDE8CF; }
.cal-legend .lg-absent::before { background: #F5CCCE; }
.cal-legend .lg-class::before { background: #FBEFE6; border: 1px solid var(--line); }

/* ================= eventy / strona publiczna ================= */
.event-cover {
  width: 100%; aspect-ratio: 16 / 6; object-fit: cover; display: block;
  border-radius: var(--r-md);
}
.public-wrap { max-width: 720px; margin: 0 auto; padding: 20px 16px 60px; }
.pay-box {
  background: #FBEFE6; border: 1.5px solid var(--accent); border-radius: var(--r-md);
  padding: 14px 16px; margin: 16px 0; font-size: 14px;
}
table.pricelist td { font-size: 15px; }
.who-row { display: flex; gap: 18px; }
.who-opt {
  display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 400;
  color: var(--text); cursor: pointer; margin: 0;
}
.who-opt input { width: 20px; height: 20px; }
.hp-field { position: absolute; left: -9999px; top: -9999px; height: 0; overflow: hidden; }
details.addnew { margin-top: 12px; }
details.addnew summary {
  cursor: pointer; color: var(--accent-d); font-weight: 600; font-size: 14px;
  padding: 6px 0; list-style: none;
}
details.addnew[open] summary { margin-bottom: 6px; }

.muted { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
a { color: var(--accent-d); }

@media (max-width: 640px) {
  .container { padding: 16px 12px 60px; }
  h1 { font-size: 20px; }
  .formrow > div { min-width: 100%; }
  .formrow > div:has(button), .formrow > div[style*="flex:0"] { min-width: auto; }
  button, .btn { width: auto; }
}
