/* Platinum Tasks — design tokens + components
 * Colors / spacing match the studio redesign (task 19).
 */

/* -------------------------------------------------------------------------- */
/* Fonts (self-hosted, SIL Open Font License)                                  */
/* -------------------------------------------------------------------------- */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/manrope-latin-600.d291d41d2872.woff2") format("woff2");
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/manrope-latin-700.5d0c39c84f7b.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-400.f837d382a885.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-latin-500.42b95430773b.woff2") format("woff2");
}

/* -------------------------------------------------------------------------- */
/* Design tokens                                                               */
/* -------------------------------------------------------------------------- */

:root {
  --color-bg: #f7f9f9;
  --color-surface: #ffffff;
  --color-primary: #0f88a1;
  --color-primary-hover: #0c6c80;
  --color-accent: #e8735a;
  --color-text: #1c2b2e;
  --color-text-muted: #5c6b6e;
  --color-success: #3fa679;
  --color-border: #e4eaea;
  --color-danger: #b42318;
  --color-overlay: rgba(28, 43, 46, 0.4);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --radius-card: 16px;
  --radius-pill: 999px;
  --radius-control: 12px;

  --shadow-card: 0 2px 8px rgba(15, 45, 50, 0.08);

  --font-heading: "Manrope", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --topbar-height: 56px;
  --drawer-width: min(320px, 88vw);
}

/* -------------------------------------------------------------------------- */
/* Base / reset                                                                */
/* -------------------------------------------------------------------------- */

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  min-height: 100vh;
  /* Suppress Android Chrome's unreliable native pull-to-refresh so the
     custom gesture (pull-to-refresh.js) is the single consistent behavior. */
  overscroll-behavior-y: contain;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.25;
}

h2 {
  margin: 0 0 var(--space-1);
  font-size: 1.35rem;
}

h3 {
  margin: 0 0 var(--space-3);
  font-size: 1.05rem;
  font-weight: 600;
}

h4 {
  margin: 0 0 var(--space-2);
  font-size: 1rem;
  font-weight: 600;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
}

body.is-authenticated main {
  padding-top: var(--space-5);
}

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

a:hover {
  color: var(--color-primary-hover);
}

.subheading {
  margin: 0 0 var(--space-5);
  color: var(--color-text-muted);
}

.note {
  color: var(--color-text-muted);
  margin: var(--space-2) 0 0;
}

/* -------------------------------------------------------------------------- */
/* Top bar + off-canvas nav                                                    */
/* -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--topbar-height);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.topbar--public {
  justify-content: flex-start;
}

.topbar__brand {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text);
  flex-shrink: 0;
}

.topbar__user {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.topbar__bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-control);
  color: var(--color-text);
  text-decoration: none;
}

.topbar__bell:hover,
.topbar__bell:focus-visible {
  background: var(--color-bg);
  outline: none;
}

.topbar__bell:focus-visible {
  box-shadow: 0 0 0 2px var(--color-primary);
}

.topbar__bell-icon {
  display: block;
  width: 22px;
  height: 22px;
}

.topbar__bell-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.1rem;
  text-align: center;
}

.topbar__menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.topbar__menu-btn:hover,
.topbar__menu-btn:focus-visible {
  background: var(--color-bg);
  outline: none;
}

.topbar__menu-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--color-primary);
}

.topbar__menu-icon {
  display: block;
  width: 22px;
  height: 16px;
}

.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--color-overlay);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  width: var(--drawer-width);
  height: 100%;
  margin: 0;
  padding: var(--space-6) var(--space-5);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.nav-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.nav-drawer__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.nav-drawer__user {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-control);
  background: var(--color-bg);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.4;
}

.nav-drawer__nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.nav-drawer__link {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-control);
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
}

.nav-drawer__link:hover,
.nav-drawer__link:focus-visible {
  background: var(--color-bg);
  color: var(--color-primary);
  outline: none;
}

.nav-drawer__language {
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.nav-drawer__language-label {
  margin: 0 0 var(--space-2);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nav-drawer__logout {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.nav-drawer__logout button {
  width: 100%;
}

body.nav-open {
  overflow: hidden;
}

/* -------------------------------------------------------------------------- */
/* Cards / surfaces                                                            */
/* -------------------------------------------------------------------------- */

.card,
.task-card,
.create-form,
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: none;
  padding: var(--space-4);
}

.create-form {
  margin-bottom: var(--space-5);
}

.create-form h3 {
  margin-top: 0;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.task-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.task-actions {
  margin-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.inline-form {
  display: inline;
}

/* -------------------------------------------------------------------------- */
/* Badges (status / priority pills)                                            */
/* -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.badge--status-offen {
  background: #eef1f1;
  color: var(--color-text-muted);
}

.badge--status-in_arbeit {
  background: rgba(15, 136, 161, 0.12);
  color: var(--color-primary-hover);
}

.badge--status-erledigt {
  background: rgba(63, 166, 121, 0.15);
  color: var(--color-success);
}

.badge--priority-niedrig,
.badge--priority-mittel {
  background: #eef1f1;
  color: var(--color-text-muted);
}

.badge--priority-hoch {
  background: rgba(232, 115, 90, 0.16);
  color: var(--color-accent);
}

/* -------------------------------------------------------------------------- */
/* Counts + filter chips                                                       */
/* -------------------------------------------------------------------------- */

.counts {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0 0 var(--space-4);
}

.counts span {
  background: var(--color-surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card);
  padding: var(--space-2) var(--space-3);
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.chips a {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  text-decoration: none;
  color: var(--color-text-muted);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  font-size: 0.9rem;
  font-weight: 500;
}

.chips a:hover {
  color: var(--color-primary);
}

.chips a.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: none;
}

.chips a.active:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

/* -------------------------------------------------------------------------- */
/* Übersicht tabs                                                              */
/* -------------------------------------------------------------------------- */

.tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
}

.tabs__btn {
  padding: var(--space-2) var(--space-3);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.tabs__btn:hover {
  color: var(--color-primary);
}

.tabs__btn.is-active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: none;
}

.tabs__btn.is-active:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

.tabs__panel {
  display: none;
}

.tabs__panel.is-active {
  display: block;
}

/* -------------------------------------------------------------------------- */
/* Forms / buttons                                                             */
/* -------------------------------------------------------------------------- */

form p {
  margin: 0 0 var(--space-4);
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="username"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: var(--space-3) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-control);
  font: inherit;
  color: var(--color-text);
  background: var(--color-surface);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(15, 136, 161, 0.2);
}

