/* ============================================================
   Panel Admina — Bartosz Kuzioła
   Port designu "Panel Admina.dc.html" z Claude Design
   ============================================================ */

:root {
  --bg: #F3F1EC;
  --ink: #1C1E1C;
  --accent: #0E6B5C;
  --accent-dark: #0B5548;
  --mint: #4FD8B0;
  --muted: #66695F;
  --faint: #9A9C92;
  --card: #FFFFFF;
  --line: rgba(28, 30, 28, .08);
  --danger: #B3261E;
  --sidebar-bg: #12201C;
  --font-sans: 'Sora', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
}

a { color: inherit; text-decoration: none; }
a:hover { opacity: .85; }

button { font: inherit; border: 0; background: none; color: inherit; padding: 0; cursor: pointer; text-align: left; }

input, textarea, select { font-family: var(--font-sans); color: var(--ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@keyframes bkpulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .55; } }
@keyframes bktoast { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drawer-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }

/* --- Układ --- */

.admin { display: flex; min-height: 100vh; width: 100%; }

/* --- Sidebar --- */

.sidebar {
  width: 236px;
  flex: none;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 22px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 22px 22px;
  border-bottom: 1px solid rgba(243, 241, 236, .1);
  margin-bottom: 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--bg);
}

.sidebar__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mint);
  animation: bkpulse 2.2s ease-in-out infinite;
}

.sidebar__nav { display: flex; flex-direction: column; }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 11px 22px 11px 19px;
  border-left: 3px solid transparent;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(243, 241, 236, .65);
  transition: background .12s ease, color .12s ease;
}

.nav-item:hover { color: #fff; }

.nav-item.is-active {
  border-left-color: var(--mint);
  background: rgba(79, 216, 176, .08);
  color: #fff;
  font-weight: 600;
}

.nav-item__badge {
  background: var(--mint);
  color: #0B1512;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar__spacer { flex: 1; }

.sidebar__foot { padding: 0 22px; display: flex; flex-direction: column; gap: 10px; }

.sidebar__foot a { font-size: 12px; font-weight: 600; color: var(--mint); }

.sidebar__foot span { font-family: var(--font-mono); font-size: 11px; color: rgba(243, 241, 236, .35); }

/* --- Główna kolumna --- */

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 36px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.topbar__title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

.topbar__sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

.topbar__user { display: flex; align-items: center; gap: 10px; }

.topbar__name { font-size: 12.5px; color: var(--muted); }

.topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.content { flex: 1; overflow: auto; padding: 28px 36px 48px; }

/* --- Wspólne klocki --- */

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; }

.pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

.btn { font-weight: 600; border-radius: 999px; transition: background .15s ease, color .15s ease, border-color .15s ease; }

.btn-dark { background: var(--ink); color: var(--bg); font-size: 13px; padding: 11px 18px; }
.btn-dark:hover { background: var(--accent); }

.btn-green { background: var(--accent); color: #fff; font-size: 13px; padding: 11px 20px; }
.btn-green:hover { background: var(--accent-dark); }

.btn-outline {
  border: 1px solid rgba(28, 30, 28, .15);
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-text { font-size: 13px; font-weight: 600; color: var(--muted); padding: 11px 16px; }

.link-danger { font-size: 12.5px; font-weight: 600; color: var(--danger); }

.link-accent { font-size: 12px; font-weight: 600; color: var(--accent); }

.view-actions { display: flex; justify-content: flex-end; margin-bottom: 18px; }

.input, .textarea, .select {
  width: 100%;
  border: 1px solid rgba(28, 30, 28, .12);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 13.5px;
  background: #fff;
}

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 107, 92, .08);
}

.textarea { resize: none; }

.field-label { font-size: 11.5px; color: var(--muted); }

/* --- Pulpit --- */

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }

.stat-card { padding: 20px; }

.stat-card__value { font-size: 28px; font-weight: 700; }

.stat-card__label { margin-top: 6px; font-size: 12px; color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.panel-card { padding: 22px; }

.panel-card__title { font-size: 14px; font-weight: 600; margin-bottom: 14px; }

.plist { display: flex; flex-direction: column; gap: 2px; }

.plist__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 0;
  border-top: 1px solid rgba(28, 30, 28, .06);
}

