/* App-specific layout for KCA. */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app main {
    flex: 1 0 auto;
}

.app-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1080;
    background: var(--danger);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
    max-width: 40rem;
}

.app-toast.success {
    background: #15803d;
}

.page-shell {
    max-width: 1240px;
}

.avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex: 0 0 auto;
}

.vault-card {
    height: 100%;
}

.stat-number {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.item-name {
    font-weight: 600;
}

.item-sub {
    color: var(--muted);
    font-size: 0.85rem;
    word-break: break-word;
}

.cert-tree {
    list-style: none;
    margin: 0;
    padding-left: 1.1rem;
}

.cert-tree > li {
    border-left: 1px dashed var(--line);
    padding-left: 0.8rem;
    margin: 0.15rem 0;
}

.cert-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.25rem 0.35rem;
    border-radius: 6px;
}

.cert-row:hover {
    background: rgba(94, 234, 212, 0.06);
}

.cert-row .item-name a {
    text-decoration: none;
}

details.cert-node > summary {
    cursor: pointer;
    list-style: none;
}

details.cert-node > summary::-webkit-details-marker {
    display: none;
}

details.cert-node > summary::before {
    content: "▸";
    color: var(--accent);
    display: inline-block;
    width: 1rem;
}

details.cert-node[open] > summary::before {
    content: "▾";
}

.tab-pane {
    padding-top: 1rem;
}

.dn-table td,
.dn-table th,
.ext-table td,
.ext-table th {
    vertical-align: top;
}

.fingerprint {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.78rem;
    word-break: break-all;
}

.extension-value {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.form-section {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(0, 0, 0, 0.08);
}

.form-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.dn-row,
.san-row,
.raw-row {
    display: grid;
    gap: 0.5rem;
    align-items: start;
    margin-bottom: 0.5rem;
}

.dn-row {
    grid-template-columns: 12rem 1fr auto;
}

.san-row {
    grid-template-columns: 11rem 1fr auto;
}

.raw-row {
    grid-template-columns: 14rem 5rem 1fr auto;
}

.extension-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.35rem 1rem;
}

.wizard-nav {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.wizard-nav button {
    min-width: 7rem;
}

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

.import-preview {
    max-height: 24rem;
    overflow: auto;
}

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

.truncate {
    max-width: 28rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spinner-border.text-warning {
    color: var(--accent) !important;
}

@media (max-width: 576px) {
    .dn-row,
    .san-row,
    .raw-row {
        grid-template-columns: 1fr;
    }
    .truncate {
        max-width: 14rem;
    }
}
