/* Dashboard – ergänzt /shared/portal.css */

.loading { padding: 40px; text-align: center; color: var(--p-muted); }

/* Kopfzeile */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--p-bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--p-border);
}
.top__inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--p-text); }
.brand img { width: 28px; height: 28px; }
.top__nav { display: flex; gap: 4px; margin-left: 12px; }
.top__nav a {
  text-decoration: none; color: var(--p-muted); font-weight: 600; font-size: .9rem;
  padding: 7px 12px; border-radius: 9px;
}
.top__nav a:hover { color: var(--p-text); background: var(--p-surface); }
.top__nav a.is-active { color: var(--p-text); background: var(--p-surface); box-shadow: inset 0 0 0 1px var(--p-border); }
.top__spacer { flex: 1; }
.usermenu { position: relative; }
.usermenu__btn {
  display: flex; align-items: center; gap: 8px;
  font: inherit; color: var(--p-text); background: transparent;
  border: 1px solid var(--p-border); border-radius: 999px;
  padding: 4px 12px 4px 4px; cursor: pointer;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--p-accent); color: var(--p-accent-text);
  font-weight: 700; font-size: .8rem;
}
.usermenu__list {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 200px; padding: 6px;
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: 12px; box-shadow: var(--p-shadow);
  display: none;
}
.usermenu.is-open .usermenu__list { display: block; }
.usermenu__list a, .usermenu__list button {
  display: block; width: 100%; text-align: left;
  font: inherit; color: var(--p-text); background: none; border: 0;
  padding: 8px 10px; border-radius: 8px; text-decoration: none; cursor: pointer;
}
.usermenu__list a:hover, .usermenu__list button:hover { background: var(--p-surface-2); }

main { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }

/* Startseite */
.hello { margin-bottom: 24px; }
.hello h1 { margin-bottom: 4px; }

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.tile {
  --tile: var(--p-accent);
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 170px; padding: 20px;
  text-decoration: none; color: var(--p-text);
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: 18px;
  box-shadow: var(--p-shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
  overflow: hidden;
}
.tile::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--tile);
}
.tile:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tile) 45%, var(--p-border)); box-shadow: 0 8px 28px rgba(20, 20, 40, .1); }
.tile:focus-visible { outline: 3px solid color-mix(in srgb, var(--tile) 55%, transparent); outline-offset: 2px; }
.tile__icon {
  width: 48px; height: 48px; border-radius: 13px;
  display: grid; place-items: center; font-size: 26px;
  background: color-mix(in srgb, var(--tile) 14%, transparent);
}
.tile__icon img { width: 30px; height: 30px; object-fit: contain; }
.tile__name { font-weight: 700; font-size: 1.05rem; }
.tile__desc { color: var(--p-muted); font-size: .9rem; flex: 1; }
.tile__foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile__arrow { color: var(--p-muted); font-size: 1.1rem; transition: transform .15s; }
.tile:hover .tile__arrow { transform: translateX(3px); color: var(--tile); }

.empty {
  text-align: center; padding: 48px 20px;
  border: 1.5px dashed var(--p-border); border-radius: 18px; color: var(--p-muted);
}
.empty code { background: var(--p-surface); padding: 2px 6px; border-radius: 6px; }

/* Anmeldung */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth__card { width: 100%; max-width: 400px; padding: 32px; }
.auth__logo { width: 44px; height: 44px; margin-bottom: 16px; }
.auth__card h1 { font-size: 1.4rem; }
.auth__card p.portal-muted { margin-top: 0; margin-bottom: 22px; }
.auth__card .portal-btn { width: 100%; margin-top: 6px; }
.form-error { color: var(--p-danger); font-weight: 500; min-height: 1.4em; margin: 6px 0 0; font-size: .9rem; }

/* Verwaltung */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--p-border); margin-bottom: 20px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-weight: 600; color: var(--p-muted);
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; cursor: pointer; margin-bottom: -1px;
}
.tabs button.is-active { color: var(--p-text); border-bottom-color: var(--p-accent); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; background: var(--p-surface); border: 1px solid var(--p-border); border-radius: var(--p-radius); }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--p-border); white-space: nowrap; }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--p-muted); font-weight: 700; background: var(--p-surface-2); }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr.clickable { cursor: pointer; }
table.list tbody tr.clickable:hover td { background: var(--p-surface-2); }

/* Dialog */
.dlg {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0; border: 1px solid var(--p-border); border-radius: 18px;
  background: var(--p-surface); color: var(--p-text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.dlg::backdrop { background: rgba(10, 10, 20, .45); backdrop-filter: blur(2px); }
.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); }
.dlg__head { padding: 20px 24px 8px; }
.dlg__body { padding: 8px 24px 16px; overflow-y: auto; }
.dlg__foot {
  display: flex; gap: 10px; justify-content: flex-end; align-items: center;
  padding: 14px 24px; border-top: 1px solid var(--p-border); background: var(--p-surface-2);
  border-radius: 0 0 18px 18px;
}
.dlg__foot .spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.check { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--p-accent); }

.rights { border: 1px solid var(--p-border); border-radius: 12px; overflow: hidden; margin-top: 4px; }
.rights__row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--p-border); }
.rights__row:last-child { border-bottom: 0; }
.rights__app { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.rights__app span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rights__row .portal-select { width: auto; min-width: 150px; padding: 6px 10px; }
.rights--disabled { opacity: .55; pointer-events: none; }

.settings { max-width: 520px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--p-muted); }
.kv dd { margin: 0; font-weight: 500; }
.stack > * + * { margin-top: 16px; }

@media (max-width: 640px) {
  .top__inner { padding: 10px 14px; gap: 8px; }
  .top__nav { margin-left: 0; }
  .usermenu__name { display: none; }
  .usermenu__btn { padding: 4px; }
  main { padding: 20px 14px 48px; }
  .brand span { display: none; }
}

/* Konto & 2-Faktor */
.linklike { font: inherit; color: var(--p-accent); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.code-input { font-size: 1.35rem; letter-spacing: .25em; font-variant-numeric: tabular-nums; text-align: center; }
.notice {
  padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--p-warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--p-warn) 35%, transparent);
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.inline-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--p-border); }
.steps { padding-left: 20px; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }
.qr-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin: 6px 0 4px; }
.qr { width: 200px; height: 200px; border-radius: 12px; border: 1px solid var(--p-border); background: #fff; padding: 6px; image-rendering: pixelated; }
.qr-wrap > div { flex: 1; min-width: 200px; }
.secret { margin-top: 6px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .95rem; color: var(--p-text); word-break: break-all; background: var(--p-surface-2); border: 1px solid var(--p-border); border-radius: 8px; padding: 8px 10px; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 16px 0; }
.codes code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; text-align: center; padding: 8px; border-radius: 8px; background: var(--p-surface-2); border: 1px solid var(--p-border); }
.twofa-line { padding: 10px 12px; border: 1px solid var(--p-border); border-radius: 12px; margin: 4px 0 8px; }
.twofa-line .portal-btn { padding: 6px 12px; }
.settings { max-width: 640px; }
.settings .notice { margin: 0; }
