/* Karta czasu pracy — style wspólne dla logowania i widoku miesiąca. */

:root {
  --ink: #172337;
  --muted: #627087;
  --paper: #f5f7fb;
  --card: #fff;
  --line: #dfe5ee;
  --blue: #2b6fae;
  --blue-soft: #eaf3fb;
  --green: #14705a;
  --green-soft: #e6f5ef;
  --red: #b34040;
  --red-soft: #fff0ef;
  --amber-soft: #fff7df;
  --today-bg: #fff7d6;
  --today-bar: #e0a800;
  --shadow: 0 10px 30px rgba(23, 35, 55, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button, input, select { font: inherit; }

button, input, select {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

button { cursor: pointer; padding: 0 14px; font-weight: 700; }
button:hover:not(:disabled) { border-color: #9babc0; }
input, select { padding: 8px 10px; width: 100%; }

input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(43, 111, 174, .35);
  outline-offset: 1px;
  border-color: var(--blue);
}

input:disabled, select:disabled, button:disabled {
  background: #f4f6f9;
  color: #9aa6b6;
  cursor: not-allowed;
}

.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; width: 100%; }
.btn-primary:hover { background: #245e93; }
.ghost { background: transparent; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; margin: -8px 0 16px; }

/* ---------- nagłówek ---------- */

.app-header {
  background: linear-gradient(130deg, #122f50, #215f91);
  color: #fff;
  padding: 22px max(20px, calc((100vw - 1180px) / 2));
}
.app-header-inner {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; max-width: 1180px; margin: 0 auto;
}
.app-header h1 { margin: 0 0 3px; font-size: clamp(22px, 3.4vw, 31px); letter-spacing: -.03em; }
.app-header p { margin: 0; color: #d7e8f6; }
.app-nav { display: flex; gap: 16px; }
.app-nav a { color: #d7e8f6; font-weight: 600; text-decoration: none; border-bottom: 1px solid transparent; }
.app-nav a:hover { color: #fff; border-bottom-color: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 22px 20px 48px; }

footer {
  max-width: 1180px; margin: 0 auto;
  padding: 0 20px 30px; color: var(--muted); font-size: 12px;
}

/* ---------- pasek ustawień ---------- */

/* ---------- pasek rejestracji zmiany ---------- */

.shift-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.shift-btn {
  min-height: 58px; padding: 0 28px; font-size: 17px; font-weight: 800;
  border-radius: 12px; border: 1px solid var(--green); background: var(--green); color: #fff;
}
.shift-btn:hover:not(:disabled) { background: #0f5a48; border-color: #0f5a48; }
.shift-btn.running { background: var(--red); border-color: var(--red); }
.shift-btn.running:hover:not(:disabled) { background: #963535; border-color: #963535; }
.shift-btn:disabled { opacity: .6; }
.shift-info { flex: 1; min-width: 200px; }
.shift-state { font-weight: 750; }
.shift-hint { color: var(--muted); font-size: 13px; margin-top: 2px; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }

.norm-box {
  background: var(--blue-soft); border: 1px solid #c8deef; border-radius: 12px;
  padding: 8px 14px; min-width: 150px;
}
.norm-box .label { font-size: 12px; font-weight: 750; color: var(--muted); }
.norm-box .value { font-size: 20px; font-weight: 850; letter-spacing: -.02em; }
.norm-box .sub { font-size: 12px; color: var(--muted); }

.formula-box {
  background: var(--blue-soft); border: 1px solid #c8deef; border-radius: 10px;
  padding: 10px 14px; margin: 0 0 16px; font-size: 15px;
}
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duration .tag.warn { color: var(--red); font-weight: 700; }

.toolbar { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
.field { display: grid; gap: 5px; }
.field label { font-size: 13px; font-weight: 750; color: var(--muted); }
.month-field { width: 190px; }
.norm-field { width: 150px; }
.start-field { width: 180px; }
.toolbar .spacer { flex: 1; }

.save-state {
  align-self: center; font-size: 13px; font-weight: 700; color: var(--green);
  opacity: 0; transition: opacity .2s;
}
.save-state.visible { opacity: 1; }

.alert { margin: 0 0 16px; padding: 12px 15px; border-radius: 12px; font-size: 14px; }
.alert-error { background: var(--red-soft); border: 1px solid #efcbc8; color: #8a2f2f; }
.alert-ok { background: var(--green-soft); border: 1px solid #b9dfd2; color: #0f5a48; }

/* ---------- kafle ---------- */

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.metric {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 17px; box-shadow: var(--shadow);
}
.metric .label { color: var(--muted); font-size: 13px; font-weight: 750; margin-bottom: 8px; }
.metric .value { font-size: clamp(23px, 3vw, 31px); font-weight: 850; letter-spacing: -.03em; }
.metric .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.metric.good { background: var(--green-soft); border-color: #b9dfd2; }
.metric.bad { background: var(--red-soft); border-color: #efcbc8; }
.metric.neutral { background: var(--blue-soft); border-color: #c8deef; }

/* ---------- tygodnie i dni ---------- */

.week {
  margin: 0 0 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow);
}
.week-head {
  padding: 14px 16px; background: #f9fbfd; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 15px; align-items: center; flex-wrap: wrap;
}
.week-head h2 { margin: 0; font-size: 17px; }
.week-balance { font-weight: 850; white-space: nowrap; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.zero { color: var(--muted); font-weight: 600; }
.excused { color: var(--muted); }

.day {
  display: grid;
  grid-template-columns: 180px 150px 130px 130px minmax(150px, 1fr) 120px;
  grid-template-areas: "date status start end manual duration";
  gap: 10px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.day:last-child { border-bottom: 0; }
.day.today { background: var(--today-bg); box-shadow: inset 4px 0 var(--today-bar); }
.day.excused-row { background: #fbfcfe; }
.day.today.excused-row { background: var(--today-bg); }

.day .date { grid-area: date; }
.day .status { grid-area: status; }
.day .start { grid-area: start; }
.day .end { grid-area: end; }
.day .manual-wrap { grid-area: manual; }
.day .duration { grid-area: duration; }

.date strong { display: block; }
.date span { color: var(--muted); font-size: 12px; }

.manual-wrap { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.mode-btn { padding: 0 10px; font-size: 12px; color: var(--blue); background: var(--blue-soft); white-space: nowrap; }

.duration { font-weight: 850; text-align: right; line-height: 1.3; }
.duration .todo-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.duration .todo-value { display: block; }
.duration .tag { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }

.holiday {
  padding: 13px 16px; display: flex; gap: 12px; justify-content: space-between;
  color: var(--muted); background: #fbfcfe; border-bottom: 1px solid var(--line);
}
.holiday:last-child { border-bottom: 0; }

.empty {
  background: var(--amber-soft); border: 1px solid #ecd79a; color: #604308;
  padding: 16px; border-radius: 12px;
}

/* ---------- okno informacji ---------- */

dialog {
  border: 0; border-radius: 18px; padding: 0;
  width: min(560px, calc(100% - 30px)); box-shadow: 0 24px 70px rgba(0, 0, 0, .25);
}
dialog::backdrop { background: rgba(10, 24, 39, .55); }
.dialog-body { padding: 22px; }
.dialog-body h2 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- logowanie / instalacja / import ---------- */

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-box {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 28px; width: min(460px, 100%);
}
.auth-box h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.auth-box .field { margin-bottom: 14px; }
.auth-box form { margin-top: 18px; }
.auth-box p { line-height: 1.5; }
.stan { list-style: none; padding: 0; font-size: 14px; line-height: 1.9; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 14px; }
.check input { width: auto; min-height: 0; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 5px; font-size: .9em; }

/* ---------- widoki węższe ---------- */

@media (max-width: 900px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .day {
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "date   date  status"
      "start  end   duration"
      "manual manual manual";
    row-gap: 8px;
  }
  .duration { align-self: center; }
}

@media (max-width: 560px) {
  main { padding-inline: 12px; }
  .app-header { padding-inline: 16px; }
  .summary { grid-template-columns: 1fr; }
  .day {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "date     status"
      "start    end"
      "manual   manual"
      "duration duration";
    padding: 14px 12px;
  }
  .duration { text-align: left; }
  .month-field, .norm-field, .start-field { width: 100%; }
}

/* ---------- wydruk ---------- */

@media print {
  .app-header { background: none; color: var(--ink); padding: 15px 0; }
  .app-header p { color: var(--muted); }
  .app-nav, .toolbar, .mode-btn, .hint, .shift-bar, footer { display: none; }
  body { background: #fff; }
  main { padding: 0; }
  .metric, .week { box-shadow: none; break-inside: avoid; }
  .day.today { background: none; box-shadow: none; }
  select, input { border: 0; padding: 0; background: none; -webkit-appearance: none; appearance: none; }
}
