/* ── Secrets app ── */

.s-wrap {
    max-width: 1100px;
    margin: 40px auto;
    padding: 0 16px;
    font-family: sans-serif;
    box-sizing: border-box;
}

/* Tabs (Credentials / Environment Variables) */
.s-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 16px;
}
.s-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.s-tab.active {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
    font-weight: 600;
}

/* Group chips - read-only display in table/card rows */
.s-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3949ab;
    font-size: 11px;
    white-space: nowrap;
}

/* Group checkbox picker - inside the credential/env-var forms */
.s-group-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border: 1px solid #eee;
    border-radius: 6px;
    max-height: 120px;
    overflow-y: auto;
}
.s-group-picker-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f8f9fa;
}
.s-group-picker-item input { cursor: pointer; }

/* Top key + button bar */
.s-top-bar {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.s-top-key { flex: 1; min-width: 0; }
.s-top-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Filter / toolbar row */
.s-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
}
.s-toolbar input {
    flex: 1 1 130px;
    min-width: 0;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
}

/* Column picker */
.s-col-picker-wrap { position: relative; }
.s-col-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}
.s-col-toggle {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 0;
    user-select: none;
}
.s-col-toggle input[type=checkbox] {
    cursor: pointer;
    width: 30px;
    height: 16px;
    margin: 0;
    justify-self: center;
}
.s-col-toggle span {
    line-height: 1.2;
}

/* Table view — desktop only */
.s-table-wrap { overflow-x: auto; }
.s-card-list  { display: none; }

/* Card view — mobile only */
.s-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
}
.s-card-field {
    display: flex;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: baseline;
    cursor: copy;
}
.s-card-field:last-of-type { border-bottom: none; }
.s-card-label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 72px;
    flex-shrink: 0;
}
.s-card-value {
    font-size: 14px;
    color: #212529;
    word-break: break-all;
    flex: 1;
}
.s-card-value.masked { color: #bbb; }
.s-card-value.mono   { font-family: monospace; }
.s-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

/* Modal */
.s-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    box-sizing: border-box;
}
.s-modal-box {
    background: #fff;
    border-radius: 10px;
    padding: 28px;
    width: 460px;
    max-width: 100%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    box-sizing: border-box;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .s-wrap { margin: 16px auto; }

    .s-top-bar     { flex-direction: column; }
    .s-top-actions { width: 100%; }
    .s-top-actions button { flex: 1; }

    .s-table-wrap { display: none; }
    .s-card-list  { display: flex; flex-direction: column; gap: 10px; }

    .s-modal-box { padding: 20px; }
}

/* ── Loading overlay ── */
@keyframes s-spin {
    to { transform: rotate(360deg); }
}
.s-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(255,255,255,0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    backdrop-filter: blur(2px);
}
.s-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 4px solid #dee2e6;
    border-top-color: #0d6efd;
    animation: s-spin 0.7s linear infinite;
}
.s-loading-overlay p {
    margin: 0;
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}
