:root {
  --bg: #0f1117;
  --bg-elevated: #161b26;
  --bg-card: #1a2130;
  --border: #2a3344;
  --text: #e8ecf4;
  --text-muted: #8b95a8;
  --accent: #6c9eff;
  --accent-soft: rgba(108, 158, 255, 0.15);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --cat-praca: #6c9eff;
  --cat-obowiazki: #a78bfa;
  --cat-trening: #34d399;
  --cat-wazne: #fb7185;
  --cat-notatki: #fbbf24;
}

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

a {
  color: var(--accent);
}

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .sidebar {
    display: none;
  }

  .main-area {
    padding-bottom: 4.5rem;
  }
}

.header {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
}

.header__title {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.header__month {
  color: var(--text-muted);
  font-weight: 500;
}

.header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.header__views {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid var(--border);
}

.header__views button {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header__views button.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-weight: 500;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--bg-elevated);
  border-color: #3d4a63;
}

.btn--primary {
  background: var(--accent-soft);
  border-color: rgba(108, 158, 255, 0.35);
  color: var(--accent);
}

.btn--primary:hover {
  background: rgba(108, 158, 255, 0.25);
}

.btn--ghost {
  background: transparent;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
}

.sidebar__brand {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.5rem 0.5rem;
}

.sidebar__item {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sidebar__item:hover {
  color: var(--text);
  background: var(--bg-card);
}

.sidebar__item.is-active {
  color: var(--text);
  background: var(--accent-soft);
  font-weight: 600;
}

.main-area {
  padding: 1rem 1.25rem 2rem;
  overflow-x: hidden;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.card__title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.muted {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.calendar-wrap {
  margin-bottom: 1rem;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar__dow {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.35rem 0;
}

.calendar__cell {
  aspect-ratio: 1;
  min-height: 72px;
  max-height: 110px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.calendar__cell:hover {
  border-color: #3d4a63;
}

.calendar__cell.is-out {
  opacity: 0.35;
}

.calendar__cell.is-today {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(108, 158, 255, 0.25);
}

.calendar__cell.is-selected {
  background: var(--accent-soft);
}

.calendar__num {
  font-weight: 600;
  font-size: 0.85rem;
}

.calendar__dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
  align-items: center;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cat-praca);
}

.dot--train {
  background: var(--cat-trening);
  border-radius: 2px;
  width: 8px;
  height: 8px;
}

.mood-chip {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.thumb {
  width: 100%;
  max-height: 36px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 4px;
}

.badge-count {
  font-size: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 5px;
  min-width: 18px;
  text-align: center;
  color: var(--text-muted);
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}

.week-strip button {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.4rem;
  background: var(--bg-card);
}

.week-strip button.is-today {
  border-color: var(--accent);
}

.week-strip button.is-selected {
  background: var(--accent-soft);
}

.day-hero {
  margin-bottom: 1rem;
}

.day-hero h2 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

table.data th,
table.data td {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.35rem;
  text-align: left;
}

table.data th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table.data input,
table.data select {
  width: 100%;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.row-actions {
  display: flex;
  gap: 0.25rem;
}

.icon-btn {
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

.icon-btn:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.12);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.check-row:last-child {
  border-bottom: none;
}

.priority {
  font-size: 0.65rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.priority--niski {
  background: #334155;
  color: #94a3b8;
}
.priority--sredni {
  background: rgba(96, 165, 250, 0.2);
  color: #93c5fd;
}
.priority--wazny {
  background: rgba(251, 191, 36, 0.2);
  color: #fcd34d;
}
.priority--pilny {
  background: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}

.mood-emoji-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.mood-emoji-row button {
  font-size: 1.5rem;
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  background: var(--bg);
}

.mood-emoji-row button.is-on {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.slider-grid {
  display: grid;
  gap: 0.65rem;
}

.slider-grid label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.photo-block img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  margin-top: 0.5rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.gallery__item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  text-align: left;
  padding: 0;
}

.gallery__item img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

.gallery__cap {
  padding: 0.35rem 0.5rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.stat__val {
  font-size: 1.35rem;
  font-weight: 700;
}

.stat__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.empty-hint {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

textarea.notes {
  width: 100%;
  min-height: 120px;
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  resize: vertical;
}

.mobile-nav {
  display: none;
}

@media (max-width: 900px) {
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    padding: 0.4rem 0.5rem;
    gap: 0.25rem;
    overflow-x: auto;
    z-index: 20;
    justify-content: flex-start;
  }

  .mobile-nav button {
    flex: 0 0 auto;
    padding: 0.45rem 0.55rem;
    font-size: 0.7rem;
    border-radius: 8px;
    color: var(--text-muted);
    white-space: nowrap;
  }

  .mobile-nav button.is-active {
    background: var(--accent-soft);
    color: var(--accent);
  }
}
