/* SANEXTA Collab: additions to the binding SANEXTA stylesheet (static/css/sanexta.css).

   Rules of this file (CLAUDE.md, "Frontend und Design"):
   - sanexta.css is never changed; this file is loaded after it.
   - No colour values: only var(--...) from sanexta.css. A token of its own would go into the
     same three theme blocks as there (:root, [data-theme="dark"], prefers-color-scheme).
   - Logical properties only (margin-inline-start, inset-inline-end, ...), so Arabic (RTL)
     mirrors without special rules.
   - Every section names the markup it belongs to. */

/* ---------- Phones (Pflichtenheft Kap. 5): one hand, big targets ----------------------
   Markup: <nav class="tabbar"> at the end of base.html with <a><span class="tabbar-icon
   tabbar-icon-{home,user,admin,help}"></span><span>label</span></a>. The icons are masks
   filled with currentColor, so they follow the theme. */
.tabbar {
  display: none;
}

.tabbar-icon {
  display: block;
  inline-size: 24px;
  block-size: 24px;
  background-color: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
}

.tabbar-icon-home {
  mask-image: url("../icons/nav-home.svg");
}

.tabbar-icon-user {
  mask-image: url("../icons/nav-user.svg");
}

.tabbar-icon-admin {
  mask-image: url("../icons/nav-admin.svg");
}

.tabbar-icon-help {
  mask-image: url("../icons/nav-help.svg");
}

@media (max-width: 560px) {
  /* The bar at the bottom replaces the navigation in the header. */
  .app-nav {
    display: none;
  }

  .tabbar {
    display: flex;
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 20;
    background: var(--surface);
    border-block-start: 1px solid var(--border);
    padding-block-end: env(safe-area-inset-bottom);
    padding-inline: max(env(safe-area-inset-left), env(safe-area-inset-right));
  }

  .tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-block-size: 56px;
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
  }

  .tabbar a[aria-current] {
    color: var(--primary);
  }

  /* Room for the bar, also below the home indicator of an iPhone. */
  .app-main {
    padding-block-end: calc(80px + env(safe-area-inset-bottom));
  }

  /* At least 44 x 44 px to tap (Apple HIG, WCAG 2.5.5). */
  button,
  .button,
  input:not([type="checkbox"]):not([type="radio"]),
  select {
    min-block-size: 44px;
  }

  .app-header-tools a,
  .app-header-tools button {
    min-block-size: 44px;
  }
}

/* ---------- Two-factor pages (templates/mfa/*.html, profile.html) ---------- */
.otp-input {
  font-size: 22px;
  letter-spacing: 0.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.mfa-qr {
  text-align: center;
}

.mfa-qr img {
  max-inline-size: 100%;
  block-size: auto;
  border-radius: var(--radius-sm);
}

.mfa-secret {
  font-size: 16px;
  word-break: break-all;
  user-select: all;
}

.mfa-help {
  margin-block-start: 16px;
}

/* Ten codes in two columns, monospace, so they can be copied or printed as they stand. */
.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  padding: 0;
  list-style: none;
  font-size: 16px;
}

.steps {
  padding-inline-start: 1.4em;
}

/* ---------- Start page (index.html): installing the app ---------- */
.install-steps {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.filter-links {
  margin-block: 0 12px;
}

/* ---------- Files (files/templates/files/*.html) ----------
   Markup: <nav class="breadcrumbs"><ol><li>…; <ul class="file-list"><li><a class="file-link">
   <span class="file-icon"></span><span class="file-name"></span></a><span class="file-meta">
   <a class="file-download">; the upload form with label.upload-button around a hidden file
   field. */
.tabbar-icon-files {
  mask-image: url("../icons/nav-files.svg");
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  font-size: 14px;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-inline-end: 4px;
  color: var(--text-faint);
}

.file-list,
.folder-list,
.grant-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.file-list li,
.folder-list li,
.grant-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding-block: 10px;
  border-block-end: 1px solid var(--border);
}

.file-list li:last-child,
.folder-list li:last-child,
.grant-list li:last-child {
  border-block-end: 0;
}

.file-link,
.folder-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 240px;
  min-block-size: 44px;
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.file-meta {
  color: var(--text-muted);
  font-size: 13px;
}

.file-icon {
  flex: none;
  inline-size: 22px;
  block-size: 22px;
  border-radius: 4px;
  background-color: var(--primary-soft-2);
}

.file-icon-folder {
  background-color: currentColor;
  mask: url("../icons/nav-files.svg") center / contain no-repeat;
}

.file-title {
  overflow-wrap: anywhere;
}

.upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-block-end: 16px;
}

.upload-button {
  cursor: pointer;
}

.upload-button:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .upload-button {
    flex: 1 1 100%;
    justify-content: center;
    min-block-size: 52px;
  }
}

/* ---------- File preview (files/templates/files/file.html: section.file-preview) ---------- */
.file-preview img {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
  margin-inline: auto;
  border-radius: var(--radius-sm);
}

