*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 18px;
    background: #d4d4d4;
    color: #1a1a1a;
    overflow: hidden;
}

#app {
    position: relative;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.app-shell {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    overflow: hidden;
    background: #fff;
}

/* --- Header HP (roxo) --- */
.hp-header {
    padding: 10px 16px;
    background: #6b5878;
    color: #fff;
}

.hp-header-title {
    font-size: 1.05rem;
    font-weight: 600;
}

/* --- Main two-column --- */
.hp-main {
    display: none;
    background: #fff;
    overflow: hidden;
    height: 100%;
}

.hp-main.screen-visible {
    display: block;
}

.hp-columns {
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Tela inicial: linha divisória altura total (float não estica border-right) */
#screen-scan .hp-columns {
    position: relative;
}

#screen-scan .hp-columns::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 44%;
    width: 1px;
    background: #c8c8c8;
    pointer-events: none;
    z-index: 1;
}

#screen-scan .hp-left {
    border-right: none;
}

#screen-scan .hp-left,
#screen-scan .hp-right {
    height: 100%;
    min-height: 100%;
    box-sizing: border-box;
}

.hp-left {
    float: left;
    width: 44%;
    padding: 16px 14px;
    background: #fff;
    border-right: 1px solid #c8c8c8;
}

.hp-right {
    float: left;
    width: 56%;
    background: #fafafa;
    overflow: hidden;
}

.hp-field {
    margin-bottom: 20px;
}

.hp-field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
}

