:root {
    --text: #111827;
    --muted: #6b7280;
    --border: #d1d5db;
    --soft: #f8fafc;
    --brand: #111827;
    --accent: #eef2ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px;
    color: var(--text);
    background: #fff;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.apd-sheet {
    max-width: 1100px;
    margin: 0 auto;
}

.apd-sheet__bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--brand);
}

.apd-sheet__title {
    margin: 0;
    font-size: 28px;
    line-height: 1.1;
}

.apd-sheet__subtitle {
    margin: 6px 0 0;
    color: var(--muted);
}

.apd-sheet__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.apd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    background: #fff;
    font-weight: 600;
    text-decoration: none;
}

.apd-btn--dark {
    border-color: var(--brand);
    color: #fff;
    background: var(--brand);
}

.apd-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.apd-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 20px;
}

.apd-card {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.apd-card h2,
.apd-card h3 {
    margin: 0 0 12px;
}

.apd-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.apd-kpi {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
}

.apd-kpi__label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.apd-kpi__value {
    display: block;
    margin-top: 6px;
    font-size: 20px;
    font-weight: 700;
}

.apd-meta {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 10px 14px;
    margin: 0;
}

.apd-meta dt {
    font-weight: 700;
}

.apd-meta dd {
    margin: 0;
}

.apd-preview {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, #f8fafc);
}

.apd-preview img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.apd-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.apd-list {
    margin: 0;
    padding-left: 18px;
}

.apd-list li {
    margin: 0 0 8px;
}

.apd-table {
    width: 100%;
    border-collapse: collapse;
}

.apd-table th,
.apd-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.apd-table th {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.apd-rule {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--soft);
}

.apd-rule__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.apd-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.apd-check {
    min-height: 72px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 12px;
}

.apd-note {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid #fde68a;
    border-radius: 12px;
    background: #fffbeb;
}

@media print {
    body {
        padding: 0;
    }

    .apd-sheet {
        max-width: none;
    }

    .apd-sheet__actions {
        display: none;
    }

    .apd-card,
    .apd-kpi,
    .apd-preview,
    .apd-rule,
    .apd-check {
        break-inside: avoid;
    }

    .apd-card {
        border-color: #c7c7c7;
    }
}

@media (max-width: 960px) {
    .apd-grid,
    .apd-section-grid,
    .apd-kpis,
    .apd-checks {
        grid-template-columns: 1fr;
    }

    .apd-meta {
        grid-template-columns: 1fr;
    }
}