.text-preview {
  max-block-size: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.markdown-body {
  overflow-wrap: anywhere;
}

.markdown-body table {
  border-collapse: collapse;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 4px 8px;
}

/* App password shown once (calendar/device_created.html): large enough to type off a phone. */
.app-password {
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}

/* Calendar colours (calendar/*.html: .cal-color-<key>, a dot before the calendar name and the
   stripe of an appointment). Keys as in collab.calendar.models.COLORS. */
:root {
  --cal-blue: #2f5bea;
  --cal-green: #2e8540;
  --cal-orange: #d9822b;
  --cal-red: #c23030;
  --cal-purple: #7d4cdb;
  --cal-teal: #138a8a;
  --cal-brown: #8a5a3c;
  --cal-grey: #6b7280;
}
[data-theme="dark"] {
  --cal-blue: #7b9bff;
  --cal-green: #5fbf72;
  --cal-orange: #f0a65a;
  --cal-red: #f07070;
  --cal-purple: #b08cf5;
  --cal-teal: #4cc4c4;
  --cal-brown: #c4916f;
  --cal-grey: #a0a7b4;
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    --cal-blue: #7b9bff;
    --cal-green: #5fbf72;
    --cal-orange: #f0a65a;
    --cal-red: #f07070;
    --cal-purple: #b08cf5;
    --cal-teal: #4cc4c4;
    --cal-brown: #c4916f;
    --cal-grey: #a0a7b4;
  }
}
.cal-color-blue { --cal: var(--cal-blue); }
.cal-color-green { --cal: var(--cal-green); }
.cal-color-orange { --cal: var(--cal-orange); }
.cal-color-red { --cal: var(--cal-red); }
.cal-color-purple { --cal: var(--cal-purple); }
.cal-color-teal { --cal: var(--cal-teal); }
.cal-color-brown { --cal: var(--cal-brown); }
.cal-color-grey { --cal: var(--cal-grey); }
.cal-dot {
  display: inline-block;
  inline-size: 0.75rem;
  block-size: 0.75rem;
  border-radius: 50%;
  background: var(--cal);
  margin-inline-end: 0.5rem;
  vertical-align: middle;
}

/* ---------- Calendar month (calendar/month.html) ----------
   Markup: div.cal-header (h1, nav.cal-nav, new button); table.cal-month with td
   (.cal-outside, .cal-today) holding a.cal-day and ul.cal-items > li > a.cal-item.cal-color-*;
   section.cal-agenda with h2.cal-agenda-day and ul.cal-agenda-items. On phones only the
   agenda list is shown: seven columns do not fit, and a list is what one reads on the go. */
.tabbar-icon-calendar {
  mask-image: url("../icons/nav-calendar.svg");
}

.cal-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-block-end: 12px;
}

.cal-header h1 {
  margin: 0;
  margin-inline-end: auto;
}

.cal-nav {
  display: flex;
  gap: 4px;
}

/* The arrows point in reading direction: mirrored in Arabic. */
[dir="rtl"] .cal-arrow-back,
[dir="rtl"] .cal-arrow-forward {
  display: inline-block;
  transform: scaleX(-1);
}

.cal-month {
  inline-size: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.cal-month th {
  padding-block: 4px;
  font-weight: 600;
  color: var(--text-muted);
}

.cal-month td {
  vertical-align: top;
  block-size: 6.5rem;
  border: 1px solid var(--border);
  padding: 2px 4px;
  overflow: hidden;
}

.cal-month .cal-outside {
  background: var(--surface-muted);
  color: var(--text-muted);
}

.cal-day {
  display: inline-block;
  min-inline-size: 28px;
  text-align: center;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
}

.cal-today .cal-day {
  background: var(--primary);
  color: var(--surface);
}

.cal-items,
.cal-agenda-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cal-item {
  display: block;
  border-inline-start: 4px solid var(--cal);
  padding-inline-start: 4px;
  margin-block: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
  color: inherit;
  font-size: 0.85rem;
}

.cal-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.cal-agenda {
  display: none;
}

.cal-agenda-day {
  font-size: 1rem;
  margin-block: 16px 4px;
}

.cal-agenda .cal-item {
  display: flex;
  gap: 12px;
  align-items: center;
  min-block-size: 44px;
  white-space: normal;
  font-size: 1rem;
  padding-inline-start: 8px;
}

.cal-when {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0 12px;
}

.cal-description {
  white-space: pre-line;
}

.cal-links {
  margin-block-start: 16px;
}

@media (max-width: 560px) {
  .cal-month {
    display: none;
  }

  .cal-agenda {
    display: block;
  }
}

/* Invitations in the appointment form (calendar/event_form.html: div.cal-people with one
   label.checkbox per person; the list of invited people with input.share-url for the link). */
.cal-people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 0 12px;
}

.grant-list .share-url {
  inline-size: 100%;
}

/* ---------- Conferences (conference/*.html, static/js/conference.js) ----------
   Markup: div#conference.conference with section.conference-lobby (video.conference-preview,
   fieldset.conference-choice, button.conference-join) and section.conference-stage
   (div.conference-tiles of figure.conference-tile > div.conference-media + figcaption,
   div.conference-waiting, nav.conference-controls). On phones the controls sit at the bottom
   above the tab bar and the tiles stack. */
