:root {
  --c-bg: #f4f5f3;
  --c-surface: #ffffff;
  --c-text: #1c1e1c;
  --c-muted: #6b7168;
  --c-border: #e3e5e0;

  --c-kristijan: #378adb;
  --c-kristijan-am: #f4b400;
  --c-kristijan-pm: #378adb;
  --c-kaja: #d4537e;
  --c-skupno: #2e9e5b;
  --c-savings: #1f6f54;

  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2 { margin: 0 0 .5rem; }
h1 { font-size: 1.1rem; }
h2 { font-size: 1rem; }

.muted { color: var(--c-muted); font-size: .9rem; }

button { font: inherit; }

/* --- prijava --- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--c-surface);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
  text-align: center;
}

.login-form { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }

.user-picker { display: flex; gap: .75rem; }

.user-option {
  flex: 1;
  position: relative;
  border: 2px solid var(--c-border);
  border-radius: 14px;
  padding: 1rem .5rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-option input { position: absolute; opacity: 0; }

.user-option:has(input:checked) {
  border-color: var(--user-color);
  background: color-mix(in srgb, var(--user-color) 12%, white);
  color: var(--user-color);
}

.login-form input[type="password"] {
  padding: .85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--c-border);
  font-size: 1rem;
}

.login-form button {
  padding: .85rem 1rem;
  border-radius: 12px;
  border: none;
  background: var(--c-savings);
  color: white;
  font-weight: 600;
  font-size: 1rem;
}

.error { color: #c0392b; font-size: .9rem; }

/* --- lupina aplikacije --- */

.app-shell {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}

.icon-btn {
  border: none;
  background: transparent;
  font-size: 1.3rem;
  line-height: 1;
  padding: .25rem .5rem;
  border-radius: 8px;
  cursor: pointer;
}

.icon-btn:active { background: var(--c-border); }

.content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem;
  padding-bottom: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--c-surface);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.goal { margin-top: .75rem; }
.goal:first-child { margin-top: 0; }

.goal-label {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  margin-bottom: .35rem;
}

.progress {
  background: var(--c-border);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.progress-bar {
  background: var(--c-savings);
  height: 100%;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.quick-card {
  background: var(--c-surface);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  text-decoration: none;
  color: var(--c-text);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.quick-count { font-size: 1.5rem; font-weight: 700; }

/* --- plavajoči "+" --- */

.fab {
  position: absolute;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  border: none;
  background: var(--c-savings);
  color: white;
  font-size: 1.75rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
  cursor: pointer;
}

/* --- overlay / meni / bottom-sheet (brez position:fixed) --- */

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 10;
}

.overlay.hidden { display: none; }

.menu-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 78%;
  max-width: 300px;
  background: var(--c-surface);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: .25rem;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}

.menu-user {
  font-weight: 700;
  color: var(--user-color, var(--c-text));
}

.menu-panel a {
  padding: .75rem .5rem;
  border-radius: 10px;
  color: var(--c-text);
  text-decoration: none;
  font-weight: 500;
}

.menu-panel a:active { background: var(--c-bg); }

.menu-logout { margin-top: auto; }

.menu-logout button {
  width: 100%;
  padding: .75rem;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  background: transparent;
  color: #c0392b;
  font-weight: 600;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--c-surface);
  border-radius: 20px 20px 0 0;
  padding: .75rem 1rem 1.5rem;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--c-border);
  margin: 0 auto .75rem;
}

.sheet-options {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: .75rem;
}

.sheet-option {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem .75rem;
  border-radius: 12px;
  border: 1px solid var(--c-border);
  background: transparent;
  text-align: left;
  font-size: 1rem;
  cursor: pointer;
}

.sheet-option:active { background: var(--c-bg); }

.sheet-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg);
  font-size: 1rem;
}

.sheet-icon--savings { background: color-mix(in srgb, var(--c-savings) 20%, white); }
.sheet-icon--todo { background: color-mix(in srgb, var(--c-skupno) 20%, white); }
.sheet-icon--event { background: color-mix(in srgb, var(--c-kristijan) 20%, white); }
.sheet-icon--shopping { background: color-mix(in srgb, var(--c-kristijan-am) 30%, white); }
.sheet-icon--bucket { background: color-mix(in srgb, var(--c-kaja) 20%, white); }

.sheet-option { text-decoration: none; color: var(--c-text); }

/* --- obrazci: opravila / nakupi --- */

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.inline-form input[type="text"],
.inline-form input[type="date"],
.inline-form select {
  flex: 1;
  min-width: 8rem;
  padding: .65rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  font-size: .95rem;
  background: var(--c-surface);
}

.inline-form .qty-input { flex: 0 0 6rem; min-width: 5rem; }

.inline-form button {
  padding: .65rem 1rem;
  border-radius: 10px;
  border: none;
  background: var(--c-savings);
  color: white;
  font-weight: 600;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.chip-form { display: contents; }

.chip {
  padding: .5rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  font-size: .9rem;
  cursor: pointer;
}

.chip:active { background: var(--c-bg); }

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.check-list li {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.check-form { display: contents; }

.check-btn {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 2px solid var(--c-border);
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
}

.check-btn--done {
  border-color: var(--c-savings);
  background: var(--c-savings);
  color: white;
  font-size: .85rem;
  line-height: 1;
}

.check-label { font-size: .95rem; }
.check-label--done { text-decoration: line-through; color: var(--c-muted); }

.badge {
  display: inline-block;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 700;
  color: white;
  margin-right: .35rem;
}

.badge--kristijan { background: var(--c-kristijan); }
.badge--kaja { background: var(--c-kaja); }
.badge--skupno { background: var(--c-skupno); }

.stack-form {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.stack-form select,
.stack-form input[type="text"] {
  padding: .65rem .75rem;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  font-size: .95rem;
  background: var(--c-surface);
}

.stack-form button {
  padding: .65rem 1rem;
  border-radius: 10px;
  border: none;
  background: var(--c-savings);
  color: white;
  font-weight: 600;
  align-self: flex-start;
}

.card-link { color: inherit; text-decoration: none; }
.card-link:active { opacity: .7; }

.segmented {
  display: flex;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.segmented-item {
  flex: 1;
  text-align: center;
  padding: .55rem .5rem;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--c-muted);
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}

.segmented-item.is-active {
  background: var(--active-color, var(--c-savings));
  color: white;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.free-time-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1rem;
  border-radius: 14px;
  background: color-mix(in srgb, var(--c-savings) 12%, white);
  color: var(--c-savings);
  text-decoration: none;
  font-weight: 600;
  font-size: .92rem;
}

.free-time-link:active { background: color-mix(in srgb, var(--c-savings) 22%, white); }

.free-time-icon { font-size: 1rem; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
}

.agenda-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.agenda-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding-left: .75rem;
  border-left: 4px solid var(--event-color, var(--c-skupno));
}

.agenda-time {
  font-size: .85rem;
  color: var(--c-muted);
  min-width: 4.5rem;
  flex-shrink: 0;
}

.agenda-body { flex: 1; font-size: .95rem; }

.agenda-delete button {
  border: none;
  background: transparent;
  color: var(--c-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: .25rem .5rem;
}

.agenda-list--compact .agenda-time { min-width: 3.5rem; font-size: .8rem; }

.free-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.free-list li {
  padding: .4rem .85rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--c-savings) 15%, white);
  color: var(--c-savings);
  font-weight: 600;
  font-size: .9rem;
}

.mini-list {
  list-style: none;
  margin: .75rem 0 0;
  padding-top: .75rem;
  border-top: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  gap: .4rem;
  font-size: .9rem;
}
