/* ── Variables ───────────────────────────────────────── */
:root {
    --c3d-brand:        #13a882;
    --c3d-brand-dark:   #0d8a6b;
    --c3d-brand-deeper: #0a7059;
    --c3d-brand-light:  #e6f7f3;
    --c3d-brand-mid:    #b2e8db;
    --c3d-text:         #1a1a2e;
    --c3d-muted:        #6b7280;
    --c3d-surface:      #ffffff;
    --c3d-bg:           #f5f7f6;
    --c3d-border:       #e2e8e6;
    --c3d-border-mid:   #cbd5d1;
    --c3d-radius:       10px;
    --c3d-radius-lg:    14px;
}

/* ── Fullscreen overlay ──────────────────────────────── */
#calc3d-fullscreen-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: var(--c3d-bg);
    flex-direction: column;
    overflow: hidden;
}
#calc3d-fullscreen-overlay.active { display: flex; }

/* ── Top bar ─────────────────────────────────────────── */
.c3d-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 54px;
    background: var(--c3d-brand);
    color: #fff;
    flex-shrink: 0;
    gap: 12px;
}
.c3d-topbar-left { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.c3d-topbar-left svg { opacity: .9; }
.c3d-plan-badge { font-size: 11px; background: rgba(255,255,255,.2); padding: 2px 10px; border-radius: 99px; font-weight: 400; }
.c3d-topbar-right { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.c3d-topbar-right .c3d-user-name { opacity: .85; }
.c3d-tb-btn { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 5px 14px; border-radius: 7px; font-size: 12px; cursor: pointer; transition: background .15s; }
.c3d-tb-btn:hover { background: rgba(255,255,255,.27); }
.c3d-close-btn { background: rgba(255,255,255,.15); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.c3d-close-btn:hover { background: rgba(255,255,255,.3); }

/* ── Usage ribbon ────────────────────────────────────── */
.c3d-ribbon { display: flex; align-items: center; gap: 12px; padding: 6px 24px; background: var(--c3d-surface); border-bottom: 1px solid var(--c3d-border); font-size: 12px; color: var(--c3d-muted); flex-shrink: 0; }
.c3d-meter { width: 160px; height: 5px; background: #e5e7eb; border-radius: 99px; overflow: hidden; }
.c3d-meter-fill { height: 100%; border-radius: 99px; background: var(--c3d-brand); transition: width .4s; }

/* ── Main layout ─────────────────────────────────────── */
.c3d-body { display: grid; grid-template-columns: 360px 1fr; flex: 1; overflow: hidden; min-height: 0; }

/* ── Sidebar ─────────────────────────────────────────── */
.c3d-sidebar { background: var(--c3d-surface); border-right: 1px solid var(--c3d-border); overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; }
.c3d-section { margin-bottom: 18px; }
.c3d-section-title { font-size: 10px; font-weight: 700; color: var(--c3d-muted); text-transform: uppercase; letter-spacing: .09em; padding-bottom: 7px; margin-bottom: 11px; border-bottom: 1px solid var(--c3d-border); }
.c3d-field { margin-bottom: 10px; }
.c3d-field label { display: block; font-size: 12px; color: var(--c3d-muted); margin-bottom: 3px; font-weight: 500; }
.c3d-field input[type="number"],
.c3d-field input[type="text"],
.c3d-field input[type="email"],
.c3d-field input[type="password"],
.c3d-field select {
    width: 100%;
    border: 1.5px solid var(--c3d-border);
    border-radius: 7px;
    padding: 8px 11px;
    font-size: 14px;
    color: var(--c3d-text);
    background: var(--c3d-surface);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
    -moz-appearance: textfield;
    appearance: auto;
}
.c3d-field input:focus, .c3d-field select:focus { border-color: var(--c3d-brand); box-shadow: 0 0 0 3px rgba(19,168,130,.12); }
.c3d-row  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.c3d-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* Resina custom box */
.c3d-resin-box { background: var(--c3d-brand-light); border: 1px solid var(--c3d-brand-mid); border-radius: 8px; padding: 11px 13px; margin-top: 8px; }
.c3d-resin-box-label { font-size: 11px; font-weight: 700; color: var(--c3d-brand-dark); margin-bottom: 8px; }

/* Calc button */
.c3d-calc-btn { width: 100%; background: var(--c3d-brand); color: #fff; border: none; border-radius: 9px; padding: 13px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 4px; transition: background .15s, transform .1s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.c3d-calc-btn:hover  { background: var(--c3d-brand-dark); }
.c3d-calc-btn:active { transform: scale(.98); }
.c3d-calc-btn:disabled { background: #9ca3af; cursor: not-allowed; transform: none; }

/* ── Results ─────────────────────────────────────────── */
.c3d-results { display: flex; flex-direction: column; overflow: hidden; background: var(--c3d-bg); }

.c3d-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--c3d-surface); border-bottom: 1px solid var(--c3d-border); flex-shrink: 0; }
.c3d-hero-card { padding: 20px 26px; }
.c3d-hero-card.accent { border-left: 3px solid var(--c3d-brand); }
.c3d-hero-label { font-size: 11px; font-weight: 700; color: var(--c3d-muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 5px; }
.c3d-hero-val { font-size: 30px; font-weight: 700; color: var(--c3d-text); line-height: 1.1; }
.c3d-hero-val.brand { color: var(--c3d-brand); }
.c3d-hero-sub { font-size: 12px; color: var(--c3d-muted); margin-top: 3px; }

.c3d-detail { flex: 1; overflow-y: auto; padding: 18px 22px; }
.c3d-detail-title { font-size: 10px; font-weight: 700; color: var(--c3d-muted); text-transform: uppercase; letter-spacing: .09em; margin-bottom: 11px; margin-top: 4px; }
.c3d-cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.c3d-detail-card { background: var(--c3d-surface); border: 1px solid var(--c3d-border); border-radius: 9px; padding: 11px 13px; }
.c3d-detail-card.hl { background: var(--c3d-brand-light); border-color: var(--c3d-brand-mid); }
.c3d-detail-card-label { font-size: 11px; color: var(--c3d-muted); margin-bottom: 3px; }
.c3d-detail-card-val { font-size: 15px; font-weight: 600; color: var(--c3d-text); }
.c3d-detail-card.hl .c3d-detail-card-val { color: var(--c3d-brand-dark); }
.c3d-info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* Empty state */
.c3d-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 14px; color: var(--c3d-muted); text-align: center; padding: 60px 40px; }
.c3d-empty-icon { font-size: 40px; opacity: .3; }
.c3d-empty p { font-size: 14px; max-width: 260px; line-height: 1.7; }

/* ── Export bar ──────────────────────────────────────── */
.c3d-export-bar { border-top: 1px solid var(--c3d-border); padding: 10px 18px; display: flex; align-items: center; gap: 8px; background: var(--c3d-surface); flex-shrink: 0; }
.c3d-export-label { font-size: 12px; color: var(--c3d-muted); margin-right: 2px; }
.c3d-export-btn { display: flex; align-items: center; gap: 6px; background: var(--c3d-surface); border: 1px solid var(--c3d-border-mid); border-radius: 7px; padding: 7px 13px; font-size: 12px; font-weight: 500; color: var(--c3d-text); cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.c3d-export-btn:hover { background: var(--c3d-brand-light); border-color: var(--c3d-brand); color: var(--c3d-brand-dark); }
.c3d-export-btn:disabled { opacity: .4; cursor: not-allowed; }
.c3d-export-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.c3d-new-tag { background: var(--c3d-brand-light); color: var(--c3d-brand-dark); font-size: 10px; padding: 1px 6px; border-radius: 99px; font-weight: 700; }
.c3d-history-btn { margin-left: auto; }

/* ── Launcher button ─────────────────────────────────── */
.calc3d-launcher { display: flex; align-items: center; justify-content: center; padding: 48px 20px; }
.calc3d-open-btn { background: var(--c3d-brand); color: #fff; border: none; border-radius: 12px; padding: 16px 38px; font-size: 16px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: background .15s, transform .1s; box-shadow: 0 4px 22px rgba(19,168,130,.28); }
.calc3d-open-btn:hover  { background: var(--c3d-brand-dark); transform: translateY(-1px); }
.calc3d-open-btn:active { transform: scale(.98); }

/* ── Modals ──────────────────────────────────────────── */
.c3d-modal { position: fixed; inset: 0; background: rgba(0,0,0,.52); z-index: 9999999; display: none; align-items: center; justify-content: center; padding: 20px; }
.c3d-modal.open { display: flex; }
.c3d-modal-box { background: var(--c3d-surface); border-radius: var(--c3d-radius-lg); padding: 32px; width: 100%; max-width: 420px; position: relative; box-shadow: 0 8px 40px rgba(0,0,0,.18); }
.c3d-modal-box h2 { font-size: 20px; font-weight: 700; color: var(--c3d-text); margin-bottom: 6px; }
.c3d-modal-box > p { font-size: 14px; color: var(--c3d-muted); margin-bottom: 18px; line-height: 1.6; }
.c3d-modal-close { position: absolute; top: 14px; right: 14px; background: none; border: none; font-size: 20px; color: var(--c3d-muted); cursor: pointer; line-height: 1; padding: 4px; }
.c3d-modal-close:hover { color: var(--c3d-text); }
.c3d-mfield { margin-bottom: 13px; }
.c3d-mfield label { display: block; font-size: 12px; font-weight: 600; color: var(--c3d-muted); margin-bottom: 4px; }
.c3d-mfield input { width: 100%; border: 1.5px solid var(--c3d-border); border-radius: 8px; padding: 10px 12px; font-size: 14px; outline: none; transition: border-color .15s; box-sizing: border-box; }
.c3d-mfield input:focus { border-color: var(--c3d-brand); }
.c3d-msg { font-size: 13px; padding: 9px 12px; border-radius: 7px; margin-bottom: 12px; display: none; }
.c3d-msg.ok   { background: #ecfdf5; color: #166534; display: block; }
.c3d-msg.fail { background: #fef2f2; color: #991b1b; display: block; }
.c3d-btn-primary { width: 100%; background: var(--c3d-brand); color: #fff; border: none; border-radius: 9px; padding: 12px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.c3d-btn-primary:hover { background: var(--c3d-brand-dark); }
.c3d-btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.c3d-btn-ghost { width: 100%; background: transparent; color: var(--c3d-brand); border: 2px solid var(--c3d-brand); border-radius: 9px; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; margin-top: 9px; }
.c3d-btn-ghost:hover { background: var(--c3d-brand-light); }
.c3d-switch { text-align: center; font-size: 13px; color: var(--c3d-muted); margin-top: 14px; }
.c3d-switch a { color: var(--c3d-brand); text-decoration: none; font-weight: 600; }
.c3d-price-badge { text-align: center; background: var(--c3d-brand-light); border: 1px solid var(--c3d-brand-mid); border-radius: 10px; padding: 14px; margin: 14px 0; }
.c3d-price-badge strong { display: block; font-size: 28px; font-weight: 700; color: var(--c3d-brand-dark); }
.c3d-price-badge span { font-size: 13px; color: var(--c3d-muted); }
.c3d-pix-key-box { display: flex; align-items: center; gap: 10px; background: var(--c3d-bg); border: 1px solid var(--c3d-border); border-radius: 8px; padding: 10px 13px; margin: 10px 0 14px; font-family: monospace; font-size: 13px; word-break: break-all; }
.c3d-pix-key-box span { flex: 1; }
.c3d-copy-btn { background: var(--c3d-brand-light); color: var(--c3d-brand-dark); border: 1px solid var(--c3d-brand-mid); border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.c3d-note { font-size: 12px; color: var(--c3d-muted); text-align: center; margin-top: 10px; line-height: 1.5; }

/* ── Print / export area ─────────────────────────────── */
#c3d-print-area {
    position: fixed;
    left: -9999px; top: 0;
    width: 800px;
    background: #fff;
    padding: 40px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #1a1a2e;
}
.c3d-ph { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 16px; border-bottom: 3px solid #13a882; margin-bottom: 22px; }
.c3d-ph-title  { font-size: 20px; font-weight: 700; color: #13a882; }
.c3d-ph-sub    { font-size: 13px; color: #6b7280; margin-top: 3px; }
.c3d-ph-logo   { font-size: 12px; color: #9ca3af; text-align: right; line-height: 1.7; }
.c3d-phero     { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.c3d-phero-card { background: #f5f7f6; border-left: 4px solid #13a882; padding: 14px 18px; border-radius: 8px; }
.c3d-phero-card label { display: block; font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.c3d-phero-card.brand label { color: #0d8a6b; }
.c3d-phero-card span  { font-size: 24px; font-weight: 700; color: #1a1a2e; }
.c3d-phero-card.brand span { color: #13a882; }
.c3d-pgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.c3d-pitem { background: #f5f7f6; padding: 11px 13px; border-radius: 8px; }
.c3d-pitem label { display: block; font-size: 11px; color: #6b7280; margin-bottom: 3px; }
.c3d-pitem span  { font-size: 15px; font-weight: 600; color: #1a1a2e; }
.c3d-pigrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.c3d-pfoot { border-top: 1px solid #e2e8e6; padding-top: 12px; font-size: 11px; color: #9ca3af; display: flex; justify-content: space-between; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 700px) {
    .c3d-body { grid-template-columns: 1fr; }
    .c3d-sidebar { border-right: none; border-bottom: 1px solid var(--c3d-border); max-height: 55vh; }
    .c3d-cards-grid { grid-template-columns: 1fr 1fr; }
    .c3d-info-grid  { grid-template-columns: 1fr 1fr; }
    .c3d-hero-val   { font-size: 22px; }
    .c3d-topbar-left { font-size: 13px; }
}
