@import url('/fonts/inter/400.css');
@import url('/fonts/inter/500.css');
@import url('/fonts/inter/600.css');
@import url('/fonts/inter/700.css');

:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-2: #f0f2f7;
  --line: #e1e4ec;
  --text: #1f2433;
  --muted: #6b7184;
  --brand: #6d4fc2;       /* fiolet hematoksyliny */
  --brand-2: #e0628f;     /* róż eozyny */
  --brand-soft: #efeafc;
  --ok: #1f9d6b;
  --warn: #c98a12;
  --err: #d0433f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 22, 40, .06), 0 4px 16px rgba(20, 22, 40, .06);
  --font: 'Inter', -apple-system, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* ---------- przyciski i pola ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: 500 13px var(--font); cursor: pointer;
  white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #5b3fb0; }
.btn.pink { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: #fdeceb; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.btn svg { width: 16px; height: 16px; flex: none; }

input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], select, textarea {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font: 13px var(--font); color: var(--text); outline: none; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }

/* ---------- górny pasek ---------- */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--text); letter-spacing: -.2px; }
.logo:hover { text-decoration: none; }
.logo img { width: 30px; height: 30px; }
.logo span b { color: var(--brand); }
.topbar .spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 4px; border-radius: 20px; cursor: pointer; position: relative; }
.userchip:hover { background: var(--panel-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.rolebadge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* ---------- menu rozwijane ---------- */
.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 210px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border: 0; background: none;
  text-align: left; font: 13px var(--font); color: var(--text); border-radius: 6px; cursor: pointer; }
.menu button:hover, .menu a:hover { background: var(--panel-2); text-decoration: none; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu .label { padding: 6px 10px 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* ---------- strony ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 26px 22px 60px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { border: 0; background: none; padding: 10px 14px; font: 500 14px var(--font); color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.toolbar-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .15s, transform .15s; cursor: pointer; position: relative; }
.pcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pcard .thumb { aspect-ratio: 16/10; background: #fafafa center/contain no-repeat; border-bottom: 1px solid var(--line); display: grid; place-items: center; color: #c5c9d6; }
.pcard .meta { padding: 10px 12px; }
.pcard .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .actions { position: absolute; top: 8px; right: 8px; display: none; gap: 4px; }
.pcard:hover .actions { display: flex; }
.pcard .badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-weight: 600; }
.badge.ok { color: var(--ok); border-color: #bfe6d5; background: #effaf5; }
.badge.brand { color: var(--brand); border-color: #d9cff5; background: var(--brand-soft); }
.badge.warn { color: var(--warn); border-color: #f1dfb5; background: #fdf7e8; }
.badge.err { color: var(--err); border-color: #f3c9c7; background: #fdeceb; }

.new-tile { border: 2px dashed #cfc5ef; background: var(--brand-soft); color: var(--brand); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px; font-weight: 600; min-height: 200px; }
.new-tile:hover { border-color: var(--brand); }

/* ---------- tabele ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; }
table.data tr:hover td { background: #fafbfe; }
.table-wrap { overflow: auto; max-height: 65vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }

/* ---------- okna dialogowe ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(25, 22, 45, .45); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal { background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; }
.modal.wide { width: min(1100px, 100%); }
.modal header { padding: 18px 22px 8px; display: flex; align-items: center; gap: 10px; }
.modal header h2 { margin: 0; flex: 1; }
.modal .body { padding: 8px 22px 16px; overflow: auto; }
.modal footer { padding: 12px 22px 18px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- powiadomienia ---------- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #1f2433; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px; animation: tin .2s; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- logowanie ---------- */
.login-wrap { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(140deg, #3b2a7a 0%, #6d4fc2 45%, #e0628f 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { font-size: 40px; letter-spacing: -.5px; margin-top: 40px; }
.login-art p { font-size: 16px; opacity: .9; max-width: 440px; }
.login-art > * { position: relative; z-index: 1; }
.login-art .cells { position: absolute; z-index: 0; right: -40px; bottom: -30px; width: min(440px, 70%); opacity: .35; }
.login-form { display: grid; place-items: center; padding: 32px; background: #fff; }
.login-form form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-form .btn { height: 42px; font-size: 15px; }
.login-form input { height: 42px; font-size: 15px; }
.err-box { background: #fdeceb; color: var(--err); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
@media (max-width: 820px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---------- przełącznik języka ---------- */
.langsw { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.langsw button { border: 0; background: #fff; padding: 0 9px; height: 28px; font: 600 11.5px var(--font); color: var(--muted); cursor: pointer; }
.langsw button.on { background: var(--brand); color: #fff; }
.login-form .langsw { position: absolute; top: 18px; right: 18px; }
.login-form { position: relative; }
