/* SituationDeck-style dark dashboard - 100% layout */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  font-size: 14px;
  color: #C0C0C0;
  background: #1A1C1D;
}

body {
  font-family: var(--font-mono);
}

input,
select,
textarea {
  font-family: var(--font-mono);
}

.dashboard-dark {
  --font-sans: Inter, sans-serif;
  --font-serif: Georgia, serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --bg-dark: #1A1C1D;
  --bg-panel: #202224;
  --bg-widget: #202224;
  --border: #2a2c2e;
  --text: #C0C0C0;
  --text-muted: #909090;
  --positive: #00FF88;
  --negative: #ff6b6b;
  --accent: #00FF88;
  --warning: #FFD700;
  --nav-height: 48px;
}

#app {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== Top navigation bar ========== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding: 0 1rem;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* ========== Module navigation ========== */
.nav-modules {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.nav-module {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem 0.9rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: color 0.15s, border-color 0.15s;
}

.nav-module:hover { color: var(--text); }
.nav-module.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ========== Fullscreen modules ========== */
.app-module {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.module-fullscreen {
  display: flex !important;
  flex-direction: column;
  padding: 1rem 1.5rem;
  background: var(--bg-dark);
  overflow-y: auto;
}

.module-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  width: 100%;
}

.module-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  width: 100%;
}

.module-label {
  font-weight: 600;
  color: var(--text);
  font-size: 1rem;
  min-width: 8rem;
  text-align: center;
}

.module-body {
  flex: 1;
}