button,
.button {
  display: inline-block;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

button:hover,
.button:hover {
  background: var(--color-primary-hover);
  color: #fff;
}

button.secondary,
a.button.secondary {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: inset 0 0 0 1px var(--color-border);
}

button.secondary:hover,
a.button.secondary:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

button.danger {
  background: var(--color-danger);
}

button.danger:hover {
  background: #912018;
  color: #fff;
}

.errorlist {
  margin: 0 0 var(--space-2);
  padding: 0;
  list-style: none;
  color: var(--color-danger);
  font-size: 0.9rem;
}

.auth-links {
  margin-top: var(--space-5);
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.auth-links a {
  color: var(--color-primary);
  font-weight: 500;
}

/* `.auth-links a` is more specific than `.button`, so it was forcing primary-colored
   text onto primary-colored pill buttons (invisible until :hover). */
.auth-links a.button {
  color: #fff;
}

.auth-links a.button:hover {
  color: #fff;
  background: var(--color-primary-hover);
}

.language-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.language-switcher--auth {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  justify-content: center;
}

.language-switcher__btn {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.4;
}

.language-switcher__btn:hover,
.language-switcher__btn:focus-visible {
  border-color: var(--color-primary);
  color: var(--color-primary);
  outline: none;
}

.language-switcher__btn.is-active {
  border-color: var(--color-primary);
  background: rgba(15, 136, 161, 0.1);
  color: var(--color-primary);
}

.messages {
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.messages li {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-2);
}

.page-section-title {
  margin: var(--space-5) 0 var(--space-3);
  font-size: 1.05rem;
  font-weight: 600;
}

/* -------------------------------------------------------------------------- */
/* PWA / push banners                                                          */
/* -------------------------------------------------------------------------- */

.install-banner {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  margin: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 8px rgba(15, 45, 50, 0.08);
  font-size: 0.9rem;
}

/* Author `display: flex` otherwise overrides the UA [hidden] { display: none }. */
.install-banner[hidden] {
  display: none !important;
}

.install-banner__body {
  flex: 1;
}

.install-banner__body p {
  margin: 0 0 var(--space-2);
  color: var(--color-text-muted);
}

.install-banner__body p:last-child {
  margin-bottom: 0;
}

.install-banner__action {
  background: var(--color-primary);
}

.install-banner__dismiss {
  flex-shrink: 0;
  padding: var(--space-1) var(--space-2);
  background: transparent;
  color: var(--color-text-muted);
  box-shadow: inset 0 0 0 1px var(--color-border);
  font-size: 1.1rem;
  line-height: 1;
  border-radius: var(--radius-control);
}

.push-denied-note {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.push-denied-note[hidden] {
  display: none !important;
}

/* -------------------------------------------------------------------------- */
/* In-app notifications                                                        */
/* -------------------------------------------------------------------------- */

.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.notification-item {
  margin: 0;
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.notification-item--unread {
  box-shadow: var(--shadow-card), inset 3px 0 0 var(--color-primary);
}

.notification-item__body {
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}

.notification-item__meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* -------------------------------------------------------------------------- */
/* Pull-to-refresh indicator (pull-to-refresh.js)                              */
/* -------------------------------------------------------------------------- */

.ptr-indicator {
  position: fixed;
  top: calc(var(--topbar-height) - 40px);
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  color: var(--color-primary);
  opacity: 0;
  transform: translateX(-50%) translateY(0);
  pointer-events: none;
}

.ptr-indicator__icon {
  width: 22px;
  height: 22px;
}

.ptr-indicator.is-ready {
  color: var(--color-primary-hover);
}

.ptr-indicator.is-spinning .ptr-indicator__icon {
  animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* -------------------------------------------------------------------------- */
/* Dashboard charts                                                            */
/* -------------------------------------------------------------------------- */

.dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.dashboard-grid--simple {
  max-width: 22rem;
}

.dashboard-card h3 {
  margin: 0 0 var(--space-4);
}

.dashboard-chart {
  position: relative;
  height: 220px;
  width: 100%;
}

.dashboard-chart--tall {
  height: 280px;
}

.dashboard-empty .note {
  margin: 0;
}

.kpi-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
}

.kpi-card {
  padding: var(--space-4);
}

.kpi-card__label {
  margin: 0 0 var(--space-2);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.kpi-card__value {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-text);
}

@media (min-width: 720px) {
  .dashboard-grid:not(.dashboard-grid--simple) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }

  .dashboard-card--wide {
    grid-column: 1 / -1;
  }

  .dashboard-chart--tall {
    height: 320px;
  }

  .kpi-strip {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
  }
}
