/* ==========================================================================
   Different24 — Panel Zgłoszeń — design system
   Własna, wyrazista tożsamość (bold + kolorowo). Zero zależności / zero builda.
   ========================================================================== */

:root {
  /* Marka — fiolet Different24 (#8d44ad) */
  --brand-900: #3b1d49;
  --brand-800: #5a2c70;
  --brand-700: #743a90;
  --brand-600: #8d44ad;
  --brand-500: #a25ec0;
  --brand-400: #c08fd5;
  --accent-cyan: #06b6d4;
  --accent-amber: #f59e0b;
  --accent-pink: #ec4899;

  /* Neutralne */
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;

  /* Stany */
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px -12px rgba(59, 29, 73, .28);
  --shadow-lg: 0 24px 48px -20px rgba(59, 29, 73, .38);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .4em; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

/* ===== Układ aplikacji ===================================================== */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(165deg, var(--brand-800), var(--brand-900) 70%);
  color: #c7d2fe;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: 1.3rem 1.25rem .5rem;
  color: #fff;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -.02em;
}
.brand-logo { height: 60px; width: auto; max-width: 100%; display: block; }
.brand-logo-light { filter: brightness(0) invert(1); }     /* czarny SVG -> biały na ciemnym tle */
.brand-tag {
  padding: 0 1.3rem 1rem; margin-top: -.15rem;
  font-size: .66rem; font-weight: 800; letter-spacing: .16em;
  text-transform: uppercase; color: #c9a9dd;
}

.nav { padding: .5rem .75rem; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .8rem; margin-bottom: .2rem;
  border-radius: var(--radius-sm);
  color: #d9c5e6; font-weight: 600; font-size: .92rem;
  text-decoration: none; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, var(--brand-600), var(--brand-500)); color: #fff; box-shadow: var(--shadow); }
.nav a .ico { width: 20px; text-align: center; font-size: 1.05rem; }
.nav .sep { height: 1px; background: rgba(255,255,255,.1); margin: .6rem .4rem; }

.sidebar-foot { padding: .9rem 1rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem; color: #c9a9dd; }
.sidebar-foot .who { color: #fff; font-weight: 700; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: .7rem 1rem;
  background: var(--brand-900);
  color: #fff;
  position: sticky; top: 0; z-index: 40;
}
.topbar .brand { padding: 0; font-size: 1.05rem; }
.hamburger {
  background: rgba(255,255,255,.12); border: 0; color: #fff;
  width: 42px; height: 42px; border-radius: 10px; font-size: 1.3rem; cursor: pointer;
}

.content { padding: 1.6rem 1.8rem 3rem; max-width: 1280px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; flex-wrap: wrap; }
.page-head .subtitle { color: var(--muted); font-size: .92rem; margin-top: -.2rem; }

/* ===== Karty ============================================================== */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.2rem;
}
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: 1rem; }

/* ===== Przyciski ========================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .58rem 1.1rem; border-radius: 10px; border: 0; cursor: pointer;
  font-weight: 700; font-size: .9rem; line-height: 1;
  background: #e2e8f0; color: var(--ink-soft);
  transition: transform .05s, box-shadow .15s, background .15s; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--brand-600), var(--brand-500)); color: #fff; box-shadow: 0 8px 18px -8px rgba(141,68,173,.6); }
.btn-primary:hover { background: linear-gradient(135deg, var(--brand-700), var(--brand-600)); }
.btn-accent { background: linear-gradient(135deg, var(--accent-cyan), #0891b2); color: #fff; box-shadow: 0 8px 18px -8px rgba(6,182,212,.7); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-warn { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-ghost:hover { background: #f8fafc; }
.btn-sm { padding: .4rem .75rem; font-size: .82rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ===== Odznaki (badge) ==================================================== */

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .6rem; border-radius: 999px;
  font-size: .76rem; font-weight: 800; letter-spacing: .01em; white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Statusy: szary -> niebieski -> zielony -> fiolet */