.tabbar-icon-conference {
  mask-image: url("../icons/nav-conference.svg");
}

.conference-preview {
  inline-size: 100%;
  max-inline-size: 480px;
  aspect-ratio: 16 / 9;
  background: var(--surface-muted);
  border-radius: var(--radius);
  object-fit: cover;
}

.conference-choice {
  border: 0;
  padding: 0;
  margin-block: 12px;
}

.conference-join {
  min-block-size: 44px;
}

.conference-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.conference-tile {
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 9;
  background: var(--surface-muted);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.conference-tile.speaking {
  border-color: var(--primary);
}

.conference-tile.conference-screen {
  grid-column: 1 / -1;
}

.conference-media,
.conference-video {
  inline-size: 100%;
  block-size: 100%;
}

.conference-video {
  object-fit: cover;
}

.conference-screen .conference-video {
  object-fit: contain;
}

.conference-audio {
  display: none;
}

.conference-tile figcaption {
  position: absolute;
  inset-block-end: 4px;
  inset-inline-start: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
}

.conference-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-block: 12px;
}

.conference-controls button {
  min-block-size: 44px;
  min-inline-size: 44px;
}

.conference-controls button[aria-pressed="false"] {
  background: var(--surface-muted);
  color: var(--text-muted);
  text-decoration: line-through;
}

.conference-waiting {
  margin-block-start: 12px;
}

.conference-close {
  margin-block-start: 24px;
}

@media (max-width: 560px) {
  .conference-tiles {
    grid-template-columns: 1fr;
  }

  .conference-controls {
    position: sticky;
    inset-block-end: calc(64px + env(safe-area-inset-bottom));
    background: var(--surface);
    padding-block: 8px;
    margin-inline: -16px;
    border-block-start: 1px solid var(--border);
  }
}

/* Guest links of a room (conference/room.html: details.conference-invite). */
.conference-invite {
  margin-block-start: 16px;
}

/* Join button of an appointment with a video conference (calendar/month.html, agenda list). */
.cal-join {
  margin-inline-start: 12px;
  min-block-size: 44px;
}

/* ---------- Editor (editor/editor.html, static/js/editor.js) ----------
   Markup: div#editor.editor[data-view] with header.editor-header (ul.editor-people of
   li.editor-person.editor-color-N), div.editor-switch, div.editor-toolbar and div.editor-panes
   (div.editor-source with div.editor-mirror under textarea.editor-text, div.editor-preview).
   The mirror repeats the text invisibly and carries span.editor-caret marks for the cursors of
   the others. Side by side on wide screens; on phones one pane at a time (editor-switch). */
.editor-color-0 { --cal: var(--cal-blue); }
.editor-color-1 { --cal: var(--cal-green); }
.editor-color-2 { --cal: var(--cal-orange); }
.editor-color-3 { --cal: var(--cal-red); }
.editor-color-4 { --cal: var(--cal-purple); }
.editor-color-5 { --cal: var(--cal-teal); }
.editor-color-6 { --cal: var(--cal-brown); }
.editor-color-7 { --cal: var(--cal-grey); }

.editor-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.editor-header h1 {
  margin: 0;
  margin-inline-end: auto;
  overflow-wrap: anywhere;
}

.editor-people {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.editor-person {
  padding: 2px 10px;
  border-radius: 999px;
  border: 2px solid var(--cal);
  font-size: 0.85rem;
}

.editor-self {
  background: var(--surface-muted);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-block: 8px;
}

.editor-toolbar button,
.editor-switch button {
  min-block-size: 44px;
  min-inline-size: 44px;
}

.editor-switch {
  display: none;
  gap: 6px;
  margin-block: 8px;
}

.editor-switch button[aria-selected="true"] {
  border-color: var(--primary);
  color: var(--primary);
}

.editor-panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.editor-source {
  position: relative;
}

.editor-text,
.editor-mirror {
  box-sizing: border-box;
  inline-size: 100%;
  min-block-size: 60vh;
  margin: 0;
  padding: 12px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.editor-text {
  position: relative;
  background: transparent;
  color: var(--text);
  resize: vertical;
}

.editor-mirror {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: transparent;
  background: var(--surface);
  border-color: transparent;
  pointer-events: none;
}

.editor-caret {
  display: inline-block;
  inline-size: 0;
  block-size: 1.3em;
  vertical-align: text-bottom;
  border-inline-start: 2px solid var(--cal);
  margin-inline-end: -2px;
}

.editor-preview {
  min-block-size: 60vh;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .editor-switch {
    display: flex;
  }

  .editor-panes {
    grid-template-columns: 1fr;
  }

  .editor:not([data-view="preview"]) .editor-preview,
  .editor[data-view="preview"] .editor-source {
    display: none;
  }
}

/* Invitation links of a document (editor/editor.html: details.editor-invite). */
.editor-invite {
  margin-block-start: 16px;
}
