:root {
    --bg-dark: #121212;
    --card-bg: #1A1A1A;
    --input-bg: #111111;
    /* Darker background to contrast with card */
    --border-color: #333333;
    --text-main: #FFFFFF;
    --text-muted: #A0A0A0;
    --accent-yellow: #FFC107;
    --accent-yellow-hover: #FFCA28;
    --danger-red: #D32F2F;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 480px;
    transition: filter 0.3s ease;
}

.app-container.blurred {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* Payment Overlay */
.payment-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 900;
    overflow-y: auto;
    align-items: flex-start;
    justify-content: center;
    padding: 20px 16px;
    box-sizing: border-box;
}

.payment-overlay.active { display: flex; }

.overlay-content {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 20px;
    padding: 36px 32px;
    max-width: 460px;
    width: 92%;
    text-align: center;
    color: #fff;
    margin: auto;
}

.overlay-logo { width: 64px; margin-bottom: 16px; }

.overlay-content h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
    color: #fff;
}

.overlay-content .subtitle {
    color: #999;
    font-size: 14px;
    margin-bottom: 24px;
}

.plan-card {
    background: #111;
    border: 2px solid #FFC107;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 22px;
    text-align: left;
}

.plan-card .plan-name {
    font-size: 16px;
    font-weight: 700;
    color: #FFC107;
    margin-bottom: 4px;
}

.plan-card .plan-price {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 2px;
}

.plan-card .plan-price span {
    font-size: 14px;
    color: #888;
    font-weight: 400;
}

.plan-card .plan-features {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}

.plan-card .plan-features li {
    font-size: 13px;
    color: #ccc;
    padding: 3px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.plan-card .plan-features li::before {
    content: '✓';
    color: #FFC107;
    font-weight: 700;
    flex-shrink: 0;
}

.ep-renew-note {
    background: #181800;
    border: 1px solid #3a3200;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 11px;
    color: #c8a200;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
}

.card-form-section {
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
    text-align: left;
}

.card-form-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: #aaa;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-field-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-field-label {
    font-size: 11px;
    color: #777;
    margin-bottom: 4px;
    display: block;
}

.card-field-wrap {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 11px 13px;
    transition: border-color 0.2s;
}