.hp-field-row {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.hp-field-value {
    display: table-cell;
    vertical-align: middle;
    padding-right: 8px;
    font-size: 0.9rem;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-hp-select {
    display: table-cell;
    width: 130px;
    min-height: 44px;
    padding: 8px 10px;
    border: none;
    border-radius: 4px;
    background: #0078a8;
    color: #fff;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
}

.btn-hp-select:disabled {
    background: #9eb4c8;
    cursor: not-allowed;
}

.hp-chevron {
    margin-left: 2px;
}

.hp-filename-row {
    display: table;
    width: 100%;
    table-layout: fixed;
    border: 1px solid #a8a8a8;
    border-radius: 3px;
    background: #fff;
}

.hp-input {
    display: table-cell;
    width: 100%;
    min-height: 44px;
    padding: 8px 10px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    color: #1a1a1a;
    outline: none;
}

.hp-extension {
    display: table-cell;
    width: 48px;
    padding: 8px 10px 8px 0;
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
    vertical-align: middle;
}

/* --- Picker (painel direito): fluxo normal, sem position:absolute --- */
.picker-shell {
    width: 100%;
    overflow: hidden;
}

.picker-header {
    padding: 10px 12px;
    border-bottom: 1px solid #d0d0d0;
    background: #fff;
    min-height: 44px;
}

.picker-title {
    font-size: 0.95rem;
    font-weight: 700;
    vertical-align: middle;
}

.picker-body {
    height: 240px;
    padding: 0;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    background: #fff;
}

.picker-idle {
    margin: 24px 16px;
    font-size: 0.9rem;
    color: #777;
    line-height: 1.4;
}

.picker-panel-view {
    height: 100%;
}

.picker-panel-view.is-hidden {
    display: none;
}

.scan-session-count {
    margin: 28px 16px 10px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a1a;
}

.scan-session-hint {
    margin: 0 16px 20px;
    font-size: 0.88rem;
    color: #666;
    line-height: 1.4;
}

.btn-hp-scan-add {
    display: table;
    width: calc(100% - 32px);
    margin: 8px 16px 0;
    min-height: 52px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: #5f9a2e;
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    table-layout: fixed;
    -webkit-appearance: none;
    appearance: none;
}

.btn-hp-scan-add.is-hidden {
    display: none;
}

.btn-hp-scan-add-text {
    display: table-cell;
    vertical-align: middle;
    padding: 12px 16px;
    text-align: center;
}

.btn-hp-scan-add-plus {
    display: table-cell;
    width: 52px;
    vertical-align: middle;
    text-align: center;
    font-size: 1.6rem;
    line-height: 1;
    font-weight: 700;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-hp-scan-add:disabled {
    background: #a8c48a;
    cursor: not-allowed;
}

.picker-idle .btn-hp-scan-add {
    margin-top: 20px;
}

.scan-actions-row {
    margin: 8px 16px 0;
    overflow: hidden;
}

.scan-actions-row .btn-hp-scan-add {
    float: left;
    width: calc(100% - 60px);
    margin: 0;
}

.btn-hp-scan-discard.is-hidden {
    display: none;
}

.btn-hp-scan-discard {
    float: right;
    position: relative;
    width: 52px;
    min-height: 52px;
    height: 52px;
    padding: 0;
    border: 2px solid #c62828;
    border-radius: 4px;
    background: #fff5f5;
    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

/* Lixeira desenhada em CSS — compatível com webview da impressora (sem SVG) */
.btn-hp-scan-discard-icon {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    box-sizing: border-box;
    width: 18px;
    height: 14px;
    margin: -1px 0 0 -9px;
    background-color: #c62828;
    border-radius: 0 0 3px 3px;
}

.btn-hp-scan-discard-icon::before {
    content: '';
    position: absolute;
    top: -7px;
    left: -4px;
    width: 26px;
    height: 3px;
    background-color: #c62828;
    border-radius: 1px;
}

.btn-hp-scan-discard-icon::after {
    content: '';
    position: absolute;
    top: -11px;
    left: 4px;
    width: 10px;
    height: 4px;
    border: 2px solid #c62828;
    border-bottom: 0;
    border-radius: 2px 2px 0 0;
    box-sizing: border-box;
}

.btn-hp-scan-discard:disabled {
    border-color: #e8a5a0;
    background: #fafafa;
    cursor: not-allowed;
}

.btn-hp-scan-discard:disabled .btn-hp-scan-discard-icon {
    background-color: #e8a5a0;
}

.btn-hp-scan-discard:disabled .btn-hp-scan-discard-icon::before {
    background-color: #e8a5a0;
}

.btn-hp-scan-discard:disabled .btn-hp-scan-discard-icon::after {
    border-color: #e8a5a0;
}

.scan-actions-row::after {
    content: '';
    display: table;
    clear: both;
}

.btn-hp-send {
    float: right;
    min-height: 52px;
    padding: 12px 28px;
    border-radius: 4px;
    background: #5f9a2e;
    color: #fff;
    font-size: 1.05rem;
}

.picker-list-item {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
    text-align: left;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.picker-list-item.is-selected {
    background: #e8f4fa;
    color: #0078a8;
}

.picker-list-item-primary {
    color: #0078a8;
}

.picker-footer {
    padding: 0 12px;
    background: #ececec;
    border-top: 1px solid #d0d0d0;
    overflow: hidden;
}

.picker-footer-inner {
    display: table;
    width: 100%;
    height: 100%;
}

.picker-footer-cell {
    display: table-cell;
    vertical-align: middle;
    text-align: right;
    padding: 0;
}

.btn-hp-picker-confirm {
    min-width: 110px;
    min-height: 44px;
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    background: #0078a8;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-hp-picker-confirm:disabled {
    background: #b0b0b0;
    cursor: not-allowed;
}

/* --- Páginas (legado removido da UI) --- */

/* --- Footer HP (colado embaixo) --- */
.hp-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 72px;
    overflow: hidden;
    padding: 10px 12px;
    box-sizing: border-box;
    background: #d9d9d9;
    border-top: 1px solid #b8b8b8;
    z-index: 50;
}

/* Impressora: faixa inferior do webview (Opções/Feito) acima do chrome nativo Start */
.is-oxpd-panel .hp-header,
.is-oxpd-panel #options-header {
    display: none;
}

.is-oxpd-panel #app-footer {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    border-top: none;
    z-index: 100;
}

.is-oxpd-panel #btn-scan {
    display: inline-block;
    float: right;
}

.is-oxpd-panel .options-footer {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 72px;
    padding: 10px 12px;
    box-sizing: border-box;
    background: transparent;
    border-top: none;
    z-index: 210;
}

.is-oxpd-panel .options-body {
    top: 0;
}

.is-oxpd-panel .options-footer .btn-hp-options-done {
    float: right;
}

.btn-hp-footer {
    border: none;
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.btn-hp-options {
    float: left;
    width: 140px;
    min-height: 48px;
    padding: 10px 18px;
    border-radius: 4px;
    background: #4a4a4a;
    color: #fff;
    font-size: 0.95rem;
    text-align: center;
}

.btn-hp-scan {
    float: right;
    min-height: 52px;
    padding: 12px 28px;
    border-radius: 4px;
    background: #5f9a2e;
    color: #fff;
    font-size: 1.05rem;
}

.btn-hp-footer:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* --- Feedback --- */
.feedback {
    margin: 0;
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.3;
}

.feedback.is-hidden {
    display: none;
}

.feedback-busy {
    background: #e8f2fc;
    color: #0b3d6e;
}

.feedback-success {
    background: #e6f6ec;
    color: #1a6b3a;
}

.feedback-error {
    background: #fdecea;
    color: #9b2330;
}

/* --- Opções (tela cheia) --- */
.options-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    background: #d4d4d4;
    overflow: hidden;
}

.options-screen.is-hidden {
    display: none;
}

.options-body {
    position: absolute;
    top: 42px;
    left: 0;
    right: 0;
    bottom: 58px;
    overflow: hidden;
}

.options-screen .options-layout {
    display: table;
    width: 100%;
    height: 100%;
    table-layout: fixed;
}

.options-nav,
.options-detail {
    display: table-cell;
    vertical-align: top;
    height: 100%;
}

.options-detail {
    background: #fafafa;
    padding: 14px 16px 12px;
    overflow: hidden;
}

.options-nav {
    width: 42%;
    max-width: 300px;
    background: #fff;
    border-right: 1px solid #c8c8c8;
    padding: 8px 0;
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
}

.options-nav-item {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: none;
    border-left: 4px solid transparent;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.options-nav-item.is-active {
    background: #e8f4fa;
    border-left-color: #0078a8;
}

.options-nav-label {
    display: block;
    font-size: 0.92rem;
    font-weight: 700;
}

.options-nav-value {
    display: block;
    margin-top: 3px;
    font-size: 0.8rem;
    color: #666;
    font-weight: 600;
}

.options-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 58px;
    padding: 8px 12px;
    box-sizing: border-box;
    background: #d9d9d9;
    border-top: 1px solid #b8b8b8;
    overflow: hidden;
}

.options-footer .btn-options-hide {
    float: left;
}

.options-footer .btn-hp-options-done {
    float: right;
}

.btn-options-hide {
    min-height: 42px;
    padding: 8px 16px;
    border: 2px solid #4a4a4a;
    border-radius: 4px;
    background: #fff;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.options-pane {
    display: none;
}

.options-pane.is-active {
    display: block;
}

.options-pane-title {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
}

.options-choice-list {
    overflow-x: hidden;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 10px;
}

.options-choice-list .picker-list-item {
    border: 1px solid #e0e0e0;
    border-bottom: none;
}

.options-choice-list .picker-list-item:last-child {
    border-bottom: 1px solid #e0e0e0;
}

.btn-hp-options-done {
    min-width: 100px;
    min-height: 44px;
    padding: 8px 24px;
    border: none;
    border-radius: 4px;
    background: #0078a8;
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.is-hidden {
    display: none !important;
}
