@view-transition {
    navigation: auto;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: #f5f5f5;
}

/* ── Header ──────────────────────────────────────────── */

header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 2rem;
}

header nav a {
    font-weight: 600;
    font-size: 1.25rem;
    color: #1a1a1a;
    text-decoration: none;
}

/* ── Main ────────────────────────────────────────────── */

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

main h1 {
    margin-bottom: 1.5rem;
}

/* ── Cards grid ──────────────────────────────────────── */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.card {
    display: block;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.card:hover {
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.card-number {
    font-weight: 600;
    font-size: 0.95rem;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-client {
    font-size: 1.05rem;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    color: #666;
    font-size: 0.9rem;
}

.card-amount {
    font-weight: 600;
    color: #1a1a1a;
}

/* ── Badge ───────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge.signed {
    background: #d4edda;
    color: #155724;
}

.badge.pending {
    background: #fff3cd;
    color: #856404;
}

/* ── Back link ───────────────────────────────────────── */

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: #555;
    text-decoration: none;
    font-size: 0.95rem;
}

.back-link:hover {
    color: #1a1a1a;
}

/* ── Detail page ─────────────────────────────────────── */

.detail-card {
    position: relative;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
}

.detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.detail-header h1 {
    margin-bottom: 0;
}

.detail-header .badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.detail-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.detail-label {
    color: #666;
    font-weight: 500;
}

.detail-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.detail-items {
    margin-top: 1.5rem;
    overflow-x: auto;
}

.detail-items h3 {
    margin-bottom: 0.75rem;
}

.detail-items table {
    width: 100%;
    border-collapse: collapse;
}

.detail-items th,
.detail-items td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #eee;
}

.detail-items th {
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.detail-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* ── Sign page ───────────────────────────────────────── */

.sign-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 2rem;
}

.sign-subtitle {
    color: #666;
    margin-bottom: 2rem;
}

.sign-area {
    margin-bottom: 2rem;
}

.sign-area-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sign-label {
    font-weight: 500;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}

.sign-canvas {
    width: 100%;
    height: 120px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    background: #fafafa;
    touch-action: none;
    cursor: crosshair;
}

@media (min-width: 600px) {
    .sign-canvas {
        height: 200px;
    }
}

.sign-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

/* ── Share options ────────────────────────────────────── */

.share-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.share-option:hover {
    border-color: #999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.share-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 2.5rem;
    text-align: center;
}

.share-option-title {
    font-weight: 600;
    display: block;
}

.share-option-desc {
    font-size: 0.85rem;
    color: #666;
    display: block;
}

/* ── Signature image ─────────────────────────────────── */

.detail-signature {
    margin-top: 1.5rem;
}

.detail-signature h3 {
    margin-bottom: 0.75rem;
}

.signature-img {
    max-width: 100%;
    height: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #fafafa;
}

/* ── Buttons ─────────────────────────────────────────── */

.btn {
    display: inline-block;
    padding: 0.65rem 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s;
}

.btn-primary {
    background: #1a1a1a;
    color: #fff;
}

.btn-primary:hover {
    background: #333;
}

.btn-outline {
    background: transparent;
    color: #555;
    border: 1px solid #ccc;
}

.btn-outline:hover {
    background: #f0f0f0;
}
