/* LyxFaktura – wygląd panelu. Kolory zmieniasz w :root. */
:root {
  /* Kolory LyxStäd: niebieski #2AA7FF, ciemny #0B1220 */
  --c: #2AA7FF; --c-dark: #0B1220; --c-soft: #E8F4FF; --c-text: #0F6CB0;
  --bg: #f3f6fa; --card: #fff; --line: #dde4e0; --text: #1f2a24; --muted: #66756d;
  --red: #b42318; --red-soft: #fdecea; --amber: #a15c07; --amber-soft: #fef3e2; --blue: #175cd3; --blue-soft: #e8f0fe;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14.5px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--c-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }

/* Układ */
.app { display: flex; min-height: 100vh; }
@media (min-width: 861px) { .app { background: linear-gradient(to right, var(--c-dark) 220px, var(--bg) 220px); } }
.side { width: 220px; background: var(--c-dark); color: #c9d6e6; padding: 18px 12px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .logo { color: #fff; font-weight: 700; font-size: 17px; padding: 4px 10px 18px; display: block; }
.side .logo small { display: block; font-weight: 400; font-size: 12px; color: var(--c); }
.side nav a { display: flex; gap: 10px; align-items: center; color: #c9d6e6; padding: 8px 10px; border-radius: 8px; margin-bottom: 2px; }
.side nav a:hover { background: #17233a; text-decoration: none; }
.side nav a.on { background: var(--c); color: var(--c-dark); font-weight: 600; }
.side nav .sep { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: #6d84a3; padding: 14px 10px 6px; }
.side .me { border-top: 1px solid #22314d; margin-top: 16px; padding-top: 12px; font-size: 13px; }
.side .me button { background: none; border: 0; color: #9cc9ea; padding: 0; cursor: pointer; font: inherit; }
.main { flex: 1; min-width: 0; padding: 22px 28px 40px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.menu-btn { display: none; }

@media (max-width: 860px) {
  .app { display: block; }
  .side { position: fixed; z-index: 30; left: -240px; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 30px rgba(0,0,0,.4); }
  .btn.menu-btn { display: inline-flex; margin-right: 8px; }
  .main { padding: 14px 16px 30px; }
}

/* Karty, siatki */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 14px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }

/* Tabele */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:hover td { background: #fafcfb; }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; }

/* Formularze */
label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 5px; }
.field { margin-bottom: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=color], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c8d2cd; border-radius: 7px; font: inherit; background: #fff; color: var(--text);
}
input[type=color] { padding: 2px; height: 38px; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c-soft); border-color: var(--c); }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: auto; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.error-text { color: var(--red); font-size: 12.5px; margin-top: 3px; }

/* Przyciski */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--c-dark); background: var(--c-dark); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #1c2b45; text-decoration: none; }
.btn.ghost { background: #fff; color: var(--c-dark); border-color: var(--c); }
.btn.ghost:hover { background: var(--c-soft); }
.btn.grey { background: #fff; color: var(--text); border-color: #c8d2cd; }
.btn.grey:hover { background: #f1f4f2; }
.btn.danger { background: #fff; color: var(--red); border-color: #f1b8b2; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 4px 9px; font-size: 13px; }
form.inline { display: inline; }

/* Statusy */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef1ef; color: #4b5a52; white-space: nowrap; }
.badge.sent, .badge.partial { background: var(--blue-soft); color: var(--blue); }
.badge.accepted, .badge.paid, .badge.invoiced { background: #e3f6ea; color: #17673a; }
.badge.awaiting_skv { background: var(--amber-soft); color: var(--amber); }
.badge.overdue, .badge.declined { background: var(--red-soft); color: var(--red); }
.badge.expired, .badge.credited { background: #eceae6; color: #6b6458; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 700; background: var(--c-soft); color: var(--c-text); }

/* Komunikaty */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: #e3f6ea; color: #17673a; }
.flash.error { background: var(--red-soft); color: var(--red); }

/* Filtry */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border-radius: 99px; color: var(--muted); border: 1px solid transparent; }
.tabs a.on { background: #fff; border-color: var(--line); color: var(--text); font-weight: 600; }

/* Edytor pozycji */
table.items td { padding: 5px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.items th { font-size: 12px; color: var(--muted); text-align: left; padding: 4px; }
table.items input, table.items select { padding: 6px 7px; }
table.items .c-desc { min-width: 220px; }
table.items .c-qty { width: 80px; } table.items .c-unit { width: 80px; } table.items .c-price { width: 105px; }
table.items .c-disc { width: 70px; } table.items .c-vat { width: 75px; } table.items .c-ded { width: 90px; } table.items .c-sum { width: 110px; text-align: right; padding-top: 11px; white-space: nowrap; }
.sumbox { margin-left: auto; max-width: 380px; }
.sumbox div { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; }
.sumbox .big { font-size: 18px; font-weight: 700; border-top: 2px solid var(--text); padding-top: 8px; margin-top: 4px; }
.sumbox .ded { color: var(--c-text); }

/* Oś czasu */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--line); position: relative; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* Logowanie */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth .card { width: 100%; max-width: 420px; }
.auth.wide .card { max-width: 760px; }

/* Paginacja */
.pager { display: flex; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.pager .on { background: var(--c-dark); color: #fff; border-color: var(--c-dark); }
.pager .off { color: #aab5af; }