.card-field-wrap.StripeElement--focus { border-color: #FFC107; }
.card-field-wrap.StripeElement--invalid { border-color: #e74c3c; }

.card-row-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.text-field-wrap {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 11px 13px;
    margin-bottom: 0;
    transition: border-color 0.2s;
}

.text-field-wrap:focus-within { border-color: #FFC107; }

.text-field-wrap input {
    width: 100%;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    box-sizing: border-box;
}

.text-field-wrap input::placeholder { color: #555; }

.pay-btn {
    width: 100%;
    background: #FFC107;
    color: #000;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    font-family: 'Inter', sans-serif;
}

.pay-btn:hover { background: #ffca28; }

.pay-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#card-errors {
    color: var(--danger-red);
    font-size: 13px;
    margin-top: 12px;
    text-align: left;
    font-weight: 500;
    line-height: 1.5;
}

.stripe-badge {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.restore-group {
    margin-top: 20px;
    border-top: 1px solid #2a2a2a;
    padding-top: 18px;
}

.restore-group a {
    color: #FFC107;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}

.restore-group a:hover { text-decoration: underline; }

.restore-form {
    display: none;
    margin-top: 14px;
    text-align: left;
}

.restore-form.visible { display: block; }

.restore-form label {
    font-size: 12px;
    color: #888;
    display: block;
    margin-bottom: 4px;
    margin-top: 10px;
}

.restore-form input {
    width: 100%;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    padding: 9px 12px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

.restore-form input:focus {
    outline: none;
    border-color: #FFC107;
}

.restore-btn {
    width: 100%;
    margin-top: 12px;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 900;
    padding: 20px;
}

.success-overlay.active { display: flex; }

.success-content {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 20px;
    padding: 36px 32px;
    max-width: 460px;
    width: 92%;
    text-align: center;
    color: #fff;
}

.success-icon { font-size: 64px; color: #4CAF50; margin-bottom: 20px; }

.success-detail-box {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
}

.success-detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}

.success-detail-row span:first-child { color: #888; }
.success-detail-row span:last-child { color: #fff; font-weight: 600; }

.success-go-btn {
    background-color: #FFC107;
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 16px;
    width: 100%;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ep-session-bar {
    display: none;
    background: #1a1500;
    border-bottom: 1px solid #FFC107;
    padding: 8px 16px;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    width: 100%;
}

.ep-session-bar.ep-active { display: flex; }

.ep-logout, .ep-cancel-sub {
    background: transparent;
    border: none;
    color: #FFC107;
    text-decoration: underline;
    cursor: pointer;
    font-size: 12px;
}
.ep-my-account {
    color: #FFC107;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s;
}
.ep-my-account:hover { opacity: 0.8; color: #FFC107; }

#restore-link {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

#restore-link:hover {
    color: var(--accent-yellow);
}

.ep-session-bar {
    display: none;
    background: #0b1f0b;
    border: 1px solid #1a4d1a;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    color: #5cb85c;
    margin-bottom: 12px;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.ep-session-bar.ep-active { display: flex; }

.ep-session-bar i { color: #5cb85c; font-size: 16px; }

.ep-session-bar .ep-logout, .ep-session-bar .ep-cancel-sub {
    color: #5cb85c;
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    margin-left: 10px;
}

.ep-session-bar .ep-logout { margin-left: auto; color: #555; }
.ep-session-bar .ep-cancel-sub { color: #e74c3c; }
.ep-session-bar .ep-cancel-sub:hover { color: #c0392b; }

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding: 0 4px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-right-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.currency-selector-wrap {
    position: relative;
}

.currency-selector-wrap select {
    background: #2a2a2a;
    border: 1px solid #FFC107;
    color: #FFC107;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 28px 6px 10px;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    min-width: 90px;
}

.currency-selector-wrap::after {
    content: '▾';
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #FFC107;
    pointer-events: none;
    font-size: 12px;
}
.header-titles h1 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.1;
    color: #fff;
}

.header-titles h2 {
    font-size: 18px;
    font-weight: 700;
    color: #FFC107;
    line-height: 1.1;
}

.save-btn {
    background: transparent;
    border: none;
    color: #FFC107;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.save-btn:hover {
    color: var(--accent-yellow-hover);
}

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 3px;
    /* Tighter gap between cards like client design */
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 8px 16px;
    /* Reduced bottom padding */
}

.card-instruction {
    padding: 0 16px 12px 16px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.section-desc {
    padding: 0 16px 12px 16px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.number-badge {
    background-color: var(--accent-yellow);
    color: #000;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.header-title-group h3 {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.header-icon {
    color: var(--text-muted);
    font-size: 16px;
}

.add-btn {
    background: transparent;
    border: none;
    color: var(--accent-yellow);
    font-size: 10px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.labour-btns {
    display: flex;
    gap: 12px;
}

.inline-add-btn {
    padding: 12px 16px;
    margin-bottom: 4px;
}

.table-headers {
    display: grid;
    padding: 0 16px 8px 16px;
    font-size: 11px;
    /* Smaller font size like client design */
    color: var(--text-muted);
}

.labour-grid {
    grid-template-columns: 24px 2fr 1.1fr 1.1fr 1fr 28px;
    /* Adjusted to allow wrap and match client */
    gap: 8px;
    align-items: center;
}

.admin-grid {
    grid-template-columns: 1fr 1fr;
}

.running-costs-grid {
    grid-template-columns: 1fr 1fr;
}

.materials-grid {
    grid-template-columns: 1fr 1fr;
}

.extras-grid {
    grid-template-columns: 2fr 1fr 32px;
    gap: 8px;
}

.item-row {
    display: grid;
    padding: 0 16px 10px 16px;
    /* Tighter padding below rows */
    gap: 8px;
    align-items: center;
}

.drag-icon {
    color: var(--text-muted);
    font-size: 20px;
    cursor: grab;
}

select,
input {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid #2a2a2a;
    /* More subtle border */
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
    height: 40px;
    /* Reduced height to match client */
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22%23FFFFFF%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpolyline%20points%3D%226%209%2012%2015%2018%209%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 8px top 50%;
    background-size: 16px;
    padding-right: 28px;
}

select:focus,
input:focus {
    border-color: var(--accent-yellow);
}

.item-total {
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    padding-left: 2px;
}

.delete-btn {
    background: transparent;
    border: none;
    color: var(--danger-red);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.card-footer {
    padding: 8px 0;
    margin: 0 16px;
    border-top: 1px solid #2a2a2a;
    /* Fixed to 1px and aligned with text */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.footer-value {
    font-size: 18px;
    /* Larger total numbers like client design */
    font-weight: 700;
}

.highlight {
    color: var(--accent-yellow);
}

/* Input Grids */
.input-grid {
    display: grid;
    padding: 0 16px 12px 16px;
    /* Reduced bottom padding */
    gap: 12px;
    /* Tighter gap */
}

.input-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    min-height: 28px; /* Ensures labels take same space even if they wrap */
    line-height: 1.2;
}

.label-icon {
    font-size: 14px;
}

.input-with-icon,
.input-with-suffix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    right: 12px;
    color: var(--text-muted);
    font-size: 16px;
}

.input-with-suffix .suffix {
    position: absolute;
    right: 12px;
    color: var(--text-main);
    font-size: 13px;
}

.input-with-icon input,
.input-with-suffix input {
    padding-right: 32px;
}

.info-text {
    font-size: 11px;
    color: var(--accent-yellow);
    display: flex;
    align-items: center;
    line-height: 1.4;
}

.profit-container {
    display: flex;
    padding: 0 16px 16px 16px;
    gap: 16px;
    align-items: flex-end;
}

.vat-container {
    display: flex;
    padding: 0 16px 16px 16px;
    gap: 16px;
    align-items: center;
}

.profit-input-group {
    flex: 1;
}

.profit-amount-box,
.vat-amount-box {
    flex: 1;
    background-color: var(--input-bg);
    border: none;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 66px;
    /* Exactly matches the left side height */
}

.box-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
    /* Tighter gap between label and value */
}

.box-value {
    font-size: 20px;
    /* Larger, like client design */
    font-weight: 700;
    line-height: 1.2;
}

/* Toggle Switch */
.toggle-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toggle-group-inline {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-group label:first-child,
.toggle-group-inline label:first-child {
    font-size: 13px;
    color: var(--text-muted);
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent-yellow);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Summary Section */
.summary-section {
    padding: 12px 16px;
    /* Reduced vertical padding */
    margin-bottom: 8px;
    /* Small gap before final price */
}

.summary-section h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #aba5a5;
    margin-bottom: 4px;
}

.summary-row span:last-child {
    color: #aba5a5;
}

.subtotal-row {
    margin-top: 8px;
    padding-top: 8px;
    font-size: 13px;
    color: #aba5a5;
    border-top: 1px solid var(--border-color);
}

.subtotal-row span:last-child {
    font-weight: normal;
    /* Client design doesn't seem to make values bold here */
}

.profit-row {
    margin-bottom: 8px;
}

.profit-row span,
.vat-row span {
    color: #aba5a5;
}

.profit-row span:last-child,
.vat-row span:last-child {
    color:#aba5a5;
}

/* Final Price */
.final-price-section {
    background-color: transparent;
    border: 1px solid var(--accent-yellow);
    color: var(--accent-yellow);
    border-radius: 4px;
    padding: 2px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    margin-top: 16px;
    /* Space from the VAT row */
}

.final-price-section span:first-child {
    font-size: 16px;
}

.final-price-section span:last-child {
    font-size: 24px;
}.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

.pwa-install-btn {
    position: fixed;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #FFC107 !important;
    color: #000 !important;
    border: none;
    border-radius: 50px;
    padding: 8px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    z-index: 900;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    white-space: nowrap;
    min-width: 180px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { opacity: 0; transform: translate(-50%, 100px); }
    60% { opacity: 1; transform: translate(-50%, -10px); }
    100% { transform: translate(-50%, 0); }
}

.pwa-install-btn:hover {
    background-color: #ffca28 !important;
    transform: translate(-50%, -5px) scale(1.05);
}

.pwa-install-btn i {
    font-size: 22px;
}

@media (max-width: 480px) {
    .pwa-install-btn {
        width: 90%;
        max-width: 320px;
        bottom: 20px;
    }
}
}