/* ========== ZADANIA – task list ========== */
/* outer container for all groups */
#tasksList {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* group header */
.task-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.5rem;
  transition: background 0.12s;
}
.task-group-header:hover { background: #1e2a1e; }

.task-group-title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.3rem;
  background: rgba(80,180,80,0.18);
  color: var(--accent);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.task-group-chevron {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

/* grid of cards inside a group */
.tasks-list {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.6rem;
  align-items: start;
}

@media (max-width: 1400px) { .tasks-list { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1150px) { .tasks-list { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .tasks-list { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 650px)  { .tasks-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px)  { .tasks-list { grid-template-columns: 1fr; } }

.task-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  transition: background 0.12s, border-color 0.12s;
  min-width: 0;
  overflow: hidden;
}
.task-row:hover { background: #1e2e1e; border-color: var(--accent); }
.task-row.task-done { opacity: 0.5; }
.task-row.task-done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-row.task-pinned { border-color: #c8a820; box-shadow: inset 3px 0 0 #f5c842; background: rgba(245,200,66,0.04); }
.task-row.task-pinned:hover { background: rgba(245,200,66,0.08); border-color: #f5c842; }

/* left: content */
.task-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.6rem 0.7rem;
}

/* top badges row */
.task-row-top {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.task-title {
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.task-meta { font-size: 0.72rem; color: var(--text-muted); }

.task-priority-badge {
  font-size: 0.67rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-weight: 700;
  flex-shrink: 0;
}
.task-overdue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 2px;
  background: rgba(200,50,50,0.3);
  border: 1px solid rgba(200,50,50,0.6);
  color: #f08080;
  font-size: 0.55rem;
  font-weight: 700;
  margin-left: 0.3rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.task-priority-today  { background: rgba(220,80,80,0.35);  color: #ff6b6b; border: 1px solid rgba(220,80,80,0.5); }
.task-priority-high   { background: rgba(200,60,60,0.2);   color: #f08080; }
.task-priority-medium { background: rgba(200,160,60,0.2);  color: #e6c060; }
.task-priority-low    { background: rgba(80,180,80,0.15);  color: var(--accent); }

/* right: action buttons column */
.task-actions {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  flex-shrink: 0;
}

.task-btn {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 0.5rem;
  color: var(--text-muted);
  transition: background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  line-height: 1;
}
.task-btn + .task-btn { border-top: 1px solid var(--border); }

.task-btn-done:hover     { background: rgba(80,180,80,0.15);   color: var(--accent); }
.task-btn-edit:hover     { background: rgba(100,180,255,0.1);  color: #7eb8da; }
.task-btn-copy:hover     { background: rgba(200,160,60,0.15);  color: #e6c060; }
.task-btn-comments:hover { background: rgba(120,120,200,0.15); color: #a0a0f0; }
.task-btn-delete:hover   { background: rgba(200,60,60,0.15);   color: #f08080; }
.task-btn-pin            { font-size: 0.75rem; }
.task-btn-pin:hover      { background: rgba(245,200,66,0.18);  color: #f5c842; }
.task-btn-pin--active    { color: #f5c842; }
.task-btn-pin--active:hover { background: rgba(245,200,66,0.22); color: #f5c842; }

.task-btn-comments {
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-btn.task-btn-comments--active {
  color: #a0a0f0;
}

/* ===== Modal komentarzy ===== */
#taskCommentsModal {
  width: min(560px, 92vw);
  max-height: 85vh;
  margin: auto;
  overflow: hidden;
}

.task-comments-modal-wrap {
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
  gap: 1rem;
  box-sizing: border-box;
  max-height: 85vh;
  overflow: hidden;
}

.task-comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0.2rem;
  line-height: 1;
  transition: color 0.12s;
}
.modal-close-btn:hover { color: #f08080; }

.task-comments-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 60px;
  max-height: 45vh;
  padding-right: 0.25rem;
}

.task-comments-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0.5rem 0;
}

.task-comment-item {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  position: relative;
}

.task-comment-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.task-comment-body {
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-comment-del {
  position: absolute;
  top: 0.3rem;
  right: 0.4rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
}
.task-comment-item:hover .task-comment-del { opacity: 1; }
.task-comment-del:hover { color: #f08080; }

.task-comments-add {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.task-comment-input {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.5rem 0.65rem;
  resize: vertical;
  min-height: 64px;
}
.task-comment-input:focus { outline: none; border-color: var(--accent); }

.task-status-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}
.task-status-todo      { background: rgba(150,150,150,0.15); color: var(--text-muted); }
.task-status-in_progress { background: rgba(100,180,255,0.15); color: #7eb8da; }
.task-status-completed { background: rgba(80,180,80,0.15); color: var(--accent); }

.task-actions { display: flex; gap: 0.35rem; }

/* ========== KALENDARZ – full screen ========== */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 2px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  min-height: 130px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.45rem 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}
.cal-day.cal-empty { background: transparent; border-color: transparent; }
.cal-day.cal-today {
  border-color: var(--accent);
  border-width: 2px;
}

.cal-day-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin-bottom: 0.15rem;
}
.cal-today .cal-day-num {
  background: var(--accent);
  color: #1A1C1D;
  font-weight: 800;
}

.cal-item {
  font-size: 0.7rem;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  cursor: pointer;
  cursor: pointer;
}
.cal-item-task  { background: rgba(80,160,80,0.2);   color: var(--accent); }
.cal-item-event { background: rgba(100,180,255,0.2); color: #7eb8da; cursor: grab; }
.cal-item-event:active { cursor: grabbing; }
.cal-item-done  { opacity: 0.45; }
.cal-item-done .cal-item-text { text-decoration: line-through; }
.cal-item-dragging { opacity: 0.35; outline: 1px dashed #7eb8da; }
.cal-drag-over { background: rgba(100,180,255,0.12) !important; outline: 2px solid #7eb8da; outline-offset: -2px; }

/* left: content — mirrors .task-row-body */
.cal-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.22rem 0.4rem;
}

.cal-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-item-client {
  font-size: 0.6rem;
  opacity: 0.55;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* right: action column — mirrors .task-actions / .task-btn */
.cal-item-actions {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
}

.cal-item-done-btn {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.55;
  font-size: 0.65rem;
  padding: 0 0.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, opacity 0.12s;
}
.cal-item-done-btn + .cal-item-done-btn { border-top: 1px solid var(--border); }
.cal-item-done-btn:hover { opacity: 1; background: rgba(255,255,255,0.05); }
.cal-item-del-btn:hover  { color: #f08080; opacity: 1; }

/* ========== NOTATKI – full screen ========== */
.notes-layout-full {
  display: flex;
  height: 100%;
  gap: 0;
  overflow: hidden;
}

.notes-sidebar-full {
  width: 260px;
  min-width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-panel);
}

.notes-search-full {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.notes-list-full {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.notes-list-item {
  display: flex;
  align-items: stretch;
  border-radius: 5px;
  border: 1px solid transparent;
  overflow: hidden;
  transition: background 0.12s;
}
.notes-list-item:hover { background: #222f22; }
.notes-list-item.active { border-color: var(--accent); background: rgba(80,180,80,0.08); }

.notes-list-item-info {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

.notes-list-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notes-list-item-date { font-size: 0.7rem; color: var(--text-muted); }

.notes-list-item-del {
  flex-shrink: 0;
  background: none;
  border: none;
  border-left: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.5rem;
  opacity: 0;
  transition: opacity 0.15s, background 0.12s, color 0.12s;
  display: flex;
  align-items: center;
}
.notes-list-item:hover .notes-list-item-del { opacity: 0.5; border-left-color: var(--border); }
.notes-list-item-del:hover { opacity: 1 !important; color: #f08080; background: rgba(200,50,50,0.1); }

.notes-editor-full {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

.notes-editor-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.notes-title-full {
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 1.25rem;
  font-family: var(--font-mono);
  padding: 0.3rem 0;
  margin-bottom: 0.75rem;
  outline: none;
}
.notes-title-full:focus { border-bottom-color: var(--accent); }

.notes-body-full {
  flex: 1;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  resize: none;
  outline: none;
  min-height: 300px;
}

.notes-editor-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: flex-end;
}

/* ===== PANEL SZYBKIEGO PODGLĄDU ZADANIA ===== */
.tasks-body-wrap {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.tasks-list-pane {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  padding-left: 0.5rem;
}
.task-preview-panel {
  width: 320px;
  min-width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-left: 15px;
  transition: width 0.2s;
}
.task-preview-panel.hidden { display: none; }

.task-preview-header {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
}
.task-preview-close-row {
  display: flex;
  justify-content: flex-end;
  min-height: 2rem;
}
.task-preview-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 0.25rem 0.5rem;
  transition: color 0.12s, background 0.12s;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.task-preview-close:hover { color: #f08080; background: rgba(200,60,60,0.1); }

.task-preview-actions {
  display: flex;
  flex-direction: row;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 2.5rem;
}
.task-preview-actions .task-btn {
  flex: none;
  width: 1.9rem;
  padding: 0;
  font-size: 0.85rem;
  border-top: none;
  min-height: 2.5rem;
}
.task-preview-actions .task-btn + .task-btn {
  border-top: none;
  border-left: 1px solid var(--border);
}

.task-preview-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  padding: 0.6rem 1rem 0.9rem;
  border-top: 1px solid var(--border);
}

.task-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.task-preview-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.task-preview-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.task-preview-value {
  font-size: 0.84rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.task-preview-value.muted { color: var(--text-muted); font-style: italic; }

.task-preview-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.1rem 0;
}

.task-preview-comments {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.task-preview-comment {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.4rem 0.6rem;
}
.task-preview-comment-meta { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 0.2rem; }
.task-preview-comment-text { font-size: 0.82rem; white-space: pre-wrap; word-break: break-word; }

.task-preview-attach {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.task-preview-attach-thumb {
  width: 60px;
  height: 60px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: var(--text-muted);
  cursor: pointer;
}
.task-preview-attach-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* karta zadania — kursorem sygnalizuj kliknięcie na body */
.task-row-body { cursor: pointer; }
.task-row.task-preview-active { border-color: var(--accent); background: rgba(80,180,80,0.04); }

@media (max-width: 900px) {
  .task-preview-panel { width: 260px; }
}
@media (max-width: 650px) {
  .task-preview-panel { display: none !important; }
}

/* ===== ZAŁĄCZNIKI W ZADANIACH ===== */
.task-attach-zone {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
  margin-top: 0.25rem;
}
.task-attach-zone.drag-over {
  border-color: var(--accent);
  background: rgba(80,180,80,0.06);
}
.task-attach-browse {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}
.task-attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.task-attach-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
}
.task-attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.task-attach-del {
  position: absolute;
  top: 1px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  border: none;
  color: #f08080;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 3px;
  border-radius: 3px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 0.12s;
}
.task-attach-thumb:hover .task-attach-del { opacity: 1; }

/* ===== WIDOK TYGODNIOWY KALENDARZA ===== */
.cal-view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin-left: 0.75rem;
}
.cal-view-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.cal-view-btn + .cal-view-btn { border-left: 1px solid var(--border); }
.cal-view-btn.active { background: rgba(80,180,80,0.18); color: var(--accent); }
.cal-view-btn:hover:not(.active) { background: rgba(255,255,255,0.05); color: var(--text); }

.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 0.5rem;
}
.cal-week-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 120px;
}
.cal-week-col-header {
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  padding: 0.3rem 0;
  border-radius: 4px;
  color: var(--text-muted);
}
.cal-week-col-header.cal-today-header {
  background: rgba(80,180,80,0.2);
  color: var(--accent);
}

/* ===== NOTATKI: TAGI ===== */
.notes-tags-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-bottom: 1px solid var(--border);
}
.notes-tags-input {
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  outline: none;
  min-width: 140px;
  padding: 0.15rem 0;
}
.notes-tags-input::placeholder { color: var(--text-muted); }
.notes-tags-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.notes-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(80,180,80,0.12);
  border: 1px solid rgba(80,180,80,0.3);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.75rem;
  color: var(--accent);
}
.notes-tag-chip-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0;
  line-height: 1;
  transition: color 0.12s;
}
.notes-tag-chip-del:hover { color: #f08080; }

.notes-tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.4rem 0.5rem;
  min-height: 0;
}
.notes-tag-filter-btn {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.73rem;
  font-family: var(--font-mono);
  padding: 0.1rem 0.45rem;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.notes-tag-filter-btn.active {
  background: rgba(80,180,80,0.15);
  border-color: rgba(80,180,80,0.4);
  color: var(--accent);
}

.notes-list-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  margin-top: 0.2rem;
}
.notes-list-item-tag {
  font-size: 0.65rem;
  background: rgba(80,180,80,0.1);
  border: 1px solid rgba(80,180,80,0.2);
  border-radius: 3px;
  padding: 0 0.3rem;
  color: var(--accent);
}

/* ===== USTAWIENIA ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  align-items: start;
}

.settings-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.settings-card-wide { grid-column: span 2; }
@media (max-width: 700px) { .settings-card-wide { grid-column: span 1; } }

.settings-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.settings-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-label { font-size: 0.75rem; color: var(--text-muted); }
.settings-stat  { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.settings-info  { font-size: 0.78rem; color: var(--text-muted); margin: 0; }
.settings-info code { color: var(--accent); font-family: var(--font-mono); }

.settings-field input,
.settings-field select {
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}
.settings-field input:focus,
.settings-field select:focus { outline: none; border-color: var(--accent); }

.settings-save-btn {
  align-self: flex-start;
  background: rgba(80,180,80,0.15);
  border: 1px solid rgba(80,180,80,0.35);
  border-radius: 5px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  padding: 0.3rem 0.85rem;
  transition: background 0.12s;
}
.settings-save-btn:hover { background: rgba(80,180,80,0.25); }

.settings-crud-card { grid-column: span 1; }

.settings-tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; align-content: flex-start; flex: 1; }

.settings-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.4rem 0.15rem 0.5rem;
  font-size: 0.8rem;
}
.settings-tag-edit,
.settings-tag-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0 0.15rem;
  line-height: 1;
  transition: color 0.12s;
}
.settings-tag-edit:hover { color: #7eb8da; }
.settings-tag-del:hover { color: #f08080; }

.settings-add-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.settings-add-user-row .user-field-login { min-width: 6rem; }
.settings-add-user-row .user-field-name { min-width: 5rem; }
.settings-add-user-row .user-field-email { min-width: 8rem; }
.settings-add-user-row .user-field-role { min-width: 5rem; }
.settings-add-user-row .user-field-pass { min-width: 6rem; }
.settings-add-row input,
.settings-add-row select {
  flex: 1;
  min-width: 0;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}
.settings-add-row input:focus,
.settings-add-row select:focus { outline: none; border-color: var(--accent); }

.settings-add-btn {
  background: rgba(80,180,80,0.15);
  border: 1px solid rgba(80,180,80,0.35);
  border-radius: 5px;
  color: var(--accent);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.7rem;
  transition: background 0.12s;
}
.settings-add-btn:hover { background: rgba(80,180,80,0.28); }

.tasks-filter {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 0.35rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Keyboard shortcut hint in module toolbars */
.module-kb-hint {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  cursor: default;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.module-kb-hint:hover {
  opacity: 1;
  color: var(--accent);
  border-color: var(--accent);
}

/* Notes sidebar header row */
.notes-sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem 0.5rem;
}
.notes-sidebar-header .notes-search-full {
  flex: 1;
}

.tasks-search {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  padding: 0.35rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  box-sizing: border-box;
}
.tasks-search:focus { outline: none; border-color: var(--accent); }
.tasks-search::placeholder { color: var(--text-muted); }
.tasks-search::-webkit-search-cancel-button { cursor: pointer; }

.nav-main {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.nav-item:hover {
  color: var(--accent);
}

.nav-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-current-month {
  font-size: 0.9rem;
  color: var(--accent);
  margin-left: 0.25rem;
  font-weight: 600;
}

.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-center span {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.nav-logo {
  font-size: 1rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em;
  color: var(--accent) !important;
}

.nav-center-sep {
  color: var(--border) !important;
  font-size: 0.85rem !important;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-user {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.nav-logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.2rem 0.3rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.12s, background 0.12s;
}
.nav-logout-btn:hover { color: #f08080; background: rgba(200,60,60,0.12); }

/* ===== Bell / reminders ===== */
.nav-bell-wrap {
  position: relative;
}

.nav-bell-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.3rem 0.4rem;
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
}
.nav-bell-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-bell-btn.has-events { color: var(--accent); }

.nav-bell-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 1rem;
  height: 1rem;
  background: var(--negative, #c03030);
  color: #fff;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.2rem;
  line-height: 1;
}

.nav-bell-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 300px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
  overflow: visible;
}

.nav-bell-header {
  padding: 0.6rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}

.nav-bell-list {
  max-height: calc(100vh - 80px);
  overflow-y: visible;
}

.nav-bell-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.nav-bell-item:last-child { border-bottom: none; }
.nav-bell-item:hover { background: #1e2e1e; }

.nav-bell-item-title {
  font-size: 0.85rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-bell-item-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
}
.nav-bell-item-meta .bell-today  { color: var(--accent); font-weight: 700; }
.nav-bell-item-meta .bell-soon   { color: #e6c060; font-weight: 700; }
.nav-bell-item-meta .bell-past   { color: #f08080; font-weight: 700; }

.nav-bell-empty {
  padding: 1rem 0.85rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.nav-bell-section-title {
  padding: 0.35rem 0.85rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(80,180,80,0.07);
}
.nav-bell-section-tasks {
  color: var(--text-muted);
  background: rgba(255,255,255,0.03);
}

.nav-bell-section-payments {
  color: #e6c060;
  background: rgba(200,160,60,0.06);
}

.nav-bell-separator {
  height: 2px;
  background: var(--accent);
  opacity: 0.35;
  margin: 0;
}

.nav-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
}

.nav-icon:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

/* Month selector - dropdown under nav or inline */
.month-selector {
  position: absolute;
  top: var(--nav-height);
  left: 120px;
  z-index: 100;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-top: none;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.month-selector.hidden {
  display: none;
}

.month-selector button {
  background: var(--bg-widget);
  border: 1px solid var(--border);
  color: var(--text);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.month-selector button:hover {
  background: var(--border);
}

#currentMonthLabel {
  min-width: 140px;
  text-align: center;
  font-weight: 600;
}

/* ========== Dashboard grid ========== */
.dashboard-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto;
  gap: 1rem;
  padding: 1rem;
  max-width: 100%;
}

.widget-summary {
  grid-column: 1 / -1;
}

.widget-table {
  min-height: 280px;
}

.widget-actions {
  grid-column: 1 / -1;
  max-width: 800px;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .widget-summary,
  .widget-actions {
    grid-column: 1;
  }
}

/* ========== Widget chrome ========== */
.widget {
  background: var(--bg-widget);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.widget-header-three {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.widget-header-three .widget-title {
  justify-self: start;
}

.widget-header-three .widget-header-center {
  justify-self: center;
}

.widget-header-three .widget-toolbar {
  justify-self: end;
}

.widget-header-three {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.widget-header-three .widget-title {
  justify-self: start;
}

.widget-header-three .widget-header-center {
  justify-self: center;
}

.widget-header-three .widget-toolbar {
  justify-self: end;
}

.widget-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.widget-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.widget-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.widget-count-label {
  margin-right: 0.2em;
}

.widget-sums {
  font-size: 0.75rem;
  white-space: nowrap;
}

.widget-sums-label {
  color: var(--text);
}

.widget-sums-value {
  color: var(--text-muted);
}

/* ========== Tasks / Calendar / Notes widget ========== */
.tasks-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tasks-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.tasks-filter {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-widget);
  color: var(--text);
  font-size: 0.8rem;
}


.task-item-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.task-status-badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.task-status-completed .task-item-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-priority-low {
  border-left: 3px solid #22c55e;
}
.task-priority-medium {
  border-left: 3px solid #f97316;
}
.task-priority-high {
  border-left: 3px solid #ef4444;
}

.task-actions {
  display: flex;
  gap: 0.25rem;
}

.task-actions button {
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
}

.task-actions button:hover {
  color: var(--accent);
}

.tasks-calendar-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tasks-calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tasks-calendar-header button {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  cursor: pointer;
}

.tasks-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.25rem;
  font-size: 0.7rem;
}

.tasks-calendar-day {
  min-height: 70px;
  padding: 0.25rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
}

.tasks-calendar-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.15rem;
  color: var(--text-muted);
}

.tasks-calendar-day-number {
  font-weight: 600;
}

.tasks-calendar-day-today .tasks-calendar-day-number {
  color: var(--accent);
}

.tasks-calendar-day-list {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.tasks-calendar-pill {
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
  background: rgba(0, 255, 136, 0.08);
  color: var(--text);
  border: 1px solid rgba(0, 255, 136, 0.4);
  font-size: 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tasks-notes-panel {
  display: flex;
  flex-direction: column;
  height: 260px;
}

.tasks-notes-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.75rem;
  height: 100%;
}

.tasks-notes-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tasks-notes-search {
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-widget);
  color: var(--text);
  font-size: 0.8rem;
}

.tasks-notes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  max-height: 100%;
}

.tasks-notes-list-item {
  margin-bottom: 0.25rem;
}

.tasks-notes-list-item button {
  width: 100%;
  text-align: left;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
}

.tasks-notes-list-item.active button {
  background: rgba(0, 255, 136, 0.08);
  border-color: rgba(0, 255, 136, 0.4);
  color: var(--text);
}

.tasks-notes-title {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-widget);
  color: var(--text);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.tasks-notes-body {
  width: 100%;
  height: 100%;
  min-height: 120px;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-widget);
  color: var(--text);
  font-size: 0.85rem;
  resize: vertical;
}

.tasks-notes-actions {
  margin-top: 0.5rem;
  display: flex;
  justify-content: flex-end;
}

.widget-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  font-size: 0.9rem;
  border-radius: 3px;
}

.widget-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.widget-tabs {
  display: flex;
  gap: 0;
  padding: 0 0.75rem;
  border-bottom: 1px solid var(--border);
}

.widget-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  margin-bottom: -1px;
}

.widget-tab:hover {
  color: var(--text);
}

.widget-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.widget-body {
  padding: 1rem;
  overflow: auto;
  flex: 1;
}

.widget-tasks .widget-body {
  display: flex;
  flex-direction: column;
}

/* ========== Summary cards (row 1) ========== */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.summary-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
}

.summary-card.summary-highlight {
  border-color: var(--accent);
  background: rgba(0, 255, 136, 0.06);
}

.summary-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.summary-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.summary-value.positive {
  color: var(--positive);
}

.summary-value.negative {
  color: var(--negative);
}

#openingBalanceCard,
#openingBalanceVatCard {
  cursor: pointer;
}

#openingBalanceCard .summary-value,
#openingBalanceVatCard .summary-value {
  border-bottom: 1px dashed var(--text-muted);
}

.simulation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}
.simulation-toggle input {
  width: auto;
  accent-color: var(--accent);
  border: 1px solid var(--text-muted);
  border-radius: 3px;
  background: var(--bg-widget);
}
.simulation-toggle input:checked {
  background: var(--bg-widget);
}

@media (max-width: 600px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========== Tables ========== */
.table-wrap {
  overflow-x: auto;
  margin-right: -1rem;
}

.data-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th,
.data-table td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.data-table td.col-wrap {
  white-space: normal;
  word-break: break-word;
  min-width: 6rem;
  max-width: 18rem;
}

.data-table tbody tr:not(.group-header):hover {
  background: rgba(255, 255, 255, 0.04);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-align: left;
}

.data-table .cell-actions .sim-check {
  margin-right: 0.5rem;
  vertical-align: middle;
  cursor: pointer;
  accent-color: var(--accent);
  border: 1px solid var(--text-muted) !important;
  border-radius: 3px;
  background: var(--bg-widget);
}
.data-table .cell-actions .sim-check:checked {
  background: var(--bg-widget);
}

.data-table td.numeric {
  text-align: left;
  white-space: nowrap;
  min-width: 6rem;
}

.data-table .positive {
  color: var(--positive);
}

.data-table .negative {
  color: var(--negative);
}

/* Nagłówek grupy kategorii */
.data-table tr.group-header td {
  font-weight: 600;
  color: var(--accent);
  background: rgba(0, 255, 136, 0.08);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
}

/* Ważność: 3 stopnie + kolory wierszy */
.data-table tr.importance-low {
  border-left: 3px solid #4a4d50;
  background: rgba(74, 77, 80, 0.15);
}
.data-table tr.importance-normal {
  border-left: 3px solid var(--border);
}
.data-table tr.importance-uwaga {
  border-left: 3px solid #7eb8da;
  background: rgba(126, 184, 218, 0.12);
}

.data-table tr.importance-high {
  border-left: 3px solid var(--warning);
  background: rgba(255, 215, 0, 0.06);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25em;
  height: 1.25em;
  padding: 0 0.25em;
  border-radius: 3px;
  font-size: 0.85em;
  font-weight: 700;
  vertical-align: middle;
}
.badge-low {
  background: #4a4d50;
  color: var(--text);
  border: 1px solid #4a4d50;
}
.badge-normal {
  background: #3a3d40;
  color: var(--text);
  border: 1px solid var(--border);
}
.badge-uwaga {
  background: #7eb8da;
  color: #1A1C1D;
  border: 1px solid #7eb8da;
}

.badge-high {
  background: var(--warning);
  color: #1A1C1D;
  border: 1px solid var(--warning);
}

/* Termin zapłaty i przeterminowane */
.due-date {
  font-size: 0.85em;
}
.due-recurring-hint {
  margin-left: 0.2em;
  font-size: 0.75em;
  color: var(--text-muted);
  cursor: help;
}
.overdue-label {
  color: var(--negative);
}
.overdue-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  font-size: 0.85em;
  font-weight: 700;
  color: var(--negative);
  border: 1px solid var(--negative);
  border-radius: 3px;
  margin-left: 0.25em;
  vertical-align: middle;
}

/* Termin za 3 dni lub mniej – symbol ! w stylu gradientu (pomarańcz/żółty/zielony) */
.due-soon-label {
  color: var(--text);
}
.due-soon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25em;
  height: 1.25em;
  font-size: 0.85em;
  font-weight: 700;
  color: var(--warning);
  border: 1px solid var(--warning);
  border-radius: 3px;
  margin-left: 0.25em;
  vertical-align: middle;
}

.count-mode-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  height: 1.25em;
  padding: 0 0.25em;
  font-size: 0.75em;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-right: 0.5em;
  vertical-align: middle;
}

/* Zapłacone: styl jak w załączniku – cienka jasna obwódka, jasnoszary tekst */
.paid-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15em 0.5em;
  margin-left: 0.5em;
  font-size: 0.8em;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--text-muted);
  border-radius: 6px;
  background: transparent;
  vertical-align: middle;
}

.data-table tr.paid {
  color: var(--text-muted);
  opacity: 0.55;
}

.data-table tr.paid td {
  color: var(--text-muted);
}

.data-table tr.paid .paid-tag {
  opacity: 0.9;
}

.data-table tr.overdue {
  border-left: 3px solid var(--negative) !important;
  background: rgba(255, 107, 107, 0.12) !important;
}
.data-table tr.overdue.importance-high {
  border-left-color: var(--negative) !important;
  background: rgba(255, 107, 107, 0.14) !important;
}
.data-table tr.overdue.importance-uwaga {
  background: rgba(255, 107, 107, 0.12) !important;
}
.data-table tr.overdue.importance-low {
  background: rgba(255, 107, 107, 0.1) !important;
}

.data-table .btn-edit,
.data-table .btn-copy,
.data-table .btn-delete {
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  margin-right: 0.05rem;
  background: none;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
  vertical-align: middle;
}

.data-table .btn-edit:hover   { color: #7eb8da; background: rgba(100,180,255,0.1); }
.data-table .btn-copy:hover   { color: #e6c060; background: rgba(200,160,60,0.15); }
.data-table .btn-delete:hover { color: #f08080; background: rgba(200,60,60,0.15); }

.data-table .btn-delete:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.data-table .btn-delete:disabled:hover {
  color: var(--text-muted);
  background: none;
}

/* ========== Actions widget ========== */
.actions-panel,
.suggestions-panel {
  min-height: 80px;
}

.actions-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.action-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-panel);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

.action-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: var(--text-muted);
}

.action-btn.primary {
  background: rgba(0, 255, 136, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}

.action-btn.primary:hover {
  background: rgba(0, 255, 136, 0.2);
}

.suggestions-panel.hidden {
  display: none;
}

#suggestionsContent .suggestion-block,
#suggestionsContentModal .suggestion-block {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-panel);
  border-radius: 4px;
  border-left: 4px solid var(--accent);
  font-size: 0.85rem;
  line-height: 1.5;
}

#suggestionsContent .suggestion-warning,
#suggestionsContentModal .suggestion-warning {
  border-left-color: var(--warning);
  background: rgba(255, 215, 0, 0.08);
}

#suggestionsContent .suggestion-ok,
#suggestionsContentModal .suggestion-ok {
  border-left-color: var(--positive);
  background: rgba(0, 255, 136, 0.06);
}

#suggestionsContent .suggestion-tip,
#suggestionsContentModal .suggestion-tip {
  border-left-color: var(--warning);
  background: rgba(255, 215, 0, 0.06);
}

#suggestionsContent .suggestion-info,
#suggestionsContentModal .suggestion-info {
  border-left-color: var(--text-muted);
  background: rgba(144, 144, 144, 0.08);
}

#suggestionsContent .suggestion-analyst-title,
#suggestionsContentModal .suggestion-analyst-title {
  font-weight: 700;
  font-size: 0.95rem;
  border-left-width: 4px;
  border-left-color: var(--accent);
  background: rgba(0, 255, 136, 0.08);
  margin-top: 1rem;
}

/* ========== FAB - bottom right green + ========== */
.fab {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #1A1C1D;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 255, 136, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.fab:hover {
  background: #00dd77;
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.5);
}

/* FAB menu - Przychód / Wydatek */
.fab-menu {
  position: fixed;
  bottom: 4.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  z-index: 49;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.fab-menu button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--bg-widget);
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
  white-space: nowrap;
  text-align: left;
}

.fab-menu button:hover {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent);
}

/* ========== Modals - dark theme ========== */
.modal-dark {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
  padding: 0;
  max-width: 96vw;
  width: 480px;
  margin: auto;
}

.modal-item {
  width: min(720px, 96vw);
  max-width: 960px;
}

.modal-dark::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

#itemModal form,
#suggestionsModal,
#calEventModal form,
#taskModal form {
  padding: 1.5rem;
}

#calEventModal form h3,
#taskModal form h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
}

#calEventModal,
#taskModal {
  min-width: min(520px, 96vw);
  max-width: min(640px, 98vw);
}

#calEventModal .modal-form-grid,
#taskModal .modal-form-grid {
  display: grid;
  gap: 0.75rem 1rem;
}

#calEventModal input,
#calEventModal textarea,
#taskModal input,
#taskModal select,
#taskModal textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.2rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

#itemModal .modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr;
  gap: 0 1.25rem;
  row-gap: 0.6rem;
  margin-top: 0.5rem;
}

#itemModal .modal-section-title {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(0, 255, 136, 0.85);
  margin: 1rem 0 0.15rem 0;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(0, 255, 136, 0.4);
}

#itemModal .modal-form-grid .modal-section-title:first-of-type {
  margin-top: 0;
}

