.sort-field { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.board-tile {
  position: relative;
  height: 104px;
  border-radius: 8px;
  background: var(--surface);
}
.board-tile-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
}
.board-tile-color { flex: 1 1 auto; background-size: cover; background-position: center; }
.board-tile-link:hover .board-tile-color { filter: brightness(.88); }
.board-tile-sub { display: block; padding: 0 10px 8px; background: var(--surface); color: var(--muted); font-size: 11px; }
.board-tile-name {
  padding: 8px 10px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.star-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px 6px;
  border: none;
  border-radius: 4px;
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
}
/* Ohne diese Regel überschreibt button:hover aus app.css den dunklen Schleier. */
.star-btn:hover { background: rgba(0,0,0,.55); }
.board-tile:hover .star-btn,
.board-tile.is-starred .star-btn,
.star-btn:focus-visible { opacity: 1; }
.board-tile.is-starred .star-btn { color: var(--accent); }

.board-tile-new { background: rgba(255,255,255,.08); }
.board-new-btn {
  width: 100%;
  height: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-weight: 600;
}
.board-new-btn:hover { background: rgba(255,255,255,.14); }

.popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 35;
  width: 304px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  text-align: left;
}
.popover-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.popover-head h2 { font-size: 15px; margin: 0; }

.board-new-menu { display: flex; flex-direction: column; gap: 4px; width: 240px; }
.board-new-menu button { background: none; border: none; text-align: left; }
.board-new-menu button:hover { background: rgba(255,255,255,.1); }

.board-preview { height: 88px; border-radius: 6px; margin-bottom: 12px; }
.swatch-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
/* Die fünf Verläufe stehen in einer Reihe. */
#gradient-swatches { grid-template-columns: repeat(5, 1fr); }
.swatch { height: 32px; padding: 0; border: none; border-radius: 4px; }
.swatch[aria-pressed="true"] { outline: 2px solid #fff; outline-offset: 2px; }
.field-hint { margin: 4px 0 0; color: var(--danger); font-size: 12px; }

@media (max-width: 767px) {
  .boards-grid { grid-template-columns: 1fr; }
  .popover {
    position: fixed;
    top: 64px;
    left: 16px;
    right: 16px;
    width: auto;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
  }
}

/* Kachel-Menü */
.menu-btn {
  position: absolute;
  top: 6px;
  right: 34px;
  padding: 4px 6px;
  border: none;
  border-radius: 4px;
  background: rgba(0,0,0,.35);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
}
.menu-btn:hover { background: rgba(0,0,0,.55); }
.board-tile:hover .menu-btn,
.board-tile.is-menu-open .menu-btn,
.menu-btn:focus-visible { opacity: 1; }

.tile-menu { display: flex; flex-direction: column; gap: 4px; width: 260px; }
.tile-menu > button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  background: none;
  border: none;
  text-align: left;
}
.tile-menu > button:hover { background: rgba(255,255,255,.1); }
.menu-sub { color: var(--muted); font-size: 12px; font-weight: 400; }

.tile-move { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.tile-move select { width: 100%; }

.board-rename-input {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--accent);
  border-radius: 0 0 8px 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}
.board-tile.is-renaming .board-tile-name { visibility: hidden; }

/* Geschlossene Boards */
.closed-boards { margin-top: 24px; }
.closed-toggle {
  padding: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
}
.closed-toggle:hover { color: var(--text); }
.closed-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.closed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.closed-name { font-weight: 600; }
.closed-date { flex: 1 1 auto; color: var(--muted); font-size: 12px; }

/* Sichtbarkeits-Dialog */
.visibility-dialog .visibility-choice {
  display: flex;
  gap: 16px;
  margin: 0 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.visibility-dialog .visibility-choice legend { padding: 0 4px; }
.visibility-dialog .visibility-choice label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
}
.board-member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}
.board-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.board-member-info { display: flex; flex-direction: column; min-width: 0; }
.board-member-info strong { font-size: 14px; }
.board-member-row .danger { margin-left: auto; flex: 0 0 auto; }

@media (max-width: 767px) {
  .menu-btn { opacity: 1; }
  .tile-menu { width: auto; }
  .closed-item { flex-wrap: wrap; }
  .closed-date { flex: 1 1 100%; }
  .board-member-row { flex-wrap: wrap; }
}

.board-tile .unread-dot { position: absolute; top: 10px; left: 10px; width: 12px; height: 12px; border: 2px solid rgba(0,0,0,.45); z-index: 2; }

/* Betrachter legen keine Boards an und verwalten keine */
body[data-team-role="viewer"] #board-new-tile, body[data-team-role="viewer"] .board-tile .menu-btn { display: none !important; }

/* Vorlagen-Leiste rechts (wie der Vorlagenbereich in Word): Boards links, Vorlagen kompakt untereinander */
.boards-layout { display: flex; align-items: flex-start; gap: 24px; }
.boards-col { flex: 1 1 auto; min-width: 0; }
.templates-rail {
  flex: 0 0 240px;
  position: sticky;
  top: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.templates-rail h2 { margin: 0 0 12px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.templates-list { display: flex; flex-direction: column; gap: 6px; }
.templates-rail .board-tile { height: 40px; }
.templates-rail .board-tile-link { flex-direction: row; align-items: center; }
.templates-rail .board-tile-color { flex: 0 0 28px; height: 28px; margin-left: 6px; border-radius: 5px; }
.templates-rail .board-tile-name { flex: 1 1 auto; padding: 0 64px 0 10px; background: none; font-size: 13px; }
.templates-rail .board-tile-link:hover { background: rgba(255,255,255,.06); }
.templates-rail .unread-dot { display: none; }
.templates-rail .star-btn, .templates-rail .menu-btn { top: 50%; transform: translateY(-50%); }
.templates-rail .tile-menu { left: auto; right: 0; }
.templates-empty { font-size: 13px; }

@media (max-width: 1023px) {
  .boards-layout { flex-direction: column; align-items: stretch; }
  .templates-rail { position: static; flex-basis: auto; width: 100%; padding: 16px 0 0; border-left: none; border-top: 1px solid var(--border); }
}
.templates-add {
  width: 100%;
  margin-top: 10px;
  padding: 9px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.templates-add:hover { border-color: var(--accent); color: var(--text); background: rgba(255,255,255,.04); }
body[data-team-role="viewer"] .templates-add { display: none; }
.tile-menu .danger-text { color: var(--danger); }

/* Unterboards in der Übersicht: aufklappbar, ziehbar, Ablage oben für „oberste Ebene“ */
.board-tile-sub { cursor: pointer; }
.board-tile-sub:hover { color: var(--text, #fff); }
.board-tile-in { display: block; padding: 0 10px 8px; background: var(--surface); color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-tile.is-child { outline: 2px dashed rgba(255,255,255,.18); outline-offset: -2px; }
.board-tile[draggable="true"] { cursor: grab; }
.board-tile.is-drop { outline: 3px solid var(--accent, #579dff); outline-offset: -3px; }
.drop-top { margin: 0 0 12px; padding: 10px 12px; border: 2px dashed var(--border); border-radius: 8px; color: var(--muted); text-align: center; font-size: 13px; }
.drop-top[hidden] { display: none; }
.drop-top.is-drop { border-color: var(--accent, #579dff); color: #fff; }