.plist__name { font-size: 13px; font-weight: 600; }
.plist__name.is-unread { font-weight: 700; }

.plist__sub { font-size: 11.5px; color: var(--faint); }

.plist__due { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* --- Kanban --- */

.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }

.kcol {
  background: rgba(28, 30, 28, .02);
  border: 1px dashed rgba(28, 30, 28, .12);
  border-radius: 16px;
  padding: 12px;
  min-height: 360px;
  transition: border-color .12s ease, background .12s ease;
}

.kcol.drag-over { border-color: var(--accent); background: rgba(14, 107, 92, .04); }

.kcol__head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 14px; }

.kcol__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.kcol__label { font-size: 12.5px; font-weight: 600; }

.kcol__count { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }

.kcol__cards { display: flex; flex-direction: column; gap: 10px; }

.kcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  cursor: grab;
  transition: box-shadow .15s ease;
}

.kcard:hover { box-shadow: 0 8px 18px rgba(28, 30, 28, .1); }

.kcard.dragging { opacity: .45; }

.kcard__name { font-size: 13px; font-weight: 600; }

.kcard__client { margin-top: 3px; font-size: 11.5px; color: var(--faint); }

.kcard__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }

.kcard__tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  background: rgba(28, 30, 28, .06);
  padding: 3px 7px;
  border-radius: 5px;
}

.kcard__meta {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--faint);
}

/* --- Tabele (klienci / zespół) --- */

.table-card { overflow: hidden; overflow-x: auto; }

.trow { display: grid; gap: 12px; padding: 15px 20px; border-top: 1px solid rgba(28, 30, 28, .06); align-items: center; width: 100%; min-width: 620px; }

.trow--clients { grid-template-columns: 1.4fr 1.4fr .9fr 1fr 1fr; }

.trow--team { grid-template-columns: 1.4fr 1.4fr .9fr 1fr; }

.trow--head {
  border-top: 0;
  padding: 13px 20px;
  background: rgba(28, 30, 28, .03);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  letter-spacing: .06em;
}

.trow--click { cursor: pointer; transition: background .1s ease; }
.trow--click:hover { background: rgba(28, 30, 28, .02); }

.trow__name { font-size: 13px; font-weight: 600; }

.trow__code {
  display: block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  color: var(--faint);
}

.trow__dim { font-size: 12.5px; color: var(--muted); }

.trow__faint { font-size: 12.5px; color: var(--faint); }

.trow .pill { justify-self: start; }

/* --- Tickety --- */

.tickets-grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }

.ticket-list { overflow: hidden; }

.ticket-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(28, 30, 28, .07);
  transition: background .1s ease;
}

.ticket-row:last-child { border-bottom: 0; }

.ticket-row.is-active { background: rgba(14, 107, 92, .05); }

.ticket-row__top { display: flex; justify-content: space-between; gap: 8px; }

.ticket-row__name { font-size: 13px; font-weight: 600; }
.ticket-row__name.is-unread { font-weight: 700; }

.ticket-row__time { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

.ticket-row__subject { font-size: 12.5px; font-weight: 500; color: var(--muted); text-align: left; }
.ticket-row__subject.is-unread { font-weight: 600; color: var(--ink); }

.ticket-detail { padding: 26px; display: flex; flex-direction: column; }

.ticket-detail__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }

.ticket-detail__subject { font-size: 18px; font-weight: 700; }

.ticket-detail__from { margin-top: 4px; font-size: 12px; color: var(--faint); }

.ticket-detail__actions { display: flex; gap: 8px; flex: none; }

.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid rgba(28, 30, 28, .07);
}

.msg { display: flex; flex-direction: column; align-items: flex-start; }
.msg--me { align-items: flex-end; }

.msg__bubble {
  max-width: 78%;
  padding: 12px 15px;
  border-radius: 4px 14px 14px 14px;
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--ink);
}

