/* calculators.css – shared look for every CleanPDF calculator (form on the left, live answer on the right) */
.calc-shell { max-width: 1080px; margin: 0 auto 1.6rem; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; padding: 0 16px; box-sizing: border-box; }
.calc-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12); }
.calc-form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.calc-form h2 { margin: 0; font-size: 1.05rem; color: #1a202c; }
.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.calc-grid .wide, .calc-field.wide { grid-column: 1 / -1; }
.calc-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.calc-field[hidden], .calc-grid[hidden], .calc-group[hidden] { display: none !important; }
.calc-field > label, .calc-field > .calc-lab { font-size: .86rem; font-weight: 600; color: #2d3748; }
.calc-field small { font-size: .78rem; color: #718096; line-height: 1.4; }
.calc-in { position: relative; display: flex; align-items: stretch; border: 1px solid #cbd5e0; border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.calc-in:focus-within { border-color: #3666d1; box-shadow: 0 0 0 3px rgba(54, 102, 209, .15); }
.calc-in input, .calc-in select, .calc-form select.calc-sel, .calc-form textarea { flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 0; background: transparent; font: inherit; font-size: 1rem; color: #1a202c; border-radius: 10px; outline: none; }
.calc-form select.calc-sel { border: 1px solid #cbd5e0; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%234a5568' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; -webkit-appearance: none; appearance: none; padding-right: 34px; min-height: 44px; box-sizing: border-box; width: 100%; text-overflow: ellipsis; }
.calc-form select.calc-sel:focus { border-color: #3666d1; box-shadow: 0 0 0 3px rgba(54, 102, 209, .15); }
.calc-form textarea { height: auto; min-height: 120px; padding: 10px 12px; border: 1px solid #cbd5e0; resize: vertical; line-height: 1.5; }
.calc-form textarea:focus { border-color: #3666d1; box-shadow: 0 0 0 3px rgba(54, 102, 209, .15); }
.calc-in .u { display: flex; align-items: center; padding: 0 12px; font-size: .88rem; font-weight: 600; color: #4a5568; background: #f7fafc; border-left: 1px solid #e2e8f0; border-radius: 0 10px 10px 0; white-space: nowrap; }
.calc-in .u.pre { order: -1; border-left: 0; border-right: 1px solid #e2e8f0; border-radius: 10px 0 0 10px; }
.calc-in input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.calc-in input::-webkit-outer-spin-button, .calc-in input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.calc-seg label { position: relative; flex: 1 1 auto; }
.calc-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.calc-seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 6px 12px; border: 1px solid #cbd5e0; border-radius: 10px; font-size: .88rem; font-weight: 600; color: #2d3748; background: #fff; text-align: center; line-height: 1.25; transition: background .15s, border-color .15s, color .15s; }
.calc-seg input:checked + span { background: #3666d1; border-color: #3666d1; color: #fff; }
.calc-seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(54, 102, 209, .3); }
.calc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.calc-chips button { height: 32px; padding: 0 12px; border: 1px solid #cbd5e0; border-radius: 999px; background: #fff; font: inherit; font-size: .84rem; font-weight: 600; color: #2b4c94; cursor: pointer; }
.calc-chips button:hover { background: #eef3fc; border-color: #3666d1; }
.calc-check { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: #2d3748; cursor: pointer; }
.calc-check input { width: 18px; height: 18px; accent-color: #3666d1; }
.calc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.calc-btn { height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid #3666d1; background: #3666d1; color: #fff; font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer; }
.calc-btn:hover { background: #2b4c94; border-color: #2b4c94; }
.calc-btn.ghost { background: #fff; color: #2b4c94; border-color: #c9d6f2; }
.calc-btn.ghost:hover { background: #eef3fc; }
.calc-sub { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #718096; margin: 4px 0 -4px; }

/* result panel */
.calc-res { position: sticky; top: 84px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.calc-res-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.calc-res-h h2 { margin: 0; font-size: 1.05rem; color: #1a202c; }
.calc-res-h button { height: 32px; padding: 0 12px; border: 1px solid #c9d6f2; border-radius: 8px; background: #fff; color: #2b4c94; font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; }
.calc-out { display: flex; flex-direction: column; gap: 12px; min-height: 120px; }
.calc-empty { margin: 0; padding: 28px 12px; text-align: center; color: #718096; background: #f7fafc; border: 1px dashed #cbd5e0; border-radius: 12px; font-size: .92rem; }
.calc-main { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 12px; background: linear-gradient(135deg, #eef3fc, #f7f9fe); border: 1px solid #dbe5f8; }
.calc-main-l { font-size: .85rem; font-weight: 600; color: #4a5568; }
.calc-main-v { font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.15; color: #14254f; font-weight: 800; letter-spacing: -.02em; word-break: break-word; }
.calc-main-s { font-size: .86rem; color: #4a5568; }
.calc-rows { margin: 0; display: flex; flex-direction: column; border: 1px solid #edf2f7; border-radius: 12px; overflow: hidden; }
.calc-rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid #edf2f7; }
.calc-rows > div:first-child { border-top: 0; }
.calc-rows dt { font-size: .88rem; color: #4a5568; }
.calc-rows dd { margin: 0; font-size: .92rem; font-weight: 700; color: #1a202c; text-align: right; }
.calc-note { margin: 0; font-size: .82rem; line-height: 1.5; color: #718096; }
.calc-warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-size: .86rem; line-height: 1.45; }
.calc-tag { display: inline-block; margin-top: 2px; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.calc-tag.ok { background: #dcfce7; color: #166534; } .calc-tag.lo { background: #e0f2fe; color: #075985; } .calc-tag.mid { background: #fef3c7; color: #92400e; } .calc-tag.hi { background: #fee2e2; color: #991b1b; }
.calc-gauge { position: relative; display: flex; height: 12px; border-radius: 999px; overflow: visible; }
.calc-gauge span { display: block; height: 100%; } .calc-gauge span:first-child { border-radius: 999px 0 0 999px; } .calc-gauge span:nth-child(4) { border-radius: 0 999px 999px 0; }
.calc-gauge .g-lo { background: #7dd3fc; } .calc-gauge .g-ok { background: #4ade80; } .calc-gauge .g-mid { background: #fbbf24; } .calc-gauge .g-hi { background: #f87171; }
.calc-gauge i { position: absolute; top: -5px; width: 4px; height: 22px; margin-left: -2px; background: #14254f; border-radius: 2px; box-shadow: 0 0 0 2px #fff; }
.calc-gauge-l { position: relative; height: 14px; font-size: .72rem; color: #718096; margin-top: -6px; }
.calc-gauge-l span { position: absolute; transform: translateX(-50%); } .calc-gauge-l span:nth-child(1) { left: 21.67%; } .calc-gauge-l span:nth-child(2) { left: 43.33%; } .calc-gauge-l span:nth-child(3) { left: 60%; }
.calc-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: #edf2f7; }
.calc-bar span { display: block; height: 100%; }
.c1 { background: #3666d1; } .c2 { background: #f59e0b; } .c3 { background: #10b981; } .c4 { background: #ef4444; } .c5 { background: #8b5cf6; }
.calc-legend { list-style: none; margin: -4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: #4a5568; }
.calc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.calc-table { border: 1px solid #edf2f7; border-radius: 12px; }
.calc-table summary { padding: 10px 14px; font-weight: 700; font-size: .9rem; color: #2b4c94; cursor: pointer; }
.calc-table-wrap { max-height: 340px; overflow: auto; border-top: 1px solid #edf2f7; }
.calc-table table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.calc-table th, .calc-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.calc-table th:first-child, .calc-table td:first-child { text-align: left; }
.calc-table thead th { position: sticky; top: 0; background: #f7fafc; color: #4a5568; font-weight: 700; }
.calc-privacy { margin: 0; font-size: .76rem; color: #94a3b8; }

/* GPA rows */
.gpa-head, .gpa-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .7fr) minmax(0, .9fr) 40px; gap: 8px; align-items: center; }
.gpa-head { font-size: .78rem; font-weight: 700; color: #718096; text-transform: uppercase; letter-spacing: .04em; }
.gpa-rows { display: flex; flex-direction: column; gap: 8px; }
.gpa-row input, .gpa-row select { width: 100%; height: 42px; padding: 0 10px; border: 1px solid #cbd5e0; border-radius: 9px; font: inherit; font-size: .95rem; background: #fff; box-sizing: border-box; }
.gpa-row input:focus, .gpa-row select:focus { outline: none; border-color: #3666d1; box-shadow: 0 0 0 3px rgba(54, 102, 209, .15); }
.gpa-gradebox { display: flex; gap: 6px; } .gpa-gradebox input[hidden] { display: none; }
.gpa-row [data-act=rm-row] { width: 40px; height: 42px; border: 1px solid #e2e8f0; border-radius: 9px; background: #fff; color: #e53e3e; font-size: 1.1rem; cursor: pointer; }
.gpa-add { align-self: flex-start; }

/* fraction */
.frac-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.frac { display: flex; align-items: center; gap: 6px; }
.frac-stack { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.frac-stack hr { width: 100%; margin: 0; border: 0; border-top: 2px solid #1a202c; }
.frac input { width: 74px; height: 44px; text-align: center; border: 1px solid #cbd5e0; border-radius: 9px; font: inherit; font-size: 1.05rem; }
.frac input.w { width: 60px; }
.frac input.w::placeholder { font-size: .78rem; }
.frac input:focus { outline: none; border-color: #3666d1; box-shadow: 0 0 0 3px rgba(54, 102, 209, .15); }
.frac-op { width: 64px; height: 44px; border: 1px solid #cbd5e0; border-radius: 9px; font: inherit; font-size: 1.2rem; text-align: center; background: #fff; }

/* scientific calculator */
.sc { max-width: 560px; margin: 0 auto 1.6rem; padding: 0 16px; box-sizing: border-box; }
.sc-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sc-screen { background: #0f1b3d; border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.sc-expr { width: 100%; box-sizing: border-box; background: transparent; border: 0; color: #fff; font: 600 1.35rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-align: right; outline: none; padding: 2px 0; }
.sc-res { min-height: 1.6em; text-align: right; color: #a9bfef; font: 600 1.05rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.sc-res.is-err { color: #fca5a5; font-family: inherit; font-size: .9rem; }
.sc-keys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.sc-keys button { height: 48px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f7fafc; font: inherit; font-size: .95rem; font-weight: 600; color: #1a202c; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sc-keys button:active { transform: translateY(1px); }
.sc-keys .n { background: #fff; font-size: 1.15rem; }
.sc-keys .o { background: #eef3fc; color: #2b4c94; font-size: 1.15rem; }
.sc-keys .f { font-size: .84rem; color: #2d3748; }
.sc-keys .eq { background: #3666d1; border-color: #3666d1; color: #fff; font-size: 1.3rem; }
.sc-keys .ac { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.sc-keys .m { font-size: .78rem; color: #4a5568; }
.sc-histbox { border-top: 1px solid #edf2f7; padding-top: 8px; }
.sc-histbox h3 { margin: 0 0 6px; font-size: .82rem; color: #718096; text-transform: uppercase; letter-spacing: .05em; }
.sc-hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font: .88rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: #2d3748; }
.sc-hist button { border: 0; background: none; padding: 0; font: inherit; color: #2b4c94; cursor: pointer; text-decoration: underline dotted; }

@media (max-width: 900px) {
    .calc-shell { grid-template-columns: 1fr; }
    .calc-res { position: static; }
}
@media (max-width: 520px) {
    .calc-shell { padding: 0 12px; gap: 12px; }
    .calc-form, .calc-res { padding: 16px; }
    .calc-grid { grid-template-columns: 1fr; }
    .calc-grid.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .gpa-head { display: none; }
    .gpa-row { grid-template-columns: minmax(0, 1fr) 54px 108px 40px; gap: 6px; }
    .gpa-row select { padding: 0 6px; font-size: .9rem; }
    .frac input { width: 60px; } .frac input.w { width: 48px; }
    .sc { padding: 0 10px; } .sc-body { padding: 12px; }
    .sc-keys { gap: 5px; } .sc-keys button { height: 46px; }
}
/* inside the Android app: tool only */
html.app-mode .calc-shell { margin-top: 6px; }
