@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700&display=swap');

:root {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --primary: #123d6d;
    --accent: #4fb477;
    --text: #0f172a;
    --muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    background: radial-gradient(circle at 10% 20%, rgba(79,180,119,0.08), transparent 30%),
                radial-gradient(circle at 80% 0%, rgba(18,61,109,0.08), transparent 25%),
                var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.copyright-bar {
    background: #0f172a;
    color: #fff;
    padding: 8px 24px;
    text-align: center;
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.copyright-bar p {
    margin: 0;
    opacity: 0.8;
}

.page {
    max-width: 1200px;
    padding: 40px 24px 80px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

h1 {
    margin: 0 0 8px;
    font-size: 36px;
    letter-spacing: -0.02em;
}

h2 {
    margin: 0;
}

h3 { margin: 0; }

h4 { margin: 0 0 8px; }

p { margin: 0; }

.lede {
    max-width: 620px;
    color: var(--muted);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 12px;
    color: var(--accent);
    margin: 0 0 6px;
    font-weight: 700;
}

.badge {
    background: #0f172a;
    color: #fff;
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    box-shadow: var(--shadow);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    align-items: end;
}

.form-grid .full { grid-column: 1 / -1; }

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

input, textarea, button {
    width: 100%;
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    background: #fff;
    transition: border 0.2s ease, box-shadow 0.2s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 180, 119, 0.15);
}

button {
    background: linear-gradient(135deg, var(--primary), #0b2d52);
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.01em;
}

button:hover { opacity: 0.95; }
button:active { transform: translateY(1px); }

.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.danger:hover { opacity: 0.93; }

.delete-customer-form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    border: 1px dashed #fecdd3;
    border-radius: 12px;
    background: #fff5f5;
    overflow: hidden;
}

.delete-confirm {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #b91c1c;
    cursor: pointer;
    margin: 0;
    order: 2;
    padding-right: 12px;
}

.delete-confirm input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.delete-confirm span {
    user-select: none;
}

.trash-btn {
    font-size: 16px;
    padding: 12px 20px;
    width: auto;
    white-space: nowrap;
    order: 1;
    flex: 1;
    border-radius: 11px 0 0 11px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.trash-btn::before {
    content: '🗑️';
    font-size: 18px;
}

.danger-zone {
    border: 1px dashed #fecdd3;
    padding: 12px;
    border-radius: 12px;
    background: #fff5f5;
}

.stack { display: flex; flex-direction: column; gap: 10px; }

.upload-card {
    border: 2px dashed var(--accent);
    border-radius: 12px;
    padding: 16px;
    background: rgba(79, 180, 119, 0.05);
}

.upload-card label {
    color: var(--accent);
    font-weight: 700;
}

.note-card {
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 16px;
    background: rgba(18, 61, 109, 0.05);
}

.note-card label {
    color: var(--primary);
    font-weight: 700;
}

.customer-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.customer {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 30px rgba(15,23,42,0.06);
    overflow: hidden;
    scroll-margin-top: 20px;
}

.customer-toggle {
    width: 100%;
    border: none;
    background: rgba(18, 61, 109, 0.25);
    color: inherit;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease;
}

.customer-toggle:hover { background: rgba(18, 61, 109, 0.32); }

.customer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

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

.tag {
    background: rgba(79, 180, 119, 0.15);
    color: #166534;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    transform: translateY(3px);
}

.chevron {
    display: inline-block;
    font-weight: 700;
    transform: rotate(90deg);
    transition: transform 0.2s ease;
}

.customer.open .chevron { transform: rotate(270deg); }

.customer-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
}

.customer-body[hidden] { display: none; }

.customer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.customer-meta .tags {
    justify-content: flex-end;
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.inline-form button {
    width: auto;
    padding: 8px 12px;
}

.pill {
    border-radius: 999px;
    font-size: 12px;
}

.files ul, .notes ul { list-style: none; padding: 0; margin: 0; }
.files li, .notes li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.files li:last-child, .notes li:last-child { border-bottom: none; }

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.file-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    background: #fff;
    transition: box-shadow 0.2s ease;
}

.file-card:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.file-preview {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 1px solid var(--border);
}

.file-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #0b2d52);
    color: #fff;
}

.file-ext {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
}

.file-name {
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-name:hover {
    text-decoration: underline;
}

.file-card .muted {
    font-size: 11px;
}

.file-card .inline-form {
    margin-top: auto;
}

.file-card .inline-form button {
    width: 100%;
    padding: 6px 10px;
    font-size: 11px;
}

.files a { color: var(--primary); font-weight: 600; text-decoration: none; }
.files a:hover { text-decoration: underline; }

.notes li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.notes li:last-child { border-bottom: none; }

.muted { color: var(--muted); font-size: 14px; }

.files .muted, .notes .muted {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 8px;
    display: inline-block;
}

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

.alert.success { background: #e7f8ef; color: #166534; }
.alert.error { background: #fdecec; color: #b91c1c; }

.toast-stack {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 240px;
    max-width: 320px;
    padding: 14px 16px;
    border-radius: 12px;
    color: #fff;
    font-weight: 700;
    box-shadow: var(--shadow);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.toast.success { background: #22c55e; }
.toast.error { background: #ef4444; }

.toast.hide {
    opacity: 0;
    transform: translateY(8px);
}

.filter input {
    width: 220px;
}

@media (max-width: 700px) {
    header { flex-direction: column; }
    .panel-head { flex-direction: column; align-items: flex-start; }
    .filter input { width: 100%; }
    
    h1 { font-size: 28px; }
    
    .page { padding: 20px 16px 60px; }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .file-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .customer-toggle {
        padding: 14px;
    }
    
    .customer-body {
        padding: 0 14px 14px;
    }
    
    .customer-head h3 {
        font-size: 16px;
    }
    
    .tags {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .customer-meta {
        flex-direction: column;
        align-items: flex-start;
    }
    
    input, textarea, button {
        font-size: 16px;
    }
    
    .item-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .inline-form {
        width: 100%;
    }
    
    .inline-form button {
        width: 100%;
    }
    
    .delete-customer-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .trash-btn {
        width: 100%;
    }
}
