* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
}

a {
  color: inherit;
}

/* Auth pages */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.auth-card h1 {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 600;
}

.hint {
  font-size: 13px;
  color: #64748b;
  margin: -12px 0 20px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form label span {
  font-size: 14px;
  font-weight: 500;
  color: #334155;
}

.form input {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
}

.form input:focus {
  border-color: #64748b;
}

.error {
  color: #dc2626;
  font-size: 14px;
  margin: 0;
}

.success {
  color: #15803d;
  font-size: 14px;
  margin: 0;
}

.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: #0f172a;
  color: #fff;
  margin-top: 8px;
}

.btn-primary:hover {
  background: #334155;
}

.btn-light {
  background: #f1f5f9;
  color: #334155;
}

.btn-light:hover {
  background: #e2e8f0;
}

.btn-dark {
  background: #0f172a;
  color: #fff;
}

.btn-dark:hover {
  background: #334155;
}

.btn.active {
  background: #2563eb;
  color: #fff;
}

.btn.notify-off {
  background: #fef3c7;
  color: #92400e;
}

.btn.notify-off:hover {
  background: #fde68a;
}

/* Admin page */

.admin-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-header h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.link {
  font-size: 14px;
  text-decoration: underline;
  color: #475569;
}

.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px;
}

.card h2 {
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  margin: 0 0 16px;
}

.form-row {
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
  min-width: 160px;
}

.section-title {
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  margin: 0 0 12px;
}

.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.user-list li {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  font-size: 14px;
  border-top: 1px solid #e2e8f0;
}

.user-list li:first-child {
  border-top: none;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.reset-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reset-form input {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  outline: none;
  width: 160px;
}

.btn-small {
  padding: 4px 10px;
  font-size: 13px;
}

.user-name {
  font-weight: 500;
}

.user-email {
  margin-left: 8px;
  color: #64748b;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}

.user-date {
  font-size: 12px;
  color: #94a3b8;
}

/* Board */

.board-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

.board-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  padding: 12px 16px;
}

.board-header h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.board-header .hint {
  margin: 4px 0 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  font-size: 14px;
  color: #475569;
}

.tab-nav {
  display: flex;
  gap: 4px;
  padding: 8px 16px 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.tab-link {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.tab-link:hover {
  color: #0f172a;
}

.tab-link-active {
  color: #0f172a;
  border-bottom-color: #2563eb;
}

.error-banner {
  border-bottom: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
  padding: 8px 16px;
}

.canvas-viewport {
  position: relative;
  flex: 1;
  overflow: auto;
  background-image: radial-gradient(circle, #e2e8f0 1px, transparent 1px);
  background-size: 24px 24px;
}

.canvas {
  position: relative;
  width: 3000px;
  height: 2000px;
}

.square {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  user-select: none;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: grab;
  border-style: solid;
}

.square.connect-mode {
  cursor: pointer;
}

.square.dragging {
  cursor: grabbing;
}

.square.connect-source {
  outline: 4px solid #60a5fa;
}

.square textarea {
  flex: 1;
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.35;
  padding: 0;
}

.square-text {
  font-size: 14px;
  line-height: 1.35;
  overflow: hidden;
  margin: 0;
  word-break: break-word;
}

.square-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #475569;
  gap: 4px;
}

.square-author {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.square-image-wrap {
  position: relative;
  flex-shrink: 0;
  width: calc(100% + 16px);
  height: 72px;
  margin: -8px -8px 6px;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: #e2e8f0;
}

.square.size-small .square-image-wrap {
  height: 44px;
}

.square.size-large .square-image-wrap {
  height: 160px;
}

.square.size-small .square-text {
  font-size: 12px;
}

.square.size-large .square-text {
  font-size: 16px;
}

.square-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.square-image:hover {
  filter: brightness(0.92);
}

.image-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 1000;
  cursor: zoom-out;
}

.image-lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  cursor: default;
}

.remove-image-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.85);
  color: #64748b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
}

.remove-image-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}

.image-input-hidden {
  display: none;
}

.image-btn {
  border: none;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  color: #334155;
  flex-shrink: 0;
}

.image-btn:hover {
  filter: brightness(0.95);
}

