:root{
  --bg:#f8fafc;
  --card:#ffffff;
  --line:#e2e8f0;
  --text:#0f172a;
  --muted:#64748b;
  --primary:#2563eb;
  --primary2:#1d4ed8;
  --ring:rgba(37,99,235,.18);
  --success:#16a34a;
  --danger:#dc2626;
}

/* Reset */
*{box-sizing:border-box}
body{
  margin:0;
  font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Arial;
  background:var(--bg);
  color:var(--text);
}
a{color:var(--primary); text-decoration:none;}
a:hover{color:var(--primary2);}

/* Layout */
.container{
  max-width:1100px;
  margin:0 auto;
  padding:24px;
}

.topbar{
  background:#fff;
  border-bottom:1px solid var(--line);
}
.topbar .container{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
}
.logo{
  width:40px;
  height:40px;
  border-radius:16px;
  background:var(--primary);
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:900;
  box-shadow:0 8px 20px rgba(37,99,235,.25);
}

/* Cards */
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:0 10px 30px rgba(15,23,42,.06);
}
.card.pad{ padding:20px; }

/* Typography */
h1{font-size:22px;margin:0 0 8px 0}
.muted{color:var(--muted); font-size:13px}
.label{
  font-weight:700;
  font-size:12px;
  color:var(--muted);
  margin-bottom:6px;
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 16px;
  border-radius:14px;
  border:1px solid transparent;
  font-weight:700;
  cursor:pointer;
  transition:.15s;
}
.btn.primary{
  background:var(--primary);
  color:#fff;
}
.btn.primary:hover{
  background:var(--primary2);
}
.btn.secondary{
  background:#fff;
  border-color:var(--line);
}
.btn.secondary:hover{
  background:#f1f5f9;
}
.btn.small{
  padding:6px 10px;
  border-radius:10px;
  font-size:12px;
}

/* Inputs */
.input{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--line);
  background:#fff;
  outline:none;
  transition:.15s;
}
.input:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 6px var(--ring);
}

/* Grid */
.row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}
@media (max-width:900px){
  .row{grid-template-columns:1fr;}
}

/* Tables */
.tablewrap{
  overflow:auto;
  border-radius:18px;
}
table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
th, td{
  padding:14px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:top;
}
th{
  font-size:12px;
  color:var(--muted);
  background:#fff;
  position:sticky;
  top:0;
}
tr:hover td{
  background:#f8fafc;
}

/* Status Badges */
.badge{
  display:inline-flex;
  padding:4px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:700;
  border:1px solid;
}
.badge.open{
  background:#fef3c7;
  border-color:#fcd34d;
  color:#92400e;
}
.badge.done{
  background:#dcfce7;
  border-color:#86efac;
  color:#166534;
}

/* Progress Bar */
.progress{
  height:10px;
  background:#e2e8f0;
  border-radius:999px;
  overflow:hidden;
}
.progress-bar{
  height:10px;
  background:var(--primary);
}

/* Small helpers */
.space{height:16px;}
.flex{display:flex; gap:10px; align-items:center; flex-wrap:wrap;}
/* Task cards (Today) */
.tasklist{display:flex; flex-direction:column; gap:14px;}

.task{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:0 10px 30px rgba(15,23,42,.06);
  padding:16px;
}

.task-top{display:flex; justify-content:space-between; gap:14px; flex-wrap:wrap;}
.task-title{font-weight:900; font-size:16px;}
.task-sub{margin-top:4px; color:var(--muted); font-size:12px; word-break:break-all;}

.task-meta{display:flex; gap:10px; flex-wrap:wrap; margin-top:12px;}
.kv{font-size:12px; color:var(--muted);}
.kv b{color:var(--text);}

.task-actions{margin-top:14px; display:flex; flex-direction:column; gap:10px;}

.task-actions form{
  display:flex;
  gap:10px;
  align-items:center;
  margin:0;
}

.task-actions .input{
  flex:1;
  min-width: 0;       /* wichtig: verhindert unnötiges umbrechen */
}

.task-actions .btn{
  white-space:nowrap; /* Button bleibt kompakt */
}

/* Auf sehr schmalen Screens darf es umbrechen */
@media (max-width: 520px){
  .task-actions form{flex-direction:column; align-items:stretch;}
  .task-actions .btn{width:100%;}
}

/* Collapsible details */
details summary{
  cursor:pointer;
  font-weight:800;
  color:var(--primary);
  list-style:none;
}
details summary::-webkit-details-marker{display:none;}
.details-box{
  margin-top:10px;
  padding:12px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
}
.header-left{display:flex;align-items:center;gap:12px;}
.header-title{font-weight:900;}
.header-sub{font-size:12px;color:var(--muted);margin-top:2px;}

.header-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:nowrap; /* wichtig: erstmal nicht umbrechen */
}

.nav-group{display:flex;gap:10px;align-items:center;}
.nav-group .btn{padding:10px 14px;}

.btn.ghost{
  background:transparent;
  border-color:var(--line);
  color:var(--text);
}
.btn.ghost:hover{background:#f1f5f9}

/* Wenn es zu eng wird, umbrechen wir sauber in 2 Reihen */
@media (max-width: 860px){
  .topbar .container{align-items:flex-start;}
  .header-right{flex-wrap:wrap;justify-content:flex-end;}
}
.linkcell{
  display:flex;
  align-items:center;
  gap:8px;
  max-width: 420px;   /* optional: begrenzt die gesamte Zelle */
}

.linkpill{
  display:block;
  flex: 1 1 auto;     /* darf schrumpfen */
  min-width: 0;       /* WICHTIG: erlaubt ellipsis in flex */
  max-width: 320px;   /* oder z.B. 360px */
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  font-size:12px;

  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}