/* Datenaustausch Portal – helles, sachliches Layout */
:root {
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --success: #059669;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ——— Startseite ——— */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  padding: 1rem 1.5rem;
}

.landing-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.site-host {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-top: 0.2rem;
}

@media (min-width: 600px) {
  .app-brand h1 .site-host {
    display: inline;
    margin-left: 0.5rem;
    font-size: 0.85rem;
    vertical-align: middle;
  }
}

.landing-main {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.landing-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  line-height: 1.2;
}

.lead {
  font-size: 1.125rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
}

.landing-list {
  margin: 0 0 2rem;
  padding-left: 1.25rem;
  color: var(--text);
}

.landing-list li {
  margin-bottom: 0.5rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

/* Ablauf als durchgehende Linie (Orientierung) */
.landing-flow {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  counter-reset: landing-step;
  border-left: 2px solid var(--border);
  margin-left: 0.75rem;
}

.landing-flow li {
  position: relative;
  padding: 0 0 1.25rem 1.5rem;
  margin: 0;
  color: var(--text);
}

.landing-flow li:last-child {
  padding-bottom: 0;
}

.landing-flow li::before {
  counter-increment: landing-step;
  content: counter(landing-step);
  position: absolute;
  left: 0;
  top: 0;
  transform: translateX(calc(-50% - 1px));
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.landing-flow strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.landing-flow p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
  line-height: 1.5;
}

.landing-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--text);
  text-decoration: none;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

.btn .btn-loader {
  display: none;
}
.btn.loading .btn-text {
  opacity: 0;
}
.btn.loading .btn-loader {
  display: block;
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-secondary.loading .btn-loader {
  border-color: var(--border);
  border-top-color: var(--accent);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* JS verwendet .neu-button-outline – gleicher Look wie sekundärer Button */
.neu-button-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
}
.neu-button-outline:hover {
  background: var(--bg-subtle);
}

.neu-button-inline {
  display: inline-flex;
  position: relative;
  padding: 0.65rem 1.1rem;
  font-weight: 600;
  font-size: 0.9375rem;
  font-family: inherit;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
}
.neu-button-inline:hover {
  background: var(--accent-hover);
}
.neu-button-inline input[type="file"] {
  display: none;
}

.neu-button.login-btn {
  width: 100%;
  position: relative;
  padding: 0.75rem 1.25rem;
  margin-bottom: 0;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.neu-button.login-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}
.neu-button.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ——— Login-Karte ——— */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg-subtle);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
}

.auth-sub {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0 0 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.neu-input {
  display: block;
}
.neu-input input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg);
}
.neu-input input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.password-group {
  position: relative;
}
.neu-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
}
.eye-closed {
  display: none;
}
.neu-toggle.show-password .eye-open {
  display: none;
}
.neu-toggle.show-password .eye-closed {
  display: block;
}

.error-message {
  color: var(--danger);
  font-size: 0.8125rem;
  margin-top: 0.35rem;
  display: none;
}
.error-message.show {
  display: block;
}
.form-group.error .neu-input input {
  border-color: var(--danger);
}

.auth-back {
  margin-top: 1.25rem;
  font-size: 0.875rem;
}

.login-hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: -0.5rem 0 1.25rem;
}

.success-message {
  display: none;
  text-align: center;
  padding: 1rem;
}
.success-message.show {
  display: block;
}
.success-message h3 {
  margin: 0.5rem 0;
}

/* ——— App-Shell ——— */
.dashboard-body {
  background: var(--bg-subtle);
}

.app-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  margin: -1.25rem -1.25rem 1.5rem;
  padding: 1rem 1.25rem;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-brand h1,
.app-brand .folder-title-block h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.app-sub {
  margin: 0.15rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.app-brand-icon {
  display: none;
}

.app-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.role-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--muted);
  border: 1px solid var(--border);
}

.app-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.tab-btn {
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
a.tab-btn:hover {
  text-decoration: none;
  color: var(--text);
}
.tab-btn.active {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-toolbar h2 {
  margin: 0;
  font-size: 1.125rem;
}

.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.panel-desc {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.neu-surface {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

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

.folder-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: var(--bg);
}

.folder-card-main {
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  text-align: center;
  padding: 0.5rem;
  font: inherit;
  color: inherit;
}
.folder-card-main:hover .folder-name {
  color: var(--accent);
}

.folder-icon {
  color: var(--muted);
  display: block;
  margin-bottom: 0.5rem;
}

.folder-name {
  font-weight: 600;
  display: block;
}

.folder-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.folder-create-wrap .neu-field-inline {
  min-width: 160px;
  flex: 1;
  max-width: 280px;
}

.neu-field {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-family: inherit;
}
.neu-field:focus {
  outline: none;
  border-color: var(--accent);
}

.neu-field-inline {
  width: auto;
}

.neu-field-compact {
  padding: 0.4rem 0.5rem;
  font-size: 0.8125rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.col-actions {
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
}
.empty-state[hidden] {
  display: none;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 840px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

.member-form h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.form-row {
  margin-bottom: 0.85rem;
}
.form-row label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.form-msg {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}
.form-msg.ok {
  color: var(--success);
}
.form-msg.err {
  color: var(--danger);
}

.field-hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.folder-checkbox-list {
  max-height: 200px;
  overflow-y: auto;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.folder-check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}
.folder-check-row:last-child {
  border-bottom: none;
}

#newMemberFoldersWrap.is-admin-only .folder-checkbox-list,
#newMemberFoldersWrap.is-admin-only .field-hint {
  display: none;
}

.muted {
  color: var(--muted);
}

.folder-cell {
  font-size: 0.8125rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-link {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.back-link:hover {
  text-decoration: underline;
}

.folder-title-block h1 {
  font-size: 1.25rem;
}

.folder-detail-main {
  padding-top: 0.5rem;
}

.link-btn {
  text-decoration: none;
  color: var(--text);
  vertical-align: middle;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(92vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
  overflow: hidden;
}

.modal-narrow {
  width: min(92vw, 420px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  border: none;
  background: var(--bg-subtle);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted);
}

.modal-body {
  padding: 1rem 1.25rem;
  overflow: auto;
  flex: 1;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.preview-iframe {
  width: 100%;
  min-height: 65vh;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}

.preview-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: var(--radius);
}

.preview-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8125rem;
  max-height: 65vh;
  overflow: auto;
}

.preview-fallback {
  color: var(--muted);
  text-align: center;
  padding: 1.5rem;
}