.badge-status-todo     { background: #e2e8f0; color: #475569; }
.badge-status-progress { background: #dbeafe; color: #1d4ed8; }
.badge-status-done     { background: #d1fae5; color: #047857; }
.badge-status-closed   { background: #ede9fe; color: #6d28d9; }

/* Priorytety: zielony -> czerwony */
.badge-prio-low      { background: #dcfce7; color: #15803d; }
.badge-prio-medium   { background: #fef9c3; color: #a16207; }
.badge-prio-high     { background: #ffedd5; color: #c2410c; }
.badge-prio-critical { background: #fee2e2; color: #b91c1c; }

.badge-role  { background: #f3e3fb; color: #743a90; }
.badge-on    { background: #d1fae5; color: #047857; }
.badge-off   { background: #fee2e2; color: #b91c1c; }
.badge-live  { background: #fee2e2; color: #b91c1c; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ===== Tabele ============================================================= */

.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data thead th {
  text-align: left; padding: .8rem 1rem; background: #f8fafc;
  font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.data tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:hover { background: #f8faff; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data a.title-link { font-weight: 700; color: var(--ink); }
table.data a.title-link:hover { color: var(--brand-600); }
.t-muted { color: var(--muted); font-size: .85rem; }
.t-id { color: var(--brand-500); font-weight: 800; font-size: .82rem; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .big { font-size: 2.5rem; margin-bottom: .5rem; }

/* ===== Formularze ========================================================= */

.form-grid { display: grid; gap: 1.05rem; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field.full { grid-column: 1 / -1; }
label.lbl { font-weight: 700; font-size: .85rem; color: var(--ink-soft); }
label.lbl .req { color: var(--danger); }
.hint { font-size: .78rem; color: var(--muted); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1.5px solid var(--line);
  border-radius: 10px; font-size: .92rem; font-family: inherit; color: var(--ink);
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(141,68,173,.2);
}
textarea { resize: vertical; min-height: 90px; }
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .4rem; max-height: 220px; overflow-y: auto; padding: .6rem; border: 1.5px solid var(--line); border-radius: 10px; }
.checklist label { display: flex; align-items: center; gap: .5rem; font-size: .88rem; font-weight: 500; cursor: pointer; }
.checklist input { width: auto; accent-color: var(--brand-600); }

.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.inline-form { display: inline; }

/* ===== Flash ============================================================== */

.flashes { margin-bottom: 1.2rem; display: flex; flex-direction: column; gap: .6rem; }
.flash { padding: .8rem 1.1rem; border-radius: 11px; font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .6rem; border-left: 5px solid; }
.flash-success { background: #ecfdf5; color: #065f46; border-color: var(--ok); }
.flash-error   { background: #fef2f2; color: #991b1b; border-color: var(--danger); }
.flash-info    { background: #eff6ff; color: #1e40af; border-color: var(--info); }

/* ===== KPI / statystyki =================================================== */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.3rem; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.15rem 1.3rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after { content: ""; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; opacity: .12; }
.stat .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.stat .value { font-size: 2rem; font-weight: 900; letter-spacing: -.03em; margin-top: .2rem; }
.stat .sub { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.stat.accent-indigo .value { color: var(--brand-600); }
.stat.accent-indigo::after { background: var(--brand-600); }
.stat.accent-cyan .value { color: var(--accent-cyan); }
.stat.accent-cyan::after { background: var(--accent-cyan); }
.stat.accent-green .value { color: var(--ok); }
.stat.accent-green::after { background: var(--ok); }
.stat.accent-amber .value { color: var(--accent-amber); }
.stat.accent-amber::after { background: var(--accent-amber); }
.stat.accent-red .value { color: var(--danger); }
.stat.accent-red::after { background: var(--danger); }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; }
.chart-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; }
.chart-box canvas { max-height: 280px; }

/* ===== Szczegóły zgłoszenia =============================================== */

.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 1.2rem; align-items: start; }
.meta-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.meta-row:last-child { border-bottom: 0; }
.meta-row .k { color: var(--muted); font-weight: 600; }
.meta-row .v { font-weight: 700; text-align: right; }

.timer-box { text-align: center; padding: 1.1rem; border-radius: var(--radius); background: linear-gradient(135deg, #faf3fd, #f3e8fa); border: 1.5px solid #ecd4f5; margin-bottom: 1rem; }
.timer-box .clock { font-size: 2.1rem; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--brand-700); letter-spacing: -.02em; }
.timer-box .state { font-size: .82rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .3rem; }

.thread { display: flex; flex-direction: column; gap: .9rem; }
.comment { background: #f8fafc; border: 1px solid var(--line); border-radius: 11px; padding: .8rem 1rem; }
.comment .head { display: flex; justify-content: space-between; font-size: .82rem; margin-bottom: .35rem; }
.comment .author { font-weight: 800; color: var(--ink); }
.comment .body { white-space: pre-wrap; font-size: .92rem; }

.attach-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.attach-list li { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; background: #f8fafc; border: 1px solid var(--line); border-radius: 9px; font-size: .88rem; }
.attach-list .size { color: var(--muted); font-size: .8rem; margin-left: auto; }

.log-list { list-style: none; padding: 0; margin: 0; }
.log-list li { padding: .55rem 0; border-bottom: 1px dashed var(--line); font-size: .85rem; display: flex; gap: .6rem; }
.log-list li:last-child { border-bottom: 0; }
.log-list .when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-list .who { font-weight: 700; }

/* ===== Pasek filtrów ====================================================== */

.filters { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; }
.filters .field { min-width: 150px; flex: 1; }
.filters .field.narrow { min-width: 120px; flex: 0; }

/* ===== Logowanie ========================================================== */

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: linear-gradient(160deg, var(--brand-800), var(--brand-900)); }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); padding: 2.2rem; }
.auth-card .brand { justify-content: center; padding: 0 0 1.2rem; color: var(--ink); font-size: 1.35rem; }
.auth-card h1 { text-align: center; font-size: 1.3rem; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 1.5rem; font-size: .9rem; }

/* ===== Pomocnicze ========================================================= */

.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.gap-sm { gap: .35rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.text-right { text-align: right; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; }
.pill-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ===== Modal potwierdzenia ================================================ */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200; padding: 1rem;
  background: rgba(15, 23, 42, .55);
  display: grid; place-items: center;
  animation: fade .12s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  max-width: 430px; width: 100%; padding: 1.5rem 1.6rem;
  animation: pop .14s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin-top: 0; display: flex; align-items: center; gap: .55rem; }
.modal .modal-msg { color: var(--ink-soft); margin-bottom: 1.4rem; font-size: .95rem; }
.modal .modal-actions { display: flex; gap: .6rem; justify-content: flex-end; }

/* ===== Responsywność ====================================================== */

.backdrop { display: none; }

@media (max-width: 900px) {
  .topbar { display: flex; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 55; }
  .content { padding: 1.1rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-grid.cols-2 { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
}