.size-btn {
  border: none;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: #334155;
  flex-shrink: 0;
}

.size-btn:hover {
  filter: brightness(0.95);
}

.vote-btn {
  border: none;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  color: #334155;
  flex-shrink: 0;
}

.vote-btn:hover {
  filter: brightness(0.95);
}

.vote-btn.voted {
  background: #2563eb;
  color: #fff;
}

.delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: #fff;
  color: #64748b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}

.delete-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}

.creating-box {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 2px solid #60a5fa;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.creating-box textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
}

.creating-image-input {
  width: 100%;
  max-width: 100%;
  font-size: 11px;
}

.creating-size-row {
  display: flex;
  gap: 4px;
}

.creating-size-btn {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 4px;
  font-size: 11px;
  cursor: pointer;
  background: #fff;
  color: #334155;
}

.creating-size-btn:hover {
  background: #f1f5f9;
}

.creating-size-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.creating-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.creating-actions button {
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.creating-cancel {
  background: transparent;
  color: #64748b;
}

.creating-cancel:hover {
  background: #f1f5f9;
}

.creating-submit {
  background: #2563eb;
  color: #fff;
  font-weight: 500;
}

.creating-submit:hover {
  background: #1d4ed8;
}

/* Calendar */

.calendar-viewport {
  flex: 1;
  overflow: auto;
  padding: 20px;
}

.calendar-wrap {
  max-width: 1000px;
  margin: 0 auto;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-nav h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #e2e8f0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.cal-weekday {
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 6px 4px;
}

.cal-day {
  position: relative;
  background: #fff;
  min-height: 110px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-day-other {
  background: #f8fafc;
  color: #94a3b8;
}

.cal-day-today .cal-day-num {
  background: #2563eb;
  color: #fff;
  border-radius: 999px;
}

.cal-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cal-day-num {
  font-size: 13px;
  font-weight: 500;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-add-btn {
  border: none;
  border-radius: 999px;
  width: 18px;
  height: 18px;
  line-height: 1;
  font-size: 13px;
  background: #f1f5f9;
  color: #334155;
  cursor: pointer;
}

.cal-add-btn:hover {
  background: #e2e8f0;
}

.cal-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.cal-event {
  position: relative;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 4px;
  padding: 2px 18px 2px 5px;
}

.cal-event-time {
  font-weight: 600;
  flex-shrink: 0;
}

.cal-event-title {
  word-break: break-word;
}

.cal-event-author {
  font-size: 11px;
  color: #64748b;
  width: 100%;
}

.cal-event-delete {
  position: absolute;
  top: 1px;
  right: 2px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 2px;
}

.cal-event-delete:hover {
  color: #dc2626;
}

.cal-add-form {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.cal-add-form input,
.cal-add-form textarea {
  font-size: 12px;
  font-family: inherit;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  outline: none;
  resize: none;
}

.cal-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.cal-add-actions button {
  border: none;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
}

.cal-add-cancel {
  background: transparent;
  color: #64748b;
}

.cal-add-cancel:hover {
  background: #e2e8f0;
}

.cal-add-submit {
  background: #2563eb;
  color: #fff;
  font-weight: 500;
}

.cal-add-submit:hover {
  background: #1d4ed8;
}


.reset-form input[type="email"] {
  width: 240px;
}

.reset-form + .reset-form {
  margin-top: 6px;
}

/* Formatierter Kachel-Text */
.square-text strong {
  font-weight: 700;
}

.square-text ul {
  margin: 2px 0;
  padding-left: 1.1em;
}

.square-text li {
  margin: 0;
}

.square-text a {
  color: #1d4ed8;
  text-decoration: underline;
  word-break: break-all;
  cursor: pointer;
}

/* Formatierungs-Leiste beim Bearbeiten/Erstellen */
.format-toolbar {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  margin-bottom: 3px;
}

.format-btn {
  min-width: 22px;
  height: 20px;
  padding: 0 4px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.format-btn:hover {
  background: #f1f5f9;
}

.format-btn.fmt-bold {
  font-weight: 700;
}

.format-btn.fmt-italic {
  font-style: italic;
  font-family: Georgia, serif;
}

.format-btn.fmt-strike {
  text-decoration: line-through;
}
