:root {
    --bg: #0b0c0f;
    --card: #151821;
    --muted: #8a93a4;
    --fg: #e7ebf3;
    --accent: #5cc8ff;
    --ok: #2ecc71;
    --danger: #ff6b6b;
    --shadow: 0 10px 30px rgba(0, 0, 0, .25);
    --gap: 12px;
    --border: rgba(255, 255, 255, .08);
}

* {
    box-sizing: border-box;
    touch-action: manipulation;
}

html,
body {
    height: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.4
}

/* Body-Scroll bei geöffnetem Modal deaktivieren */
html.modal-open,
body.modal-open {
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: calc(var(--gap)*2) var(--gap) 96px
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(180deg, rgba(11, 12, 15, 0.95), rgba(11, 12, 15, 0.6));
    backdrop-filter: saturate(1.2) blur(6px);
    border-bottom: 1px solid var(--border)
}

.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 12px var(--gap);
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between
}

.topbar h1 {
    font-size: 1.1rem;
    margin: 0
}

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

.btn {
    appearance: none;
    border: 1px solid var(--border);
    background: #1b2030;
    color: var(--fg);
    padding: 10px 14px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: transform .05s ease, opacity .2s ease, border-color .2s ease
}

.btn:hover {
    border-color: #2a3145
}

.btn:active {
    transform: translateY(1px)
}

.btn.primary {
    background: var(--accent);
    color: #041019;
    border-color: transparent
}

.btn.ok {
    background: var(--ok);
    color: #041019;
    border-color: transparent
}

.btn.warn {
    background: var(--danger);
    color: #2a0000;
    border-color: transparent
}

.input,
select {
    width: 100%;
    background: #10131b;
    color: var(--fg);
    border: 1px solid var(--border);
    padding: 12px 14px;
    border-radius: 12px;
    outline: none
}

.input:focus,
select:focus {
    border-color: #2b3955;
    box-shadow: 0 0 0 3px rgba(92, 200, 255, .15)
}

.grid {
    display: grid;
    gap: var(--gap)
}

@media (min-width:640px) {
    .grid.cols-2 {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .modal {
        border-radius: 1rem;
    }

    .modal-backdrop {
        align-items: center;
    }

    .footerbar {
        position: sticky;
        bottom: 0;
        backdrop-filter: blur(6px) saturate(1.05);
    }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 16px
}

.card h3 {
    margin: 0 0 6px 0;
    font-size: 1rem
}

.small {
    font-size: .9rem;
    color: var(--muted)
}

.badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0f1320;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: .8rem
}

.badge.owner {
    color: #9fd9ff;
    border-color: #25455a
}

.badge.viewer {
    color: #b9b9ff;
    border-color: #3b345e
}

.badge.shared {
    color: #7ae6c6;
    border-color: #1f4a3f
}

.kpis {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px
}

.kpi {
    background: #0f1320;
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 12px;
    font-variant-numeric: tabular-nums
}

.card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px
}

.footerbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background: linear-gradient(180deg, rgba(21, 24, 33, 0.7), rgba(21, 24, 33, 0.95));
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--border);

}

.footerbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 10px var(--gap);
    display: flex;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.footer-meta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    line-height: 1.2;
}

.footer-meta .brand {
    color: var(--fg);
    font-weight: 600;
}

.footer-links {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-links a {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: .18em;
    text-decoration-thickness: .08em;
    transition: opacity .2s ease, color .2s ease, border-color .2s ease;
    opacity: .9;
}

.footer-links a:hover,
.footer-links a:focus-visible {
    opacity: 1;
}

.footer-links .sep {
    opacity: .45;
}

/* rechte Seite */
.footer-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.footer-actions .btn.ok{
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.fab {
    position: fixed;
    left: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    z-index: 11;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    background: var(--accent);
    color: #041019;
    border: none;
    box-shadow: 0 14px 28px rgba(0, 0, 0, .35), 0 4px 10px rgba(0, 0, 0, .25);
    cursor: pointer
}

.fab:focus {
    outline: 3px solid rgba(92, 200, 255, .35)
}

.section-title {
    margin: 10px 0 6px 2px;
    color: var(--muted);
    font-size: .9rem
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    display: none;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 1rem;
    z-index: 1000;
}

.modal-backdrop[aria-hidden="false"] {
    display: flex;
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    width: 100%;
    max-width: 640px;
    padding: 16px;
    max-height: calc(100svh - 2rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    margin: env(safe-area-inset-top) auto env(safe-area-inset-bottom);
    scroll-padding-bottom: env(safe-area-inset-bottom);
    z-index: 1001;
}

@supports (height: 100dvh) {
    .modal {
        max-height: calc(100dvh - 2rem);
    }
}

.modal header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px
}

.modal .actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px
}

@supports (height: 100dvh) {
    .modal {
        max-height: 90dvh;
    }
}

/* Chips & Table */
.chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.chip {
    border: 1px solid var(--border);
    background: #0f1320;
    color: var(--fg);
    padding: 6px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: .85rem
}

.chip.active {
    border-color: var(--accent)
}

.badge,
.chip {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

img,
svg,
canvas,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

.table {
    width: 100%;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0 8px;
    font-variant-numeric: tabular-nums;

}

.tr {
    background: #0f1320;
    border: 1px solid var(--border);
    border-radius: 12px
}

.table th,
.table td {
    padding: 10px 12px
}

.table .right {
    text-align: right
}

:focus-visible {
    outline: 3px solid rgba(92, 200, 255, .35);
    outline-offset: 2px
}

.hide {
    display: none !important
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.container,
.card,
.modal,
.table {
    overflow-wrap: anywhere;
}

.table td,
.table th {
    word-break: break-word;
}

.modal {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.badge,
.chip {
    max-width: 100%;
}

/* --- Mehr-Menü (Dropdown) --- */
.actions-menu {
    position: relative;
    display: none;
}

.actions-menu>summary.btn {
    list-style: none;
}

.actions-menu>summary::-webkit-details-marker {
    display: none;
}

.actions-menu[open]>summary.btn {
    border-color: #2a3145;
}

.menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px;
    margin: 0;
    list-style: none;
    min-width: 200px;
    box-shadow: var(--shadow);
    z-index: 100;
    /* über der Topbar */
}

.menu-item {
    width: 100%;
    display: block;
    text-align: left;
    border: 0;
    background: transparent;
    color: var(--fg);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
}

.menu-item:hover,
.menu-item:focus {
    background: #10131b;
    outline: none;
}

/* Sichtbarkeit: klein = Menü, groß = Buttons */
@media (max-width: 560px) {
    .top-actions>.btn {
        display: none;
    }

    /* Einzel-Buttons aus */
    .top-actions>.actions-menu {
        display: block;
    }

    .footerbar-inner {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .footer-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Menü an */
}

@media (min-width: 561px) {
    .top-actions>.actions-menu {
        display: none;
    }

    /* Menü aus */
}