.msg--me .msg__bubble { border-radius: 14px 14px 4px 14px; background: var(--accent); color: #fff; }

.msg__time { margin-top: 4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }

.reply-row { display: flex; gap: 10px; margin-top: 18px; }

.reply-row .textarea { flex: 1; height: 52px; border-radius: 12px; padding: 12px 14px; font-size: 13px; }

.reply-row .btn-green { align-self: flex-end; white-space: nowrap; padding: 13px 20px; }

/* --- Treść strony (CMS) --- */

.cms { max-width: 760px; display: flex; flex-direction: column; gap: 22px; }

.cms-card { padding: 22px; }

.cms-card__title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: .08em;
  margin-bottom: 14px;
}

.cms-card__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.cms-card__head .cms-card__title { margin-bottom: 0; }

.cms-field { margin-bottom: 14px; }
.cms-field:last-child { margin-bottom: 0; }

.cms-field .input, .cms-field .textarea { margin-top: 6px; font-size: 14px; padding: 11px 14px; }

.cms-field .textarea { font-size: 13.5px; }

.showcase-list { display: flex; flex-direction: column; gap: 14px; }

.showcase-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.showcase-item__top { display: flex; gap: 8px; align-items: center; }

.showcase-item__title { flex: 1; border-radius: 8px; padding: 9px 12px; font-size: 13px; font-weight: 600; }

.showcase-item__remove { font-size: 11.5px; font-weight: 600; color: var(--danger); padding: 9px 10px; flex: none; }

.showcase-item .textarea { height: 44px; border-radius: 8px; padding: 9px 12px; font-size: 12.5px; }

.showcase-item__tags { border-radius: 8px; padding: 9px 12px; font-family: var(--font-mono); font-size: 11.5px; }

/* --- Przełącznik (strona w budowie) --- */

.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; }

.switch-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.switch-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(28, 30, 28, .18);
  position: relative;
  flex: none;
  transition: background .15s ease;
}

.switch-ui::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}

.switch-row input:checked + .switch-ui { background: var(--accent); }

.switch-row input:checked + .switch-ui::after { transform: translateX(18px); }

.switch-row input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.switch-label { font-size: 13px; font-weight: 500; }

.mnt-hint { margin-top: 12px; }

.mnt-hint a { font-size: 12px; font-weight: 600; color: var(--accent); }

/* --- Zespół --- */

.invite-card { padding: 18px; display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }

.invite-card .input { flex: 1; width: auto; }

.invite-card .select { width: auto; padding: 10px 12px; font-size: 13px; }

/* --- Szuflada --- */

.drawer-overlay { position: fixed; inset: 0; background: rgba(20, 22, 20, .32); z-index: 90; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(400px, 100vw);
  background: var(--card);
  z-index: 91;
  padding: 26px;
  display: flex;
  flex-direction: column;
  box-shadow: -16px 0 40px rgba(20, 22, 20, .12);
  overflow: auto;
  animation: drawer-in .18s ease-out;
}

.drawer__title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }

.drawer .field-label { display: block; }

.drawer .input, .drawer .select { margin: 6px 0 14px; }

.drawer .textarea { margin-top: 6px; height: 80px; font-size: 13px; }

.drawer__cols { display: flex; gap: 10px; }
.drawer__cols > div { flex: 1; }

.drawer__spacer { flex: 1; }

.drawer__foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.drawer__foot-actions { display: flex; gap: 10px; margin-left: auto; align-items: center; }

/* --- Toast --- */

.toast {
  position: fixed;
  top: 22px;
  right: 32px;
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: 12px;
  z-index: 99;
  animation: bktoast .2s ease-out;
}

/* --- Responsywność --- */

@media (max-width: 1150px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .kanban { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .tickets-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 14px 0 0; }
  .sidebar__brand { padding: 0 18px 12px; margin-bottom: 0; border-bottom: 0; }
  .sidebar__nav { flex-direction: row; overflow-x: auto; border-top: 1px solid rgba(243, 241, 236, .1); }
  .nav-item { flex: none; border-left: 0; border-bottom: 3px solid transparent; padding: 12px 14px; }
  .nav-item.is-active { border-left: 0; border-bottom-color: var(--mint); }
  .sidebar__spacer, .sidebar__foot { display: none; }
  .topbar { padding: 20px; flex-wrap: wrap; gap: 10px; }
  .content { padding: 20px 20px 40px; }
  .kanban { grid-template-columns: 1fr; }
  .stat-grid { gap: 12px; }
  .invite-card { flex-wrap: wrap; }
}
