* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f3f4f6;
    color: #111;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.page-header {
    margin-bottom: 32px;
}
.page-header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.page-header p {
    color: #6b7280;
    margin-top: 6px;
    font-size: 14px;
}

.layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 32px;
    align-items: start;
}

@media (max-width: 960px) {
    .layout { grid-template-columns: 1fr; }
}

/* ---------- Controls ---------- */
.controls {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.control-group {
    padding: 14px 0;
    border-bottom: 1px solid #f3f4f6;
}
.control-group:last-child { border-bottom: 0; }

.control-group h2 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 10px;
}

.controls label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 12px;
}
.controls input[type="text"],
.controls textarea {
    width: 100%;
    margin-top: 6px;
    padding: 9px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    background: #fafafa;
    color: #111;
    resize: vertical;
}
.controls input[type="text"]:focus,
.controls textarea:focus {
    outline: none;
    border-color: #2d6cdf;
    background: #fff;
}
.controls input[type="file"] {
    display: block;
    margin-top: 6px;
    font-size: 12px;
}

.small-btn {
    margin-top: 6px;
    font-size: 11px;
    padding: 5px 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
    color: #374151;
}
.small-btn:hover { background: #f9fafb; }

.primary-btn {
    width: 100%;
    padding: 12px;
    background: #2d6cdf;
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.primary-btn:hover { background: #245ac0; }

.secondary-btn {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    background: #fff;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}
.secondary-btn:hover { background: #f9fafb; }

.hint { margin-top: 10px; font-size: 12px; color: #6b7280; text-align: center; }
.slug-hint { text-align: left; margin-top: -4px; margin-bottom: 12px; }
.slug-hint code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #1f2937;
}
.file-name {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: #6b7280;
    word-break: break-all;
}

/* ---------- Preview ---------- */
.preview-wrap {
    display: flex;
    justify-content: center;
}

.comparison {
    background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
    padding: 48px 40px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 28px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.side {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.side-label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #1f2937;
    margin-bottom: 16px;
    padding: 6px 14px;
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.side-label-right {
    background: #2d6cdf;
    color: #fff;
}

.vs {
    font-size: 18px;
    font-weight: 700;
    color: #9ca3af;
    letter-spacing: 0.1em;
    padding: 8px 14px;
    background: #fff;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ---------- Phone frame (iOS dark) ---------- */
.phone {
    width: 320px;
    height: 660px;
    background: #111;
    border-radius: 44px;
    padding: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25), 0 0 0 2px #1d1d1f;
    position: relative;
}
.phone-notch {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 96px;
    height: 26px;
    background: #000;
    border-radius: 999px;
    z-index: 5;
}
.phone-screen {
    width: 100%;
    height: 100%;
    background: #000;
    color: #fff;
    border-radius: 36px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    font-size: 14px;
}

/* Status bar */
.status-bar {
    height: 50px;
    padding: 16px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}
.status-left {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.status-moon {
    width: 13px;
    height: 13px;
    color: #fff;
    opacity: 0.95;
}
.status-icons { display: flex; gap: 6px; align-items: center; }
.signal-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 10px;
}
.signal-bars i {
    width: 3px;
    background: #fff;
    border-radius: 1px;
    display: block;
}
.signal-bars i:nth-child(1) { height: 4px; }
.signal-bars i:nth-child(2) { height: 6px; }
.signal-bars i:nth-child(3) { height: 8px; }
.signal-bars i:nth-child(4) { height: 10px; opacity: 0.4; }
.wifi-icon { width: 16px; height: 12px; color: #fff; }

.battery-pill {
    width: 28px;
    height: 13px;
    border: 1px solid rgba(255,255,255,0.45);
    border-radius: 4px;
    position: relative;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.battery-pill::before {
    content: '';
    position: absolute;
    inset: 1.5px;
    background: #34d158;
    border-radius: 2px;
}
.battery-pill::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 3.5px;
    width: 2px;
    height: 4px;
    background: rgba(255,255,255,0.45);
    border-radius: 0 1px 1px 0;
}
.battery-text {
    position: relative;
    z-index: 1;
    font-size: 8px;
    font-weight: 700;
    color: #000;
    line-height: 1;
}
.battery-bolt {
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 12px;
    z-index: 2;
}
.battery-bolt::before {
    content: '';
    position: absolute;
    inset: 0;
    background: #fff;
    clip-path: polygon(55% 0, 0 60%, 38% 60%, 25% 100%, 80% 35%, 45% 35%);
}

/* Chat header */
.chat-header-ios {
    padding: 4px 14px 8px;
    display: grid;
    grid-template-columns: 44px 1fr 36px;
    align-items: start;
    gap: 4px;
    background: #000;
    position: relative;
    min-height: 96px;
}
.back-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: #fff;
    justify-self: start;
    align-self: center;
    padding: 4px 6px 4px 2px;
    background: #1c1c1e;
    border-radius: 999px;
    height: 30px;
    margin-top: 6px;
}
.back-arrow {
    font-size: 20px;
    line-height: 1;
    font-weight: 500;
    color: #fff;
    padding: 0 4px;
}
.back-count {
    display: inline-block;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #fff;
    color: #000;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

.chat-peer-col {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 0;
    padding-top: 0;
}

.avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #3a3a3c;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}
.avatar-sms {
    background: #555;
}
.avatar-sms svg {
    width: 38px;
    height: 38px;
    color: #d1d1d6;
}
.avatar-imsg {
    background: #3a3a3c;
    font-size: 18px;
    font-weight: 600;
    color: #ebebf0;
}
.avatar-imsg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.peer-name-large {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    padding: 4px 12px;
    background: #1c1c1e;
    border-radius: 999px;
    white-space: nowrap;
    margin-top: -8px;
    position: relative;
    z-index: 2;
}

.header-action {
    grid-column: 3;
    align-self: center;
    margin-top: 6px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #1c1c1e;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.header-action svg {
    width: 16px;
    height: 12px;
}

/* Message meta (type + date) */
.message-meta {
    padding: 4px 12px 8px;
    text-align: center;
    background: #000;
}
.message-type {
    font-size: 11px;
    color: #8e8e93;
    font-weight: 400;
}
.message-date {
    font-size: 11px;
    color: #8e8e93;
    font-weight: 600;
    margin-top: 1px;
}

/* Messages */
.messages {
    flex: 1;
    padding: 4px 12px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #000;
}

.bubble {
    max-width: 78%;
    padding: 9px 15px 10px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.3;
    word-wrap: break-word;
    white-space: pre-wrap;
    color: #fff;
    background: #2c2c2e;
    position: relative;
    letter-spacing: -0.01em;
}
.bubble-group + .bubble-group { margin-top: 4px; }

.bubble-sms,
.bubble-imsg {
    align-self: flex-start;
    background: #2c2c2e;
    color: #fff;
    border-bottom-left-radius: 5px;
    margin-left: 6px;
}

/* iOS-style tail on incoming bubbles */
.bubble-sms::before,
.bubble-imsg::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -7px;
    width: 14px;
    height: 16px;
    background: #2c2c2e;
    border-bottom-right-radius: 14px;
    z-index: -1;
}
.bubble-sms::after,
.bubble-imsg::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -10px;
    width: 10px;
    height: 16px;
    background: #000;
    border-bottom-right-radius: 10px;
    z-index: -1;
}

/* Blue-looking "links" in bubbles */
.bubble a,
.bubble .link { color: #0a84ff; text-decoration: underline; }

/* Spam footer (SMS side only) */
.spam-footer {
    padding: 14px 16px 12px;
    background: #000;
    text-align: center;
}
.spam-notice {
    font-size: 12px;
    color: #8e8e93;
    line-height: 1.35;
    margin-bottom: 10px;
    padding: 0 8px;
}
.spam-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}
.spam-btn {
    flex: 1;
    padding: 12px 0;
    border-radius: 999px;
    border: 0;
    background: #1c1c1e;
    font-size: 15px;
    font-weight: 500;
    cursor: default;
    font-family: inherit;
}
.spam-btn-delete { color: #ff453a; }
.spam-btn-known { color: #0a84ff; }

/* Input bar */
.input-bar {
    padding: 8px 12px 18px;
    background: #000;
}
.input-bar-ios {
    display: flex;
    align-items: center;
    gap: 8px;
}
.input-plus {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1c1c1e;
    color: #8e8e93;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 300;
    flex-shrink: 0;
    line-height: 1;
}
.input-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 8px 14px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    font-size: 14px;
    color: #8e8e93;
    min-height: 32px;
    position: relative;
}
.input-mic {
    width: 14px;
    height: 16px;
    position: relative;
    flex-shrink: 0;
    display: inline-block;
    background:
        radial-gradient(ellipse 5px 7px at 50% 35%, #8e8e93 50%, transparent 51%) no-repeat,
        linear-gradient(#8e8e93, #8e8e93) no-repeat 50% 78% / 8px 1.5px,
        linear-gradient(#8e8e93, #8e8e93) no-repeat 50% 100% / 1.5px 4px;
}
.input-placeholder::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 16px;
    margin-left: 8px;
    background:
        radial-gradient(ellipse 5px 7px at 50% 35%, #8e8e93 50%, transparent 51%) no-repeat,
        linear-gradient(#8e8e93, #8e8e93) no-repeat 50% 78% / 8px 1.5px,
        linear-gradient(#8e8e93, #8e8e93) no-repeat 50% 100% / 1.5px 4px;
}
.input-mic { display: none; }

/* ---------- Proposal page ---------- */
.proposal-body {
    background: #fafafa;
}

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

.not-found {
    max-width: 520px;
    margin: 80px auto;
    text-align: center;
    background: #fff;
    padding: 40px 28px;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
.not-found h1 { font-size: 22px; margin-bottom: 10px; }
.not-found p { color: #6b7280; margin-bottom: 20px; font-size: 14px; }

.proposal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}
.proposal-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}
.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: 600;
    font-size: 20px;
    color: #4b5563;
    flex-shrink: 0;
}
.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.proposal-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    margin-bottom: 2px;
}
.proposal-client-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.proposal-edit-link {
    font-size: 13px;
    color: #2d6cdf;
    text-decoration: none;
    font-weight: 500;
}
.proposal-edit-link:hover { text-decoration: underline; }

.proposal-section {
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.section-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #2d6cdf;
    margin-bottom: 8px;
}
.proposal-section h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
    margin-bottom: 12px;
}
.section-lead {
    font-size: 16px;
    color: #4b5563;
    line-height: 1.5;
    max-width: 720px;
}

.comparison-section {
    display: flex;
    justify-content: center;
    padding: 32px 16px;
}

.invoice-section { text-align: left; }
.invoice-wrap {
    margin-top: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #fafafa;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.invoice-image {
    width: 100%;
    height: auto;
    display: block;
}
.invoice-pdf {
    width: 100%;
    height: 720px;
    border: 0;
    display: block;
}
.invoice-section .secondary-btn {
    width: auto;
    margin-top: 16px;
    padding: 10px 18px;
}

.proposal-footer {
    text-align: center;
    padding: 24px;
    color: #6b7280;
    font-size: 13px;
}
.proposal-footer a { color: #2d6cdf; text-decoration: none; }
.proposal-footer a:hover { text-decoration: underline; }

@media (max-width: 720px) {
    .comparison { flex-direction: column; padding: 32px 20px; gap: 16px; }
    .vs { align-self: center; }
    .proposal-section { padding: 28px 20px; }
    .proposal-section h2 { font-size: 22px; }
    .proposal-header { flex-direction: column; gap: 16px; align-items: flex-start; }
}