#itemModal .modal-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.25rem;
}

#itemModal .modal-field-full {
  grid-column: 1 / -1;
}

#itemModal .modal-field-narrow {
  grid-column: span 1;
}

@media (max-width: 640px) {
  #itemModal .modal-form-grid {
    grid-template-columns: 1fr;
  }
  .modal-item {
    width: min(480px, 96vw);
  }
}

#itemModal .modal-label,
#itemModal .modal-label-inline {
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 0.2rem;
}

#itemModal .modal-field.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

#itemModal .modal-field.checkbox-label .modal-label-inline {
  margin-bottom: 0;
}

#itemModal .modal-form-grid .modal-field input[type="text"],
#itemModal .modal-form-grid .modal-field input[type="number"],
#itemModal .modal-form-grid .modal-field input[type="date"],
#itemModal .modal-form-grid .modal-field select {
  margin-top: 0.2rem;
}

#itemModal .modal-form-grid .recurring-options {
  margin-left: 0;
  margin-top: 0.25rem;
}

#itemModal .modal-form-grid .calculated {
  margin-top: 0.15rem;
  margin-bottom: 0.25rem;
}

#itemModal form h3,
#suggestionsModal h3 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: var(--text);
}

#itemModal #modalTitle.modal-title-income {
  color: var(--negative);
}

