:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #0f766e;
    --primary-strong: #0b5d56;
    --accent: #0ea5e9;
    --danger: #b91c1c;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
}

.panel-body {
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

.sideload-msg,
.panel {
    margin: 8px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(31, 41, 55, 0.06);
}

.sideload-msg {
    padding: 12px;
}

.sideload-msg h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.panel {
    padding: 12px;
    width: calc(100% - 16px);
    box-sizing: border-box;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

.panel-header h1 {
    margin: 0;
    font-size: 23px;
    letter-spacing: 0;
    line-height: 1.15;
}

.panel-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.tabs {
    margin: 16px 0;
    display: flex;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: 8px;
    padding: 10px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn i {
    font-size: 18px;
}

.tab-btn:hover {
    background: rgba(14, 165, 233, 0.08);
    color: var(--accent);
}

.tab-btn.is-active {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.tab-panel {
    display: none;
}

.tab-panel.is-active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.tab-internal-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--line);
}

.tab-internal-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-internal-header h2 i {
    font-size: 18px;
}

.tab-internal-header p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.info-list {
    display: grid;
    gap: 8px;
    margin: 12px 0;
}

.info-list-compact {
    margin-bottom: 0;
}

.info-item {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fafcff;
}

.info-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 4px;
}

.info-value {
    display: block;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    line-height: 1.35;
    word-break: break-word;
}

.status-section {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.status-section label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: 600;
}

/* Modern Form Controls */
input[type="text"],
input[type="date"],
input[type="time"],
select,
textarea {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    background: #ffffff;
    color: #1e293b;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Custom dropdown arrow for selects */
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='Status9 5l7 7-7 7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 34px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
    background-color: #f8fafc;
}

label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 800;
    color: #64748b;
    margin-bottom: 6px;
    margin-left: 2px;
}

#poliza-input:disabled {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}

#app-observaciones-input {
    resize: vertical;
    min-height: 72px;
}

.motivo-section {
    margin-top: 10px;
}

.subtabs {
    margin-top: 16px;
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.subtab-btn {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #334155;
    border-radius: 9px;
    padding: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.subtab-btn:hover {
    background: #eef6ff;
    border-color: #93c5fd;
}

.subtab-btn.is-active {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border-color: #0284c7;
    color: #ffffff;
}

.subtab-panel {
    display: none;
}

.subtab-panel.is-active {
    display: block;
}

.button-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 12px;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 700;
    width: 100%;
    white-space: normal;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #ffffff;
    box-shadow: 0 8px 14px rgba(15, 118, 110, 0.25);
}

.btn-secondary {
    background: #e8f7ff;
    color: #075985;
}

.status-msg {
    min-height: 20px;
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
}

.status-msg.error {
    color: var(--danger);
}

.status-msg.success {
    color: var(--primary-strong);
}

.historial-section {
    margin-top: 12px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.historial-title {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
}

.historial-list {
    display: grid;
    gap: 8px;
}

.historial-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
}

.historial-top {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
}

.historial-status {
    font-weight: 800;
    color: #0f172a;
}

.historial-date {
    color: var(--muted);
    font-weight: 600;
}

.historial-meta {
    color: #334155;
}

@media (max-width: 340px) {
    .panel-header h1 {
        font-size: 20px;
    }

    .button-row {
        grid-template-columns: 1fr;
    }
}