#itemModal #modalTitle.modal-title-expense {
  color: var(--accent);
}

#itemModal form label {
  display: block;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

#itemModal form input[type="text"],
#itemModal form input[type="number"],
#itemModal form input[type="date"],
#itemModal form input[type="month"],
#itemModal form select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: var(--font-mono);
  background: var(--bg-widget);
  color: var(--text);
}

#itemModal form input::placeholder {
  color: var(--text-muted);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
}

.checkbox-label input {
  width: auto;
  accent-color: var(--accent);
  border: 1px solid var(--text-muted);
  border-radius: 3px;
  background: var(--bg-widget);
}
.checkbox-label input:checked {
  background: var(--bg-widget);
}

.recurring-options,
.validity-options {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
}

.recurring-options.hidden,
.validity-options.hidden {
  display: none;
}

.calculated {
  margin: -0.25rem 0 0.75rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.field-error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--negative);
}

#deleteConfirmModal p {
  margin: 0 0 1rem 0;
  color: var(--text);
}

#deleteConfirmModal .modal-actions {
  margin-top: 0;
}

#btnDeleteConfirm {
  background: var(--negative);
  color: #fff;
}

#btnDeleteConfirm:hover {
  background: #e53e3e;
}

.modal-field {
  display: flex;
  flex-direction: column;
  margin-bottom: 0.25rem;
}

.modal-field-full { grid-column: 1 / -1; }

.modal-field input, .modal-field select, .modal-field textarea {
  margin-top: 0.2rem;
}

.modal-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-actions button {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}

#btnCancelModal {
  background: var(--bg-widget);
  color: var(--text);
  border: 1px solid var(--border);
}

.modal-actions button[type="submit"] {
  background: var(--accent);
  color: #1A1C1D;
}

.modal-actions button[type="submit"]:hover {
  background: #00dd77;
}

#btnCloseSuggestions {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--bg-widget);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
}

#btnCloseSuggestions:hover {
  background: var(--border);
}

.modal-switch-type {
  margin: 0;
}

.modal-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.modal-header-row h3 {
  margin: 0;
}

.btn-add-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #1A1C1D;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-add-type:hover {
  filter: brightness(1.08);
}

.btn-add-type:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-add-type .btn-add-type-icon {
  font-size: 1.1em;
  font-weight: 700;
  line-height: 1;
}

.hidden {
  display: none !important;
}

/* ===== Ekran logowania ===== */
.login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg, #0e1a0e);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.login-box {
  background: var(--bg-panel, #131f13);
  border: 1px solid var(--border, #2a3a2a);
  border-radius: 12px;
  padding: 2.5rem 2.8rem;
  width: min(380px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.login-logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent, #48bb78);
  text-align: center;
}
.login-subtitle {
  margin: -0.8rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #6b7280);
  text-align: center;
  letter-spacing: 0.04em;
}
.login-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.login-input {
  background: var(--bg-widget, #0a140a);
  border: 1px solid var(--border, #2a3a2a);
  border-radius: 6px;
  color: var(--text, #e2e8f0);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--accent, #48bb78); }
.login-btn {
  margin-top: 0.4rem;
  background: var(--accent, #48bb78);
  color: #0a180a;
  border: none;
  border-radius: 6px;
  padding: 0.65rem;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s;
}
.login-btn:hover:not(:disabled) { background: #5dd68a; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error {
  background: rgba(200,60,60,0.15);
  border: 1px solid rgba(200,60,60,0.35);
  color: #f08080;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
}
